Back to index

tetex-bin  3.0
vmscli.c
Go to the documentation of this file.
00001 /* EJG - 02-Jul-1996 */
00002 /* fix processing of filter qualifier */
00003 /* add secure qualifier */
00004 /* add oddpages qualifier */
00005 /* add evenpages qualifier */
00006 /* set sendcontrold only if qualifier present, not if merely negated */
00007 /* check for setting or resetting disablecomments was cli$_negated in both cases - fix */
00008 /* add downloadps (as PK) fonts qualifier */
00009 /* add hyperps qualifier */
00010 /* EJG - 07-Jul-1996 */
00011 /* test for INC_COM was looking for negated in both cases, so fixed */
00012 #ifdef __GNUC__
00013 #include "ssdef.h"
00014 #else
00015 #include ssdef
00016 #endif
00017 /* this code is included into dvips.c; don't compile it separately. */
00018 int vmscli()
00019     {long int k,scnt;
00020     int length,status,maxdrift,jext;
00021     float offset,conversion;
00022     char *u;
00023     static char dummy[100],prtr[20];
00024     static $DESCRIPTOR(qual1,"copies");
00025     static $DESCRIPTOR(qual2,"debug");
00026     static $DESCRIPTOR(qual3,"maxdrift");
00027     static $DESCRIPTOR(qual4,"filter");
00028     static $DESCRIPTOR(qual5,"last");
00029     static $DESCRIPTOR(qual6,"manual");
00030     static $DESCRIPTOR(qual7,"number");
00031     static $DESCRIPTOR(qual8,"output");
00032     static $DESCRIPTOR(qual9,"start");
00033     static $DESCRIPTOR(qual10,"quiet");
00034     static $DESCRIPTOR(qual11,"reverse");
00035     static $DESCRIPTOR(qual12,"sav_res");
00036     static $DESCRIPTOR(qual13,"mode");
00037     static $DESCRIPTOR(qual14,"magnification");
00038     static $DESCRIPTOR(qual15,"collate");
00039     static $DESCRIPTOR(qual16,"dpi");
00040     static $DESCRIPTOR(qual17,"ctrld");
00041     static $DESCRIPTOR(qual18,"inc_com");
00042     static $DESCRIPTOR(qual19,"comment");
00043     static $DESCRIPTOR(qual20,"vm_save");
00044     static $DESCRIPTOR(qual21,"h_dpi");
00045     static $DESCRIPTOR(qual22,"v_dpi");
00046     static $DESCRIPTOR(qual23,"compress");
00047     static $DESCRIPTOR(qual24,"printer");
00048     static $DESCRIPTOR(qual25,"header");
00049     static $DESCRIPTOR(qual26,"absolute");
00050     static $DESCRIPTOR(qual27,"epsf");
00051     static $DESCRIPTOR(qual28,"prescan");
00052     static $DESCRIPTOR(qual29,"pagecopies");
00053     static $DESCRIPTOR(qual30,"separate");
00054     static $DESCRIPTOR(qual31,"cropmarks");
00055     static $DESCRIPTOR(qual32,"sec_size");
00056     static $DESCRIPTOR(qual33,"help");
00057     static $DESCRIPTOR(qual34,"makefont");
00058     static $DESCRIPTOR(qual35,"psize");
00059     static $DESCRIPTOR(qual36,"poffset");
00060     static $DESCRIPTOR(qual37,"secure");  /* EJG 02-Jul-1996 */
00061     static $DESCRIPTOR(qual38,"oddpages");       /* EJG 02-Jul-1996 */
00062     static $DESCRIPTOR(qual39,"evenpages");      /* EJG 02-Jul-1996 */
00063     static $DESCRIPTOR(qual40,"downloadps");     /* EJG 02-Jul-1996 */
00064     static $DESCRIPTOR(qual41,"hyperps"); /* EJG 02-Jul-1996 */
00065     static $DESCRIPTOR(dumdum,dummy);
00066     static $DESCRIPTOR(dvi_file,"dvifile");
00067     static $DESCRIPTOR(input_file,infnme);
00068     scnt=0;
00069     status = cli$present(&dvi_file);
00070 
00071     if(status == CLI$_PRESENT)
00072     {status = cli$get_value(&dvi_file,&input_file,&jext);
00073       length=0;
00074       for(k=0;k<252;k++)
00075       { if(infnme[k] == ':' || infnme[k] == ']')
00076           scnt=k+1;
00077       }
00078       for(k=scnt;k<252;k++)
00079     {if(infnme[k]=='.')
00080       {length=k;
00081        jext=k;
00082        }
00083      else
00084       {if(infnme[k]=='/' || infnme[k]==' ' || infnme[k]=='\0')
00085          infnme[k]='\0';
00086        }
00087     }
00088     if(length==0)
00089      {jext= strlen(infnme);
00090      strcat(infnme,".DVI");}
00091 
00092     iname = &infnme[0] ;
00093     length = 0;         /* Initialize length...VAX C bug? */
00094 
00095    }
00096     status = cli$present(&qual1);
00097 
00098     if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
00099         {status = cli$get_value(&qual1,&dumdum,&length);
00100 
00101         if(sscanf(&dummy[0],"%d",&numcopies) == 0)
00102          error("!Bad copies option");
00103         }
00104 #ifdef DEBUG
00105     status = cli$present(&qual2);
00106 
00107     if(status == CLI$_PRESENT)
00108         {
00109         status = cli$get_value(&qual2,&dumdum,&length);
00110 
00111         if(sscanf(&dummy[0],"%d",&debug_flag) == 0)
00112          error("!Bad debug option");
00113         }
00114 #else
00115          error("not compiled in debug mode");
00116 #endif
00117     status = cli$present(&qual3);
00118 
00119     if(status == CLI$_PRESENT)
00120         {status = cli$get_value(&qual3,&dumdum,&length);
00121 
00122         if(sscanf(&dummy[0],"%d",&maxdrift) == 0 ||maxdrift <0)
00123             error("bad maxdrift option");
00124         vmaxdrift=maxdrift;
00125         }
00126 
00127 
00128     status = cli$present(&qual5);
00129 
00130     if(status == CLI$_PRESENT)
00131         {status = cli$get_value(&qual5,&dumdum,&length);
00132 
00133 #ifdef SHORTINT
00134             switch(sscanf(&dummy[0], "%ld.%ld", &lastpage, &lastseq)) {
00135 #else  /* ~SHORTINT */
00136             switch(sscanf(&dummy[0], "%ld.%ld", &lastpage, &lastseq)) {
00137 #endif /* ~SHORTINT */
00138 case 1:        lastseq = 0 ;
00139 case 2:        break ;
00140 default:
00141                error("! Bad last page option.") ;
00142             }
00143             notlast = 1 ;
00144         }
00145     status = cli$present(&qual6);
00146 
00147     if(status == CLI$_PRESENT)
00148      manualfeed=1;
00149      else
00150      if(status == CLI$_NEGATED)
00151       manualfeed=0;
00152 
00153     status = cli$present(&qual7);
00154      if(status == CLI$_PRESENT)
00155      {status = cli$get_value(&qual7,&dumdum,&length);
00156 #ifdef SHORTINT
00157             if (sscanf(&dummy[0], "%ld", &maxpages)==0)
00158 #else  /* ~SHORTINT */
00159             if (sscanf(&dummy[0], "%d", &maxpages)==0)
00160 #endif /* ~SHORTINT */
00161                error("! Bad number of pages option.") ;
00162       }
00163 
00164     status = cli$present(&qual8);
00165      if(status == CLI$_PRESENT)
00166      {status = cli$get_value(&qual8,&dumdum,&length);
00167      sscanf(&dummy[0],"%s",ofnme);
00168      }
00169      else
00170      {for(k=scnt;k<jext;k++)ofnme[k-scnt]=infnme[k];
00171         strcat(ofnme,".PS");}
00172      oname = &ofnme[0] ;
00173 
00174     status = cli$present(&qual4);
00175 
00176     if(status == CLI$_PRESENT)
00177         {oname="";
00178          filter=1;          /* EJG 02-Jul-1996 */
00179          noenv=(1==1);
00180         }
00181     else             /* EJG 02-Jul-1996 */
00182       filter=0;             /* EJG 02-Jul-1996 */
00183 
00184     status = cli$present(&qual9);
00185      if(status == CLI$_PRESENT)
00186      {status = cli$get_value(&qual9,&dumdum,&length);
00187 #ifdef SHORTINT
00188             switch(sscanf(&dummy[0], "%ld.%ld", &firstpage, &firstseq)) {
00189 #else  /* ~SHORTINT */
00190             switch(sscanf(&dummy[0], "%ld.%ld", &firstpage, &firstseq)) {
00191 #endif /* ~SHORTINT */
00192 case 1:        firstseq = 0 ;
00193 case 2:        break ;
00194 default:
00195                error("! Bad first page option.") ;
00196             }
00197             notfirst = 1 ;
00198      }
00199 
00200     status = cli$present(&qual10);
00201 
00202     if(status == CLI$_PRESENT)
00203      quiet=(1==1);
00204     else
00205     if(status == CLI$_NEGATED)
00206      quiet=(1==0);
00207 
00208     status = cli$present(&qual11);
00209 
00210     if(status == CLI$_PRESENT)
00211      reverse=1;
00212     else 
00213     if(status == CLI$_NEGATED)
00214      reverse=0;
00215 
00216     status = cli$present(&qual12);
00217 
00218     if(status == CLI$_PRESENT)
00219      safetyenclose=1;
00220     else
00221     if(status == CLI$_NEGATED)
00222      safetyenclose=0;
00223 
00224     status = cli$present(&qual13);
00225      if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
00226      {status = cli$get_value(&qual13,&dumdum,&length);
00227      sscanf(&dummy[0],"%s",pap);
00228      if (strcmp(&pap[0], "landscape") == 0)
00229          { if (hpapersize || vpapersize)
00230               error( "both landscape and papersize specified; ignoring landscape") ;
00231            else
00232               landscape = 1 ;
00233               /* The following lines have been added by G.Bonacci */
00234               if ((status=cli$get_value(&qual13,&dumdum,&length))==1)
00235               {
00236                      sscanf(&dummy[0],"%s",pap);
00237                      
00238                      paperfmt = &pap[0] ;
00239               }
00240               /* end G.Bonacci 20.3.92 */
00241          }
00242          else
00243          paperfmt = &pap[0] ;
00244      }
00245 
00246     status = cli$present(&qual14);
00247 
00248     if(status == CLI$_PRESENT)
00249         {status = cli$get_value(&qual14,&dumdum,&length);
00250 
00251         if(sscanf(&dummy[0],"%d",&mag) == 0 || mag < 10 || mag >100000)
00252          error("!Bad magnification parameter.");
00253          overridemag=1;
00254         }
00255     status = cli$present(&qual15);
00256 
00257     if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
00258         {status = cli$get_value(&qual15,&dumdum,&length);
00259 
00260         if(sscanf(&dummy[0],"%d",&collatedcopies) == 0)
00261          error("!Bad number of collated copies");
00262         }
00263     status = cli$present(&qual16);
00264 
00265     if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
00266         {status = cli$get_value(&qual16,&dumdum,&length);
00267 
00268         if(sscanf(&dummy[0],"%d",&actualdpi) == 0 ||
00269            actualdpi < 10 || actualdpi >10000)
00270         error("!Bad dpi parameter.");
00271         vactualdpi=actualdpi;
00272         }
00273 
00274     status = cli$present(&qual17);
00275 
00276     if(status == CLI$_PRESENT)            /* EJG 02-Jul-1996 */
00277       sendcontrolD =1;
00278     else
00279     if(status == CLI$_NEGATED | status==CLI$_DEFAULTED) /* EJG 02-Jul-1996 */
00280       sendcontrolD =0;
00281 
00282     status = cli$present(&qual18);
00283 
00284     if(status == CLI$_PRESENT)            /* EJG 07-Jul-1996 */
00285      removecomments =0;
00286     else
00287     if(status == CLI$_NEGATED)
00288      removecomments =1;
00289 
00290     status = cli$present(&qual19);
00291 
00292     if(status == CLI$_PRESENT)            /* EJG 02-JUL-1996 */
00293       disablecomments = 0;
00294     else
00295     if(status == CLI$_NEGATED)
00296       disablecomments = 1;
00297 
00298     status = cli$present(&qual20);
00299 
00300     if(status == CLI$_PRESENT)
00301       nosmallchars=1;
00302     else
00303     if(status == CLI$_NEGATED)
00304       nosmallchars=0;
00305 
00306     status = cli$present(&qual21);
00307 
00308     if(status == CLI$_PRESENT)
00309         {status = cli$get_value(&qual21,&dumdum,&length);
00310 
00311         if(sscanf(&dummy[0],"%d",&actualdpi) == 0 ||
00312            actualdpi < 10 || actualdpi >10000)
00313          error("!Bad dpi parameter in X.");
00314         }
00315 
00316     status = cli$present(&qual22);
00317 
00318     if(status == CLI$_PRESENT)
00319         {status = cli$get_value(&qual22,&dumdum,&length);
00320 
00321         if(sscanf(&dummy[0],"%d",&vactualdpi) == 0 ||
00322            vactualdpi < 10 || vactualdpi >10000)
00323          error("!Bad dpi parameter in Y.");
00324         }
00325 
00326     status = cli$present(&qual23);
00327 
00328     if(status == CLI$_PRESENT)
00329       compressed=1;
00330     else
00331     if(status == CLI$_NEGATED)
00332       compressed=0;
00333 
00334     status = cli$present(&qual24);
00335      if(status == CLI$_PRESENT)
00336      {status = cli$get_value(&qual24,&dumdum,&length);
00337      sscanf(&dummy[0],"%s",prtr);
00338      u = &dummy[0] ;
00339      strcpy(u,"config.");
00340      strcat(u,&prtr[0]);
00341      getdefaults("");
00342      noenv=1;
00343      getdefaults(u);
00344      }
00345 
00346     status = cli$present(&qual25);
00347      if(status == CLI$_PRESENT) {
00348        while (status != SS$_NORMAL) {
00349        status = cli$get_value(&qual25,&dumdum,&length);
00350        dummy[length] = '\0';
00351        if (strcmp(dummy, "-") == 0)
00352           headers_off = 1;
00353        else
00354           (void)add_header(dummy) ;
00355        }
00356      }
00357      else {
00358        if(status == CLI$_NEGATED)
00359           headers_off = 1;
00360      }
00361 
00362     status = cli$present(&qual26);
00363     if(status == CLI$_PRESENT) abspage = 1;
00364 
00365     status = cli$present(&qual27);
00366     if(status == CLI$_PRESENT | status==CLI$_DEFAULTED) tryepsf = 1;
00367     else
00368     if(status == CLI$_NEGATED) tryepsf = 0;
00369 
00370     status = cli$present(&qual28);
00371     if(status == CLI$_PRESENT | status==CLI$_DEFAULTED) dopprescan = 1;
00372     else
00373     if(status == CLI$_NEGATED) dopprescan = 0;
00374 
00375     status = cli$present(&qual29);
00376 
00377     if(status == CLI$_PRESENT | status == CLI$_DEFAULTED)
00378         {status = cli$get_value(&qual29,&dumdum,&length);
00379 
00380         if(sscanf(&dummy[0],"%d",&pagecopies) == 0)
00381          error("!Bad number of page copies option /PAGECOPIES");
00382         if (pagecopies < 1 || pagecopies > 1000)
00383                error("! can only print one to a thousand page copies") ;
00384         }
00385 
00386     status = cli$present(&qual30);
00387     if(status == CLI$_PRESENT | status==CLI$_DEFAULTED) sepfiles = 1;
00388     else
00389     if(status == CLI$_NEGATED) sepfiles = 0;
00390 
00391     status = cli$present(&qual31);
00392     if(status == CLI$_PRESENT | status==CLI$_DEFAULTED) cropmarks = 1;
00393     else
00394     if(status == CLI$_NEGATED) cropmarks = 0;
00395 
00396     status = cli$present(&qual32);
00397      if(status == CLI$_PRESENT)
00398      {status = cli$get_value(&qual32,&dumdum,&length);
00399 #ifdef SHORTINT
00400             if (sscanf(&dummy[0], "%ld", &maxsecsize)==0)
00401 #else  /* ~SHORTINT */
00402             if (sscanf(&dummy[0], "%d", &maxsecsize)==0)
00403 #endif /* ~SHORTINT */
00404                error("! Bad section size arg (/SEC_SIZE).") ;
00405      }
00406 
00407     status = cli$present(&qual33);
00408      if(status == CLI$_PRESENT)
00409      {  (void)fprintf(stderr, banner) ;
00410         help() ;
00411      }
00412 
00413     status = cli$present(&qual34);
00414     if(status == CLI$_NEGATED) dontmakefont = 1;
00415 /*-----------------------------------------------------------------------
00416  * Currently one uses /PSIZE="5mm,10mm" This way CASE is preserved
00417  * Should I convert the PSIZE to allow a LIST => /PSIZE=(5mm,10mm) and
00418  * convert the case back to lowercase in here.
00419  *-----------------------------------------------------------------------*/
00420     status = cli$present(&qual35);
00421      if(status == CLI$_PRESENT) {
00422        status = cli$get_value(&qual35,&dumdum,&length);
00423        dummy[length] = '\0';
00424        handlepapersize(&dummy[0], &hpapersize, &vpapersize) ;
00425        if (landscape) {
00426           error("both landscape and papersize specified; ignoring landscape") ;
00427           landscape = 0 ;
00428        }
00429      }
00430 
00431     status = cli$present(&qual36);
00432      if(status == CLI$_PRESENT) {
00433        status = cli$get_value(&qual36,&dumdum,&length);
00434        dummy[length] = '\0';
00435        handlepapersize(&dummy[0], &hoff, &voff) ;
00436      }
00437 
00438     status = cli$present(&qual37);        /* EJG 02-Jul-1996 */
00439     if(status == CLI$_PRESENT) secure = 1;       /* EJG 02-Jul-1996 */
00440     else                                  /* EJG 02-Jul-1996 */
00441     if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) secure = 0; /* EJG 02-Jul-1996 */
00442 
00443     status = cli$present(&qual38);        /* EJG 02-Jul-1996 */
00444     if(status == CLI$_PRESENT) oddpages = 1;     /* EJG 02-Jul-1996 */
00445     else                                  /* EJG 02-Jul-1996 */
00446     if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) oddpages = 0;      /* EJG 02-Jul-1996 */
00447 
00448     status = cli$present(&qual39);        /* EJG 02-Jul-1996 */
00449     if(status == CLI$_PRESENT) evenpages = 1;    /* EJG 02-Jul-1996 */
00450     else                                  /* EJG 02-Jul-1996 */
00451     if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) evenpages = 0; /* EJG 02-Jul-1996 */
00452 
00453     status = cli$present(&qual40);        /* EJG 02-Jul-1996 */
00454     if(status == CLI$_PRESENT) downloadpspk = 1; /* EJG 02-Jul-1996 */
00455     else                                  /* EJG 02-Jul-1996 */
00456     if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) downloadpspk = 0; /* EJG 02-Jul-1996 */
00457 
00458 #ifdef HPS           /* EJG 02-Jul-1996 */
00459 
00460     status = cli$present(&qual41);        /* EJG 02-Jul-1996 */
00461     if(status == CLI$_PRESENT) HPS_FLAG = 1;     /* EJG 02-Jul-1996 */
00462     else                                  /* EJG 02-Jul-1996 */
00463     if(status == CLI$_NEGATED | status == CLI$_DEFAULTED) HPS_FLAG = 0; /* EJG 02-Jul-1996 */
00464 #endif               /* EJG 02-Jul-1996 */
00465 
00466 }