*** /gnu/fsf/ss-961023/cccp.c Wed Oct 16 12:12:40 1996 --- ./ss-961023/cccp.c Sun Oct 27 17:58:30 1996 *************** my_bzero (b, length) *** 179,183 **** #endif /* ! STDC_HEADERS */ ! #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) # define __attribute__(x) #endif --- 179,183 ---- #endif /* ! STDC_HEADERS */ ! #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || defined (VMS) # define __attribute__(x) #endif *************** my_bzero (b, length) *** 224,227 **** --- 224,232 ---- #ifdef VMS #include + static void hack_vms_include_specification (); + #define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a))) + #define INO_T_HASH(a) 0 + #define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */ + #ifndef __ALPHA #define O_RDONLY 0 /* Open arg for Read/Only */ #define O_WRONLY 1 /* Open arg for Write/Only */ *************** static int VMS_open (); *** 238,245 **** static FILE * VMS_fopen (); static FILE * VMS_freopen (); ! static void hack_vms_include_specification (); ! #define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a))) ! #define INO_T_HASH(a) 0 ! #define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */ #ifdef __GNUC__ #define BSTRING /* VMS/GCC supplies the bstring routines */ --- 243,247 ---- static FILE * VMS_fopen (); static FILE * VMS_freopen (); ! #endif /* !__ALPHA */ #ifdef __GNUC__ #define BSTRING /* VMS/GCC supplies the bstring routines */ *************** do_include (buf, limit, op, keyword) *** 4198,4201 **** --- 4200,4206 ---- expanding the include line*/ int angle_brackets = 0; /* 0 for "...", 1 for <...> */ + #ifdef VMS + int vax_include = 0; /* old vax style include found */ + #endif int pcf = -1; char *pcfbuf; *************** get_filename: *** 4305,4313 **** * (Note: macro expansion of `xyz' takes precedence.) */ ! if (retried && isalpha(*(U_CHAR *) (--fbeg))) { ! while (fin != limit && (!isspace(*fin))) *fend++ = *fin++; warning ("VAX-C-style include specification found, use '#include ' !"); ! if (fin == limit) { angle_brackets = 1; /* If -I-, start with the first -I dir after the -I-. */ --- 4310,4322 ---- * (Note: macro expansion of `xyz' takes precedence.) */ ! fin--; ! if (retried && isalpha (*((U_CHAR *)fin))) ! { ! while ((fin != limit) && (!isspace (*fin))) *fend++ = *fin++; warning ("VAX-C-style include specification found, use '#include ' !"); ! vax_include = 1; ! if (fin == limit) ! { angle_brackets = 1; /* If -I-, start with the first -I dir after the -I-. */ *************** get_filename: *** 4426,4435 **** if (searchptr->fname[0]) { /* Fix up the filename */ ! hack_vms_include_specification (fname); } else { /* This is a normal VMS filespec, so use it unchanged. */ strcpy (fname, fbeg); /* if it's '#include filename', add the missing .h */ ! if (index(fname,'.')==NULL) { strcat (fname, ".h"); } --- 4435,4444 ---- if (searchptr->fname[0]) { /* Fix up the filename */ ! hack_vms_include_specification (fname, vax_include); } else { /* This is a normal VMS filespec, so use it unchanged. */ strcpy (fname, fbeg); /* if it's '#include filename', add the missing .h */ ! if (vax_include && (index (fname,'.') == NULL)) { strcat (fname, ".h"); } *************** open_include_file (filename, searchptr, *** 4867,4876 **** || ! inc->control_macro || (inc->control_macro[0] && ! lookup (inc->control_macro, -1, -1))) { - fd = open (fname, O_RDONLY, 0); if (fd < 0) return fd; ! if (!inc) { /* FNAME was not in include_hashtab; insert a new entry. */ --- 4876,4897 ---- || ! inc->control_macro || (inc->control_macro[0] && ! lookup (inc->control_macro, -1, -1))) { fd = open (fname, O_RDONLY, 0); + if (fd < 0) + { + #ifdef VMS + /* if #include fails, try again with */ + char *fsep; + fsep = index (fname, '/'); + if (fsep) + { + *fsep = ':'; + fd = open (fname, O_RDONLY, 0); + *fsep = '/'; + } if (fd < 0) + #endif return fd; ! } if (!inc) { /* FNAME was not in include_hashtab; insert a new entry. */ *************** savestring (input) *** 10000,10005 **** static void ! hack_vms_include_specification (fname) char *fname; { register char *cp, *cp1, *cp2; --- 10021,10027 ---- static void ! hack_vms_include_specification (fname, vax_include) char *fname; + int vax_include; { register char *cp, *cp1, *cp2; *************** hack_vms_include_specification (fname) *** 10015,10019 **** * and add the missing .h */ ! if (!index (cp,'.')) strcat (cp, ".h"); --- 10037,10041 ---- * and add the missing .h */ ! if (vax_include && !index (cp,'.')) strcat (cp, ".h"); *************** hack_vms_include_specification (fname) *** 10033,10037 **** /* See if we found that 1st slash */ if (cp == 0) return; /* Nothing to do!!! */ ! if (*cp != '/') return; /* Nothing to do!!! */ /* Point to the UNIX filename part (which needs to be fixed!) */ cp1 = cp+1; --- 10055,10059 ---- /* See if we found that 1st slash */ if (cp == 0) return; /* Nothing to do!!! */ ! if (index (cp, '/') == 0) return; /* Nothing to do!!! */ /* Point to the UNIX filename part (which needs to be fixed!) */ cp1 = cp+1; *************** hack_vms_include_specification (fname) *** 10058,10062 **** */ cp -= 2; /* Strip ".]" */ ! cp1--; }; /* backspace */ } else { --- 10080,10085 ---- */ cp -= 2; /* Strip ".]" */ ! cp1--; /* backspace */ ! } } else { *************** hack_vms_include_specification (fname) *** 10140,10144 **** #endif /* VMS */ ! #ifdef VMS /* These are the read/write replacement routines for --- 10163,10167 ---- #endif /* VMS */ ! #if defined(VMS) && !defined(__ALPHA) /* These are the read/write replacement routines for