Rename VMS macro to MK_OS_VMS

* src/makeint.h: Set MK_OS_VMS to 1 if we're on VMS.
* src/*: Convert all #if references to VMS, to use MK_OS_VMS.
* gl/lib/*: Ditto.
This commit is contained in:
Paul Smith 2023-01-15 18:04:36 -05:00
parent d4692df20d
commit ceb52b5d1b
25 changed files with 152 additions and 151 deletions

View File

@ -71,7 +71,7 @@ USA. */
# endif # endif
#endif #endif
#if !defined _AMIGA && !defined VMS && !defined WINDOWS32 #if !defined _AMIGA && !MK_OS_VMS && !defined WINDOWS32
# include <pwd.h> # include <pwd.h>
#endif #endif
@ -518,13 +518,13 @@ glob (const char *pattern, int flags,
oldcount = pglob->gl_pathc; oldcount = pglob->gl_pathc;
#ifndef VMS #if !MK_OS_VMS
if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~') if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~')
{ {
if (dirname[1] == '\0' || dirname[1] == '/') if (dirname[1] == '\0' || dirname[1] == '/')
{ {
/* Look up home directory. */ /* Look up home directory. */
#ifdef VMS #if MK_OS_VMS
/* This isn't obvious, RTLs of DECC and VAXC know about "HOME" */ /* This isn't obvious, RTLs of DECC and VAXC know about "HOME" */
const char *home_dir = getenv ("SYS$LOGIN"); const char *home_dir = getenv ("SYS$LOGIN");
#else #else
@ -538,7 +538,7 @@ glob (const char *pattern, int flags,
if (home_dir == NULL || home_dir[0] == '\0') if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "c:/users/default"; /* poor default */ home_dir = "c:/users/default"; /* poor default */
# else # else
# ifdef VMS # if MK_OS_VMS
/* Again, this isn't obvious, if "HOME" isn't known "SYS$LOGIN" should be set */ /* Again, this isn't obvious, if "HOME" isn't known "SYS$LOGIN" should be set */
if (home_dir == NULL || home_dir[0] == '\0') if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "SYS$DISK:[]"; home_dir = "SYS$DISK:[]";
@ -601,7 +601,7 @@ glob (const char *pattern, int flags,
else else
home_dir = "~"; /* No luck. */ home_dir = "~"; /* No luck. */
} }
# endif /* VMS */ # endif /* MK_OS_VMS */
# endif /* WINDOWS32 */ # endif /* WINDOWS32 */
# endif # endif
/* Now construct the full directory. */ /* Now construct the full directory. */
@ -622,7 +622,7 @@ glob (const char *pattern, int flags,
dirname = newp; dirname = newp;
} }
} }
# if !defined _AMIGA && !defined WINDOWS32 && !defined VMS # if !defined _AMIGA && !defined WINDOWS32 && !MK_OS_VMS
else else
{ {
char *end_name = strchr (dirname, '/'); char *end_name = strchr (dirname, '/');
@ -702,9 +702,9 @@ glob (const char *pattern, int flags,
home directory. */ home directory. */
return GLOB_NOMATCH; return GLOB_NOMATCH;
} }
# endif /* Not Amiga && not WINDOWS32 && not VMS. */ # endif /* Not Amiga && not WINDOWS32 && not MK_OS_VMS. */
} }
#endif /* Not VMS. */ #endif /* Not MK_OS_VMS. */
/* Now test whether we looked for "~" or "~NAME". In this case we /* Now test whether we looked for "~" or "~NAME". In this case we
can give the answer now. */ can give the answer now. */
@ -1124,7 +1124,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
int meta; int meta;
int save; int save;
#ifdef VMS #if MK_OS_VMS
if (*directory == 0) if (*directory == 0)
directory = "[]"; directory = "[]";
#endif #endif

View File

