summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipsk/vms/vmscli.c
blob: 438e23ec841dd405ec3a03dcf9f4c13e70af86ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
/* EJG - 02-Jul-1996 */
/* fix processing of filter qualifier */
/* add secure qualifier */
/* add oddpages qualifier */
/* add evenpages qualifier */
/* set sendcontrold only if qualifier present, not if merely negated */
/* check for setting or resetting disablecomments was cli$_negated in both cases - fix */
/* add downloadps (as PK) fonts qualifier */
/* add hyperps qualifier */
/* EJG - 07-Jul-1996 */
/* test for INC_COM was looking for negated in both cases, so fixed */
#ifdef __GNUC__
#include "ssdef.h"
#else
#include ssdef
#endif
/* this code is included into dvips.c; don't compile it separately. */
int vmscli()
    {long int k,scnt;
    int length,status,maxdrift,jext;
    float offset,conversion;
    char *u;
    static char dummy[100],prtr[20];
    static $DESCRIPTOR(qual1,"copies");
    static $DESCRIPTOR(qual2,"debug");
    static $DESCRIPTOR(qual3,"maxdrift");
    static $DESCRIPTOR(qual4,"filter");
    static $DESCRIPTOR(qual5,"last");
    static $DESCRIPTOR(qual6,"manual");
    static $DESCRIPTOR(qual7,"number");
    static $DESCRIPTOR(qual8,"output");
    static $DESCRIPTOR(qual9,"start");
    static $DESCRIPTOR(qual10,"quiet");
    static $DESCRIPTOR(qual11,"reverse");
    static $DESCRIPTOR(qual12,"sav_res");
    static $DESCRIPTOR(qual13,"mode");
    static $DESCRIPTOR(qual14,"magnification");
    static $DESCRIPTOR(qual15,"collate");
    static $DESCRIPTOR(qual16,"dpi");
    static $DESCRIPTOR(qual17,"ctrld");
    static $DESCRIPTOR(qual18,"inc_com");
    static $DESCRIPTOR(qual19,"comment");
    static $DESCRIPTOR(qual20,"vm_save");
    static $DESCRIPTOR(qual21,"h_dpi");
    static $DESCRIPTOR(qual22,"v_dpi");
    static $DESCRIPTOR(qual23,"compress");
    static $DESCRIPTOR(qual24,"printer");
    static $DESCRIPTOR(qual25,"header");
    static $DESCRIPTOR(qual26,"absolute");
    static $DESCRIPTOR(qual27,"epsf");
    static $DESCRIPTOR(qual28,"prescan");
    static $DESCRIPTOR(qual29,"pagecopies");
    static $DESCRIPTOR(qual30,"separate");
    static $DESCRIPTOR(qual31,"cropmarks");
    static $DESCRIPTOR(qual32,"sec_size");
    static $DESCRIPTOR(qual33,"help");
    static $DESCRIPTOR(qual34,"makefont");
    static $DESCRIPTOR(qual35,"psize");
    static $DESCRIPTOR(qual36,"poffset");
    static $DESCRIPTOR(qual37,"secure");	/* EJG 02-Jul-1996 */
    static $DESCRIPTOR(qual38,"oddpages");	/* EJG 02-Jul-1996 */
    static $DESCRIPTOR(qual39,"evenpages");	/* EJG 02-Jul-1996 */
    static $DESCRIPTOR(qual40,"downloadps");	/* EJG 02-Jul-1996 */
    static $DESCRIPTOR(qual41,"hyperps");	/* EJG 02-Jul-1996 */
    static $DESCRIPTOR(dumdum,dummy);
    static $DESCRIPTOR(dvi_file,"dvifile");
    static $DESCRIPTOR(input_file,infnme);
    scnt=0;
    status = cli$present(&dvi_file);

    if(status == CLI$_PRESENT)
    {status = cli$get_value(&dvi_file,&input_file,&jext);
      length=0;
      for(k=0;k<252;k++)
      { if(infnme[k] == ':' || infnme[k] == ']')
          scnt=k+1;
      }
      for(k=scnt;k<252;k++)
    {if(infnme[k]=='.')
      {length=k;
       jext=k;
       }
     else
      {if(infnme[k]=='/' || infnme[k]==' ' || infnme[k]=='\0')
         infnme[k]='\0';
       }
    }
    if(length==0)
     {jext= strlen(infnme);
     strcat(infnme,".DVI");}

    iname = &infnme[0] ;
    length = 0;         /* Initialize length...VAX C bug? */

   }
    status = cli$present(&qual1);

    if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
        {status = cli$get_value(&qual1,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&numcopies) == 0)
         error("!Bad copies option");
        }
