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