diff options
| author | Richard M. Stallman | 1994-09-25 17:42:55 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-09-25 17:42:55 +0000 |
| commit | 778d47c737a2ed17f2a76ba6c7c41e59d4643c61 (patch) | |
| tree | 20d6222a81c64b2806b26b10f3dd7d807f0331f5 /src | |
| parent | 45d91af4244c3d08242431838d4cca4342bbd9c2 (diff) | |
| download | emacs-778d47c737a2ed17f2a76ba6c7c41e59d4643c61.tar.gz emacs-778d47c737a2ed17f2a76ba6c7c41e59d4643c61.zip | |
(get_doc_string): Look in ../etc while dumping.
(munge_doc_file_name): New subroutine.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc.c | 68 |
1 files changed, 49 insertions, 19 deletions
| @@ -43,25 +43,12 @@ Lisp_Object Vdoc_file_name; | |||
| 43 | 43 | ||
| 44 | extern Lisp_Object Voverriding_local_map; | 44 | extern Lisp_Object Voverriding_local_map; |
| 45 | 45 | ||
| 46 | Lisp_Object | 46 | /* For VMS versions with limited file name syntax, |
| 47 | get_doc_string (filepos) | 47 | convert the name to something VMS will allow. */ |
| 48 | long filepos; | 48 | static void |
| 49 | munge_doc_file_name (name) | ||
| 50 | char *name; | ||
| 49 | { | 51 | { |
| 50 | char buf[512 * 32 + 1]; | ||
| 51 | register int fd; | ||
| 52 | register char *name; | ||
| 53 | register char *p, *p1; | ||
| 54 | register int count; | ||
| 55 | extern char *index (); | ||
| 56 | |||
| 57 | if (XTYPE (Vdoc_directory) != Lisp_String | ||
| 58 | || XTYPE (Vdoc_file_name) != Lisp_String) | ||
| 59 | return Qnil; | ||
| 60 | |||
| 61 | name = (char *) alloca (XSTRING (Vdoc_directory)->size | ||
| 62 | + XSTRING (Vdoc_file_name)->size + 8); | ||
| 63 | strcpy (name, XSTRING (Vdoc_directory)->data); | ||
| 64 | strcat (name, XSTRING (Vdoc_file_name)->data); | ||
| 65 | #ifdef VMS | 52 | #ifdef VMS |
| 66 | #ifndef VMS4_4 | 53 | #ifndef VMS4_4 |
| 67 | /* For VMS versions with limited file name syntax, | 54 | /* For VMS versions with limited file name syntax, |
| @@ -78,10 +65,53 @@ get_doc_string (filepos) | |||
| 78 | strcpy (name, sys_translate_unix (name)); | 65 | strcpy (name, sys_translate_unix (name)); |
| 79 | #endif /* VMS4_4 */ | 66 | #endif /* VMS4_4 */ |
| 80 | #endif /* VMS */ | 67 | #endif /* VMS */ |
| 68 | } | ||
| 69 | |||
| 70 | Lisp_Object | ||
| 71 | get_doc_string (filepos) | ||
| 72 | long filepos; | ||
| 73 | { | ||
| 74 | char buf[512 * 32 + 1]; | ||
| 75 | register int fd; | ||
| 76 | register char *name; | ||
| 77 | register char *p, *p1; | ||
| 78 | register int count; | ||
| 79 | int minsize; | ||
| 80 | extern char *index (); | ||
| 81 | |||
| 82 | if (XTYPE (Vdoc_directory) != Lisp_String | ||
| 83 | || XTYPE (Vdoc_file_name) != Lisp_String) | ||
| 84 | return Qnil; | ||
| 85 | |||
| 86 | minsize = XSTRING (Vdoc_directory)->size; | ||
| 87 | /* sizeof ("../etc/") == 8 */ | ||
| 88 | if (minsize < 8) | ||
| 89 | minsize = 8; | ||
| 90 | name = (char *) alloca (minsize + XSTRING (Vdoc_file_name)->size + 8); | ||
| 91 | strcpy (name, XSTRING (Vdoc_directory)->data); | ||
| 92 | strcat (name, XSTRING (Vdoc_file_name)->data); | ||
| 93 | munge_doc_file_name (name); | ||
| 81 | 94 | ||
| 82 | fd = open (name, O_RDONLY, 0); | 95 | fd = open (name, O_RDONLY, 0); |
| 83 | if (fd < 0) | 96 | if (fd < 0) |
| 84 | error ("Cannot open doc string file \"%s\"", name); | 97 | { |
| 98 | #ifndef CANNOT_DUMP | ||
| 99 | if (!NILP (Vpurify_flag)) | ||
| 100 | { | ||
| 101 | /* Preparing to dump; DOC file is probably not installed. | ||
| 102 | So check in ../etc. */ | ||
| 103 | strcpy (name, "../etc/"); | ||
| 104 | strcat (name, XSTRING (Vdoc_file_name)->data); | ||
| 105 | munge_doc_file_name (name); | ||
| 106 | |||
| 107 | fd = open (name, O_RDONLY, 0); | ||
| 108 | } | ||
| 109 | #endif | ||
| 110 | |||
| 111 | if (fd < 0) | ||
| 112 | error ("Cannot open doc string file \"%s\"", name); | ||
| 113 | } | ||
| 114 | |||
| 85 | if (0 > lseek (fd, filepos, 0)) | 115 | if (0 > lseek (fd, filepos, 0)) |
| 86 | { | 116 | { |
| 87 | close (fd); | 117 | close (fd); |