#ifdef DEBUG
    status = cli$present(&qual2);

    if(status == CLI$_PRESENT)
        {
        status = cli$get_value(&qual2,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&debug_flag) == 0)
         error("!Bad debug option");
        }
#else
         error("not compiled in debug mode");
#endif
    status = cli$present(&qual3);

    if(status == CLI$_PRESENT)
        {status = cli$get_value(&qual3,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&maxdrift) == 0 ||maxdrift <0)
            error("bad maxdrift option");
        vmaxdrift=maxdrift;
        }


    status = cli$present(&qual5);

    if(status == CLI$_PRESENT)
        {status = cli$get_value(&qual5,&dumdum,&length);

#ifdef SHORTINT
            switch(sscanf(&dummy[0], "%ld.%ld", &lastpage, &lastseq)) {
#else	/* ~SHORTINT */
            switch(sscanf(&dummy[0], "%ld.%ld", &lastpage, &lastseq)) {
#endif	/* ~SHORTINT */
case 1:        lastseq = 0 ;
case 2:        break ;
default:
               error("! Bad last page option.") ;
            }
            notlast = 1 ;
        }
    status = cli$present(&qual6);

    if(status == CLI$_PRESENT)
     manualfeed=1;
     else
     if(status == CLI$_NEGATED)
      manualfeed=0;

    status = cli$present(&qual7);
     if(status == CLI$_PRESENT)
     {status = cli$get_value(&qual7,&dumdum,&length);
#ifdef SHORTINT
            if (sscanf(&dummy[0], "%ld", &maxpages)==0)
#else	/* ~SHORTINT */
            if (sscanf(&dummy[0], "%d", &maxpages)==0)
#endif	/* ~SHORTINT */
               error("! Bad number of pages option.") ;
      }

    status = cli$present(&qual8);
     if(status == CLI$_PRESENT)
     {status = cli$get_value(&qual8,&dumdum,&length);
     sscanf(&dummy[0],"%s",ofnme);
     }
     else
     {for(k=scnt;k<jext;k++)ofnme[k-scnt]=infnme[k];
        strcat(ofnme,".PS");}
     oname = &ofnme[0] ;

    status = cli$present(&qual4);

    if(status == CLI$_PRESENT)
        {oname="";
         filter=1;		/* EJG 02-Jul-1996 */
         noenv=(1==1);
        }
    else		/* EJG 02-Jul-1996 */
      filter=0;		/* EJG 02-Jul-1996 */

    status = cli$present(&qual9);
     if(status == CLI$_PRESENT)
     {status = cli$get_value(&qual9,&dumdum,&length);
#ifdef SHORTINT
            switch(sscanf(&dummy[0], "%ld.%ld", &firstpage, &firstseq)) {
#else	/* ~SHORTINT */
            switch(sscanf(&dummy[0], "%ld.%ld", &firstpage, &firstseq)) {
#endif	/* ~SHORTINT */
case 1:        firstseq = 0 ;
case 2:        break ;
default:
               error("! Bad first page option.") ;
            }
            notfirst = 1 ;
     }

    status = cli$present(&qual10);

    if(status == CLI$_PRESENT)
     quiet=(1==1);
    else
    if(status == CLI$_NEGATED)
     quiet=(1==0);

    status = cli$present(&qual11);

    if(status == CLI$_PRESENT)
     reverse=1;
    else 
    if(status == CLI$_NEGATED)
     reverse=0;

    status = cli$present(&qual12);

    if(status == CLI$_PRESENT)
     safetyenclose=1;
    else
    if(status == CLI$_NEGATED)
     safetyenclose=0;

    status = cli$present(&qual13);
     if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
     {status = cli$get_value(&qual13,&dumdum,&length);
     sscanf(&dummy[0],"%s",pap);
     if (strcmp(&pap[0], "landscape") == 0)
         { if (hpapersize || vpapersize)
              error( "both landscape and papersize specified; ignoring landscape") ;
           else
              landscape = 1 ;
         	/* The following lines have been added by G.Bonacci */
         	if ((status=cli$get_value(&qual13,&dumdum,&length))==1)
         	{
         		sscanf(&dummy[0],"%s",pap);
         		
         		paperfmt = &pap[0] ;
         	}
         	/* end G.Bonacci 20.3.92 */
         }
         else
         paperfmt = &pap[0] ;
     }

    status = cli$present(&qual14);

    if(status == CLI$_PRESENT)
        {status = cli$get_value(&qual14,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&mag) == 0 || mag < 10 || mag >100000)
         error("!Bad magnification parameter.");
         overridemag=1;
        }
    status = cli$present(&qual15);

    if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
        {status = cli$get_value(&qual15,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&collatedcopies) == 0)
         error("!Bad number of collated copies");
        }
    status = cli$present(&qual16);

    if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
        {status = cli$get_value(&qual16,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&actualdpi) == 0 ||
           actualdpi < 10 || actualdpi >10000)
	 error("!Bad dpi parameter.");
  	 vactualdpi=actualdpi;
        }

    status = cli$present(&qual17);

    if(status == CLI$_PRESENT)		/* EJG 02-Jul-1996 */
      sendcontrolD =1;
    else
    if(status == CLI$_NEGATED | status==CLI$_DEFAULTED)	/* EJG 02-Jul-1996 */
      sendcontrolD =0;

    status = cli$present(&qual18);

    if(status == CLI$_PRESENT)		/* EJG 07-Jul-1996 */
     removecomments =0;
    else
    if(status == CLI$_NEGATED)
     removecomments =1;

    status = cli$present(&qual19);

    if(status == CLI$_PRESENT)		/* EJG 02-JUL-1996 */
      disablecomments = 0;
    else
    if(status == CLI$_NEGATED)
      disablecomments = 1;

    status = cli$present(&qual20);

    if(status == CLI$_PRESENT)
      nosmallchars=1;
    else
    if(status == CLI$_NEGATED)
      nosmallchars=0;

    status = cli$present(&qual21);

    if(status == CLI$_PRESENT)
        {status = cli$get_value(&qual21,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&actualdpi) == 0 ||
           actualdpi < 10 || actualdpi >10000)
         error("!Bad dpi parameter in X.");
        }

    status = cli$present(&qual22);

    if(status == CLI$_PRESENT)
        {status = cli$get_value(&qual22,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&vactualdpi) == 0 ||
           vactualdpi < 10 || vactualdpi >10000)
         error("!Bad dpi parameter in Y.");
        }

    status = cli$present(&qual23);

    if(status == CLI$_PRESENT)
      compressed=1;
    else
    if(status == CLI$_NEGATED)
      compressed=0;

    status = cli$present(&qual24);
     if(status == CLI$_PRESENT)
     {status = cli$get_value(&qual24,&dumdum,&length);
     sscanf(&dummy[0],"%s",prtr);
     u = &dummy[0] ;
     strcpy(u,"config.");
     strcat(u,&prtr[0]);
     getdefaults("");
     noenv=1;
     getdefaults(u);
     }

    status = cli$present(&qual25);
     if(status == CLI$_PRESENT) {
       while (status != SS$_NORMAL) {
       status = cli$get_value(&qual25,&dumdum,&length);
       dummy[length] = '\0';
       if (strcmp(dummy, "-") == 0)
          headers_off = 1;
       else
          (void)add_header(dummy) ;
       }
     }
     else {
       if(status == CLI$_NEGATED)
          headers_off = 1;
     }

    status = cli$present(&qual26);
    if(status == CLI$_PRESENT) abspage = 1;

    status = cli$present(&qual27);
    if(status == CLI$_PRESENT | status==CLI$_DEFAULTED) tryepsf = 1;
    else
    if(status == CLI$_NEGATED) tryepsf = 0;

    status = cli$present(&qual28);
    if(status == CLI$_PRESENT | status==CLI$_DEFAULTED) dopprescan = 1;
    else
    if(status == CLI$_NEGATED) dopprescan = 0;

    status = cli$present(&qual29);

    if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
        {status = cli$get_value(&qual29,&dumdum,&length);

        if(sscanf(&dummy[0],"%d",&pagecopies) == 0)
         error("!Bad number of page copies option /PAGECOPIES");
        if (pagecopies < 1 || pagecopies > 1000)
               error("! can only print one to a thousand page copies") ;
        }

    status = cli$present(&qual30);
    if(status == CLI$_PRESENT | status==CLI$_DEFAULTED) sepfiles = 1;
    else
    if(status == CLI$_NEGATED) sepfiles = 0;

    status = cli$present(&qual31);
    if(status == CLI$_PRESENT | status==CLI$_DEFAULTED) cropmarks = 1;
    else
    if(status == CLI$_NEGATED) cropmarks = 0;

    status = cli$present(&qual32);
     if(status == CLI$_PRESENT)
     {status = cli$get_value(&qual32,&dumdum,&length);
#ifdef SHORTINT
            if (sscanf(&dummy[0], "%ld", &maxsecsize)==0)
#else	/* ~SHORTINT */
            if (sscanf(&dummy[0], "%d", &maxsecsize)==0)
#endif	/* ~SHORTINT */
               error("! Bad section size arg (/SEC_SIZE).") ;
     }

    status = cli$present(&qual33);
     if(status == CLI$_PRESENT)
     {  (void)fprintf(stderr, banner) ;
        help() ;
     }

    status = cli$present(&qual34);
    if(status == CLI$_NEGATED) dontmakefont = 1;
