xref: /csrg-svn/contrib/sc/VMS_NOTES (revision 45319)
1*45319SbosticFrom: ihnp4!gargoyle!oddjob!noao!arizona!naucse!jdc (John Campbell)
2*45319SbosticTo: arizona!noao!oddjob!gargoyle!ihnp4!nsc!nscpdc!rgb
3*45319SbosticSubject: VMS SC
4*45319Sbostic
5*45319SbosticVMS USERS:
6*45319Sbostic
7*45319SbosticBob Bond has been generous enough to give me free rein in adding what I
8*45319Sbosticthink is needed to make SC run on VMS.  Any problems with VMS should be
9*45319Sbosticdirected to me--they are not Bob's fault.
10*45319Sbostic
11*45319SbosticThe VMS SC is "SIMPLE" for the most part, except that the arrow keys
12*45319Sbostic(instead of hjkl) will move you around the cells.  The VMS version of SC
13*45319Sbosticwill not interact with the Bourne shell (obviously), which means that CRYPT
14*45319Sbosticand EXTERNAL FUNCTIONS will not be available.
15*45319Sbostic
16*45319SbosticIf you have a 'C' compiler and GNU Bison then you should be able to get
17*45319SbosticSC running on VMS by following the instructions below.
18*45319Sbostic
19*45319SbosticStep 1:  Get all the files
20*45319Sbostic
21*45319SbosticI've heard of a few sites that can unpack unix shar files directly on
22*45319SbosticVMS.  Most people, however, will need access to a unix machine to get
23*45319Sbosticthe original distribution unpacked.  At this time you should also build
24*45319Sbosticexperres.h and statres.h and perhaps run the man pages off if you need
25*45319Sbosticto port the documentation. To build the two "missing" hearder files:
26*45319Sbostic   sed <gram.y >experres.h -f eres.sed
27*45319Sbostic   sed <gram.y >statres.h -f sres.sed
28*45319Sbostic
29*45319SbosticStep 2: Cut out BUILD.COM and GETOPT.C
30*45319Sbostic
31*45319SbosticAt the end of this file are two other pieces: BUILD.COM and GETOPT.C.  After
32*45319Sbosticyou've moved everything to VMS, cut BUILD.COM and GETOPT.C out of here and
33*45319Sbosticput them in the same directory as the rest of the SC distribution.
34*45319Sbostic
35*45319SbosticStep 3: Build it
36*45319Sbostic
37*45319SbosticTheoretically all you now need to do is @BUILD and SC (as well as PSC)
38*45319Sbosticwill be running on VMS.  If you have problems feel free to contact me
39*45319Sbosticat ...!arizona!naucse!jdc  (or even call at 602-523-6259).
40*45319Sbostic
41*45319Sbostic---------------------cut here for BUILD.COM--------------------------
42*45319Sbostic$! VMS command file to build SC and PSC (requires bison)
43*45319Sbostic$! SC:
44*45319Sbostic$ bison -d gram.y
45*45319Sbostic$ ren gram_tab.c gram.c
46*45319Sbostic$ cc  /define=("SIMPLE","SIGVOID") sc.c
47*45319Sbostic$ cc  /define=("SIMPLE","SIGVOID") gram.c
48*45319Sbostic$ cc  /define=("SIMPLE","SIGVOID") lex.c
49*45319Sbostic$ cc  /define=("SIMPLE","SIGVOID") interp
50*45319Sbostic$ cc  /define=("SIMPLE","SIGVOID") cmds
51*45319Sbostic$ cc  /define=("SIMPLE","SIGVOID") xmalloc
52*45319Sbostic$ cc  /define=("SIMPLE","SIGVOID") range
53*45319Sbostic$ cc  /define=("SIMPLE","SIGVOID") help
54*45319Sbostic$ link sc.obj,lex.obj,gram.obj,interp.obj,cmds.obj,xmalloc.obj,-
55*45319Sbostic       range.obj,help.obj,sys$library:vaxcrtl.olb/lib
56*45319Sbostic$ !
57*45319Sbostic$ ! Create VMS foreign command symbol to test SC
58*45319Sbostic$ !
59*45319Sbostic$ sc == "$" + f$logical("SYS$DISK") + f$directory() + "SC.EXE"
60*45319Sbostic$!
61*45319Sbostic$! Now PSC
62*45319Sbostic$!
63*45319Sbostic$ cc psc.c
64*45319Sbostic$ cc getopt.c
65*45319Sbostic$ link psc,getopt,sys$library:vaxcrtl.olb/lib
66*45319Sbostic$ !
67*45319Sbostic$ ! Create VMS foreign command symbol to test PSC (Note that
68*45319Sbostic$ ! PSC reads SYS$INPUT and writes to SYS$OUTPUT, so use
69*45319Sbostic$ ! DEFINE/USER to redirect.)
70*45319Sbostic$ !
71*45319Sbostic$ psc == "$" + f$logical("SYS$DISK") + f$directory() + "PSC.EXE"
72*45319Sbostic
73*45319Sbostic---------------------cut here for GETOPT.C------------------------
74*45319Sbostic/*
75*45319Sbostic * getopt - get option letter from argv
76*45319Sbostic *      This software is in the public domain
77*45319Sbostic *      Originally written by Henry Spencer at the U. of Toronto
78*45319Sbostic */
79*45319Sbostic
80*45319Sbostic#include <stdio.h>
81*45319Sbostic
82*45319Sbosticchar    *optarg;        /* Global argument pointer. */
83*45319Sbosticint     optind = 0;     /* Global argv index. */
84*45319Sbostic
85*45319Sbosticstatic char     *scan = NULL;   /* Private scan pointer. */
86*45319Sbostic
87*45319Sbostic/* extern char     *index();  obsolete, used strchr (JDC). */
88*45319Sbostic
89*45319Sbosticint
90*45319Sbosticgetopt(argc, argv, optstring)
91*45319Sbosticint argc;
92*45319Sbosticchar *argv[];
93*45319Sbosticchar *optstring;
94*45319Sbostic{
95*45319Sbostic        register char c;
96*45319Sbostic        register char *place;
97*45319Sbostic
98*45319Sbostic        optarg = NULL;
99*45319Sbostic
100*45319Sbostic        if (scan == NULL || *scan == '\0') {
101*45319Sbostic                if (optind == 0)
102*45319Sbostic                        optind++;
103*45319Sbostic
104*45319Sbostic                if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0')
105*45319Sbostic                        return(EOF);
106*45319Sbostic                if (strcmp(argv[optind], "--")==0) {
107*45319Sbostic                        optind++;
108*45319Sbostic                        return(EOF);
109*45319Sbostic                }
110*45319Sbostic
111*45319Sbostic                scan = argv[optind]+1;
112*45319Sbostic                optind++;
113*45319Sbostic        }
114*45319Sbostic
115*45319Sbostic        c = *scan++;
116*45319Sbostic        place = strchr(optstring, c);
117*45319Sbostic
118*45319Sbostic        if (place == NULL || c == ':') {
119*45319Sbostic                fprintf(stderr, "%s: unknown option -%c\n", argv[0], c);
120*45319Sbostic                return('?');
121*45319Sbostic        }
122*45319Sbostic
123*45319Sbostic        place++;
124*45319Sbostic        if (*place == ':') {
125*45319Sbostic                if (*scan != '\0') {
126*45319Sbostic                        optarg = scan;
127*45319Sbostic                        scan = NULL;
128*45319Sbostic                } else {
129*45319Sbostic                        optarg = argv[optind];
130*45319Sbostic                        optind++;
131*45319Sbostic                }
132*45319Sbostic        }
133*45319Sbostic
134*45319Sbostic        return(c);
135*45319Sbostic}
136