From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 29-DEC-1988 19:17
To:	MRGATE::"ARISIA::EVERHART"
Subj:	MAKE.SHAR (part 4 of 5)


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Tue, 20 DEC 88 01:16:41 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Tue, 20 Dec 88 01:04:58 PST
Received: by ucbvax.Berkeley.EDU (5.61/1.33)
	id AA27601; Mon, 19 Dec 88 23:28:25 PST
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 5 Dec 88 23:33:13 GMT
From: tektronix!gvgpsa!gvgpvd!tony@ucbvax.Berkeley.EDU  (Tony Ivanov)
Organization: Grass Valley Group, Inc., Grass Valley, CA
Subject: MAKE.SHAR (part 4 of 5)
Message-Id: <925@gvgpvd.GVG.TEK.COM>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


$Part4:
$ File_is="RULES.C"
$ Check_Sum_is=355891133
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X/*
X *`009Control of the implicit suffix rules
X */
X
X#include "h.h"
X
X/*
X * Built-in macro, rule, and suffix tables.  All built-in macro names are
X * entirely in UPPER-CASE.  For readability, please preserve alphabetical
X * order in each table.
X */
X
X#ifdef EON
Xstatic MACRO defmacros[] =
X{
X`009{NULL_MACROP,`009"AS",`009`009"zas",`009`009'\0'},
X`009{NULL_MACROP,`009"BDSCC",`009"asm",`009`009'\0'},
X`009{NULL_MACROP,`009"CC",`009`009"c",`009`009'\0'},
X`009{NULL_MACROP,`009"CFLAGS",`009"-O",`009`009'\0'},
X`009{NULL_MACROP,`009"M80",`009`009"asm -n",`009'\0'},
X};
X
Xstatic RULE defrules[] =
X{
X`009{".as.obj",`009`009`009"$(ZAS) $(AFLAGS) -o $@ $<"},
X`009{".c.o",`009`009`009"$(BDSCC) $(BDSCFLAGS) -n $<"},
X`009{".c.obj",`009`009`009"$(CC) $(CFLAGS) -c $<"},
X`009{".mac.o",`009`009`009"$(M80) $(M80FLAGS) $<"},
X};
X
Xstatic char * defsuffix = ".SUFFIXES: .as .obj .c .o .mac";
X#endif
X
X
X#ifdef KCC_20
Xstatic MACRO defmacros[] =
X{
X`009{NULL_MACROP,`009"AMSTEX",`009"AMSTeX",`009'\0'},
X`009{NULL_MACROP,`009"AMSTEXFLAGS",`009"\\batchmode",`009'\0'},
X`009{NULL_MACROP,`009"AS",`009`009"compile",`009'\0'},
X`009{NULL_MACROP,`009"AFLAGS",`009"",`009`009'\0'},
X`009{NULL_MACROP,`009"CC",`009`009"kcc",`009`009'\0'},
X`009{NULL_MACROP,`009"CFLAGS",`009"",`009`009'\0'},
X`009{NULL_MACROP,`009"FC",`009`009"compile",`009'\0'},
X`009{NULL_MACROP,`009"FFLAGS",`009"/debug:(argument,label)",`009'\0'},
X`009{NULL_MACROP,`009"LATEX",`009"LaTeX",`009'\0'},
X`009{NULL_MACROP,`009"LATEXFLAGS",`009"\\batchmode",`009'\0'},
X`009{NULL_MACROP,`009"MV",`009`009"rename",`009'\0'},
X`009{NULL_MACROP,`009"PC",`009`009"compile",`009'\0'},
X`009{NULL_MACROP,`009"PFLAGS",`009"",`009`009'\0'},
X`009{NULL_MACROP,`009"RM",`009`009"delete",`009'\0'},
X`009{NULL_MACROP,`009"SF3",`009`009"sf3",`009`009'\0'},
X`009{NULL_MACROP,`009"SLITEX",`009"SliTeX",`009'\0'},
X`009{NULL_MACROP,`009"SLITEXFLAGS",`009"\\batchmode",`009'\0'},
X`009{NULL_MACROP,`009"TEX",`009`009"TeX",`009`009'\0'},
X`009{NULL_MACROP,`009"TEXFLAGS",`009"\\batchmode",`009'\0'},
X`009{NULL_MACROP,`009"YACC",`009`009"yacc",`009`009'\0'},
X};
X
Xstatic RULE defrules[] =
X{
X`009{".atx.dvi .amstex.dvi",`009"$(AMSTEX) $(AMSTEXFLAGS) \\input $<"},
X`009{".c.rel",`009`009`009"$(CC) $(CFLAGS) -c $<"},
X`009{".fai.rel .mac.rel .mid.rel",`009"$(AS) $(AFLAGS) $<"},
X`009{".for.rel .f.rel",`009`009"$(FC) /fortran/language:\"$(FFLAGS)\" $<"},
X`009{".ltx.dvi .latex.dvi",`009`009"$(LATEX) $(LATEXFLAGS) \\input $<"},
X`009{".pas.rel .p.rel",`009`009"$(PC) /pascal/language:\"$(PFLAGS)\" $<"},
X`009{".sf3.for",`009`009`009"$(SF3) $(SF3FLAGS) $<"},
X`009{".stx.dvi .slitex.dvi",`009"$(SLITEX) $(SLITEXFLAGS) \\input $<"},
X`009{".tex.dvi",`009`009`009"$(TEX) $(TEXFLAGS) \\input $<"},
X`009{".y.c",`009`009`009"$(YACC) $(YFLAGS) $<\n\
X$(MV) ytab.c $@"},
X`009{".y.rel",`009`009`009"$(YACC) $(YFLAGS) $<\n\
X$(CC) $(CFLAGS) -c ytab.c\n\
X$(RM) ytab.c\n\
X$(MV) ytab.rel $@"},
X};
X
Vstatic char * defsuffix = ".SUFFIXES: .exe .rel .dvi .c .y .l .mac .fai .mid .s
Xf3 \
X.for .f .pas .p .tex .latex .ltx .slitex .stx .amstex .atx .inc .h";
X#endif
X
X#ifdef MSC
Xstatic MACRO defmacros[] =
X{
X`009{NULL_MACROP,`009"AMSTEX",`009"AMSTeX",`009'\0'},
X`009{NULL_MACROP,`009"AMSTEXFLAGS",`009"\\batchmode",`009'\0'},
X`009{NULL_MACROP,`009"AS",`009`009"masm",`009`009'\0'},
X`009{NULL_MACROP,`009"CC",`009`009"msc",`009`009'\0'},
X`009{NULL_MACROP,`009"CFLAGS",`009"",`009`009'\0'},
X`009{NULL_MACROP,`009"LATEX",`009"LaTeX",`009'\0'},
X`009{NULL_MACROP,`009"LATEXFLAGS",`009"\\batchmode",`009'\0'},
X`009{NULL_MACROP,`009"MV",`009`009"rename",`009'\0'},
X`009{NULL_MACROP,`009"RM",`009`009"delete",`009'\0'},
X`009{NULL_MACROP,`009"SLITEX",`009"SliTeX",`009'\0'},
X`009{NULL_MACROP,`009"SLITEXFLAGS",`009"\\batchmode",`009'\0'},
X`009{NULL_MACROP,`009"TEX",`009`009"TeX",`009`009'\0'},
X`009{NULL_MACROP,`009"TEXFLAGS",`009"\\batchmode",`009'\0'},
X`009{NULL_MACROP,`009"YACC",`009`009"yacc",`009`009'\0'},
X};
X
Xstatic RULE defrules[] =
X{
X`009{".asm.obj",`009`009`009"$(AS) $(AFLAGS) $*;"},
X`009{".atx.dvi",`009`009`009"$(AMSTEX) $(AMSTEXFLAGS) \\input $<"},
X`009{".c.obj",`009`009`009"$(CC) $* $(CFLAGS);"},
X`009{".ltx.dvi",`009`009`009"$(LATEX) $(LATEXFLAGS) \\input $<"},
X`009{".stx.dvi",`009`009`009"$(SLITEX) $(SLITEXFLAGS) \\input $<"},
X`009{".tex.dvi",`009`009`009"$(TEX) $(TEXFLAGS) \\input $<"},
X`009{".y.c",`009`009`009"$(YACC) $(YFLAGS) $<\n\
Xmv ytab.c $@"},
X`009{".y.obj",`009`009`009"$(YACC) $(YFLAGS) $<\n\
X$(CC) $(CFLAGS) -c ytab.c\n\
Xrm ytab.c\n\
Xmv ytab.obj $@"},
X};
X
Xstatic char * defsuffix = ".SUFFIXES: .obj .dvi .c .y .l .asm .for .f .sf3 \
X.pas .p .tex .ltx .slitex .stx .atx .inc .h";
X#endif
X
X#ifdef OS9
Xstatic MACRO defmacros[] =
X{
X`009{NULL_MACROP,`009"CC",`009`009"cc",`009`009'\0'},
X`009{NULL_MACROP,`009"CFLAGS",`009"-z",`009`009'\0'},
X};
X
Xstatic RULE defrules[] =
X{
X`009{".c.r.ca.r.a.r.o.r.mc.r.mca.r.ma.r.mo.r",`009"$(CC) $(CFLAGS) -r $<"},
X};
X
Xstatic char * defsuffix = ".SUFFIXES: .r .mc .mca .c .ca .ma .mo .o .a";
X#endif
X
X#ifdef UNIX
Xstatic MACRO defmacros[] =
X{
X`009{NULL_MACROP,`009"AS",`009`009"as",`009`009'\0'},
X`009{NULL_MACROP,`009"CC",`009`009"cc",`009`009'\0'},
X`009{NULL_MACROP,`009"CFLAGS",`009"-O",`009`009'\0'},
X`009{NULL_MACROP,`009"YACC",`009`009"yacc",`009`009'\0'},
X};
X
Xstatic RULE defrules[] =
X{
X`009{".c.o",`009`009`009"$(CC) $(CFLAGS) -c $<"},
X`009{".s.o",`009`009`009"$(AS) $(AFLAGS) -o $@ $<"},
X`009{".y.c",`009`009`009"$(YACC) $(YFLAGS) $<\n\
Xmv y.tab.c $@"},
X`009{".y.o",`009`009`009"$(YACC) $(YFLAGS) $<\n\
X$(CC) $(CFLAGS) -c y.tab.c\n\
Xrm y.tab.c\n\
Xmv y.tab.o $@"},
X};
Xstatic char * defsuffix = ".SUFFIXES: .o .c .p .e .r .f .y .l .s";
X#endif
X
X#ifdef VMS
Xstatic MACRO defmacros[] =
X{
X`009{NULL_MACROP,`009"AMSTEX",`009"AMSTeX",`009'\0'},
X`009{NULL_MACROP,`009"AMSTEXFLAGS",`009"/batch",`009'\0'},
X`009{NULL_MACROP,`009"AS",`009`009"macro",`009'\0'},
X`009{NULL_MACROP,`009"CC",`009`009"cc",`009`009'\0'},
V`009{NULL_MACROP,`009"CFLAGS",`009"/debug=(symbols,traceback)/nolist",`009'\0'}
X,
X`009{NULL_MACROP,`009"FC",`009`009"fortran",`009'\0'},
V`009{NULL_MACROP,`009"FFLAGS",`009"/debug=(symbols,traceback)/nolist",`009'\0'}
X,
X`009{NULL_MACROP,`009"LATEX",`009"LaTeX",`009'\0'},
X`009{NULL_MACROP,`009"LATEXFLAGS",`009"/batch",`009'\0'},
X`009{NULL_MACROP,`009"MV",`009`009"rename",`009'\0'},
X`009{NULL_MACROP,`009"PC",`009`009"pascal",`009'\0'},
V`009{NULL_MACROP,`009"PFLAGS",`009"/debug=(symbols,traceback)/nolist",`009'\0'}
X,
X`009{NULL_MACROP,`009"RM",`009`009"delete",`009'\0'},
X`009{NULL_MACROP,`009"SF3",`009`009"sf3",`009`009'\0'},
X`009{NULL_MACROP,`009"SLITEX",`009"SliTeX",`009'\0'},
X`009{NULL_MACROP,`009"SLITEXFLAGS",`009"/batch",`009'\0'},
X`009{NULL_MACROP,`009"TEX",`009`009"TeX",`009`009'\0'},
X`009{NULL_MACROP,`009"TEXFLAGS",`009"/batch",`009'\0'},
X`009{NULL_MACROP,`009"YACC",`009`009"yacc",`009`009'\0'},
X};
X
Xstatic RULE defrules[] =
X{
X`009{".atx.dvi .amstex.dvi",`009"$(AMSTEX) $(AMSTEXFLAGS) $<"},
X`009{".c.obj",`009`009`009"$(CC) $(CFLAGS) $<"},
X`009{".for.obj .f.obj .ftn.obj",`009"$(FC) $(FFLAGS) $<"},
X`009{".ltx.dvi .latex.dvi",`009`009"$(LATEX) $(LATEXFLAGS) $<"},
X`009{".mar.obj",`009`009`009"$(AS) $(AFLAGS) $<"},
X`009{".pas.obj .p.obj",`009`009"$(PC) $(PFLAGS) $<"},
X`009{".sf3.for",`009`009`009"$(SF3) $(SF3FLAGS) $<"},
X`009{".stx.dvi .slitex.dvi",`009"$(SLITEX) $(SLITEXFLAGS) $<"},
X`009{".tex.dvi",`009`009`009"$(TEX) $(TEXFLAGS) $<"},
X`009{".y.c",`009`009`009"$(YACC) $(YFLAGS) $<\n\
X$(MV) ytab.c $@"},
X`009{".y.obj",`009`009`009"$(YACC) $(YFLAGS) $<\n\
X$(CC) $(CFLAGS) ytab.c\n\
X$(RM) ytab.c\n\
X$(MV) ytab.obj $@"},
X};
X
Xstatic char * defsuffix = ".SUFFIXES: .exe .obj .dvi .c .y .l .mar .sf3 \
X.for .f .ftn .pas .p .tex .latex .ltx .slitex .stx .amstex .atx .inc .h";
X#endif
X
X#define MAXMACROS (sizeof(defmacros)/sizeof(MACRO))
X
X#define MAXRULES (sizeof(defrules)/sizeof(RULE))
X
X/*
X *`009Return a pointer to the suffix of a name
X */
Xchar *
Xsuffix(name)
Xchar *name;
X{
X    return rindex(name, '.');
X}
X
X
X/*
X *`009Dynamic dependency.  This routine applies the suffix rules
X *`009to try and find a source and a set of rules for a missing
X *`009target.  If found, np is made into a target with the implicit
X *`009source name, and rules.  Returns TRUE if np was made into
X *`009a target.
X */
Xbool
Xdyndep(np)
XNAMEP np;
X{
X    register char *p;
X    register char *q;
X    register char *suff;`009/* Old suffix  */
X    register char *basename;`009/* Name without suffix  */
X    NAMEP op;`009`009`009/* New dependent  */
X    NAMEP sp;`009`009`009/* Suffix  */
X    LINEP lp;
X    DEPENDP dp;
X    char *newsfx;
X
X
X    p = str1;
X    q = np->n_name;
X
X    if (debug)
X`009fprintf(stderr, "%cDEPENDENCY[%s]\n", TAB, q);
X
X    if (!(suff = suffix(q)))
X`009return FALSE;`009`009/* No suffix */
X
X    while (q < suff)
X`009*p++ = *q++;
X
X    *p = '\0';
X    basename = setmacro("*", str1, TEMPORARY)->m_val;
X
X    if (debug)
X`009fprintf(stderr, "%c%cBASENAME[%s]\n", TAB, TAB, basename);
X
X    if (!((sp = newname(".SUFFIXES"))->n_flag & N_TARG))
X`009return FALSE;
X
X    for (lp = sp->n_line; lp; lp = lp->l_next)
X`009for (dp = lp->l_dep; dp; dp = dp->d_next)
X`009{
X`009    newsfx = dp->d_name->n_name;
X`009    if (strlen(suff) + strlen(newsfx) + 1 >= MAXSTRING)
X`009`009fatal("Suffix rule too long");
X`009    p = str1;
X`009    q = newsfx;
X`009    while (*p++ = *q++)
X`009`009;
X`009    p--;
X`009    q = suff;
X`009    while (*p++ = *q++)
X`009`009;
X`009    sp = newname(str1);
X`009    if (sp->n_flag & N_TARG)
X`009    {
X`009`009p = str1;
X`009`009q = basename;
X`009`009if (strlen(basename) + strlen(newsfx) + 1 >= MAXSTRING)
X`009`009    fatal("Implicit name too long");
X`009`009while (*p++ = *q++)
X`009`009    ;
X`009`009p--;
X`009`009q = newsfx;
X`009`009while (*p++ = *q++)
X`009`009    ;
X`009`009op = newname(str1);
X`009`009if (!op->n_time)
X`009`009    modtime(op);
X`009`009if (op->n_time)
X`009`009{
X`009`009    dp = newdep(op, NULL_DEPENDP);
X`009`009    newline(np, dp, sp->n_line->l_cmd, FALSE);
X`009`009    (void) setmacro("<", op->n_name, TEMPORARY);
X`009`009    return TRUE;
X`009`009}
X`009    }
X`009}
X    return FALSE;
X}
X
X
X/*
X *`009Make the default rules
X */
Xvoid
Xmakerules()
X{
X    CMDP cp;
X    int k;
X    NAMEP np;
X    char *s;
X    char *t;
X    char *p;
X    char *q;
X
X    for (k = 0; k < MAXMACROS; ++k)`009/* install built-in macros */
X`009(void) setmacro(defmacros[k].m_name, defmacros[k].m_val, TEMPORARY);
X
X    for (k = 0; k < MAXRULES; ++k)`009/* install built-in rules */
X    {
X`009/* Make command line list */
X`009cp = NULL_CMDP;
X`009p = defrules[k].r_command;
X`009while (q = index(p, '\n'))
X`009{
X`009    *q = '\0';`009`009/* make line a string */
X`009    cp = newcmd(p, cp);
X`009    *q = '\n';`009`009/* restore string to line */
X`009    p = q + 1;
X`009}
X`009cp = newcmd(p, cp);
X
X`009/* Install each target name and attach command line list to it */
X`009strcpy(str1, defrules[k].r_target);
X`009str1[strlen(str1) + 1] = '\0';`009/* extra NUL for gettok() */
X`009for (s = str1; (t = gettok(&s)) != NULL_CHARP; /* NO-OP */ )
X`009{
X`009    np = newname(t);
X`009    newline(np, NULL_DEPENDP, cp, FALSE);
X`009}
X    }
X
X    newsuffix(defsuffix);
X}
X
X/*
X * Convert a string of the form ".SUFFIXES: .sfx .sfx ... .sfx" to a
X * dependency list, easing coding above.  Suffixes are separated by any
X * amount of white space.
X */
X
Xvoid
Xnewsuffix(s)
Xchar *s;`009`009`009/* ".SUFFIXES: ..." */
X{
X    register char *p;`009`009/* temporary pointer into str1[] */
X    char *q;`009`009`009/* temporary pointer into str1[] */
X    register NAMEP np;
X    register DEPENDP dp;
X
X    if (strncmp(s, ".SUFFIXES:", 10) != 0)
X    {
X`009sprintf(str1, "Internal error: invalid .SUFFIXES string ``%s'", s);
X`009fatal(str1);
X    }
X
X
X    strcpy(str1, s);`009`009/* copy s[] into str1[]--gettok modifies it */
X    str1[strlen(str1) + 1] = '\0';`009/* extra NUL for gettok() */
X
X    dp = NULL_DEPENDP;
X
X    q = index(str1, ':');`009/* point past ".SUFFIXES" */
X    *q++ = '\0';`009`009/* and clobber colon */
X
X    for ( /* NO-OP */ ; (p = gettok(&q)) != NULL_CHARP; /* NO-OP */ )
X    {`009`009`009`009/* loop collecting tokens */
X`009np = newname(p);
X`009dp = newdep(np, dp);
X    }
X    np = newname(str1);`009`009/* this is ".SUFFIXES" */
X    newline(np, dp, NULL_CMDP, FALSE);
X}
$ GoSub Convert_File
$ File_is="TOUCH.C"
$ Check_Sum_is=1850559380
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X# include`009<descrip.h>
X# include`009<file.h>
X# include`009<rmsdef.h>
X# include`009<ssdef.h>
X# include`009<stdio.h>
X# include`009"glibsrc:types.h"
X
X# define`009FALSE`009(0)
X# define`009TRUE`009(!FALSE)
X
Xmain (argc, argv)
X`009int`009argc;
X`009char`009*argv[];
X{
V`009char`009`009`009`009*pa;`009`009`009/* Pointer to next file name to process
X. */
X`009char`009`009`009`009*comma;`009`009`009/* Pointer to comma in file spec. */
V`009char`009`009`009`009fname[256];`009`009/* Buffer to hold actual file name m
Xatched by wildcard. */
V`009char`009`009`009`009related[256];`009`009/* Buffer to hold the related file
X name. */
X`009int`009`009`009`009context;`009`009/* Context of file search. */
X`009char`009`009`009`009*strchr();`009`009/* A function. */
V`009int`009`009`009`009status;`009`009`009/* Status of call to lib$find_file().
X */
X`009bool`009`009`009`009verbose = FALSE;`009/* TRUE for verbose mode. */
V`009struct dsc$descriptor_s`009`009fname_desc = {sizeof(fname)-1, DSC$K_DTYPE_T
X, DSC$K_CLASS_S, fname};
V`009struct dsc$descriptor_s`009`009files_desc = {0, DSC$K_DTYPE_T, DSC$K_CLASS_
XS, 0};
V`009struct dsc$descriptor_s`009`009related_desc = {0, DSC$K_DTYPE_T, DSC$K_CLAS
XS_S, related};
V`009ushort`009`009`009`009msg_len;`009`009/* Length of error message returned. 
X*/
V`009char`009`009`009`009msg_buff[257];`009`009/* Error message from lib$find_fi
Xle(). */
V`009struct dsc$descriptor_s`009`009msg_desc = {sizeof(msg_buff)-1, DSC$K_DTYPE_
XT, DSC$K_CLASS_S, msg_buff};
X
X`009`009/* Check for -v flag. */
X`009for (argc--, pa=(*++argv);  (*pa == '-');  argc--, pa=(*++argv))
X`009{`009while (*++pa)
X`009`009{`009switch (*pa)
X`009`009`009{`009case 'v':`009verbose = TRUE;
X`009`009`009`009`009`009break;
X`009`009`009`009default:`009printf ("touch: unknown flag %c.\n", *pa);
X`009`009`009`009`009`009exit (2);
X`009`009`009}
X`009`009}
X`009}
X
X`009for (;  argc;  argc--, argv++)
X`009{`009`009/* Set up the related file descrtiptor. */
X`009`009related_desc.dsc$w_length = 0;
X`009`009`009/* Now process each of the files in the "comma separated list". */
X`009`009for (pa=(*argv), comma=strchr(pa,',');  pa;  )
X`009`009{`009`009/* Set up local variables. */
X`009`009`009if (comma)
X`009`009`009`009*comma = '\0';
X`009`009`009files_desc.dsc$w_length = strlen(pa);
X`009`009`009files_desc.dsc$a_pointer = pa;
X`009`009`009context = 0;
X
X`009`009`009`009/* Process the next file. */
V`009`009`009while ((status = lib$find_file (&files_desc, &fname_desc, &context,
X 0, &related_desc, 0, 0)) != RMS$_NMF)
X`009`009`009{`009*strchr(fname,' ') = '\0';
X`009`009`009`009if ((status == RMS$_NORMAL) || (status == RMS$_FNF))
X`009`009`009`009{`009if (verbose)
X`009`009`009`009`009`009printf ("touch(%s)\n", fname);
X`009`009`009`009`009touch_file (fname);
X`009`009`009`009}
X`009`009`009`009else
X`009`009`009`009{`009printf ("touch: can't touch '%s', ", fname);
V`009`009`009`009`009if (sys$getmsg (status, &msg_len, &msg_desc, 0, 0) == SS$_N
XORMAL)
X`009`009`009`009`009{`009msg_buff[msg_len] = '\0';
X`009`009`009`009`009`009puts (msg_buff);
X`009`009`009`009`009}
X`009`009`009`009`009else
X`009`009`009`009`009`009printf ("status = 0x%s.\n", status);
X`009`009`009`009}
X`009`009`009}
X
V`009`009`009`009/* Set up for next file in "comma separated list" (if specified
X). */
X`009`009`009pa = (comma) ? comma+1 : 0;
X`009`009`009if (pa)
V`009`009`009{`009for (;  *pa == ' ';  pa++);`009`009`009/* Strip off leading bl
Xanks. */
X`009`009`009`009comma = strchr (pa, ',');`009`009`009/* Find the next comma. */
V`009`009`009`009strcpy (related, fname);`009`009`009/* Related file is last fil
Xe found... */
V`009`009`009`009related_desc.dsc$w_length = strlen(related);`009/* ...from lib$
Xfind_file(). */
X`009`009`009}
X`009`009}
X`009}
X}
X
X
Xtouch_file (file)
X`009char`009*file;
X{
X`009int`009fd;
X
X`009if ((fd = open (file, O_RDWR | O_CREAT, 0)) < 0)
X`009`009fprintf (stderr, "touch: cannot access '%s'.\n", file);
X}
$ GoSub Convert_File
$ File_is="VAXVMS.C"
$ Check_Sum_is=503796795
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X#include <descrip.h>
X#include <ssdef.h>
X
X/**********************************************************************/
X/*-->EXIT*/
X
Xvoid
Xvms_exit(code)
Xint code;
X{
X    switch (code)
X    {
X    case 0:
X`009exit(1);`009`009`009/* success */
X`009break;
X
X    default:
X`009exit(2);`009`009`009/* error */
X`009break;
X    }
X}
X
X
X/**********************************************************************/
X/*-->vms_system*/
Xint
Xvms_system(s)
Xchar *s;
X{
X`009struct`009dsc$descriptor t;
X`009int`009status, comp_status;
X
X`009t.dsc$w_length = strlen(s);
X`009t.dsc$a_pointer = s;
X`009t.dsc$b_class = DSC$K_CLASS_S;
X`009t.dsc$b_dtype = DSC$K_DTYPE_T;
X`009status = LIB$SPAWN(&t, 0, 0, 0, 0, 0, &comp_status, 0, 0, 0, 0, 0);
V`009return ((status != SS$_NORMAL) ? 127 : ((comp_status & 1) == 1) ? 0 : comp_
Xstatus);
X}
X
X
X/**********************************************************************/
X/*-->vms_unlink*/
Xint
Xvms_unlink(filename)
Xchar *filename;
X{
X`009return (delete(filename)); /* use equivalent VMS routine */
X}
$ GoSub Convert_File
$ Goto Part5
-- 
/* My opinions...             *  Tony Ivanov   MS-4B       *  ...ucbvax!   */
/* shared by my company?!...  *  Grass Valley Group, Inc.  *  tektronix!   */
/* you've got to be kidding!  *  P.O. Box 1114             *  gvgpsa!      */
/* "tony@gvgpvd.GVG.TEK.COM"  *  Grass Valley, CA  95945   *  gvgpvd!tony  */