/*-----------------------------------------------------------------------
 * Currently one uses /PSIZE="5mm,10mm" This way CASE is preserved
 * Should I convert the PSIZE to allow a LIST => /PSIZE=(5mm,10mm) and
 * convert the case back to lowercase in here.
 *-----------------------------------------------------------------------*/
    status = cli$present(&qual35);
     if(status == CLI$_PRESENT) {
       status = cli$get_value(&qual35,&dumdum,&length);
       dummy[length] = '\0';
       handlepapersize(&dummy[0], &hpapersize, &vpapersize) ;
       if (landscape) {
          error("both landscape and papersize specified; ignoring landscape") ;
          landscape = 0 ;
       }
     }

    status = cli$present(&qual36);
     if(status == CLI$_PRESENT) {
       status = cli$get_value(&qual36,&dumdum,&length);
       dummy[length] = '\0';
       handlepapersize(&dummy[0], &hoff, &voff) ;
     }

    status = cli$present(&qual37);		/* EJG 02-Jul-1996 */
    if(status == CLI$_PRESENT) secure = 1;	/* EJG 02-Jul-1996 */
    else					/* EJG 02-Jul-1996 */
    if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) secure = 0;	/* EJG 02-Jul-1996 */

    status = cli$present(&qual38);		/* EJG 02-Jul-1996 */
    if(status == CLI$_PRESENT) oddpages = 1;	/* EJG 02-Jul-1996 */
    else					/* EJG 02-Jul-1996 */
    if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) oddpages = 0;	/* EJG 02-Jul-1996 */

    status = cli$present(&qual39);		/* EJG 02-Jul-1996 */
    if(status == CLI$_PRESENT) evenpages = 1;	/* EJG 02-Jul-1996 */
    else					/* EJG 02-Jul-1996 */
    if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) evenpages = 0; /* EJG 02-Jul-1996 */

    status = cli$present(&qual40);		/* EJG 02-Jul-1996 */
    if(status == CLI$_PRESENT) downloadpspk = 1; /* EJG 02-Jul-1996 */
    else					/* EJG 02-Jul-1996 */
    if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) downloadpspk = 0; /* EJG 02-Jul-1996 */

#ifdef HPS		/* EJG 02-Jul-1996 */

    status = cli$present(&qual41);		/* EJG 02-Jul-1996 */
    if(status == CLI$_PRESENT) HPS_FLAG = 1;	/* EJG 02-Jul-1996 */
    else					/* EJG 02-Jul-1996 */
    if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) HPS_FLAG = 0; /* EJG 02-Jul-1996 */
#endif			/* EJG 02-Jul-1996 */

}