[comp.emacs] Bug in gnu-emacs under VMS 4.4+

ugkong@sunybcs.UUCP (02/14/87)

Here is a patch that I have created for gnu-emacs that is running on a
VMS 4.4 system using VAX C version 2.2.  There seems to be a bug in C 
run time routine that translates a Unix type file path to a VMS type file
path.  It seems that the routine that does the translation of the path(s)
does not like the character "-" and cause gnu-emacs to bomb when file
names contain "-"'s in them.  This only happens when gnu-emacs trys to
translate an entire file path.  

	eg) ./etc/DOC-18.38.2 will cause an error when emacs trys to
			      open the file.

The patch that is included is just a kludge that I have placed in our
version of emacs to force it to translate the directory specification
first and then append the file name that is to be opened.  This is
just a temporary fix that I have implemented to get gnu-emacs to run
on our system, so that it will handle "-".  

 
                Bob Lay Kong 
                UCS Graphics Consultant / TeX Software Support
 
       BITNET:  acsgrlk@ubvms
                acsgrlk@ubvm
       CSNET:   ugkong@buffalo
       UUCP:    ...{alegra,decvax,watmath}!sunybcs!ugkong


--------------------------cut here--------------------------------------
*** src/doc.c	Tue Dec  9 11:42:45 1986
--- /u1/undergra/ugkong/doc.c	Fri Feb 13 21:04:15 1987
***************
*** 48,52 ****
    register int count;
    extern char *index ();
! 
    if (XTYPE (Vexec_directory) != Lisp_String
        || XTYPE (Vdoc_file_name) != Lisp_String)
--- 48,55 ----
    register int count;
    extern char *index ();
! #ifdef VMS4_4
!   char vms_file[256], work_buffer[256];
!   char *last_slash;
! #endif /* VMS4_4 */
    if (XTYPE (Vexec_directory) != Lisp_String
        || XTYPE (Vdoc_file_name) != Lisp_String)
***************
*** 70,75 ****
  #endif /* not VMS4_4 */
  #endif /* VMS */
  
!   fd = open (name, O_RDONLY, 0);
    if (fd < 0)
      error ("Cannot open doc string file \"%s\"", name);
--- 73,87 ----
  #endif /* not VMS4_4 */
  #endif /* VMS */
+ #ifdef VMS4_4
+   vms_file[0] = work_buffer[0] = '\0';
+   last_slash = strrchr(name, '/');
+   strncat(vms_file, name, (last_slash-name)+1);
+   vms_file[(last_slash-name)+1] = '\0';
+   strcat(vms_file, ++last_slash);
+   strcpy (vms_file, sys_translate_unix(vms_file));
+ #endif /* VMS4_4 */
  
!   fd = open (vms_file, O_RDONLY, 0);
! 
    if (fd < 0)
      error ("Cannot open doc string file \"%s\"", name);
***************
*** 189,192 ****
--- 201,207 ----
    name = (char *) alloca (XSTRING (filename)->size + 8);
    strcpy (name, "../etc/");
+ #ifdef VMS4_4
+   strcpy (name, sys_translate_unix(name));
+ #endif /* VMS4_4 */
  #else /* CANNOT_DUMP */
    CHECK_STRING (Vexec_directory, 0);