[gnu.gcc.bug] VMS fix for cccp.c

angel@FLIPPER.MIAMI.EDU (angel li) (09/01/89)

The following patch fixes two problems:

	* On VMS, argv[0] has the absolute path of the program.  I removed
	  the directory spec and extension so when errors are printed, they fit
	  on a single line.

	* In pfatal_with_name, change the exit code from a generic failure 
	  code to the exact reason.

The third patch is something that I will announce sometime soon...


Angel Li
University of Miami/RSMAS Remote Sensing Group

Internet: angel@flipper.miami.edu			UUCP: ncar!umigw!angel



*** cccp.c-orig	Thu Aug 31 17:46:39 1989
--- cccp.c	Thu Aug 31 18:16:34 1989
***************
*** 272,280 ****
      { &cplusplus_include_defaults[2], GCC_INCLUDE_DIR },
      { 0, "/usr/include" }
  #else
!     { &cplusplus_include_defaults[1], "GNU_CC_INCLUDE:" },
      /* VAX-11 C includes */
!     { &cplusplus_include_defaults[2], "SYS$SYSROOT:[SYSLIB.]" },
      { 0, "" },	/* This makes normal VMS filespecs work OK */
  #endif /* VMS */
    };
--- 272,281 ----
      { &cplusplus_include_defaults[2], GCC_INCLUDE_DIR },
      { 0, "/usr/include" }
  #else
!     { &cplusplus_include_defaults[1], "GNU_GXX_INCLUDE:" },
!     { &include_defaults[2], "GNU_CC_INCLUDE:" },       /* GNU includes */
      /* VAX-11 C includes */
!     { &cplusplus_include_defaults[3], "SYS$SYSROOT:[SYSLIB.]" },
      { 0, "" },	/* This makes normal VMS filespecs work OK */
  #endif /* VMS */
    };
***************
*** 539,544 ****
--- 540,563 ----
    /* Target-name to write with the dependency information.  */
    char *deps_target = 0;
  
+ #ifdef VMS
+   {
+     /*
+        Remove the directory information from argv[0]:
+        Error messages might fit on one line now.
+     */
+     char		*s;
+     char		*strrchr();
+ 
+     if (!(s = strrchr(argv[0], ']')))
+       s = strrchr(argv[0], ':');
+     if (s)
+       strcpy(argv[0], s+1);
+     if (s = strrchr(argv[0], '.'))
+       *s = '\0';
+   }
+ #endif
+ 
  #ifdef RLIMIT_STACK
    /* Get rid of any avoidable limit on stack size.  */
    {
***************
*** 5307,5313 ****
--- 5326,5336 ----
       char *name;
  {
    perror_with_name (name);
+ #ifdef VMS
+   exit (vaxc$errno);
+ #else
    exit (FATAL_EXIT_CODE);
+ #endif
  }