@ -67,7 +67,7 @@ extern "C" {
#endif #endif
/* Structure describing a globbing run. */ /* Structure describing a globbing run. */
#if !defined _AMIGA && !defined VMS /* Buggy compiler. */ #if !defined _AMIGA && !MK_OS_VMS /* Buggy compiler. */
struct stat; struct stat;
#endif #endif
typedef struct typedef struct
@ -83,7 +83,7 @@ typedef struct
struct dirent *(*gl_readdir) (void *); struct dirent *(*gl_readdir) (void *);
void * (*gl_opendir) (const char *); void * (*gl_opendir) (const char *);
int (*gl_lstat) (const char *, struct stat *); int (*gl_lstat) (const char *, struct stat *);
#if defined(VMS) && defined(__DECC) && !defined(_POSIX_C_SOURCE) #if MK_OS_VMS && defined(__DECC) && !defined(_POSIX_C_SOURCE)
int (*gl_stat) (const char *, struct stat *, ...); int (*gl_stat) (const char *, struct stat *, ...);
#else #else
int (*gl_stat) (const char *, struct stat *); int (*gl_stat) (const char *, struct stat *);

View File

@ -120,7 +120,7 @@ ar_member_date (const char *name)
/* Set the archive-member NAME's modtime to now. */ /* Set the archive-member NAME's modtime to now. */
#ifdef VMS #if MK_OS_VMS
int int
ar_touch (const char *name) ar_touch (const char *name)
{ {
@ -172,7 +172,7 @@ ar_touch (const char *name)
return val; return val;
} }
#endif /* !VMS */ #endif /* !MK_OS_VMS */
/* State of an 'ar_glob' run, passed to 'ar_glob_match'. */ /* State of an 'ar_glob' run, passed to 'ar_glob_match'. */
@ -187,7 +187,7 @@ struct ar_glob_state
{ {
const char *arname; const char *arname;
const char *pattern; const char *pattern;
#ifdef VMS #if MK_OS_VMS
char *suffix; char *suffix;
#endif #endif
size_t size; size_t size;
@ -210,7 +210,7 @@ ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED,
{ {
/* We have a match. Add it to the chain. */ /* We have a match. Add it to the chain. */
struct nameseq *new = xcalloc (state->size); struct nameseq *new = xcalloc (state->size);
#ifdef VMS #if MK_OS_VMS
if (state->suffix) if (state->suffix)
new->name = strcache_add( new->name = strcache_add(
concat(5, state->arname, "(", mem, state->suffix, ")")); concat(5, state->arname, "(", mem, state->suffix, ")"));
@ -268,7 +268,7 @@ ar_glob (const char *arname, const char *member_pattern, size_t size)
struct nameseq *n; struct nameseq *n;
const char **names; const char **names;
unsigned int i; unsigned int i;
#ifdef VMS #if MK_OS_VMS
char *vms_member_pattern; char *vms_member_pattern;
#endif #endif
if (! ar_glob_pattern_p (member_pattern, 1)) if (! ar_glob_pattern_p (member_pattern, 1))
@ -278,7 +278,7 @@ ar_glob (const char *arname, const char *member_pattern, size_t size)
ar_glob_match will accumulate them in STATE.chain. */ ar_glob_match will accumulate them in STATE.chain. */
state.arname = arname; state.arname = arname;
state.pattern = member_pattern; state.pattern = member_pattern;
#ifdef VMS #if MK_OS_VMS
{ {
/* In a copy of the pattern, find the suffix, save it and remove it from /* In a copy of the pattern, find the suffix, save it and remove it from
the pattern */ the pattern */
@ -299,7 +299,7 @@ ar_glob (const char *arname, const char *member_pattern, size_t size)
state.n = 0; state.n = 0;
ar_scan (arname, ar_glob_match, &state); ar_scan (arname, ar_glob_match, &state);
#ifdef VMS #if MK_OS_VMS
/* Deallocate any duplicated string */ /* Deallocate any duplicated string */
free(vms_member_pattern); free(vms_member_pattern);
if (state.suffix) if (state.suffix)

View File

@ -29,7 +29,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef NO_ARCHIVES #ifndef NO_ARCHIVES
#ifdef VMS #if MK_OS_VMS
#include <lbrdef.h> #include <lbrdef.h>
#include <mhddef.h> #include <mhddef.h>
#include <credef.h> #include <credef.h>
@ -289,7 +289,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
return -2; return -2;
} }
#else /* !VMS */ #else /* !MK_OS_VMS */
/* SCO Unix's compiler defines both of these. */ /* SCO Unix's compiler defines both of these. */
#ifdef M_UNIX #ifdef M_UNIX
@ -841,7 +841,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
close (desc); close (desc);
return -2; return -2;
} }
#endif /* !VMS */ #endif /* !MK_OS_VMS */
/* Return nonzero iff NAME matches MEM. /* Return nonzero iff NAME matches MEM.
If TRUNCATED is nonzero, MEM may be truncated to If TRUNCATED is nonzero, MEM may be truncated to
@ -856,7 +856,7 @@ ar_name_equal (const char *name, const char *mem, int truncated)
if (p != 0) if (p != 0)
name = p + 1; name = p + 1;
#ifndef VMS #if !MK_OS_VMS
if (truncated) if (truncated)
{ {
#ifdef AIAMAG #ifdef AIAMAG
@ -896,10 +896,10 @@ ar_name_equal (const char *name, const char *mem, int truncated)
match = !strcasecmp (name, mem); match = !strcasecmp (name, mem);
return match; return match;
} }
#endif /* !VMS */ #endif /* !MK_OS_VMS */
} }
#ifndef VMS #if !MK_OS_VMS
/* ARGSUSED */ /* ARGSUSED */
static intmax_t static intmax_t
ar_member_pos (int desc UNUSED, const char *mem, int truncated, ar_member_pos (int desc UNUSED, const char *mem, int truncated,

View File

@ -26,7 +26,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "w32err.h" #include "w32err.h"
#endif #endif
#if VMS #if MK_OS_VMS
# define FILE_LIST_SEPARATOR (vms_comma_separator ? ',' : ' ') # define FILE_LIST_SEPARATOR (vms_comma_separator ? ',' : ' ')
#else #else
# define FILE_LIST_SEPARATOR ' ' # define FILE_LIST_SEPARATOR ' '

View File

@ -17,7 +17,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "mkconfig.h" #include "mkconfig.h"
#define MK_VMS 1 #define MK_OS_VMS 1
/* Pull in types.h here to get __CRTL_VER defined for old versions of the /* Pull in types.h here to get __CRTL_VER defined for old versions of the
compiler which don't define it. */ compiler which don't define it. */

View File

@ -37,7 +37,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
a '.c' or '.p' or ... file rather than from a .s file. */ a '.c' or '.p' or ... file rather than from a .s file. */
static char default_suffixes[] static char default_suffixes[]
#ifdef VMS #if MK_OS_VMS
/* VMS should include all UNIX/POSIX + some VMS extensions */ /* VMS should include all UNIX/POSIX + some VMS extensions */
= ".out .exe .a .olb .hlb .tlb .mlb .ln .o .obj .c .cxx .cc .cpp .pas .p \ = ".out .exe .a .olb .hlb .tlb .mlb .ln .o .obj .c .cxx .cc .cpp .pas .p \
.for .f .r .y .l .ym .yl .mar .s .ss .i .ii .mod .sym .def .h .info .dvi \ .for .f .r .y .l .ym .yl .mar .s .ss .i .ii .mod .sym .def .h .info .dvi \
@ -55,7 +55,7 @@ static char default_suffixes[]
static struct pspec default_pattern_rules[] = static struct pspec default_pattern_rules[] =
{ {
#ifdef VMS #if MK_OS_VMS
{ "(%)", "%", { "(%)", "%",
"@if f$$search(\"$@\") .eqs. \"\" then $(LIBRARY)/CREATE/" "@if f$$search(\"$@\") .eqs. \"\" then $(LIBRARY)/CREATE/"
"$(or " "$(or "
@ -76,7 +76,7 @@ static struct pspec default_pattern_rules[] =
/* The X.out rules are only in BSD's default set because /* The X.out rules are only in BSD's default set because
BSD Make has no null-suffix rules, so 'foo.out' and BSD Make has no null-suffix rules, so 'foo.out' and
'foo' are the same thing. */ 'foo' are the same thing. */
#ifdef VMS #if MK_OS_VMS
{ "%.exe", "%", { "%.exe", "%",
"$(CP) $< $@" }, "$(CP) $< $@" },
@ -95,7 +95,7 @@ static struct pspec default_pattern_rules[] =
static struct pspec default_terminal_rules[] = static struct pspec default_terminal_rules[] =
{ {
#ifdef VMS #if MK_OS_VMS
/* RCS. */ /* RCS. */
{ "%", "%$$5lv", /* Multinet style */ { "%", "%$$5lv", /* Multinet style */
@ -124,13 +124,13 @@ static struct pspec default_terminal_rules[] =
"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" }, "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
{ "%", "SCCS/s.%", { "%", "SCCS/s.%",
"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" }, "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
#endif /* !VMS */ #endif /* !MK_OS_VMS */
{ 0, 0, 0 } { 0, 0, 0 }
}; };
static const char *default_suffix_rules[] = static const char *default_suffix_rules[] =
{ {
#ifdef VMS #if MK_OS_VMS
".o", ".o",
"$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) -o $@", "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".obj", ".obj",
@ -263,7 +263,7 @@ static const char *default_suffix_rules[] =
".l.ln", ".l.ln",
"@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c", "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
#else /* ! VMS */ #else /* ! MK_OS_VMS */
".o", ".o",
"$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@", "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
@ -393,14 +393,14 @@ static const char *default_suffix_rules[] =
".web.tex", ".web.tex",
"$(WEAVE) $<", "$(WEAVE) $<",
#endif /* !VMS */ #endif /* !MK_OS_VMS */
0, 0, 0, 0,
}; };
static const char *default_variables[] = static const char *default_variables[] =
{ {
#ifdef VMS #if MK_OS_VMS
#ifdef __ALPHA #ifdef __ALPHA
"ARCH", "ALPHA", "ARCH", "ALPHA",
#endif #endif
@ -515,7 +515,7 @@ static const char *default_variables[] =
"CP", "copy", "CP", "copy",
".LIBPATTERNS", "%.olb lib%.a", ".LIBPATTERNS", "%.olb lib%.a",
#else /* !VMS */ #else /* !MK_OS_VMS */
"AR", "ar", "AR", "ar",
#ifdef _AIX #ifdef _AIX
@ -670,7 +670,7 @@ static const char *default_variables[] =
".LIBPATTERNS", "lib%.so lib%.a", ".LIBPATTERNS", "lib%.so lib%.a",
#endif #endif
#endif /* !VMS */ #endif /* !MK_OS_VMS */
/* Make this assignment to avoid undefined variable warnings. */ /* Make this assignment to avoid undefined variable warnings. */
GNUMAKEFLAGS_NAME, "", GNUMAKEFLAGS_NAME, "",
0, 0 0, 0

View File

@ -89,7 +89,7 @@ struct goaldep
#define PARSE_SIMPLE_SEQ(_s,_t) \ #define PARSE_SIMPLE_SEQ(_s,_t) \
(_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE) (_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE)
#ifdef VMS #if MK_OS_VMS
void *parse_file_seq (); void *parse_file_seq ();
#else #else
void *parse_file_seq (char **stringp, size_t size, void *parse_file_seq (char **stringp, size_t size,

View File

@ -23,7 +23,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#ifdef HAVE_DIRENT_H #ifdef HAVE_DIRENT_H
# include <dirent.h> # include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name) # define NAMLEN(dirent) strlen((dirent)->d_name)
# ifdef VMS # if MK_OS_VMS
/* its prototype is in vmsdir.h, which is not needed for HAVE_DIRENT_H */ /* its prototype is in vmsdir.h, which is not needed for HAVE_DIRENT_H */
const char *vmsify (const char *name, int type); const char *vmsify (const char *name, int type);
# endif # endif
@ -50,7 +50,7 @@ const char *vmsify (const char *name, int type);
# define NAMLEN(d) _D_NAMLEN(d) # define NAMLEN(d) _D_NAMLEN(d)
#endif #endif
#if (defined (POSIX) || defined (VMS) || defined (WINDOWS32)) && !defined (__GNU_LIBRARY__) #if (defined (POSIX) || MK_OS_VMS || defined (WINDOWS32)) && !defined (__GNU_LIBRARY__)
/* Posix does not require that the d_ino field be present, and some /* Posix does not require that the d_ino field be present, and some
systems do not provide it. */ systems do not provide it. */
# define REAL_DIR_ENTRY(dp) 1 # define REAL_DIR_ENTRY(dp) 1
@ -137,7 +137,7 @@ downcase (const char *filename)
} }
#endif /* HAVE_CASE_INSENSITIVE_FS */ #endif /* HAVE_CASE_INSENSITIVE_FS */
#ifdef VMS #if MK_OS_VMS
static char * static char *
downcase_inplace(char *filename) downcase_inplace(char *filename)
@ -227,7 +227,7 @@ vmsstat_dir (const char *name, struct stat *st)
# define stat(__path, __sbuf) vmsstat_dir (__path, __sbuf) # define stat(__path, __sbuf) vmsstat_dir (__path, __sbuf)
#endif /* _USE_STD_STAT */ #endif /* _USE_STD_STAT */
#endif /* VMS */ #endif /* MK_OS_VMS */
/* Never have more than this many directories open at once. */ /* Never have more than this many directories open at once. */
@ -258,7 +258,7 @@ struct directory_contents
# define FS_NTFS 0x2 # define FS_NTFS 0x2
# define FS_UNKNOWN 0x4 # define FS_UNKNOWN 0x4
#else #else
# ifdef VMS_INO_T # if MK_OS_VMS_INO_T
ino_t ino[3]; ino_t ino[3];
# else # else
ino_t ino; ino_t ino;
@ -296,7 +296,7 @@ directory_contents_hash_1 (const void *key_0)
ISTRING_HASH_1 (key->path_key, hash); ISTRING_HASH_1 (key->path_key, hash);
hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) key->ctime; hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) key->ctime;
#else #else
# ifdef VMS_INO_T # if MK_OS_VMS_INO_T
hash = (((unsigned int) key->dev << 4) hash = (((unsigned int) key->dev << 4)
^ ((unsigned int) key->ino[0] ^ ((unsigned int) key->ino[0]
+ (unsigned int) key->ino[1] + (unsigned int) key->ino[1]
@ -319,7 +319,7 @@ directory_contents_hash_2 (const void *key_0)
ISTRING_HASH_2 (key->path_key, hash); ISTRING_HASH_2 (key->path_key, hash);
hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ctime; hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ctime;
#else #else
# ifdef VMS_INO_T # if MK_OS_VMS_INO_T
hash = (((unsigned int) key->dev << 4) hash = (((unsigned int) key->dev << 4)
^ ~((unsigned int) key->ino[0] ^ ~((unsigned int) key->ino[0]
+ (unsigned int) key->ino[1] + (unsigned int) key->ino[1]
@ -358,7 +358,7 @@ directory_contents_hash_cmp (const void *xv, const void *yv)
if (result) if (result)
return result; return result;
#else #else
# ifdef VMS_INO_T # if MK_OS_VMS_INO_T
result = MAKECMP(x->ino[0], y->ino[0]); result = MAKECMP(x->ino[0], y->ino[0]);
if (result) if (result)
return result; return result;
@ -499,7 +499,7 @@ find_directory (const char *name)
size_t len = strlen (name); size_t len = strlen (name);
dir = xmalloc (sizeof (struct directory)); dir = xmalloc (sizeof (struct directory));
#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) #if defined(HAVE_CASE_INSENSITIVE_FS) && MK_OS_VMS
/* Todo: Why is this only needed on VMS? */ /* Todo: Why is this only needed on VMS? */
{ {
char *lname = downcase_inplace (xstrdup (name)); char *lname = downcase_inplace (xstrdup (name));
@ -548,7 +548,7 @@ find_directory (const char *name)
dc_key.path_key = w32_path = w32ify (name, 1); dc_key.path_key = w32_path = w32ify (name, 1);
dc_key.ctime = st.st_ctime; dc_key.ctime = st.st_ctime;
#else #else
# ifdef VMS_INO_T # if MK_OS_VMS_INO_T
dc_key.ino[0] = st.st_ino[0]; dc_key.ino[0] = st.st_ino[0];
dc_key.ino[1] = st.st_ino[1]; dc_key.ino[1] = st.st_ino[1];
dc_key.ino[2] = st.st_ino[2]; dc_key.ino[2] = st.st_ino[2];
@ -734,7 +734,7 @@ dir_contents_file_exists_p (struct directory *dir,
break; break;
} }
#if defined(VMS) && defined(HAVE_DIRENT_H) #if MK_OS_VMS && defined(HAVE_DIRENT_H)
/* In VMS we get file versions too, which have to be stripped off. /* In VMS we get file versions too, which have to be stripped off.
Some versions of VMS return versions on Unix files even when Some versions of VMS return versions on Unix files even when
the feature option to strip them is set. */ the feature option to strip them is set. */
@ -760,7 +760,7 @@ dir_contents_file_exists_p (struct directory *dir,
#endif #endif
{ {
df = xmalloc (sizeof (struct dirfile)); df = xmalloc (sizeof (struct dirfile));
#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) #if MK_OS_VMS && defined(HAVE_CASE_INSENSITIVE_FS)
/* TODO: Why is this only needed on VMS? */ /* TODO: Why is this only needed on VMS? */
df->name = strcache_add_len (downcase_inplace (d->d_name), len); df->name = strcache_add_len (downcase_inplace (d->d_name), len);
#else #else
@ -797,7 +797,7 @@ dir_contents_file_exists_p (struct directory *dir,
int int
dir_file_exists_p (const char *dirname, const char *filename) dir_file_exists_p (const char *dirname, const char *filename)
{ {
#ifdef VMS #if MK_OS_VMS
if (filename && dirname && strpbrk (dirname, ":<[") != NULL) if (filename && dirname && strpbrk (dirname, ":<[") != NULL)
filename = vmsify (filename, 0); filename = vmsify (filename, 0);
#endif #endif
@ -820,7 +820,7 @@ file_exists_p (const char *name)
#endif #endif
dirend = strrchr (name, '/'); dirend = strrchr (name, '/');
#ifdef VMS #if MK_OS_VMS
if (dirend == NULL) if (dirend == NULL)
{ {
dirend = strrchr (name, ']'); dirend = strrchr (name, ']');
@ -836,7 +836,7 @@ file_exists_p (const char *name)
dirend = strrchr (name, ':'); dirend = strrchr (name, ':');
dirend == NULL ? dirend : dirend++; dirend == NULL ? dirend : dirend++;
} }
#endif /* VMS */ #endif /* MK_OS_VMS */
#ifdef HAVE_DOS_PATHS #ifdef HAVE_DOS_PATHS
/* Forward and backslashes might be mixed. We need the rightmost one. */ /* Forward and backslashes might be mixed. We need the rightmost one. */
{ {
@ -868,7 +868,7 @@ file_exists_p (const char *name)
p[dirend - name] = '\0'; p[dirend - name] = '\0';
dirname = p; dirname = p;
} }
#ifdef VMS #if MK_OS_VMS
if (*slash == '/') if (*slash == '/')
slash++; slash++;
#else #else
@ -890,7 +890,7 @@ file_impossible (const char *filename)
struct dirfile *new; struct dirfile *new;
dirend = strrchr (p, '/'); dirend = strrchr (p, '/');
#ifdef VMS #if MK_OS_VMS
if (dirend == NULL) if (dirend == NULL)
{ {
dirend = strrchr (p, ']'); dirend = strrchr (p, ']');
@ -941,7 +941,7 @@ file_impossible (const char *filename)
dirname = cp; dirname = cp;
} }
dir = find_directory (dirname); dir = find_directory (dirname);
#ifdef VMS #if MK_OS_VMS
if (*slash == '/') if (*slash == '/')
filename = p = slash + 1; filename = p = slash + 1;
else else
@ -964,7 +964,7 @@ file_impossible (const char *filename)
new = xmalloc (sizeof (struct dirfile)); new = xmalloc (sizeof (struct dirfile));
new->length = strlen (filename); new->length = strlen (filename);
#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) #if defined(HAVE_CASE_INSENSITIVE_FS) && MK_OS_VMS
/* todo: Why is this only needed on VMS? */ /* todo: Why is this only needed on VMS? */
new->name = strcache_add_len (downcase (filename), new->length); new->name = strcache_add_len (downcase (filename), new->length);
#else #else
@ -983,12 +983,12 @@ file_impossible_p (const char *filename)
struct directory_contents *dir; struct directory_contents *dir;
struct dirfile *dirfile; struct dirfile *dirfile;
struct dirfile dirfile_key; struct dirfile dirfile_key;
#ifdef VMS #if MK_OS_VMS
int want_vmsify = 0; int want_vmsify = 0;
#endif #endif
dirend = strrchr (filename, '/'); dirend = strrchr (filename, '/');
#ifdef VMS #if MK_OS_VMS
if (dirend == NULL) if (dirend == NULL)
{ {
want_vmsify = (strpbrk (filename, "]>:^") != NULL); want_vmsify = (strpbrk (filename, "]>:^") != NULL);
@ -1033,7 +1033,7 @@ file_impossible_p (const char *filename)
dirname = cp; dirname = cp;
} }
dir = find_directory (dirname)->contents; dir = find_directory (dirname)->contents;
#ifdef VMS #if MK_OS_VMS
if (*slash == '/') if (*slash == '/')
filename = slash + 1; filename = slash + 1;
else else
@ -1053,7 +1053,7 @@ file_impossible_p (const char *filename)
#ifdef HAVE_CASE_INSENSITIVE_FS #ifdef HAVE_CASE_INSENSITIVE_FS
filename = downcase (filename); filename = downcase (filename);
#endif #endif
#ifdef VMS #if MK_OS_VMS
if (want_vmsify) if (want_vmsify)
filename = vmsify (filename, 1); filename = vmsify (filename, 1);
#endif #endif
@ -1274,8 +1274,8 @@ read_dirstream (void *stream)
* On MS-Windows, stat() "succeeds" for foo/bar/. where foo/bar is a * On MS-Windows, stat() "succeeds" for foo/bar/. where foo/bar is a
* regular file; fix that here. * regular file; fix that here.
*/ */
#if !defined(stat) && !defined(WINDOWS32) || defined(VMS) #if !defined(stat) && !defined(WINDOWS32) || MK_OS_VMS
# ifndef VMS # if !MK_OS_VMS
# ifndef HAVE_SYS_STAT_H # ifndef HAVE_SYS_STAT_H
int stat (const char *path, struct stat *sbuf); int stat (const char *path, struct stat *sbuf);
# endif # endif
@ -1314,8 +1314,8 @@ local_stat (const char *path, struct stat *buf)
#endif #endif
/* Similarly for lstat. */ /* Similarly for lstat. */
#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS) #if !defined(lstat) && !defined(WINDOWS32) || MK_OS_VMS
# ifndef VMS # if !MK_OS_VMS
# ifndef HAVE_SYS_STAT_H # ifndef HAVE_SYS_STAT_H
int lstat (const char *path, struct stat *sbuf); int lstat (const char *path, struct stat *sbuf);
# endif # endif

View File

@ -73,7 +73,7 @@ lookup_file (const char *name)
{ {
struct file *f; struct file *f;
struct file file_key; struct file file_key;
#ifdef VMS #if MK_OS_VMS
int want_vmsify; int want_vmsify;
#ifndef WANT_CASE_SENSITIVE_TARGETS #ifndef WANT_CASE_SENSITIVE_TARGETS
char *lname; char *lname;
@ -85,7 +85,7 @@ lookup_file (const char *name)
/* This is also done in parse_file_seq, so this is redundant /* This is also done in parse_file_seq, so this is redundant
for names read from makefiles. It is here for names passed for names read from makefiles. It is here for names passed
on the command line. */ on the command line. */
#ifdef VMS #if MK_OS_VMS
want_vmsify = (strpbrk (name, "]>:^") != NULL); want_vmsify = (strpbrk (name, "]>:^") != NULL);
# ifndef WANT_CASE_SENSITIVE_TARGETS # ifndef WANT_CASE_SENSITIVE_TARGETS
if (*name != '.') if (*name != '.')
@ -117,7 +117,7 @@ lookup_file (const char *name)
{ {
/* It was all slashes after a dot. */ /* It was all slashes after a dot. */
name = "./"; name = "./";
#if defined(VMS) #if MK_OS_VMS
/* TODO - This section is probably not needed. */ /* TODO - This section is probably not needed. */
if (want_vmsify) if (want_vmsify)
name = "[]"; name = "[]";
@ -125,7 +125,7 @@ lookup_file (const char *name)
} }
file_key.hname = name; file_key.hname = name;
f = hash_find_item (&files, &file_key); f = hash_find_item (&files, &file_key);
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) #if MK_OS_VMS && !defined(WANT_CASE_SENSITIVE_TARGETS)
if (*name != '.') if (*name != '.')
free (lname); free (lname);
#endif #endif
@ -149,7 +149,7 @@ enter_file (const char *name)
assert (*name != '\0'); assert (*name != '\0');
assert (! verify_flag || strcache_iscached (name)); assert (! verify_flag || strcache_iscached (name));
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) #if MK_OS_VMS && !defined(WANT_CASE_SENSITIVE_TARGETS)
if (*name != '.') if (*name != '.')
{ {
const char *n; const char *n;

View File

@ -520,7 +520,7 @@ func_notdir_suffix (char *o, char **argv, const char *funcname)
int is_suffix = funcname[0] == 's'; int is_suffix = funcname[0] == 's';
int is_notdir = !is_suffix; int is_notdir = !is_suffix;
int stop = MAP_DIRSEP | (is_suffix ? MAP_DOT : 0); int stop = MAP_DIRSEP | (is_suffix ? MAP_DOT : 0);
#ifdef VMS #if MK_OS_VMS
/* For VMS list_iterator points to a comma separated list. To use the common /* For VMS list_iterator points to a comma separated list. To use the common
[find_]next_token, create a local copy and replace the commas with [find_]next_token, create a local copy and replace the commas with
spaces. Obviously, there is a problem if there is a ',' in the VMS filename spaces. Obviously, there is a problem if there is a ',' in the VMS filename
@ -565,7 +565,7 @@ func_notdir_suffix (char *o, char **argv, const char *funcname)
if (is_notdir || p >= p2) if (is_notdir || p >= p2)
{ {
#ifdef VMS #if MK_OS_VMS
if (vms_comma_separator) if (vms_comma_separator)
o = variable_buffer_output (o, ",", 1); o = variable_buffer_output (o, ",", 1);
else else
@ -596,7 +596,7 @@ func_basename_dir (char *o, char **argv, const char *funcname)
int is_basename = funcname[0] == 'b'; int is_basename = funcname[0] == 'b';
int is_dir = !is_basename; int is_dir = !is_basename;
int stop = MAP_DIRSEP | (is_basename ? MAP_DOT : 0) | MAP_NUL; int stop = MAP_DIRSEP | (is_basename ? MAP_DOT : 0) | MAP_NUL;
#ifdef VMS #if MK_OS_VMS
/* As in func_notdir_suffix ... */ /* As in func_notdir_suffix ... */
char *vms_p3 = alloca (strlen(p3) + 1); char *vms_p3 = alloca (strlen(p3) + 1);
int i; int i;
@ -625,7 +625,7 @@ func_basename_dir (char *o, char **argv, const char *funcname)
o = variable_buffer_output (o, p2, 2); o = variable_buffer_output (o, p2, 2);
#endif #endif
else if (is_dir) else if (is_dir)
#ifdef VMS #if MK_OS_VMS
{ {
extern int vms_report_unix_paths; extern int vms_report_unix_paths;
if (vms_report_unix_paths) if (vms_report_unix_paths)
@ -635,12 +635,12 @@ func_basename_dir (char *o, char **argv, const char *funcname)
} }
#else #else
o = variable_buffer_output (o, "./", 2); o = variable_buffer_output (o, "./", 2);
#endif /* !VMS */ #endif /* !MK_OS_VMS */
else else
/* The entire name is the basename. */ /* The entire name is the basename. */
o = variable_buffer_output (o, p2, len); o = variable_buffer_output (o, p2, len);
#ifdef VMS #if MK_OS_VMS
if (vms_comma_separator) if (vms_comma_separator)
o = variable_buffer_output (o, ",", 1); o = variable_buffer_output (o, ",", 1);
else else
@ -1807,7 +1807,7 @@ msdos_openpipe (int* pipedes, int *pidp, char *text)
Do shell spawning, with the naughty bits for different OSes. Do shell spawning, with the naughty bits for different OSes.
*/ */
#ifdef VMS #if MK_OS_VMS
/* VMS can't do $(shell ...) */ /* VMS can't do $(shell ...) */
@ -2000,7 +2000,7 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
{ {
return func_shell_base (o, argv, 1); return func_shell_base (o, argv, 1);
} }
#endif /* !VMS */ #endif /* !MK_OS_VMS */
#ifdef EXPERIMENTAL #ifdef EXPERIMENTAL

View File

@ -68,7 +68,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
# include <unistd.h> # include <unistd.h>
#endif /* GNU C library. */ #endif /* GNU C library. */
#ifdef VMS #if MK_OS_VMS
# include <unixlib.h> # include <unixlib.h>
# if HAVE_STRING_H - 0 # if HAVE_STRING_H - 0
# include <string.h> # include <string.h>

View File

@ -284,7 +284,7 @@ pattern_search (struct file *file, int archive,
but not counting any slash at the end. (foo/bar/ counts as but not counting any slash at the end. (foo/bar/ counts as
bar/ in directory foo/, not empty in directory foo/bar/.) */ bar/ in directory foo/, not empty in directory foo/bar/.) */
lastslash = memrchr (filename, '/', namelen - 1); lastslash = memrchr (filename, '/', namelen - 1);
#ifdef VMS #if MK_OS_VMS
if (lastslash == NULL) if (lastslash == NULL)
lastslash = strrchr (filename, ']'); lastslash = strrchr (filename, ']');
if (lastslash == NULL) if (lastslash == NULL)
@ -357,7 +357,7 @@ pattern_search (struct file *file, int archive,
check_lastslash = 0; check_lastslash = 0;
if (lastslash) if (lastslash)
{ {
#ifdef VMS #if MK_OS_VMS
check_lastslash = strpbrk (target, "/]>:") == NULL; check_lastslash = strpbrk (target, "/]>:") == NULL;
#else #else
check_lastslash = strchr (target, '/') == 0; check_lastslash = strchr (target, '/') == 0;

View File

@ -51,7 +51,7 @@ int batch_mode_shell = 0;
const char *default_shell = "/bin/sh"; const char *default_shell = "/bin/sh";
int batch_mode_shell = 0; int batch_mode_shell = 0;
#elif defined (VMS) #elif MK_OS_VMS
# include <descrip.h> # include <descrip.h>
# include <stsdef.h> # include <stsdef.h>
@ -83,7 +83,7 @@ int dos_status;
int dos_command_running; int dos_command_running;
#endif /* __MSDOS__ */ #endif /* __MSDOS__ */
#ifdef VMS #if MK_OS_VMS
# ifndef __GNUC__ # ifndef __GNUC__
# include <processes.h> # include <processes.h>
# endif # endif
@ -179,7 +179,7 @@ int wait ();
int dup2 (); int dup2 ();
int execve (); int execve ();
void _exit (); void _exit ();
# ifndef VMS # if !MK_OS_VMS
int geteuid (); int geteuid ();
int getegid (); int getegid ();
int setgid (); int setgid ();
@ -702,7 +702,7 @@ reap_children (int block, int err)
DB (DB_JOBS, (_("Live child %p (%s) PID %s %s\n"), DB (DB_JOBS, (_("Live child %p (%s) PID %s %s\n"),
c, c->file->name, pid2str (c->pid), c, c->file->name, pid2str (c->pid),
c->remote ? _(" (remote)") : "")); c->remote ? _(" (remote)") : ""));
#ifdef VMS #if MK_OS_VMS
break; break;
#endif #endif
} }
@ -727,7 +727,7 @@ reap_children (int block, int err)
#if !defined(__MSDOS__) && !defined(WINDOWS32) #if !defined(__MSDOS__) && !defined(WINDOWS32)
if (any_local) if (any_local)
{ {
#ifdef VMS #if MK_OS_VMS
/* Todo: This needs more untangling multi-process support */ /* Todo: This needs more untangling multi-process support */
/* Just do single child process support now */ /* Just do single child process support now */
vmsWaitForChildren (&status); vmsWaitForChildren (&status);
@ -746,7 +746,7 @@ reap_children (int block, int err)
else else
#endif #endif
EINTRLOOP (pid, wait (&status)); EINTRLOOP (pid, wait (&status));
#endif /* !VMS */ #endif /* !MK_OS_VMS */
} }
else else
pid = 0; pid = 0;
@ -1153,7 +1153,7 @@ start_job_command (struct child *child)
{ {
int flags; int flags;
char *p; char *p;
#ifdef VMS #if MK_OS_VMS
# define FREE_ARGV(_a) # define FREE_ARGV(_a)
char *argv; char *argv;
#else #else
@ -1216,7 +1216,7 @@ start_job_command (struct child *child)
/* Figure out an argument list from this command line. */ /* Figure out an argument list from this command line. */
{ {
char *end = 0; char *end = 0;
#ifdef VMS #if MK_OS_VMS
/* Skip any leading whitespace */ /* Skip any leading whitespace */
while (*p) while (*p)
{ {
@ -1275,7 +1275,7 @@ start_job_command (struct child *child)
if (argv != 0 && question_flag && NONE_SET (flags, COMMANDS_RECURSE)) if (argv != 0 && question_flag && NONE_SET (flags, COMMANDS_RECURSE))
{ {
FREE_ARGV (argv); FREE_ARGV (argv);
#ifdef VMS #if MK_OS_VMS
/* On VMS, argv[0] can be a null string here */ /* On VMS, argv[0] can be a null string here */
if (argv[0] != 0) if (argv[0] != 0)
{ {
@ -1283,7 +1283,7 @@ start_job_command (struct child *child)
child->file->update_status = us_question; child->file->update_status = us_question;
notice_finished_file (child->file); notice_finished_file (child->file);
return; return;
#ifdef VMS #if MK_OS_VMS
} }
#endif #endif
} }
@ -1351,7 +1351,7 @@ start_job_command (struct child *child)
performed some action (makes a difference as to what messages are performed some action (makes a difference as to what messages are
printed, etc. */ printed, etc. */
#if !defined(VMS) #if !MK_OS_VMS
if ( if (
#if defined __MSDOS__ || defined (__EMX__) #if defined __MSDOS__ || defined (__EMX__)
unixy_shell /* the test is complicated and we already did it */ unixy_shell /* the test is complicated and we already did it */
@ -1369,7 +1369,7 @@ start_job_command (struct child *child)
FREE_ARGV (argv); FREE_ARGV (argv);
goto next_command; goto next_command;
} }
#endif /* !VMS */ #endif /* !MK_OS_VMS */
/* If -n was given, recurse to get the next line in the sequence. */ /* If -n was given, recurse to get the next line in the sequence. */
@ -1410,7 +1410,7 @@ start_job_command (struct child *child)
#if !defined(__MSDOS__) && !defined(WINDOWS32) #if !defined(__MSDOS__) && !defined(WINDOWS32)
#ifndef VMS #if !MK_OS_VMS
/* start_waiting_job has set CHILD->remote if we can start a remote job. */ /* start_waiting_job has set CHILD->remote if we can start a remote job. */
if (child->remote) if (child->remote)
{ {
@ -1434,7 +1434,7 @@ start_job_command (struct child *child)
} }
} }
else else
#endif /* !VMS */ #endif /* !MK_OS_VMS */
{ {
/* Fork the child process. */ /* Fork the child process. */
run_local: run_local:
@ -1442,7 +1442,7 @@ start_job_command (struct child *child)
child->remote = 0; child->remote = 0;
#ifdef VMS #if MK_OS_VMS
child->pid = child_execute_job ((struct childbase *)child, 1, argv); child->pid = child_execute_job ((struct childbase *)child, 1, argv);
#else #else
@ -1454,7 +1454,7 @@ start_job_command (struct child *child)
jobserver_post_child (ANY_SET (flags, COMMANDS_RECURSE)); jobserver_post_child (ANY_SET (flags, COMMANDS_RECURSE));
#endif /* !VMS */ #endif /* !MK_OS_VMS */
} }
#else /* __MSDOS__ or WINDOWS32 */ #else /* __MSDOS__ or WINDOWS32 */
@ -2017,7 +2017,7 @@ job_next_command (struct child *child)
static int static int
load_too_high (void) load_too_high (void)
{ {
#if defined(__MSDOS__) || defined(VMS) || defined(__riscos__) #if defined(__MSDOS__) || MK_OS_VMS || defined(__riscos__)
return 1; return 1;
#else #else
static double last_sec; static double last_sec;
@ -2268,7 +2268,7 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
return pid; return pid;
} }
#elif !defined (__MSDOS__) && !defined (VMS) #elif !defined (__MSDOS__) && !MK_OS_VMS
/* POSIX: /* POSIX:
Create a child process executing the command in ARGV. Create a child process executing the command in ARGV.
@ -2467,7 +2467,7 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
return pid; return pid;
} }
#endif /* !__MSDOS__ && !VMS */ #endif /* !__MSDOS__ && !MK_OS_VMS */
#endif /* !WINDOWS32 */ #endif /* !WINDOWS32 */
/* Replace the current process with one running the command in ARGV, /* Replace the current process with one running the command in ARGV,
@ -2476,7 +2476,7 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
pid_t pid_t
exec_command (char **argv, char **envp) exec_command (char **argv, char **envp)
{ {
#ifdef VMS #if MK_OS_VMS
/* to work around a problem with signals and execve: ignore them */ /* to work around a problem with signals and execve: ignore them */
#ifdef SIGCHLD #ifdef SIGCHLD
signal (SIGCHLD,SIG_IGN); signal (SIGCHLD,SIG_IGN);
@ -2653,10 +2653,10 @@ exec_command (char **argv, char **envp)
return pid; return pid;
#endif /* !WINDOWS32 */ #endif /* !WINDOWS32 */
#endif /* !VMS */ #endif /* !MK_OS_VMS */
} }
#ifndef VMS #if !MK_OS_VMS
/* Figure out the argument list necessary to run LINE as a command. Try to /* Figure out the argument list necessary to run LINE as a command. Try to
avoid using a shell. This routine handles only ' quoting, and " quoting avoid using a shell. This routine handles only ' quoting, and " quoting
when no backslash, $ or ' characters are seen in the quotes. Starting when no backslash, $ or ' characters are seen in the quotes. Starting
@ -3609,7 +3609,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
return new_argv; return new_argv;
} }
#endif /* !VMS */ #endif /* !MK_OS_VMS */
/* Figure out the argument list necessary to run LINE as a command. Try to /* Figure out the argument list necessary to run LINE as a command. Try to
avoid using a shell. This routine handles only ' quoting, and " quoting avoid using a shell. This routine handles only ' quoting, and " quoting
@ -3738,6 +3738,6 @@ dup2 (int old, int new)
/* On VMS systems, include special VMS functions. */ /* On VMS systems, include special VMS functions. */
#ifdef VMS #if MK_OS_VMS
#include "vmsjobs.c" #include "vmsjobs.c"
#endif #endif

View File

@ -18,7 +18,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Structure describing a running or dead child process. */ /* Structure describing a running or dead child process. */
#ifdef VMS #if MK_OS_VMS
#define VMSCHILD \ #define VMSCHILD \
char *comname; /* Temporary command file name */ \ char *comname; /* Temporary command file name */ \
int efn; /* Completion event flag number */ \ int efn; /* Completion event flag number */ \

View File

@ -42,7 +42,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
# include <fcntl.h> # include <fcntl.h>
#endif #endif
#ifdef VMS #if MK_OS_VMS
int vms_use_mcr_command = 0; int vms_use_mcr_command = 0;
int vms_always_use_cmd_file = 0; int vms_always_use_cmd_file = 0;
int vms_gnv_shell = 0; int vms_gnv_shell = 0;
@ -669,7 +669,7 @@ initialize_stopchar_map (void)
stopchar_map[(int)'\t'] = MAP_BLANK; stopchar_map[(int)'\t'] = MAP_BLANK;
stopchar_map[(int)'/'] = MAP_DIRSEP; stopchar_map[(int)'/'] = MAP_DIRSEP;
#if defined(VMS) #if MK_OS_VMS
stopchar_map[(int)':'] |= MAP_DIRSEP; stopchar_map[(int)':'] |= MAP_DIRSEP;
stopchar_map[(int)']'] |= MAP_DIRSEP; stopchar_map[(int)']'] |= MAP_DIRSEP;
stopchar_map[(int)'>'] |= MAP_DIRSEP; stopchar_map[(int)'>'] |= MAP_DIRSEP;
@ -1336,7 +1336,7 @@ main (int argc, char **argv, char **envp)
program = xstrndup (program, len - 4); program = xstrndup (program, len - 4);
} }
} }
#elif defined(VMS) #elif MK_OS_VMS
set_program_name (argv[0]); set_program_name (argv[0]);
program = program_name; program = program_name;
{ {
@ -1677,7 +1677,7 @@ main (int argc, char **argv, char **envp)
fflush (stdout); fflush (stdout);
} }
#ifndef VMS #if !MK_OS_VMS
/* Set the "MAKE_COMMAND" variable to the name we were invoked with. /* Set the "MAKE_COMMAND" variable to the name we were invoked with.
(If it is a relative pathname with a slash, prepend our directory name (If it is a relative pathname with a slash, prepend our directory name
so the result will run the same program regardless of the current dir. so the result will run the same program regardless of the current dir.
@ -1829,7 +1829,7 @@ main (int argc, char **argv, char **envp)
/* The extra indirection through $(MAKE_COMMAND) is done /* The extra indirection through $(MAKE_COMMAND) is done
for hysterical raisins. */ for hysterical raisins. */
#ifdef VMS #if MK_OS_VMS
if (vms_use_mcr_command) if (vms_use_mcr_command)
define_variable_cname ("MAKE_COMMAND", vms_command (argv[0]), o_default, 0); define_variable_cname ("MAKE_COMMAND", vms_command (argv[0]), o_default, 0);
else else
@ -1885,7 +1885,7 @@ main (int argc, char **argv, char **envp)
a reference to this hidden variable is written instead. */ a reference to this hidden variable is written instead. */
define_variable_cname ("MAKEOVERRIDES", "${-*-command-variables-*-}", define_variable_cname ("MAKEOVERRIDES", "${-*-command-variables-*-}",
o_default, 1); o_default, 1);
#ifdef VMS #if MK_OS_VMS
vms_export_dcl_symbol ("MAKEOVERRIDES", "${-*-command-variables-*-}"); vms_export_dcl_symbol ("MAKEOVERRIDES", "${-*-command-variables-*-}");
#endif #endif
} }
@ -2110,7 +2110,7 @@ main (int argc, char **argv, char **envp)
no_default_sh_exe = !find_and_set_default_shell (NULL); no_default_sh_exe = !find_and_set_default_shell (NULL);
#endif /* WINDOWS32 */ #endif /* WINDOWS32 */
#if defined (__MSDOS__) || defined (__EMX__) || defined (VMS) #if defined (__MSDOS__) || defined (__EMX__) || MK_OS_VMS
/* We need to know what kind of shell we will be using. */ /* We need to know what kind of shell we will be using. */
{ {
extern int _is_unixy_shell (const char *_path); extern int _is_unixy_shell (const char *_path);
@ -2155,7 +2155,7 @@ main (int argc, char **argv, char **envp)
else else
job_slots = arg_job_slots; job_slots = arg_job_slots;
#if defined (__MSDOS__) || defined (__EMX__) || defined (VMS) #if defined (__MSDOS__) || defined (__EMX__) || MK_OS_VMS
if (job_slots != 1 if (job_slots != 1
# ifdef __EMX__ # ifdef __EMX__
&& _osmode != OS2_MODE /* turn off -j if we are in DOS mode */ && _osmode != OS2_MODE /* turn off -j if we are in DOS mode */
@ -2700,7 +2700,7 @@ main (int argc, char **argv, char **envp)
{ {
*p = alloca (40); *p = alloca (40);
sprintf (*p, "%s=%u", MAKELEVEL_NAME, makelevel); sprintf (*p, "%s=%u", MAKELEVEL_NAME, makelevel);
#ifdef VMS #if MK_OS_VMS
vms_putenv_symbol (*p); vms_putenv_symbol (*p);
#endif #endif
} }
@ -2971,7 +2971,7 @@ handle_non_switch_argument (const char *arg, enum variable_origin origin)
/* Ignore plain '-' for compatibility. */ /* Ignore plain '-' for compatibility. */
return; return;
#ifdef VMS #if MK_OS_VMS
{ {
/* VMS DCL quoting can result in foo="bar baz" showing up here. /* VMS DCL quoting can result in foo="bar baz" showing up here.
Need to remove the double quotes from the value. */ Need to remove the double quotes from the value. */

View File

@ -94,6 +94,7 @@ extern int errno;
#endif #endif
#ifdef __VMS #ifdef __VMS
# define MK_OS_VMS 1
/* In strict ANSI mode, VMS compilers should not be defining the /* In strict ANSI mode, VMS compilers should not be defining the
VMS macro. Define it here instead of a bulk edit for the correct code. VMS macro. Define it here instead of a bulk edit for the correct code.
*/ */
@ -106,7 +107,7 @@ extern int errno;
# include <unistd.h> # include <unistd.h>
/* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get /* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
POSIX.1 behavior with 'cc -YPOSIX', which predefines POSIX itself! */ POSIX.1 behavior with 'cc -YPOSIX', which predefines POSIX itself! */
# if defined (_POSIX_VERSION) && !defined (ultrix) && !defined (VMS) # if defined (_POSIX_VERSION) && !defined (ultrix) && !MK_OS_VMS
# define POSIX 1 # define POSIX 1
# endif # endif
#endif #endif
@ -197,7 +198,7 @@ unsigned int get_path_max (void);
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif #endif
#ifdef VMS #if MK_OS_VMS
# include <fcntl.h> # include <fcntl.h>
# include <types.h> # include <types.h>
# include <unixlib.h> # include <unixlib.h>
@ -426,7 +427,7 @@ extern int unixy_shell;
/* The set of characters which are directory separators is OS-specific. */ /* The set of characters which are directory separators is OS-specific. */
#define MAP_DIRSEP 0x8000 #define MAP_DIRSEP 0x8000
#ifdef VMS #if MK_OS_VMS
# define MAP_VMSCOMMA MAP_COMMA # define MAP_VMSCOMMA MAP_COMMA
#else #else
# define MAP_VMSCOMMA 0x0000 # define MAP_VMSCOMMA 0x0000
@ -443,7 +444,7 @@ extern int unixy_shell;
# define PATH_SEPARATOR_CHAR ';' # define PATH_SEPARATOR_CHAR ';'
# define MAP_PATHSEP MAP_SEMI # define MAP_PATHSEP MAP_SEMI
#elif !defined(PATH_SEPARATOR_CHAR) #elif !defined(PATH_SEPARATOR_CHAR)
# if defined (VMS) # if MK_OS_VMS
# define PATH_SEPARATOR_CHAR (vms_comma_separator ? ',' : ':') # define PATH_SEPARATOR_CHAR (vms_comma_separator ? ',' : ':')
# define MAP_PATHSEP (vms_comma_separator ? MAP_COMMA : MAP_SEMI) # define MAP_PATHSEP (vms_comma_separator ? MAP_COMMA : MAP_SEMI)
# else # else
@ -516,7 +517,7 @@ extern struct rlimit stack_limit;
# define TTYNAME(_f) DEFAULT_TTYNAME # define TTYNAME(_f) DEFAULT_TTYNAME
#endif #endif
#ifdef VMS #if MK_OS_VMS
# define DEFAULT_TMPDIR "/sys$scratch/" # define DEFAULT_TMPDIR "/sys$scratch/"
#elif defined(P_tmpdir) #elif defined(P_tmpdir)
# define DEFAULT_TMPDIR P_tmpdir # define DEFAULT_TMPDIR P_tmpdir
@ -618,7 +619,7 @@ typedef intmax_t (*ar_member_func_t) (int desc, const char *mem, int truncated,
intmax_t ar_scan (const char *archive, ar_member_func_t function, intmax_t ar_scan (const char *archive, ar_member_func_t function,
const void *arg); const void *arg);
int ar_name_equal (const char *name, const char *mem, int truncated); int ar_name_equal (const char *name, const char *mem, int truncated);
#ifndef VMS #if !MK_OS_VMS
int ar_member_touch (const char *arname, const char *memname); int ar_member_touch (const char *arname, const char *memname);
#endif #endif
#endif #endif
@ -682,12 +683,12 @@ void dbg (const char *fmt, ...);
#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32) #if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32)
# ifndef VMS # if !MK_OS_VMS
long int lseek (); long int lseek ();
# endif # endif
# ifdef HAVE_GETCWD # ifdef HAVE_GETCWD
# if !defined(VMS) && !defined(__DECC) # if !MK_OS_VMS && !defined(__DECC)
char *getcwd (void); char *getcwd (void);
# endif # endif
# else # else
@ -766,7 +767,7 @@ extern double max_load_average;
extern const char *program; extern const char *program;
#ifdef VMS #if MK_OS_VMS
const char *vms_command (const char *argv0); const char *vms_command (const char *argv0);
const char *vms_progname (const char *argv0); const char *vms_progname (const char *argv0);

View File

@ -572,7 +572,7 @@ umask (mode_t mask)
} }
#endif #endif
#ifdef VMS #if MK_OS_VMS
# define DEFAULT_TMPFILE "sys$scratch:gnv$make_cmdXXXXXX.com" # define DEFAULT_TMPFILE "sys$scratch:gnv$make_cmdXXXXXX.com"
#else #else
# define DEFAULT_TMPFILE "GmXXXXXX" # define DEFAULT_TMPFILE "GmXXXXXX"
@ -630,7 +630,7 @@ get_tmptemplate ()
template = xmalloc (strlen (tmpdir) + CSTRLEN (DEFAULT_TMPFILE) + 2); template = xmalloc (strlen (tmpdir) + CSTRLEN (DEFAULT_TMPFILE) + 2);
cp = stpcpy (template, tmpdir); cp = stpcpy (template, tmpdir);
#if !defined VMS #if !MK_OS_VMS
/* It's not possible for tmpdir to be empty. */ /* It's not possible for tmpdir to be empty. */
if (! ISDIRSEP (cp[-1])) if (! ISDIRSEP (cp[-1]))
*(cp++) = '/'; *(cp++) = '/';

View File

@ -20,7 +20,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#define IO_STDOUT_OK 0x0008 #define IO_STDOUT_OK 0x0008
#define IO_STDERR_OK 0x0010 #define IO_STDERR_OK 0x0010
#if defined(VMS) || defined(__MSDOS__) #if MK_OS_VMS || defined(__MSDOS__)
# define check_io_state() (IO_STDIN_OK|IO_STDOUT_OK|IO_STDERR_OK) # define check_io_state() (IO_STDIN_OK|IO_STDOUT_OK|IO_STDERR_OK)
# define fd_inherit(_i) (0) # define fd_inherit(_i) (0)
# define fd_noinherit(_i) (0) # define fd_noinherit(_i) (0)
@ -151,7 +151,7 @@ void osync_release (void);
#endif /* NO_OUTPUT_SYNC */ #endif /* NO_OUTPUT_SYNC */
/* Create a "bad" file descriptor for stdin when parallel jobs are run. */ /* Create a "bad" file descriptor for stdin when parallel jobs are run. */
#if defined(VMS) || defined(WINDOWS32) || defined(__MSDOS__) #if MK_OS_VMS || defined(WINDOWS32) || defined(__MSDOS__)
# define get_bad_stdin() (-1) # define get_bad_stdin() (-1)
#else #else
int get_bad_stdin (void); int get_bad_stdin (void);

View File

@ -32,7 +32,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#ifdef WINDOWS32 #ifdef WINDOWS32
# include <windows.h> # include <windows.h>
# include "sub_proc.h" # include "sub_proc.h"
#elif defined(VMS) #elif MK_OS_VMS
struct passwd *getpwnam (char *name); struct passwd *getpwnam (char *name);
#else #else
# include <pwd.h> # include <pwd.h>
@ -223,17 +223,17 @@ read_all_makefiles (const char **makefiles)
if (num_makefiles == 0) if (num_makefiles == 0)
{ {
static const char *default_makefiles[] = static const char *default_makefiles[] =
#ifdef VMS #if MK_OS_VMS
/* all lower case since readdir() (the vms version) 'lowercasifies' */ /* all lower case since readdir() (the vms version) 'lowercasifies' */
/* TODO: Above is not always true, this needs more work */ /* TODO: Above is not always true, this needs more work */
{ "makefile.vms", "gnumakefile", "makefile", 0 }; { "makefile.vms", "gnumakefile", "makefile", 0 };
#else #else
#ifdef WINDOWS32 #ifdef WINDOWS32
{ "GNUmakefile", "makefile", "Makefile", "makefile.mak", 0 }; { "GNUmakefile", "makefile", "Makefile", "makefile.mak", 0 };
#else /* !VMS && !WINDOWS32 */ #else /* !MK_OS_VMS && !WINDOWS32 */
{ "GNUmakefile", "makefile", "Makefile", 0 }; { "GNUmakefile", "makefile", "Makefile", 0 };
#endif /* !VMS && !WINDOWS32 */ #endif /* !MK_OS_VMS && !WINDOWS32 */
#endif /* VMS */ #endif /* MK_OS_VMS */
const char **p = default_makefiles; const char **p = default_makefiles;
while (*p != 0 && !file_exists_p (*p)) while (*p != 0 && !file_exists_p (*p))
++p; ++p;
@ -3060,7 +3060,7 @@ construct_include_path (const char **arg_dirs)
char * char *
tilde_expand (const char *name) tilde_expand (const char *name)
{ {
#if !defined(VMS) #if !MK_OS_VMS
if (name[1] == '/' || name[1] == '\0') if (name[1] == '/' || name[1] == '\0')
{ {
char *home_dir; char *home_dir;
@ -3123,7 +3123,7 @@ tilde_expand (const char *name)
*userend = '/'; *userend = '/';
} }
# endif /* !WINDOWS32 */ # endif /* !WINDOWS32 */
#endif /* !VMS */ #endif /* !MK_OS_VMS */
return 0; return 0;
} }
@ -3234,7 +3234,7 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
s = p; s = p;
p = find_map_unquote (p, findmap); p = find_map_unquote (p, findmap);
#ifdef VMS #if MK_OS_VMS
/* convert comma separated list to space separated */ /* convert comma separated list to space separated */
if (p && *p == ',') if (p && *p == ',')
*p =' '; *p =' ';
@ -3261,7 +3261,7 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
/* Strip leading "this directory" references. */ /* Strip leading "this directory" references. */
if (NONE_SET (flags, PARSEFS_NOSTRIP)) if (NONE_SET (flags, PARSEFS_NOSTRIP))
#ifdef VMS #if MK_OS_VMS
/* Skip leading '[]'s. should only be one set or bug somewhere else */ /* Skip leading '[]'s. should only be one set or bug somewhere else */
if (p - s > 2 && s[0] == '[' && s[1] == ']') if (p - s > 2 && s[0] == '[' && s[1] == ']')
s += 2; s += 2;
@ -3291,7 +3291,7 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
} }
else else
{ {
#ifdef VMS #if MK_OS_VMS
/* VMS filenames can have a ':' in them but they have to be '\'ed but we need /* VMS filenames can have a ':' in them but they have to be '\'ed but we need
* to remove this '\' before we can use the filename. * to remove this '\' before we can use the filename.
* xstrdup called because S may be read-only string constant. * xstrdup called because S may be read-only string constant.

View File

@ -30,7 +30,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include <sys/file.h> #include <sys/file.h>
#endif #endif
#ifdef VMS #if MK_OS_VMS
#include <starlet.h> #include <starlet.h>
#endif #endif
#ifdef WINDOWS32 #ifdef WINDOWS32
@ -1431,7 +1431,7 @@ f_mtime (struct file *file, int search)
/* If we found it in VPATH, see if it's in GPATH too; if so, /* If we found it in VPATH, see if it's in GPATH too; if so,
change the name right now; if not, defer until after the change the name right now; if not, defer until after the
dependencies are updated. */ dependencies are updated. */
#ifndef VMS #if !MK_OS_VMS
name_len = strlen (name) - strlen (file->name) - 1; name_len = strlen (name) - strlen (file->name) - 1;
#else #else
name_len = strlen (name) - strlen (file->name); name_len = strlen (name) - strlen (file->name);

View File

@ -171,7 +171,7 @@ snap_implicit_rules (void)
const char *dname = dep_name (dep); const char *dname = dep_name (dep);
size_t len = strlen (dname); size_t len = strlen (dname);
#ifdef VMS #if MK_OS_VMS
const char *p = strrchr (dname, ']'); const char *p = strrchr (dname, ']');
const char *p2; const char *p2;
if (p == 0) if (p == 0)
@ -250,7 +250,7 @@ convert_suffix_rule (const char *target, const char *source,
{ {
/* Special case: TARGET being nil means we are defining a '.X.a' suffix /* Special case: TARGET being nil means we are defining a '.X.a' suffix
rule; the target pattern is always '(%.o)'. */ rule; the target pattern is always '(%.o)'. */
#ifdef VMS #if MK_OS_VMS
*names = strcache_add_len ("(%.obj)", 7); *names = strcache_add_len ("(%.obj)", 7);
#else #else
*names = strcache_add_len ("(%.o)", 5); *names = strcache_add_len ("(%.o)", 5);

View File

@ -215,7 +215,7 @@ define_variable_in_set (const char *name, size_t length,
var_slot = (struct variable **) hash_find_slot (&set->table, &var_key); var_slot = (struct variable **) hash_find_slot (&set->table, &var_key);
v = *var_slot; v = *var_slot;
#ifdef VMS #if MK_OS_VMS
/* VMS does not populate envp[] with DCL symbols and logical names which /* VMS does not populate envp[] with DCL symbols and logical names which
historically are mapped to environment variables. historically are mapped to environment variables.
If the variable is not yet defined, then we need to check if getenv() If the variable is not yet defined, then we need to check if getenv()
@ -479,7 +479,7 @@ lookup_variable (const char *name, size_t length)
is_parent |= setlist->next_is_parent; is_parent |= setlist->next_is_parent;
} }
#ifdef VMS #if MK_OS_VMS
/* VMS doesn't populate envp[] with DCL symbols and logical names, which /* VMS doesn't populate envp[] with DCL symbols and logical names, which
historically are mapped to environment variables and returned by historically are mapped to environment variables and returned by
getenv(). */ getenv(). */
@ -534,7 +534,7 @@ lookup_variable (const char *name, size_t length)
return define_variable (vname, length, value, o_env, 1); return define_variable (vname, length, value, o_env, 1);
} }
} }
#endif /* VMS */ #endif /* MK_OS_VMS */
return 0; return 0;
} }

View File

@ -24,7 +24,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h" #include "makeint.h"
#if VMS #if MK_OS_VMS
#include <unixlib.h> #include <unixlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <jpidef.h> #include <jpidef.h>

View File

@ -365,7 +365,7 @@ selective_vpath_search (struct vpath *path, const char *file,
/* Add the directory prefix already in *FILE. */ /* Add the directory prefix already in *FILE. */
if (name_dplen > 0) if (name_dplen > 0)
{ {
#ifndef VMS #if !MK_OS_VMS
*p++ = '/'; *p++ = '/';
#else #else
/* VMS: if this is not in VMS format, treat as Unix format */ /* VMS: if this is not in VMS format, treat as Unix format */
@ -381,7 +381,7 @@ selective_vpath_search (struct vpath *path, const char *file,
p[-1] = '/'; p[-1] = '/';
#endif #endif
/* Now add the name-within-directory at the end of NAME. */ /* Now add the name-within-directory at the end of NAME. */
#ifndef VMS #if !MK_OS_VMS
if (p != name && p[-1] != '/') if (p != name && p[-1] != '/')
{ {
*p = '/'; *p = '/';
@ -440,7 +440,7 @@ selective_vpath_search (struct vpath *path, const char *file,
/* That file wasn't mentioned in the makefile. /* That file wasn't mentioned in the makefile.
See if it actually exists. */ See if it actually exists. */
#ifdef VMS #if MK_OS_VMS
/* For VMS syntax just use the original vpath */ /* For VMS syntax just use the original vpath */
if (*p != '/') if (*p != '/')
exists_in_cache = exists = dir_file_exists_p (vpath[i], filename); exists_in_cache = exists = dir_file_exists_p (vpath[i], filename);
@ -467,7 +467,7 @@ selective_vpath_search (struct vpath *path, const char *file,
struct stat st; struct stat st;
#ifndef VMS #if !MK_OS_VMS
/* Put the slash back in NAME. */ /* Put the slash back in NAME. */
*p = '/'; *p = '/';
#else #else