home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1503 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  71.1 KB

  1. From: chip@chinacat.Unicom.COM (Chip Rosenthal)
  2. Newsgroups: alt.sources
  3. Subject: ljinit
  4. Message-ID: <1337@chinacat.Unicom.COM>
  5. Date: 23 Jun 90 00:20:31 GMT
  6.  
  7. "ljinit" provides a high level interface to the HP PCL configuration commands
  8. used by HP LaserJet printers.  For example, rather than hardcoding printer
  9. escape sequences into scripts, you can use calls to "ljinit".  Example
  10. usage would look something like:
  11.  
  12.     ljinit setup=letter font_id=roman stroke=bold left_margin=20 /right_margin
  13.  
  14. #! /bin/sh
  15. # this is a "shar" archive - run through "/bin/sh" to extract 11 files:
  16. #   README ljinit.h patchlevel.h main.c param.c cmd.c misc.c ljconfig.dat ljparam.dat Makefile testsheet
  17. # Wrapped by bin@chinacat on Fri Jun 22 19:13:56 CDT 1990
  18. # Unpacking this archive requires:  sed test wc (possibly mkdir)
  19. # Existing files will not be clobbered unless "-c" is specified on the cmd line.
  20. if test -f README -a "$1" != "-c" ; then
  21.     echo "README: file exists - will not be overwritten"
  22. else
  23.     echo "x - README (file 1 of 11, 5389 chars)"
  24.     sed -e 's/^X//' << 'END_OF_FILE_README' > README
  25. X    ljinit - Hewlett Packard LaserJet Configuration Generator
  26. X    ======   ======= ======= ======== ============= =========
  27. X
  28. X"ljinit" provides a high level interface to the HP PCL configuration commands
  29. Xused by HP LaserJet printers.  For example, rather than hardcoding printer
  30. Xescape sequences into scripts, you can use calls to "ljinit".  Example
  31. Xusage would look something like:
  32. X
  33. X    ljinit setup=letter font_id=roman stroke=bold left_margin=20 /right_margin
  34. X
  35. X(That last argument isn't a filename.  It tells "ljinit" to suppress the
  36. X"right_margin" setting implied by the "setup=letter" specification, and
  37. Xthus allows printing to extend to the end of the logical page rather than
  38. Xclipping at the margin.)
  39. X
  40. XLjinit allows you direct control over the low-level printer configuration
  41. Xparameters (e.g. typeface, left margin, HMI, etc.).  It also provides
  42. Xthree commands ("font_id", "page_id", and "setup") which simplify the
  43. Xtask of creating configurations.
  44. X
  45. XThere are two data files to configure "ljinit":
  46. X
  47. X    - ljparam.dat - device specific parameter definitions
  48. X    - ljconfig.dat - site specific configuration definitions
  49. X
  50. XThe difference between these files is that "ljparam.dat" describes the
  51. Xcapabilities of the printer, and "ljconfig.dat" describes your site-specific
  52. Xconfiguration preferences.
  53. X
  54. XLjinit has been tested under SCO XENIX 386 with an HP LaserJet IIP.  It
  55. Xshould port easily to any System V environment.  (BSD might be tough
  56. Xbecause it uses the SysV regex routines to validate the user's values.)
  57. X
  58. X
  59. XBuilding "ljinit"
  60. X======== ========
  61. X
  62. X  1)  Edit the PARAM_FILE and CONFIG_FILE definitions in "ljinit.h".
  63. X
  64. X  2)  Run a "make".
  65. X
  66. X  3)  The distributed "ljparam.dat" file contains support for all items
  67. X      documented in HP's LaserJet Series II and LaserJet Series IIP
  68. X      manual.  If you run a different printer or if you added capabilities
  69. X      (e.g. fonts) not documented there, you might need to edit this
  70. X      file.  (Please send me your changes!)
  71. X
  72. X  4)  The distributed "ljconfig.dat" file defines my local configuration
  73. X      preferences.  You might very well want to change this file.  Note
  74. X      that the "font_id" definitions describe the internal fonts for a
  75. X      LaserJet Series IIP printer.  You might want to modify these if you
  76. X      run a different printer or if you've added cartridge fonts.  (Please
  77. X      send me your changes!)
  78. X
  79. X  5)  Install "ljparam.dat" and "ljconfig.dat" in the places you defined
  80. X      in step 1.
  81. X
  82. X  6)  To test "ljinit", you can try things like:
  83. X
  84. X    ( ljinit setup=wide ; echo "hello world" ) | lp
  85. X    ( ljinit stroke=bold ; echo "this is a test" ) | lp
  86. X
  87. X  7)  For the System V print system, you will want to integrate "ljinit"
  88. X      into your interface script.  I can send you mine if you'd like an
  89. X      example.
  90. X
  91. X
  92. XWarnings, Suggestions, and Caveats
  93. X========= ============ === =======
  94. X
  95. X  1)  When you get into programming "ljinit" remember the difference
  96. X      between configuration parameters and the three special commands
  97. X      (page_id, font_id, and setup).  The configuration parameters directly
  98. X      correspond to a single PCL configuration command, which the special
  99. X      commands are higher-level abstractions to simplify the task of
  100. X      establishing a printer configuration.
  101. X
  102. X  2)  If you want to create your own "page_id" page layout entries in the
  103. X      "ljconfig.dat" file, then forget all you know about the complexities
  104. X      about page layout with the LaserJet.  If you want a left margin of
  105. X      a half inch, say "0.50".  "ljinit" knows all the messy details about
  106. X      physical pages, logical pages, conversion to columns, etc. and does
  107. X      it for you automagically.
  108. X
  109. X  3)  The execution of a "page_id" defines a right margin at which the
  110. X      text will be clipped.  If you want to suppress the clipping and
  111. X      instead allow text to extend beyond the right margin all the way
  112. X      to the end of the (logical) page, specify "/right_margin".  You can
  113. X      do this on the command line, or in a "setup" in the "ljconfig.dat"
  114. X      file.  (The '/' slash syntax can be used to inhibit the setting of
  115. X      any parameter.)
  116. X
  117. X  4)  The "ljinit" utility is useless for proportional spaced fonts.
  118. X      This release contains no support for soft fonts, nor is such
  119. X      support anticipated.
  120. X
  121. X  5)  It's a handy program.  But in ways it's like using a sledgehammer
  122. X      to drive a nail.
  123. X      
  124. X
  125. XFine Print
  126. X==== =====
  127. X
  128. X  This program is copyright 1990, Unicom Systems Development.  All rights
  129. X  reserved.  This program is provided "as is" without any warranties,
  130. X  express or implied.  You are granted license to use and distribute this
  131. X  program, provided:  (1) all copyright notices remain intact, (2) you
  132. X  will not distribute a modified version unless it is clearly marked as
  133. X  such, (3) this program is not incorporated into a commercial product,
  134. X  (4) you may not receive payment for the distribution of this program
  135. X  beyond reimbursement of media and handling costs, and (5) you agree
  136. X  that Unicom Systems Development is to be held harmless for any damages,
  137. X  direct or incidental, for any use or application of this program.
  138. X
  139. X
  140. XComments, suggestions, and bug reports are welcomed to the address below.
  141. XEspecially if you make changes to run this with different printers,
  142. Xparticularly the LaserJet Series IID and Series III.
  143. X
  144. XChip Rosenthal
  145. X<chip@chinacat.Unicom.COM>
  146. X
  147. X@(#) README 1.1 90/06/20 23:04:22
  148. X
  149. END_OF_FILE_README
  150.     size="`wc -c < README`"
  151.     if test 5389 -ne "$size" ; then
  152.     echo "README: extraction error - got $size chars"
  153.     fi
  154. fi
  155. if test -f ljinit.h -a "$1" != "-c" ; then
  156.     echo "ljinit.h: file exists - will not be overwritten"
  157. else
  158.     echo "x - ljinit.h (file 2 of 11, 3104 chars)"
  159.     sed -e 's/^X//' << 'END_OF_FILE_ljinit.h' > ljinit.h
  160. X/* @(#) ljinit.h 1.1 90/06/20 23:04:23
  161. X *
  162. X * file:    ljinit.h
  163. X * package:    ljinit - HP LaserJet Initialization Generator
  164. X *
  165. X * Edit History:
  166. X *
  167. X * Wed Feb 28 13:53:23 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  168. X *    Original composition.
  169. X * Wed Jun 20 23:02:47 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  170. X *    Cleanup and check into SCCS.
  171. X *
  172. X * Copyright 1990, Unicom Systems Development.  All rights reserved.
  173. X * See accompanying README file for terms of distribution and use.
  174. X */
  175. X
  176. X#define PARAM_FILE    "/local/lib/ljparam.dat"
  177. X#define CONFIG_FILE    "/local/lib/ljconfig.dat"
  178. X
  179. X#define DOTS_INCH    300.0    /* number of dots printed per inch    */
  180. X#define POINTS_INCH     72.0    /* number of points per inch        */
  181. X#define VMI_SCALE     48.0    /* number of vmi increments per inch    */
  182. X#define HMI_SCALE    120.0    /* number of hmi increments per inch    */
  183. X
  184. X#define TRUE        1
  185. X#define FALSE        0
  186. X#define BUFLEN        256
  187. X
  188. X#define Dprintf(level)    if ( Debug < level ) ; else fprintf
  189. X
  190. X#ifndef LINT
  191. X#   define SCCSID(ID)        static char SccsId[] = ID;
  192. X#   define COPYRIGHT(ID)    static char Copyright[] = ID;
  193. X    typedef void * Ptr;        /* generic pointer, e.g. as malloc() returns */
  194. X#else
  195. X#   define SCCSID(ID)
  196. X#   define COPYRIGHT(ID)
  197. X    typedef char * Ptr;
  198. X#endif
  199. X
  200. X#ifdef INTERN
  201. X# define EXTERN
  202. X#else
  203. X# define EXTERN extern
  204. X#endif
  205. X
  206. X/*
  207. X * Globals.
  208. X */
  209. XEXTERN char *    Progname;        /* name of this program              */
  210. XEXTERN char *    Config_file;        /* file with site-specific info          */
  211. XEXTERN char *    Param_file;        /* file with device-specific info     */
  212. XEXTERN char    Err_buf[BUFLEN];    /* buffer for "set_param()" messages  */
  213. XEXTERN FILE    *Fp_config;        /* stream for "Config_file"          */
  214. XEXTERN FILE    *Fp_param;        /* stream for "Param_file"          */
  215. XEXTERN int    Debug;            /* debugging output level          */
  216. XEXTERN int    Inhibit_default;    /* inhibits automatic "setup=default" */
  217. X
  218. X/*
  219. X * param.c - Printer parameter processing routines.
  220. X */
  221. Xextern void    load_param();        /* load list from parameters file     */
  222. Xextern char *    get_param();        /* return configured value of a param */
  223. Xextern int    set_param();        /* set a param from a spec string     */
  224. Xextern void    exec_param();        /* generate all the setup commands    */
  225. Xextern void    dump_param();        /* print listing of available params  */
  226. X
  227. X/*
  228. X * cmd.c - Command execution procedures.
  229. X */
  230. Xextern void    (*find_cmd())();/* locate handler proc for a command          */
  231. Xextern void    cmd_setup();    /* execute a specified "setup" command          */
  232. Xextern void    cmd_font_id();    /* execute a specified "font_id" command      */
  233. Xextern void    cmd_page_id();    /* execute a specified "page_id" command      */
  234. X
  235. X/*
  236. X * misc.c - Support procedures.
  237. X */
  238. Xextern char *    fgetrec();    /* retrieve a record from a file          */
  239. Xextern char *    fgetline();    /* get the next line from a stream          */
  240. Xextern char *    strfield();    /* break line into space-delimited fields     */
  241. Xextern int    stricmp();    /* compare strings, ignore punct and case     */
  242. Xextern char *    strtrim();    /* trim comments, lead/trail white space      */
  243. Xextern Ptr    Smalloc();    /* allocate memory with error checking          */
  244. Xextern char *    Sstrdup();    /* duplicate a string with error checking     */
  245. X
  246. END_OF_FILE_ljinit.h
  247.     size="`wc -c < ljinit.h`"
  248.     if test 3104 -ne "$size" ; then
  249.     echo "ljinit.h: extraction error - got $size chars"
  250.     fi
  251. fi
  252. if test -f patchlevel.h -a "$1" != "-c" ; then
  253.     echo "patchlevel.h: file exists - will not be overwritten"
  254. else
  255.     echo "x - patchlevel.h (file 3 of 11, 194 chars)"
  256.     sed -e 's/^X//' << 'END_OF_FILE_patchlevel.h' > patchlevel.h
  257. X#define PATCHLEVEL 0
  258. X
  259. X/*
  260. X * @(#) patchlevel.h 1.1 90/06/20 23:04:26
  261. X *
  262. X * Wed Jun 20 23:02:47 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  263. X *    Patchlevel 0.  Cleanup and check into SCCS.
  264. X */
  265. END_OF_FILE_patchlevel.h
  266.     size="`wc -c < patchlevel.h`"
  267.     if test 194 -ne "$size" ; then
  268.     echo "patchlevel.h: extraction error - got $size chars"
  269.     fi
  270. fi
  271. if test -f main.c -a "$1" != "-c" ; then
  272.     echo "main.c: file exists - will not be overwritten"
  273. else
  274.     echo "x - main.c (file 4 of 11, 3778 chars)"
  275.     sed -e 's/^X//' << 'END_OF_FILE_main.c' > main.c
  276. X/* @(#) main.c 1.1 90/06/20 23:04:24
  277. X *
  278. X * file:    main.c - main procedure
  279. X * package:    ljinit - HP LaserJet Initialization Generator
  280. X *
  281. X * Edit History:
  282. X *
  283. X * Wed Feb 28 13:53:23 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  284. X *    Original composition.
  285. X * Wed Jun 20 23:02:47 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  286. X *    Cleanup and check into SCCS.
  287. X *
  288. X * Copyright 1990, Unicom Systems Development.  All rights reserved.
  289. X * See accompanying README file for terms of distribution and use.
  290. X */
  291. X
  292. X#include <stdio.h>
  293. X#include <string.h>
  294. X#define INTERN
  295. X#include "ljinit.h"
  296. X#include "patchlevel.h"
  297. X
  298. XSCCSID("@(#) main.c 1.1 90/06/20 23:04:24")
  299. XCOPYRIGHT("Copyright 1990, Unicom Systems Development.  All rights reserved.")
  300. X
  301. X#define USAGE "\
  302. Xusage: %s [-I] [-c config_file] [-p param_file] [arg ...]\n\
  303. X    (or specify '-h' for help message)\n"
  304. X
  305. Xvoid show_usage();
  306. X
  307. X
  308. Xmain(argc,argv)
  309. Xint argc;
  310. Xchar *argv[];
  311. X{
  312. X    int i, do_help;
  313. X    extern int optind;
  314. X    extern char *optarg;
  315. X
  316. X    /*
  317. X     * Initialize.
  318. X     */
  319. X    Config_file = CONFIG_FILE;    /* site-specific configuration defs          */
  320. X    Param_file = PARAM_FILE;    /* hardware dependent configuration defs      */
  321. X    Progname = argv[0];        /* this program name                  */
  322. X    Debug = 0;            /* debug disabled by default              */
  323. X    Inhibit_default = FALSE;    /* do "setup=default" by default          */
  324. X    do_help = FALSE;        /* no help message by default              */
  325. X
  326. X    /*
  327. X     * Process the command line options.
  328. X     */
  329. X    while ( (i=getopt(argc,argv,"D:Ic:p:h")) != EOF ) {
  330. X    switch ( i ) {
  331. X        case 'D':  Debug = atoi(optarg);        break;
  332. X        case 'I':  Inhibit_default = TRUE;        break;
  333. X        case 'c':  Config_file = Sstrdup(optarg);    break;
  334. X        case 'p':  Param_file = Sstrdup(optarg);    break;
  335. X        case 'h':  do_help = TRUE;            break;
  336. X        default:   fprintf(stderr,USAGE,Progname);    exit(1);
  337. X    }
  338. X    }
  339. X
  340. X    /*
  341. X     * Open up the data files.
  342. X     */
  343. X    if ( (Fp_param=fopen(Param_file,"r")) == NULL ) {
  344. X    perror(Param_file);
  345. X    exit(1);
  346. X    }
  347. X    if ( (Fp_config=fopen(Config_file,"r")) == NULL ) {
  348. X    perror(Config_file);
  349. X    exit(1);
  350. X    }
  351. X
  352. X    /*
  353. X     * Load in the parameters table.
  354. X     */
  355. X    load_param();
  356. X
  357. X    /*
  358. X     * See if help was requested.
  359. X     */
  360. X    if ( do_help ) {
  361. X    show_usage();
  362. X    exit(0);
  363. X    }
  364. X
  365. X    /*
  366. X     * Initialize the setup to the default conditions.
  367. X     */
  368. X    if ( !Inhibit_default && set_param("setup=default") != 0 ) {
  369. X    fprintf(stderr,"%s: error loading setup 'default' - %s\n",
  370. X        Progname, Err_buf);
  371. X    exit(1);
  372. X    }
  373. X
  374. X    /*
  375. X     * Process arguments on the command line.
  376. X     */
  377. X    for ( i = optind ; i < argc ; ++i ) {
  378. X    if ( set_param(argv[i]) != 0 ) {
  379. X        fprintf(stderr,"%s: error processing command line arg - %s\n",
  380. X        Progname, Err_buf);
  381. X        exit(1);
  382. X    }
  383. X    }
  384. X
  385. X    /*
  386. X     * Go through and execute all of parameter setups.
  387. X     */
  388. X    exec_param( Debug && isatty(1) ? (FILE *) NULL : stdout );
  389. X
  390. X    exit(0);
  391. X    /*NOTREACHED*/
  392. X}
  393. X
  394. Xstatic char *usage_text[] = {
  395. X    "",
  396. X    "The following parameters are available:",
  397. X    "@PARAMS",
  398. X    "",
  399. X    "In addition to these parameters, the 'setup', 'font_id', and 'page_id'",
  400. X    "commands may be used.  Non-alphabetic characters (e.g. '_') and letter",
  401. X    "case are ignored.  Example usage:",
  402. X    "",
  403. X    "    ljinit setup=memo stroke=BOLD left_margin=8 /RightMargin",
  404. X    "",
  405. X    "Copyright 1990, Unicom Systems Development.  All rights reserved.",
  406. X    "See accompanying README file for terms of distribution and use.",
  407. X    "",
  408. X    NULL
  409. X};
  410. X
  411. X
  412. Xvoid show_usage()
  413. X{
  414. X    int i;
  415. X    putchar('\n');
  416. X    printf("%s - version 1.1 (patchlevel %d)\n\n", Progname, PATCHLEVEL);
  417. X    printf(USAGE, Progname);
  418. X    for ( i = 0 ; usage_text[i] != NULL ; ++i ) {
  419. X    if ( strcmp(usage_text[i],"@PARAMS") == 0 )
  420. X        dump_param(stdout);
  421. X    else
  422. X        puts(usage_text[i]);
  423. X    }
  424. X}
  425. X
  426. END_OF_FILE_main.c
  427.     size="`wc -c < main.c`"
  428.     if test 3778 -ne "$size" ; then
  429.     echo "main.c: extraction error - got $size chars"
  430.     fi
  431. fi
  432. if test -f param.c -a "$1" != "-c" ; then
  433.     echo "param.c: file exists - will not be overwritten"
  434. else
  435.     echo "x - param.c (file 5 of 11, 11892 chars)"
  436.     sed -e 's/^X//' << 'END_OF_FILE_param.c' > param.c
  437. X/* @(#) param.c 1.1 90/06/20 23:04:25
  438. X *
  439. X * file:    param.c - printer parameter processing routines
  440. X * package:    ljinit - HP LaserJet Initialization Generator
  441. X *
  442. X * These routines maintain the printer configuration parameters, and provide
  443. X * a standard interface to the parameters table.
  444. X *
  445. X * Specifically, these routines build a list of the configurable printer 
  446. X * parameters based upon the "param" records in the "Param_file", place
  447. X * the user-specified values into the list, and finally produces the
  448. X * printer command strings to effect this configuration.
  449. X *
  450. X * The following procedures are provided:
  451. X *
  452. X *   void load_param() - Called once early in the program to initialize
  453. X *    the list of all the paramaters available for configuration.
  454. X *
  455. X *   char *get_param(name) - Lookup the value specified by the user for
  456. X *    the named parameter.
  457. X *
  458. X *   int set_param(spec) - Perform the parameter initialization given by
  459. X *    the specification string (e.g. "left_margin=5").
  460. X *
  461. X *   void exec_param(fp) - Called once all the definitions have been performed
  462. X *    to produce the commands to achieve the desired configuration.
  463. X *
  464. X *   void dump_param(fp) - Produce a listing of the parameters which the
  465. X *    user may set.
  466. X *
  467. X * Edit History:
  468. X *
  469. X * Wed Feb 28 13:53:23 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  470. X *    Original composition.
  471. X * Wed Jun 20 23:02:47 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  472. X *    Cleanup and check into SCCS.
  473. X *
  474. X * Copyright 1990, Unicom Systems Development.  All rights reserved.
  475. X * See accompanying README file for terms of distribution and use.
  476. X */
  477. X
  478. X#include <stdio.h>
  479. X#include <string.h>
  480. X#include "ljinit.h"
  481. X
  482. XSCCSID("@(#) param.c 1.1 90/06/20 23:04:25")
  483. XCOPYRIGHT("Copyright 1990, Unicom Systems Development.  All rights reserved.")
  484. X
  485. X/*
  486. X * (struct pvalspec) - Description of acceptable parameter value.  This
  487. X * structure matches a keyword specified in the parameters file (e.g. "INT")
  488. X * and associates a regular expression which may be used to validate the
  489. X * user-supplied value for the parameter.
  490. X */
  491. Xstruct pvalspec {
  492. X    char *name;        /* Name which appears in the "param" record.          */
  493. X    char *descrip;    /* Description of this item for error messages.       */
  494. X    char *pat;        /* Regular expression to validate against.          */
  495. X    char *re;        /* Space for the regcmp(3) compiled version of "pat". */
  496. X};
  497. X
  498. X/*
  499. X * Pvalspec_tab[] - The list of allowed parameter value types.
  500. X */
  501. Xstruct pvalspec Pvalspec_tab[] = {
  502. X    { "STRING",    "string",    ".",                NULL    },
  503. X    { "INT",    "integer",    "^[0-9]+$",            NULL    },
  504. X    { "SIGNINT","signed-int",    "^-{0,1}[0-9]+$",        NULL    },
  505. X    { "FLOAT2",    "float-2",    "^[0-9]*(\.[0-9]{0,2}){0,1}$",    NULL    },
  506. X    { "FLOAT4",    "float-4",    "^[0-9]*(\.[0-9]{0,4}){0,1}$",    NULL    },
  507. X    { NULL,    NULL,        NULL,                NULL    }
  508. X};
  509. X
  510. X/*
  511. X * (struct param_item) - Description of a printer configuration parameter.
  512. X */
  513. Xstruct param_item {
  514. X    char *name;            /* Name of this configuration parameter.      */
  515. X    char *value;        /* The user-assigned value for this param.    */
  516. X    char *cmd;            /* The PCL command to configure this param.  */
  517. X    int do_lookup;        /* Enable translation via param file lookup.  */
  518. X    struct pvalspec *val_spec;    /* Description of allowed parameter values.   */
  519. X    struct param_item *next;    /* Pointer to next param in the linked list.  */
  520. X};
  521. X
  522. X/*
  523. X * Param_list - Head of the linked list of parameters specified by user.
  524. X */
  525. Xstruct param_item Param_list = { NULL, NULL, NULL, FALSE, NULL, NULL };
  526. X
  527. X
  528. X/*
  529. X * find_param() - Scan the list of parameters looking for the named parameter.
  530. X */
  531. Xstatic struct param_item *find_param(name)
  532. Xregister char *name;
  533. X{
  534. X    register struct param_item *p;
  535. X    for ( p = Param_list.next ; p != NULL ; p = p->next ) {
  536. X    if ( stricmp(name,p->name) == 0 )
  537. X        return p;
  538. X    }
  539. X    return (struct param_item *) NULL;
  540. X}
  541. X
  542. X
  543. X/*
  544. X * load_param() - Initialize the printer parameters table.
  545. X *
  546. X * Arguments:    none
  547. X *
  548. X * Returns:    nothing
  549. X *
  550. X * Errors:    Aborts program if syntax error detected in definition tables.
  551. X *
  552. X * This routine reads all of the "param" records from the "Param_file"
  553. X * and places them into a linked list of (struct param_item).  It also
  554. X * compiles the regular expresions in the "Pvalspec_tab" which are used
  555. X * to validate the user-specified parameter values.
  556. X */
  557. Xvoid load_param()
  558. X{
  559. X    char *bufp, *s;
  560. X    int i;
  561. X    struct param_item *p;
  562. X    extern char *regcmp();
  563. X
  564. X    /*
  565. X     * Compile the regular expressions in the allowed parameter values list.
  566. X     */
  567. X    for ( i = 0 ; Pvalspec_tab[i].name != NULL ; ++i ) {
  568. X    Pvalspec_tab[i].re = regcmp(Pvalspec_tab[i].pat,(char *)NULL);
  569. X    if ( Pvalspec_tab[i].re == NULL ) {
  570. X        fprintf(stderr, "%s: internal error - bad pattern for '%s' args\n",
  571. X        Progname, Pvalspec_tab[i].name);
  572. X        exit(1);
  573. X    }
  574. X    }
  575. X
  576. X    /*
  577. X     * Go through the parameters file looking for definitions.
  578. X     */
  579. X    p = &Param_list;
  580. X    rewind(Fp_param);
  581. X    while ( (bufp=fgetline(Fp_param)) != NULL ) {
  582. X
  583. X    /*
  584. X     * Only consider "param" definitions.
  585. X     */
  586. X    if ( stricmp("param",strfield(&bufp)) != 0 )
  587. X        continue;
  588. X
  589. X    /* 
  590. X     * Allocate and initialize a new parameter.
  591. X     */
  592. X    p = p->next = (struct param_item *) Smalloc(sizeof(struct param_item));
  593. X    p->name = NULL;
  594. X    p->value = NULL;
  595. X    p->cmd = NULL;
  596. X    p->do_lookup = FALSE;
  597. X    p->val_spec = NULL;
  598. X    p->next = NULL;
  599. X
  600. X    /*
  601. X     * Field 1 - name of the configuration parameter.
  602. X     */
  603. X    if ( *bufp == 0 )
  604. X        goto err_field_count;
  605. X    p->name = Sstrdup(strfield(&bufp));
  606. X
  607. X    /*
  608. X     * Field 2 - PCL printer command to configure this parameter.
  609. X     */
  610. X    if ( *bufp == 0 )
  611. X        goto err_field_count;
  612. X    p->cmd = Sstrdup(strfield(&bufp));
  613. X
  614. X    /*
  615. X     * Field 3 - flag to enable translation of value via param file lookup.
  616. X     */
  617. X    if ( *bufp == 0 )
  618. X        goto err_field_count;
  619. X    p->do_lookup = ( stricmp(strfield(&bufp),"yes") == 0 );
  620. X
  621. X    /*
  622. X     * Field 4 - description of allowed values for this parameter.
  623. X     */
  624. X    if ( *bufp == 0 )
  625. X        goto err_field_count;
  626. X    s = strfield(&bufp);
  627. X    for ( i = 0 ; Pvalspec_tab[i].name != NULL ; ++i ) {
  628. X        if ( stricmp(Pvalspec_tab[i].name,s) == 0 ) {
  629. X        p->val_spec = &Pvalspec_tab[i];
  630. X        break;
  631. X        }
  632. X    }
  633. X    if ( Pvalspec_tab[i].name == NULL ) {
  634. X        fprintf(stderr,
  635. X        "%s(%s): unknown value type '%s' for parameter '%s'\n",
  636. X        Progname, Param_file, s, p->name);
  637. X        exit(1);
  638. X    }
  639. X
  640. X    if ( *bufp != '\0' )
  641. X        goto err_field_count;
  642. X
  643. X    }
  644. X
  645. X    return;
  646. X
  647. Xerr_field_count:
  648. X    fprintf(stderr,"%s(%s): bad field count in parameter '%s'\n",
  649. X    Progname,Param_file,p->name);
  650. X    exit(1);
  651. X}
  652. X
  653. X
  654. X/*
  655. X * get_param() - Retrieve the user-assigned value of a parameter.
  656. X *
  657. X * Arguments:    The name of the parameter to find.
  658. X *
  659. X * Returns:    Pointer to static character string containing the value,
  660. X *        or NULL if no value has been specified.
  661. X *
  662. X * Errors:    None.
  663. X *
  664. X * Punction and letter case are insignificant in the parameter name, i.e.
  665. X * "LeftMargin" will match the parameter named "left_margin".
  666. X */
  667. Xchar *get_param(name)
  668. Xregister char *name;
  669. X{
  670. X    register struct param_item *p;
  671. X    return ( (p=find_param(name)) == NULL ? (char *)NULL : p->value );
  672. X}
  673. X
  674. X
  675. X/*
  676. X * set_param() - Specify the user-assigned value of a parameter.
  677. X *
  678. X * Arguments:    An assignment specification, i.e. "orientation=port".
  679. X *
  680. X * Returns:    0 upon success, -1 upon error.  In the event of an error,
  681. X *        the global string "Err_buf" will describe the problem.
  682. X *
  683. X * Errors:    Error given upon poorly formed specifications or unknown
  684. X *        parameter names.
  685. X *
  686. X * The allowed specifications are of three forms:
  687. X *
  688. X *    /param_name        (suppress production of a configuration param)
  689. X *    param_name=value    (define a value for a configuration param)
  690. X *    cmd_name=value        (run one of the high level commands)
  691. X *
  692. X * Punction and letter case are insignificant in the parameter name, i.e.
  693. X * "LeftMargin" will match the parameter named "left_margin".
  694. X */
  695. Xint set_param(spec)
  696. Xchar *spec;
  697. X{
  698. X    struct param_item *p;
  699. X    char *name, *value;
  700. X    void (*cmdproc)();
  701. X    extern void free();
  702. X
  703. X    /*
  704. X     * Split the specification at '=' into option name and value.
  705. X     */
  706. X    if ( (value=strchr(spec,'=')) != NULL ) {
  707. X    *value++ = '\0';
  708. X    value = strtrim(value);
  709. X    }
  710. X    name = strtrim(spec);
  711. X
  712. X    /*
  713. X     * First, check for the "/param_name" form.
  714. X     */
  715. X    if ( *name == '/' ) {
  716. X    ++name;
  717. X    if ( value != NULL )
  718. X        goto err_value_not_allowed;
  719. X    if ( (p=find_param(name)) == NULL )
  720. X        goto err_unknown_param;
  721. X    if ( p->value != NULL )
  722. X        free(p->value);
  723. X    p->value = NULL;
  724. X    Dprintf(4)(stderr, "set_param> inhibited '%s'\n", p->name);
  725. X    return 0;
  726. X    }
  727. X
  728. X    /*
  729. X     * Second, check for the "param_name=value" form.
  730. X     */
  731. X    if ( (p=find_param(name)) != NULL ) {
  732. X    if ( value == NULL )
  733. X        goto err_value_missing;
  734. X    if ( p->value != NULL )
  735. X        free(p->value);
  736. X    p->value = Sstrdup(value);
  737. X    Dprintf(4)(stderr, "set_param> setting '%s' to '%s'\n", p->name, value);
  738. X    return 0;
  739. X    }
  740. X
  741. X    /*
  742. X     * Finally, check for the "cmd_name=value" form.
  743. X     */
  744. X    if ( (cmdproc=find_cmd(name)) != NULL ) {
  745. X    if ( value == NULL )
  746. X        goto err_value_missing;
  747. X    (*cmdproc)(value);
  748. X    return 0;
  749. X    }
  750. X
  751. X    /* else fall through to 'err_unknown_param' error */
  752. X
  753. Xerr_unknown_param:
  754. X    sprintf(Err_buf,"unknown parameter '%s'",name);
  755. X    return -1;
  756. X
  757. Xerr_value_not_allowed:
  758. X    sprintf(Err_buf,"value not allowed when inhibiting '%s'",name);
  759. X    return -1;
  760. X
  761. Xerr_value_missing:
  762. X    sprintf(Err_buf,"value missing on '%s'",name);
  763. X    return -1;
  764. X
  765. X}
  766. X
  767. X
  768. X
  769. X/*
  770. X * exec_param() - Emit the printer command string for the required config.
  771. X *
  772. X * Arguments:    File stream to send command string to, or NULL to suppress
  773. X *        actual output of the commands.
  774. X *
  775. X * Returns:    Nothing.
  776. X *
  777. X * Errors:    Prints diagnostic message and aborts program upon an error.
  778. X *
  779. X * This procedure goes through all of the possible parameters in the order
  780. X * loaded from the "Param_file", and emits a printer configuration command
  781. X * strong for each parameter which has been assigned a value by the user.
  782. X * This procedure will first check if the "do_lookup" flag has been defined
  783. X * for the parameter, and in which case it will translate the mnemonic name
  784. X * specified by the user to a printer code by performing a lookup in the
  785. X * "Param_file".  It will then take the value and validate it according to
  786. X * the "val_spec" for this parameter.
  787. X */
  788. Xvoid exec_param(fp)
  789. XFILE *fp;
  790. X{
  791. X    char *value;
  792. X    struct param_item *p;
  793. X    extern char *regex();
  794. X
  795. X    /*
  796. X     * Go through the linked list of all the possible printer parameters.
  797. X     */
  798. X    for ( p = Param_list.next ; p != NULL ; p = p->next ) {
  799. X
  800. X    /*
  801. X     * Only consider parameters for which a value has been assigned.
  802. X     */
  803. X    if ( p->value == NULL )
  804. X        continue;
  805. X
  806. X    /*
  807. X     * Perform definitions file lookup to translate value.
  808. X     */
  809. X    if ( p->do_lookup ) {
  810. X        value = fgetrec(Fp_param,p->name,p->value,(char *)NULL);
  811. X        if ( value == NULL ) {
  812. X        fprintf(stderr,
  813. X            "%s: bad value '%s' for %s (not found in param file)\n",
  814. X            Progname, p->value, p->name);
  815. X        exit(1);
  816. X        }
  817. X    } else {
  818. X        value = p->value;
  819. X    }
  820. X
  821. X    /*
  822. X     * Verify the parameter value.
  823. X     */
  824. X    if ( regex(p->val_spec->re,value) == NULL ) {
  825. X        fprintf(stderr,
  826. X        "%s: bad value '%s(%s)' for %s (illegal %s value)\n",
  827. X        Progname, value, p->value, p->name, p->val_spec->descrip);
  828. X        exit(1);
  829. X    }
  830. X
  831. X    /*
  832. X     * Generate the printer configuration string.
  833. X     */
  834. X    Dprintf(3)(stderr,"exec_param> initializing '%s' to '%s(%s)'\n",
  835. X        p->name, value, p->value);
  836. X    if ( fp != NULL )
  837. X        fprintf(fp, p->cmd, value);
  838. X
  839. X    }
  840. X
  841. X}
  842. X
  843. X
  844. X/*
  845. X * dump_param() - Dumps a list of the available configuration parameters.
  846. X *
  847. X * Arguments:    File stream to send listing to.
  848. X *
  849. X * Returns:    Nothing.
  850. X *
  851. X * Errors:    None.
  852. X *
  853. X * This procedure is used within the "help" to list all the available
  854. X * configuration parameters.
  855. X */
  856. Xvoid dump_param(fp)
  857. XFILE *fp;
  858. X{
  859. X    struct param_item *p;
  860. X    int col;
  861. X    fputs("    ",fp);
  862. X    for ( col = 1 , p = Param_list.next ; p != NULL ; ++col , p = p->next ) {
  863. X    if ( col == 5 ) {
  864. X        fputs("\n    ",fp);
  865. X        col = 1;
  866. X    }
  867. X    fprintf(fp,"%-16s",p->name);
  868. X    }
  869. X    putc('\n',fp);
  870. X}
  871. X
  872. END_OF_FILE_param.c
  873.     size="`wc -c < param.c`"
  874.     if test 11892 -ne "$size" ; then
  875.     echo "param.c: extraction error - got $size chars"
  876.     fi
  877. fi
  878. if test -f cmd.c -a "$1" != "-c" ; then
  879.     echo "cmd.c: file exists - will not be overwritten"
  880. else
  881.     echo "x - cmd.c (file 6 of 11, 11229 chars)"
  882.     sed -e 's/^X//' << 'END_OF_FILE_cmd.c' > cmd.c
  883. X/* @(#) cmd.c 1.1 90/06/20 23:04:22
  884. X *
  885. X * file:    cmd.c - command execution procedures
  886. X * package:    ljinit - HP LaserJet Initialization Generator
  887. X *
  888. X * These procedures handle the "setup", "font_id", and "page_id" commands.
  889. X * While most of this package is fairly generalized, the "font_id" and
  890. X * "page_id" procedures have specific knowledge of the HP LaserJet
  891. X * architecture, and furthermore, they demand that certain parameters be
  892. X * used.
  893. X *
  894. X * In particular, "font_id" makes use of the following parameters:
  895. X *
  896. X *    orientation    symbol_set    spacing    pitch    height
  897. X *    style        stroke        typeface
  898. X *
  899. X * The "page_id" command needs to access parameters named "orientation"
  900. X * and "paper_size" as well as a "page_dim" entry in the parameters file
  901. X * to calculate the page layout.  In turn, it sets the following parameters:
  902. X *
  903. X *    top_margin    text_length    vmi
  904. X *    left_margin    right_margin    hmi
  905. X *
  906. X * Edit History:
  907. X *
  908. X * Wed Feb 28 13:53:23 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  909. X *    Original composition.
  910. X * Wed Jun 20 23:02:47 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  911. X *    Cleanup and check into SCCS.
  912. X *
  913. X * Copyright 1990, Unicom Systems Development.  All rights reserved.
  914. X * See accompanying README file for terms of distribution and use.
  915. X */
  916. X
  917. X#include <stdio.h>
  918. X#include <string.h>
  919. X#include "ljinit.h"
  920. X
  921. XSCCSID("@(#) cmd.c 1.1 90/06/20 23:04:22")
  922. XCOPYRIGHT("Copyright 1990, Unicom Systems Development.  All rights reserved.")
  923. X
  924. Xstatic void get_page_dim();
  925. X
  926. X
  927. X/* 
  928. X * find_cmd() - Locate handler for a command.
  929. X *
  930. X * Arguments:    Name of the command to be executed.
  931. X *
  932. X * Returns:    Pointer to a procedure which handles this command.
  933. X *
  934. X * Errors:    NULL if an unknown command name is specified.
  935. X */
  936. Xvoid (*find_cmd(name))()
  937. Xchar *name;
  938. X{
  939. X    if ( stricmp(name,"setup") == 0 )        return cmd_setup;
  940. X    if ( stricmp(name,"font_id") == 0 )        return cmd_font_id;
  941. X    if ( stricmp(name,"page_id") == 0 )        return cmd_page_id;
  942. X    return (void (*)())NULL;
  943. X}
  944. X
  945. X
  946. X/*
  947. X * cmd_setup() - Execute the specified "setup".
  948. X *
  949. X * Arguments:    The name of a "setup".
  950. X *
  951. X * Returns:    Nothing.
  952. X *
  953. X * Errors:    Displays a diagnostic message and aborts program on error.
  954. X *
  955. X * The "Config_file" is searched for the specified "setup", and the arguments
  956. X * in this record are evaluated.
  957. X */
  958. Xvoid cmd_setup(value)
  959. Xchar *value;
  960. X{
  961. X    char *bufp, *savebuf;
  962. X    extern void free();
  963. X
  964. X    Dprintf(2)(stderr,"cmd_setup> loading setup '%s'\n", value);
  965. X
  966. X    /*
  967. X     * Locate this setup in the configuration file.
  968. X     */
  969. X    bufp = fgetrec(Fp_config,"setup",value,(char *)NULL);
  970. X    if ( bufp == NULL ) {
  971. X    fprintf(stderr, "%s(%s): setup '%s' not found in config file\n",
  972. X        Progname, Config_file, value);
  973. X    exit(1);
  974. X    }
  975. X
  976. X    /*
  977. X     * Go through all of the items in this setup.  We need to make a copy
  978. X     * of the setup in case we go recursive or cause fgetrec() to be run.
  979. X     */
  980. X    savebuf = bufp = Sstrdup(bufp);
  981. X    while ( *bufp != '\0' ) {
  982. X    if ( set_param(strfield(&bufp)) != 0 ) {
  983. X        fprintf(stderr,"%s: error processing setup '%s' - %s\n",
  984. X        Progname, value, Err_buf);
  985. X        exit(1);
  986. X    }
  987. X    }
  988. X    free(savebuf);
  989. X
  990. X}
  991. X
  992. X
  993. X/*
  994. X * cmd_font_id() - Execute the specified "font_id".
  995. X *
  996. X * Arguments:    The name of a "font_id".
  997. X *
  998. X * Returns:    Nothing.
  999. X *
  1000. X * Errors:    Displays a diagnostic message and aborts program on error.
  1001. X *
  1002. X * The "Config_file" is searched for the specified "font_id", and the
  1003. X * parameters corresponding to a font definition (listed in "font_component[]")
  1004. X * are loaded from this record.
  1005. X */
  1006. Xvoid cmd_font_id(value)
  1007. Xchar *value;
  1008. X{
  1009. X    char *bufp, spec[BUFLEN];
  1010. X    int i;
  1011. X
  1012. X    /*
  1013. X     * The "font_component" array contains the names of all the parameters
  1014. X     * in a "font_id" record, in the order in which they appear.
  1015. X     */
  1016. X    static char *font_component[] = {
  1017. X    "orientation", "symbol_set", "spacing", "pitch",
  1018. X    "height", "style", "stroke", "typeface", NULL
  1019. X    };
  1020. X
  1021. X    Dprintf(2)(stderr,"cmd_font_id> loading font_id '%s'\n", value);
  1022. X
  1023. X    /*
  1024. X     * Locate this font_id in the configuration file.
  1025. X     */
  1026. X    bufp = fgetrec(Fp_config,"font_id",value,(char *)NULL);
  1027. X    if ( bufp == NULL ) {
  1028. X    fprintf(stderr, "%s(%s): font_id '%s' not found in config file\n",
  1029. X        Progname, Config_file, value);
  1030. X    exit(1);
  1031. X    }
  1032. X
  1033. X    /*
  1034. X     * Load the components from the located record.
  1035. X     */
  1036. X    for ( i = 0 ; *bufp != '\0' && font_component[i] != NULL ; ++i ) {
  1037. X    strcat( strcat( strcpy(spec,font_component[i]), "="), strfield(&bufp) );
  1038. X    if ( set_param(spec) != 0 ) {
  1039. X        fprintf(stderr,"%s: error processing font_id '%s' - %s\n",
  1040. X        Progname, value, Err_buf);
  1041. X        exit(1);
  1042. X    }
  1043. X    }
  1044. X    if ( font_component[i] != NULL ) {
  1045. X    fprintf(stderr,"%s(%s): not enough fields in font_id '%s'\n",
  1046. X        Progname, Config_file, value);
  1047. X    exit(1);
  1048. X    }
  1049. X    if ( *bufp != '\0' ) {
  1050. X    fprintf(stderr,"%s(%s): too many fields in font_id '%s'\n",
  1051. X        Progname, Config_file, value);
  1052. X    exit(1);
  1053. X    }
  1054. X
  1055. X}
  1056. X
  1057. X
  1058. X/*
  1059. X * Items in a "page_dim" record which define the page dimensions.
  1060. X */
  1061. X#define DIM_PHYSICAL_PAGE_WID        0    /* dim A */
  1062. X#define DIM_PHYSICAL_PAGE_LEN        1    /* dim B */
  1063. X#define DIM_LOGICAL_PAGE_WID        2    /* dim C */
  1064. X#define DIM_MAX_LOGICAL_PAGE_LEN    3    /* dim D */
  1065. X#define DIM_LEFT_UNUSABLE_AREA        4    /* dim E */
  1066. X#define DIM_RIGHT_UNUSABLE_AREA        5    /* dim F */
  1067. X#define DIM_MIN_TOP_MARG        6    /* dim G */
  1068. X#define DIM_MIN_BOT_MARG        7    /* dim H */
  1069. X#define NUM_DIM_ITEMS            8
  1070. X
  1071. X/*
  1072. X * Items in a "page_id" record which define the page layout.
  1073. X */
  1074. X#define PAGE_LEFT_MARG        0    /* left margin in inches          */
  1075. X#define PAGE_RIGHT_MARG        1    /* right margin in inches          */
  1076. X#define PAGE_NUM_COLS        2    /* number of printable columns          */
  1077. X#define PAGE_TOP_MARG        3    /* top margin in inches              */
  1078. X#define PAGE_BOT_MARG        4    /* bottom margin in inches          */
  1079. X#define PAGE_NUM_LINES        5    /* number of printable lines          */
  1080. X#define NUM_PAGE_ITEMS        6
  1081. X
  1082. X/*
  1083. X * cmd_page_id() - Execute the specified "page_id".
  1084. X *
  1085. X * Arguments:    The name of a paget_id".
  1086. X *
  1087. X * Returns:    Nothing.
  1088. X *
  1089. X * Errors:    Displays a diagnostic message and aborts program on error.
  1090. X *
  1091. X * The "Config_file" is searched for the specified "page_id", and the
  1092. X * parameters associated with page layout are calculated and loaded from
  1093. X * the information in this record.  The "Param_file" will be consulted
  1094. X * for the "page_dim" record which lists the physical and logical page
  1095. X * dimensions for the selected page type and orientation.
  1096. X */
  1097. Xvoid cmd_page_id(value)
  1098. Xchar *value;
  1099. X{
  1100. X    int i;
  1101. X    char *bufp, spec[BUFLEN];
  1102. X    double printable_line_width, cols_per_inch;
  1103. X    double left_margin, right_margin;
  1104. X    double printable_line_height, lines_per_inch;
  1105. X    double page_dim[NUM_DIM_ITEMS], page_layout[NUM_PAGE_ITEMS];
  1106. X    extern double atof();
  1107. X
  1108. X    Dprintf(2)(stderr,"cmd_page_id> loading page_id '%s'\n", value);
  1109. X
  1110. X    /*
  1111. X     * Locate this page_id in the configuration file.
  1112. X     */
  1113. X    bufp = fgetrec(Fp_config,"page_id",value,(char *)NULL);
  1114. X    if ( bufp == NULL ) {
  1115. X    fprintf(stderr, "%s(%s): page_id '%s' not found in config file\n",
  1116. X        Progname, Config_file, value);
  1117. X    exit(1);
  1118. X    }
  1119. X
  1120. X    /*
  1121. X     * Convert the fields in the record to numeric values.
  1122. X     */
  1123. X    for ( i = 0 ; *bufp != '\0' && i < NUM_PAGE_ITEMS ; ++i )
  1124. X    page_layout[i] = atof(strfield(&bufp));
  1125. X    if ( i < NUM_PAGE_ITEMS ) {
  1126. X    fprintf(stderr, "%s(%s): not enough fields in page_id '%s'",
  1127. X        Progname, Config_file, value);
  1128. X    exit(1);
  1129. X    }
  1130. X    if ( *bufp != '\0' ) {
  1131. X    fprintf(stderr, "%s(%s): too many fields in page_id '%s'",
  1132. X        Progname, Config_file, value);
  1133. X    exit(1);
  1134. X    }
  1135. X
  1136. X    /*
  1137. X     * Load in the page dimensions for the given paper_size/orientation.
  1138. X     */
  1139. X    get_page_dim(page_dim,"page_id");
  1140. X
  1141. X    /*
  1142. X     * Calculate width of printable area in inches and number of cols/inch.
  1143. X     */
  1144. X    printable_line_width =
  1145. X    page_dim[DIM_PHYSICAL_PAGE_WID] -
  1146. X        (page_layout[PAGE_LEFT_MARG]+page_layout[PAGE_RIGHT_MARG]);
  1147. X    cols_per_inch = page_layout[PAGE_NUM_COLS] / printable_line_width;
  1148. X    Dprintf(5)(stderr, "cmd_page_id> printable_line_width = %f-(%f+%f) = %f\n",
  1149. X    page_dim[DIM_PHYSICAL_PAGE_WID],
  1150. X    page_layout[PAGE_LEFT_MARG], page_layout[PAGE_RIGHT_MARG],
  1151. X    printable_line_width
  1152. X    );
  1153. X    Dprintf(5)(stderr, "cmd_page_id> cols_per_inch = %f/%f = %f\n",
  1154. X    page_layout[PAGE_NUM_COLS], printable_line_width, cols_per_inch
  1155. X    );
  1156. X
  1157. X    /*
  1158. X     * Calculate the horizontal margins.
  1159. X     */
  1160. X    left_margin = cols_per_inch *
  1161. X    (page_layout[PAGE_LEFT_MARG]-page_dim[DIM_LEFT_UNUSABLE_AREA]);
  1162. X    right_margin = page_layout[PAGE_NUM_COLS] + left_margin - 1;
  1163. X
  1164. X    /*
  1165. X     * Calculate height of printable area in inches and number of lines/inch.
  1166. X     */
  1167. X    printable_line_height =
  1168. X    page_dim[DIM_PHYSICAL_PAGE_LEN] -
  1169. X        (page_layout[PAGE_TOP_MARG]+page_layout[PAGE_BOT_MARG]);
  1170. X    lines_per_inch = page_layout[PAGE_NUM_LINES] / printable_line_height;
  1171. X    Dprintf(5)(stderr, "cmd_page_id> printable_line_height = %f-(%f+%f) = %f\n",
  1172. X    page_dim[DIM_PHYSICAL_PAGE_LEN],
  1173. X    page_layout[PAGE_TOP_MARG], page_layout[PAGE_BOT_MARG],
  1174. X    printable_line_height
  1175. X    );
  1176. X    Dprintf(5)(stderr, "cmd_page_id> lines_per_inch = %f/%f = %f\n",
  1177. X    page_layout[PAGE_NUM_LINES], printable_line_height, lines_per_inch
  1178. X    );
  1179. X
  1180. X    /*
  1181. X     * Set the page layout parameters.
  1182. X     */
  1183. X    sprintf(spec, "left_margin=%.0f", left_margin);
  1184. X    if ( set_param(spec) != 0 )
  1185. X    goto err_bad_param;
  1186. X    sprintf(spec, "right_margin=%.0f", right_margin );
  1187. X    if ( set_param(spec) != 0 )
  1188. X    goto err_bad_param;
  1189. X    sprintf(spec, "hmi=%.4f", HMI_SCALE/cols_per_inch);
  1190. X    if ( set_param(spec) != 0 )
  1191. X    goto err_bad_param;
  1192. X    sprintf(spec, "top_margin=%.0f", lines_per_inch*page_layout[PAGE_TOP_MARG]);
  1193. X    if ( set_param(spec) != 0 )
  1194. X    goto err_bad_param;
  1195. X    sprintf(spec, "text_length=%.0f", page_layout[PAGE_NUM_LINES]);
  1196. X    if ( set_param(spec) != 0 )
  1197. X    goto err_bad_param;
  1198. X    sprintf(spec, "vmi=%.4f", VMI_SCALE/lines_per_inch);
  1199. X    if ( set_param(spec) != 0 )
  1200. X    goto err_bad_param;
  1201. X    return;
  1202. X
  1203. Xerr_bad_param:
  1204. X    fprintf(stderr,"%s: error processing page_id '%s' - %s\n",
  1205. X    Progname, value, Err_buf);
  1206. X    exit(1);
  1207. X}
  1208. X
  1209. X
  1210. Xstatic void get_page_dim(page_dim,cmdname)
  1211. Xdouble page_dim[];
  1212. Xchar *cmdname;
  1213. X{
  1214. X    int i;
  1215. X    char *ps, *or, *bufp;
  1216. X    double atof();
  1217. X
  1218. X    /*
  1219. X     * Get the paper size and page orientation.
  1220. X     */
  1221. X    if ( (ps=get_param("paper_size")) == NULL ) {
  1222. X    fprintf(stderr,"%s: must define an 'page_size' before doing '%s'\n",
  1223. X        Progname, cmdname);
  1224. X    exit(1);
  1225. X    }
  1226. X    if ( (or=get_param("orientation")) == NULL ) {
  1227. X    fprintf(stderr,"%s: must define an 'orientation' before doing '%s'\n",
  1228. X        Progname, cmdname);
  1229. X    exit(1);
  1230. X    }
  1231. X
  1232. X    /*
  1233. X     * Now get the paper dimensions based upon the paper_size and orientation.
  1234. X     */
  1235. X    bufp = fgetrec(Fp_param,"page_dim",ps,or,(char *)NULL);
  1236. X    if ( bufp == NULL ) {
  1237. X    fprintf(stderr,"%s(%s): page_dim for %s/%s not found",
  1238. X        Progname, Param_file, ps, or);
  1239. X    exit(1);
  1240. X    }
  1241. X
  1242. X    /*
  1243. X     * Convert the paper dimension fields to values in inches.
  1244. X     */
  1245. X    for ( i = 0 ; *bufp != '\0' && i < NUM_DIM_ITEMS ; ++i )
  1246. X    page_dim[i] = atof(strfield(&bufp)) / DOTS_INCH;
  1247. X    if ( i < NUM_DIM_ITEMS ) {
  1248. X    fprintf(stderr, "%s(%s): not enough fields in page_dim for %s/%s",
  1249. X        Progname, Param_file, ps, or);
  1250. X    exit(1);
  1251. X    }
  1252. X    if ( *bufp != '\0' ) {
  1253. X    fprintf(stderr, "%s(%s): too many fields in page_dim for %s/%s",
  1254. X        Progname, Param_file, ps, or);
  1255. X    exit(1);
  1256. X    }
  1257. X
  1258. X}
  1259. X
  1260. END_OF_FILE_cmd.c
  1261.     size="`wc -c < cmd.c`"
  1262.     if test 11229 -ne "$size" ; then
  1263.     echo "cmd.c: extraction error - got $size chars"
  1264.     fi
  1265. fi
  1266. if test -f misc.c -a "$1" != "-c" ; then
  1267.     echo "misc.c: file exists - will not be overwritten"
  1268. else
  1269.     echo "x - misc.c (file 7 of 11, 4200 chars)"
  1270.     sed -e 's/^X//' << 'END_OF_FILE_misc.c' > misc.c
  1271. X/* @(#) misc.c 1.1 90/06/20 23:04:25
  1272. X *
  1273. X * file:    misc.c - support procedures
  1274. X * package:    ljinit - HP LaserJet Initialization Generator
  1275. X *
  1276. X * Edit History:
  1277. X *
  1278. X * Wed Feb 28 13:53:23 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  1279. X *    Original composition.
  1280. X * Wed Jun 20 23:02:47 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  1281. X *    Cleanup and check into SCCS.
  1282. X *
  1283. X * Copyright 1990, Unicom Systems Development.  All rights reserved.
  1284. X * See accompanying README file for terms of distribution and use.
  1285. X */
  1286. X
  1287. X#include <stdio.h>
  1288. X#include <ctype.h>
  1289. X#include <string.h>
  1290. X#include <varargs.h>
  1291. X#include "ljinit.h"
  1292. X
  1293. XSCCSID("@(#) misc.c 1.1 90/06/20 23:04:25")
  1294. XCOPYRIGHT("Copyright 1990, Unicom Systems Development.  All rights reserved.")
  1295. X
  1296. X/*
  1297. X * fgetrec() - Retrieve a record from a file.  The first parameter is the
  1298. X * opened stream to search, followed by a list of field values to match.  A
  1299. X * pointer to the record, with the matched fields removed, is returned.  NULL
  1300. X * is returned upon lookup failure.
  1301. X */
  1302. X/*VARARGS1*/
  1303. Xchar *fgetrec(fp,va_alist)
  1304. XFILE *fp;
  1305. Xva_dcl
  1306. X{
  1307. X    va_list args;
  1308. X    int i;
  1309. X    char *bufp, *field[16];
  1310. X
  1311. X    /*
  1312. X     * Load in the list of fields.
  1313. X     */
  1314. X    va_start(args);
  1315. X    for ( i = 0 ; (field[i]=va_arg(args,char *)) != NULL ; ++i ) ;
  1316. X    va_end(args);
  1317. X
  1318. X    /*
  1319. X     * Go searching for the record which matches these fields.
  1320. X     */
  1321. X    rewind(fp);
  1322. X    while ( (bufp=fgetline(fp)) != NULL ) {
  1323. X    for ( i = 0 ; ; ++i ) {
  1324. X        if ( field[i] == NULL )
  1325. X        return bufp;
  1326. X        if ( stricmp(field[i],strfield(&bufp)) != 0 )
  1327. X        break;
  1328. X    }
  1329. X    }
  1330. X
  1331. X    return (char *) NULL;
  1332. X}
  1333. X
  1334. X
  1335. X/*
  1336. X * fgetline() - Get the next line from a stream.  Leading and trailing
  1337. X * whitespace is ignored.  Comments introduced with "#" are stripped.
  1338. X * Long lines may be continued by backslashes.  Blank lines are ignored.
  1339. X * Returns pointer to static data, or NULL on end of file.
  1340. X */
  1341. Xchar *fgetline(fp)
  1342. XFILE *fp;
  1343. X{
  1344. X    static char buf[BUFLEN];
  1345. X    int nchars;
  1346. X    char *bufp;
  1347. X
  1348. X    /*
  1349. X     * Clear out the buffer.
  1350. X     */
  1351. X    buf[0] = '\0';
  1352. X    nchars = 0;
  1353. X
  1354. X    /*
  1355. X     * Keep reading until we have a full line loaded.
  1356. X     */
  1357. X    for (;;) {
  1358. X
  1359. X    /*
  1360. X     * Read into the end of the buffer.
  1361. X     */
  1362. X    if ( fgets(buf+nchars,(int)sizeof(buf)-nchars,fp) == NULL )
  1363. X        return (char *) NULL;
  1364. X
  1365. X    /*
  1366. X     * Strip comments, leading/trailing white space.
  1367. X     */
  1368. X    bufp = strtrim(buf);
  1369. X    nchars = strlen(buf);
  1370. X
  1371. X    /*
  1372. X     * Ignore blank lines.
  1373. X     */
  1374. X    if ( nchars == 0 )
  1375. X        continue;
  1376. X
  1377. X    /*
  1378. X     * If there isn't a continued line then return what we have.
  1379. X     */
  1380. X    if ( buf[nchars-1] != '\\' )
  1381. X        return bufp;
  1382. X
  1383. X    /*
  1384. X     * Remove the continuation character.
  1385. X     */
  1386. X    buf[--nchars] = '\0';
  1387. X
  1388. X    }
  1389. X
  1390. X    /*NOTREACHED*/
  1391. X}
  1392. X
  1393. X
  1394. X/*
  1395. X * strfield() - Retrieve the first space-delimited field in a line, and
  1396. X * advance the buffer pointer to the start of the next field.
  1397. X */
  1398. Xchar *strfield(bufp)
  1399. Xchar **bufp;
  1400. X{
  1401. X    register char *w1, *w2;
  1402. X    for ( w1 = *bufp ; isspace(*w1) ; ++w1 ) ;
  1403. X    w2 = w1;
  1404. X    if ( *w2 != '\0' ) {
  1405. X    for ( ++w2 ; *w2 != '\0' && !isspace(*w2) ; ++w2 ) ;
  1406. X    if ( *w2 != '\0' )
  1407. X        for ( *w2++ = '\0' ; isspace(*w2) ; ++w2 ) ;
  1408. X    }
  1409. X    *bufp = w2;
  1410. X    return w1;
  1411. X}
  1412. X
  1413. X
  1414. X/*
  1415. X * stricmp() - Compare two strings, ignoring punctuation and letter case.
  1416. X */
  1417. Xint stricmp(s1,s2)
  1418. Xregister char *s1, *s2;
  1419. X{
  1420. X    int d;
  1421. X    do {
  1422. X    while ( *s1 != '\0' && !isalnum(*s1) )
  1423. X        ++s1;
  1424. X    while ( *s2 != '\0' && !isalnum(*s2) )
  1425. X        ++s2;
  1426. X    d = tolower(*s1) - tolower(*s2);
  1427. X    } while ( d == 0 && *s1++ != '\0' && *s2++ != '\0' );
  1428. X    return d;
  1429. X}
  1430. X
  1431. X
  1432. X/*
  1433. X * strtrim() - Trim comments and leading/trailing white space.
  1434. X */
  1435. Xchar *strtrim(buf)
  1436. Xregister char *buf;
  1437. X{
  1438. X    register char *s;
  1439. X
  1440. X    for ( ; isspace(*buf) ; ++buf ) ;
  1441. X    if ( (s=strchr(buf,'#')) != NULL )
  1442. X    *s = '\0';
  1443. X    for ( s = buf+strlen(buf)-1 ; s >= buf && isspace(*s) ; --s ) ;
  1444. X    *(++s) = '\0';
  1445. X    return buf;
  1446. X}
  1447. X
  1448. X
  1449. X/*
  1450. X * Smalloc() - Allocate memory with error checking.
  1451. X */
  1452. XPtr Smalloc(n)
  1453. Xregister unsigned n;
  1454. X{
  1455. X    extern Ptr malloc();
  1456. X    register Ptr s;
  1457. X    if ( (s=malloc(n)) == NULL ) {
  1458. X    fputs("malloc: out of space\n",stderr);
  1459. X    exit(2);
  1460. X    }
  1461. X    return s;
  1462. X}
  1463. X
  1464. X
  1465. X/*
  1466. X * Sstrdup() - Duplicate a string with error checking.
  1467. X */
  1468. Xchar *Sstrdup(s)
  1469. Xregister char *s;
  1470. X{
  1471. X    return strcpy( Smalloc((unsigned)strlen(s)+1), s );
  1472. X}
  1473. X
  1474. END_OF_FILE_misc.c
  1475.     size="`wc -c < misc.c`"
  1476.     if test 4200 -ne "$size" ; then
  1477.     echo "misc.c: extraction error - got $size chars"
  1478.     fi
  1479. fi
  1480. if test -f ljconfig.dat -a "$1" != "-c" ; then
  1481.     echo "ljconfig.dat: file exists - will not be overwritten"
  1482. else
  1483.     echo "x - ljconfig.dat (file 8 of 11, 8793 chars)"
  1484.     sed -e 's/^X//' << 'END_OF_FILE_ljconfig.dat' > ljconfig.dat
  1485. X# @(#) ljconfig.dat 1.1.1.1 90/06/22 19:13:25
  1486. X#
  1487. X# file:        ljconfig.dat - site specific configuration definitions
  1488. X# package:    ljinit - HP LaserJet Initialization Generator
  1489. X#
  1490. X# This file contains the site-specific definitions which are used to evaluate
  1491. X# the "setup", "pageid", and "fontid" commands.  The file is broken into three
  1492. X# sections, corresponding to the three commands.  Chances are good you'll want
  1493. X# to customize this file for the printer configurations you frequently use.
  1494. X#
  1495. X# Edit History:
  1496. X#
  1497. X# Wed Feb 28 13:53:23 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  1498. X#    Original composition.
  1499. X# Wed Jun 20 23:02:47 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  1500. X#     Cleanup and check into SCCS.
  1501. X#
  1502. X# Copyright 1990, Unicom Systems Development.  All rights reserved.
  1503. X# See accompanying README file for terms of distribution and use.
  1504. X#
  1505. X
  1506. X##############################################################################
  1507. X#
  1508. X# Setup Definitions
  1509. X#
  1510. X
  1511. X#
  1512. X# There must be a "default" setup defined.  It is evaluated before any of the
  1513. X# specifications on the command line, unless "-I" is specified to inhibit it.
  1514. X#
  1515. Xsetup default    setup=letter
  1516. X
  1517. X#
  1518. X# The "common" setup is a convenience to describe the things which are used
  1519. X# in most of the other setup definitions.
  1520. X#
  1521. Xsetup common                \
  1522. X        reset=yes        \
  1523. X        paper_size=letter    \
  1524. X        paper_source=internal    \
  1525. X        line_term=map_lf    \
  1526. X        line_wrap=disable    \
  1527. X        perf_skip=enable
  1528. X
  1529. X#
  1530. X# And finally, below are the setups which we use locally for 8.5x11 printing.
  1531. X#
  1532. Xsetup letter    setup=common font_id=I000  page_id=letter
  1533. Xsetup form    setup=common font_id=I002  page_id=form
  1534. Xsetup listing    setup=common font_id=I002  page_id=listing
  1535. Xsetup wide    setup=common font_id=I001  page_id=wide
  1536. Xsetup land    setup=common font_id=I001L page_id=land
  1537. X
  1538. X#
  1539. X# And the setup for envelope printing.
  1540. X#
  1541. Xsetup envelope                \
  1542. X        reset=yes        \
  1543. X        paper_size=com10    \
  1544. X        paper_source=manual_env    \
  1545. X        line_term=map_lf    \
  1546. X        line_wrap=disable    \
  1547. X        perf_skip=enable    \
  1548. X        font_id=I000L        \
  1549. X        clear_margins=yes    \
  1550. X        top_margin=10        \
  1551. X        left_margin=30
  1552. X
  1553. X
  1554. X############################################################################## 
  1555. X#
  1556. X# Page Layout Definitions
  1557. X#
  1558. X# A page layout definition specifies the desired margins (in inches) and the
  1559. X# number of chars/line and lines/page.  From this information, the following
  1560. X# parameters are automatically calculated and set:
  1561. X#
  1562. X#    left_margin    right_margin    hmi
  1563. X#    top_margin    text_length    vmi
  1564. X#
  1565. X#                   left  right    num    top    bot    num    intended use 
  1566. X#                   marg   marg   cols   marg   marg  lines    (orient/font)
  1567. X
  1568. Xpage_id  letter     0.60   0.60     72   0.50   0.50     66  # port/10cpi
  1569. Xpage_id  form       0.60   0.60     78   0.50   0.50     66  # port/12cpi
  1570. Xpage_id  listing    1.00   1.00     80   0.50   0.50     66  # port/12cpi
  1571. Xpage_id  wide       0.50   0.50    132   0.50   0.50     66  # port/teeny
  1572. Xpage_id  land       0.50   0.50    167   0.50   0.50     66  # land/teeny
  1573. X
  1574. X
  1575. X##############################################################################
  1576. X#
  1577. X# Font Definitions
  1578. X#
  1579. X# A font definition specifies all the components which comprise a font.
  1580. X# They are, in order:
  1581. X#
  1582. X#    orientation    symbol_set    spacing        pitch
  1583. X#    height        style        stroke        typeface
  1584. X#
  1585. X# The distributed definitions are for a LaserJet IIP, and the names
  1586. X# correspond to those printed on the IIP test sheet (except I append
  1587. X# "L" for landscape fonts).
  1588. X#
  1589. X
  1590. X#
  1591. X# Portrait Fonts
  1592. X#
  1593. X#               orien symbol_set space pitch ht    style   stroke typeface 
  1594. X
  1595. Xfont_id  I000   port  hp_roman8  fixed 10    12    upright medium courier
  1596. Xfont_id  I001   port  hp_roman8  fixed 16.67  8.5  upright medium line_printer
  1597. Xfont_id  I002   port  hp_roman8  fixed 12    10    upright medium courier
  1598. Xfont_id  I003   port  hp_roman8  fixed 12    10    upright bold   courier
  1599. Xfont_id  I004   port  hp_roman8  fixed 12    10    italic  bold   courier
  1600. Xfont_id  I005   port  hp_roman8  fixed 10    12    upright bold   courier
  1601. Xfont_id  I006   port  hp_roman8  fixed 10    12    upright bold   courier
  1602. Xfont_id  I007   port  iso_100    fixed 16.67  8.5  upright medium line_printer
  1603. Xfont_id  I008   port  iso_100    fixed 12    10    upright medium courier
  1604. Xfont_id  I009   port  iso_100    fixed 12    10    upright bold   courier
  1605. Xfont_id  I010   port  iso_100    fixed 12    10    italic  medium courier
  1606. Xfont_id  I011   port  iso_100    fixed 10    12    upright medium courier
  1607. Xfont_id  I012   port  iso_100    fixed 10    12    upright bold   courier
  1608. Xfont_id  I013   port  iso_100    fixed 10    12    italic  medium courier
  1609. Xfont_id  I014   port  pc_8       fixed 16.67  8.5  upright medium line_printer
  1610. Xfont_id  I015   port  pc_8       fixed 12    10    upright medium courier
  1611. Xfont_id  I016   port  pc_8       fixed 12    10    upright bold   courier
  1612. Xfont_id  I017   port  pc_8       fixed 12    10    italic  medium courier
  1613. Xfont_id  I018   port  pc_8       fixed 10    12    upright medium courier
  1614. Xfont_id  I019   port  pc_8       fixed 10    12    upright bold   courier
  1615. Xfont_id  I020   port  pc_8       fixed 10    12    italic  medium courier
  1616. Xfont_id  I021   port  pc_8dn     fixed 16.67  8.5  upright medium line_printer
  1617. Xfont_id  I022   port  pc_8dn     fixed 12    10    upright medium courier
  1618. Xfont_id  I023   port  pc_8dn     fixed 12    10    upright bold   courier
  1619. Xfont_id  I024   port  pc_8dn     fixed 12    10    italic  medium courier
  1620. Xfont_id  I025   port  pc_8dn     fixed 10    12    upright medium courier
  1621. Xfont_id  I026   port  pc_8dn     fixed 10    12    upright bold   courier
  1622. Xfont_id  I027   port  pc_8dn     fixed 10    12    italic  medium courier
  1623. Xfont_id  I028   port  pc_850     fixed 16.67  8.5  upright medium line_printer
  1624. Xfont_id  I029   port  pc_850     fixed 12    10    upright medium courier
  1625. Xfont_id  I030   port  pc_850     fixed 12    10    upright bold   courier
  1626. Xfont_id  I031   port  pc_850     fixed 12    10    italic  medium courier
  1627. Xfont_id  I032   port  pc_850     fixed 10    12    upright medium courier
  1628. Xfont_id  I033   port  pc_850     fixed 10    12    upright bold   courier
  1629. Xfont_id  I034   port  pc_850     fixed 10    12    italic  medium courier
  1630. X
  1631. X#
  1632. X# Landscape Fonts
  1633. X#
  1634. X#               orien symbol_set space pitch ht    style   stroke typeface 
  1635. X
  1636. Xfont_id  I000L  land  hp_roman8  fixed 10    12    upright medium courier
  1637. Xfont_id  I001L  land  hp_roman8  fixed 16.67  8.5  upright medium line_printer
  1638. Xfont_id  I002L  land  hp_roman8  fixed 12    10    upright medium courier
  1639. Xfont_id  I003L  land  hp_roman8  fixed 12    10    upright bold   courier
  1640. Xfont_id  I004L  land  hp_roman8  fixed 12    10    italic  bold   courier
  1641. Xfont_id  I005L  land  hp_roman8  fixed 10    12    upright bold   courier
  1642. Xfont_id  I006L  land  hp_roman8  fixed 10    12    upright bold   courier
  1643. Xfont_id  I007L  land  iso_100    fixed 16.67  8.5  upright medium line_printer
  1644. Xfont_id  I008L  land  iso_100    fixed 12    10    upright medium courier
  1645. Xfont_id  I009L  land  iso_100    fixed 12    10    upright bold   courier
  1646. Xfont_id  I010L  land  iso_100    fixed 12    10    italic  medium courier
  1647. Xfont_id  I011L  land  iso_100    fixed 10    12    upright medium courier
  1648. Xfont_id  I012L  land  iso_100    fixed 10    12    upright bold   courier
  1649. Xfont_id  I013L  land  iso_100    fixed 10    12    italic  medium courier
  1650. Xfont_id  I014L  land  pc_8       fixed 16.67  8.5  upright medium line_printer
  1651. Xfont_id  I015L  land  pc_8       fixed 12    10    upright medium courier
  1652. Xfont_id  I016L  land  pc_8       fixed 12    10    upright bold   courier
  1653. Xfont_id  I017L  land  pc_8       fixed 12    10    italic  medium courier
  1654. Xfont_id  I018L  land  pc_8       fixed 10    12    upright medium courier
  1655. Xfont_id  I019L  land  pc_8       fixed 10    12    upright bold   courier
  1656. Xfont_id  I020L  land  pc_8       fixed 10    12    italic  medium courier
  1657. Xfont_id  I021L  land  pc_8dn     fixed 16.67  8.5  upright medium line_printer
  1658. Xfont_id  I022L  land  pc_8dn     fixed 12    10    upright medium courier
  1659. Xfont_id  I023L  land  pc_8dn     fixed 12    10    upright bold   courier
  1660. Xfont_id  I024L  land  pc_8dn     fixed 12    10    italic  medium courier
  1661. Xfont_id  I025L  land  pc_8dn     fixed 10    12    upright medium courier
  1662. Xfont_id  I026L  land  pc_8dn     fixed 10    12    upright bold   courier
  1663. Xfont_id  I027L  land  pc_8dn     fixed 10    12    italic  medium courier
  1664. Xfont_id  I028L  land  pc_850     fixed 16.67  8.5  upright medium line_printer
  1665. Xfont_id  I029L  land  pc_850     fixed 12    10    upright medium courier
  1666. Xfont_id  I030L  land  pc_850     fixed 12    10    upright bold   courier
  1667. Xfont_id  I031L  land  pc_850     fixed 12    10    italic  medium courier
  1668. Xfont_id  I032L  land  pc_850     fixed 10    12    upright medium courier
  1669. Xfont_id  I033L  land  pc_850     fixed 10    12    upright bold   courier
  1670. Xfont_id  I034L  land  pc_850     fixed 10    12    italic  medium courier
  1671. X
  1672. END_OF_FILE_ljconfig.dat
  1673.     size="`wc -c < ljconfig.dat`"
  1674.     if test 8793 -ne "$size" ; then
  1675.     echo "ljconfig.dat: extraction error - got $size chars"
  1676.     fi
  1677. fi
  1678. if test -f ljparam.dat -a "$1" != "-c" ; then
  1679.     echo "ljparam.dat: file exists - will not be overwritten"
  1680. else
  1681.     echo "x - ljparam.dat (file 9 of 11, 9636 chars)"
  1682.     sed -e 's/^X//' << 'END_OF_FILE_ljparam.dat' > ljparam.dat
  1683. X# @(#) ljparam.dat 1.1 90/06/20 23:04:24
  1684. X#
  1685. X# file:        ljparam.dat - device specific definitions
  1686. X# package:    ljinit - HP LaserJet Initialization Generator
  1687. X#
  1688. X# Edit History:
  1689. X#
  1690. X# Wed Feb 28 13:53:23 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  1691. X#    Original composition.
  1692. X# Wed Jun 20 23:02:47 1990 - Chip Rosenthal <chip@chinacat.Unicom.COM>
  1693. X#    Cleanup and check into SCCS.
  1694. X#
  1695. X# Copyright 1990, Unicom Systems Development.  All rights reserved.
  1696. X# See accompanying README file for terms of distribution and use.
  1697. X#
  1698. X
  1699. X
  1700. X##############################################################################
  1701. X#
  1702. X# This file describes all the device-dependant parameters for the printer.
  1703. X# The distributed version has been tested with an HP LaserJet IIP printer.
  1704. X#
  1705. X# Some notes on the format of this file:
  1706. X#   - It is a sequence of records with space delimited fields.
  1707. X#   - Everything from a '#' to the end of line is ignored.
  1708. X#   - Blank lines are ignored.
  1709. X#   - Long lines may be continued with a backslash.
  1710. X#   - Punctuation and letter case are insignificant in the field values.
  1711. X#
  1712. X# There are three kinds of records in this file:
  1713. X#   - "param" records - describes a printer configuration parameter.
  1714. X#   - param value records - declares mnemonic names usable with params.
  1715. X#   - "page_dim" records - describes page dimensions.
  1716. X#
  1717. X# This file is broken into three sections, into which the three record types
  1718. X# are grouped.  Descriptions at the start of each section describes the
  1719. X# records which appear there.
  1720. X
  1721. X
  1722. X##############################################################################
  1723. X#
  1724. X# Parameter Definitions
  1725. X#
  1726. X# All of the LaserJet printer configuration parameters are defined here.
  1727. X# Each line is an entry which describes one parameter.  The order of the
  1728. X# "param" records is critical, they are emitted to the printer in the
  1729. X# order they occur in this file.  Also, be careful about changing names
  1730. X# around -- the procedures which handle the "page_id" and "font_id"
  1731. X# commands have specific knowledge of the parameter names they need to set.
  1732. X#
  1733. X# Each "param" record must have the following four fields:
  1734. X#
  1735. X# (1) The name of the printer configuration parameter.
  1736. X#
  1737. X# (2) The HP PCL code to configure this parameter.  This code will be
  1738. X#     run through a printf() command, so ensure that special characters
  1739. X#     are escaped appropriately.  A "%s" within the code will be replaced
  1740. X#     with the parameter value specified by the user.
  1741. X#
  1742. X# (3) A flag which indicates whether a lookup should be performed on this
  1743. X#     parameter.  If the value is "yes" (or "YES"), then "ljinit" will
  1744. X#     take the user-supplied value and translate it according to the
  1745. X#     definitions in section two of this file.  Any other value in this
  1746. X#     field means that the value specified by the user is what should
  1747. X#     be incorporated directly into the command sent to the printer.
  1748. X#
  1749. X# (4) A description of the allowed types for the value.  The following
  1750. X#     types may be given:
  1751. X#
  1752. X#         STRING    An arbitrary tesxt string.
  1753. X#         INT    A positive integer.
  1754. X#     SIGNINT    An integer.
  1755. X#    FLOAT2    A floating point value with up to 2 decimal digits.
  1756. X#    FLOAT4    A floating point value with up to 4 decimal digits.
  1757. X#
  1758. X#    name        code        lookup?    value_type
  1759. X#
  1760. Xparam    reset        \033E        no    STRING
  1761. Xparam    paper_source    \033&l%sH    yes    INT
  1762. Xparam    paper_size    \033&l%sA    yes    INT
  1763. Xparam    line_term    \033&k%sG    yes    INT
  1764. Xparam    line_wrap    \033&s%sC    yes    INT
  1765. Xparam    orientation    \033&l%sO    yes    INT
  1766. Xparam    symbol_set    \033(%s        yes    STRING
  1767. Xparam    spacing        \033(s%sP    yes    INT
  1768. Xparam    pitch        \033(s%sH    no    FLOAT2
  1769. Xparam    height        \033(s%sV    no    FLOAT2
  1770. Xparam    style        \033(s%sS    yes    INT
  1771. Xparam    stroke        \033(s%sB    yes    SIGNINT
  1772. Xparam    typeface    \033(s%sT    yes    INT
  1773. Xparam    long_offset    \033&l%sU    no    SIGNINT
  1774. Xparam    short_offset    \033&l%sZ    no    SIGNINT
  1775. Xparam    clear_margins    \0339        no    STRING
  1776. Xparam    hmi        \033&k%sH    no    FLOAT4
  1777. Xparam    left_margin    \033&a%sL    no    INT
  1778. Xparam    right_margin    \033&a%sM    no    INT
  1779. Xparam    vmi        \033&l%sC    no    FLOAT4
  1780. Xparam    text_length    \033&l%sF    no    INT
  1781. Xparam    top_margin    \033&l%sE    no    INT
  1782. Xparam    perf_skip    \033&l%sL    yes    INT
  1783. X
  1784. X
  1785. X##############################################################################
  1786. X#
  1787. X# Parameter Values
  1788. X#
  1789. X# When the third field in a "param" record is "yes", then the user's
  1790. X# value will be translated according to the rules in this section.
  1791. X# Each translation record has three fields:
  1792. X#
  1793. X#   - The parameter name to which this translation applies.
  1794. X#
  1795. X#   - The parameter value specified by the user.
  1796. X#
  1797. X#   - The parameter value to substitute for the user's value.
  1798. X#
  1799. X# Remember that letter case and punctuation are not significant when
  1800. X# matches upon fields 1 and 2 are performed.
  1801. X#
  1802. X
  1803. Xorientation    PORT            0    # portrait page orientation
  1804. Xorientation    LAND            1    # landscape page orientation
  1805. X
  1806. Xperf_skip    DISABLE            0    # disable perforation skip
  1807. Xperf_skip    ENABLE            1    # enable perforation skip
  1808. X
  1809. Xline_term    MAP_OFF            0    # CR=CR    LF=LF    FF=FF
  1810. Xline_term    MAP_CR            1    # CR=CR+LF LF=LF    FF=FF
  1811. Xline_term    MAP_LF            2    # CR=CR    LF=CR+LF FF=CR+FF
  1812. Xline_term    MAP_ALL            3    # CR=CR+LF LF=CR+LF FF=CR+FF
  1813. X
  1814. Xline_wrap    DISABLE            1    # disable long line wrap
  1815. Xline_wrap    ENABLE            0    # enable long line wrap
  1816. X
  1817. Xsymbol_set    HP_MATH7        0A    # HP Math-7
  1818. Xsymbol_set    HP_LINEDRAW        0B    # HP Line Draw
  1819. Xsymbol_set    ISO_60            0D    # ISO 60: Norwegian version 1
  1820. Xsymbol_set    ISO_61            1D    # ISO 61: Norwegian version 2
  1821. Xsymbol_set    HP_ROMAN        0E    # HP Roman Extension
  1822. Xsymbol_set    ISO_04            1E    # ISO 4: United Kingdom
  1823. Xsymbol_set    ISO_25            0F    # ISO 25: French
  1824. Xsymbol_set    ISO_69            1F    # ISO 69: French
  1825. Xsymbol_set    HP_GERMAN        0G    # HP German
  1826. Xsymbol_set    ISO_21            1G    # ISO 21: German
  1827. Xsymbol_set    HP_GREEK8        8G    # HP Greek-8
  1828. Xsymbol_set    ISO_15            0I    # ISO 15: Italian
  1829. Xsymbol_set    ISO_14            0K    # ISO 14: JIS ASCII
  1830. Xsymbol_set    ISO_57            2K    # ISO 57: Chinese
  1831. Xsymbol_set    TECHNICAL_7        1M    # Technical-7
  1832. Xsymbol_set    HP_MATH8        8M    # HP Math-8
  1833. Xsymbol_set    ISO_100            0N    # ISO 100: ECMA-94 (Latin 1)
  1834. Xsymbol_set    OCR_A            0O    # OCR A
  1835. Xsymbol_set    OCR_B            1O    # OCR B
  1836. Xsymbol_set    ISO_11            0S    # ISO 11: Swedish
  1837. Xsymbol_set    HP_SPANISH        1S    # HP Spanish
  1838. Xsymbol_set    ISO_17            2S    # ISO 17: Spanish
  1839. Xsymbol_set    ISO_10            3S    # ISO 10: Swedish
  1840. Xsymbol_set    ISO_16            4S    # ISO 16: Portugese
  1841. Xsymbol_set    ISO_84            5S    # ISO 84: Portugese
  1842. Xsymbol_set    ISO_85            6S    # ISO 85: Spanish
  1843. Xsymbol_set    ISO_6            0U    # ISO 6: ASCII
  1844. Xsymbol_set    HP_LEGAL        1U    # HP Legal
  1845. Xsymbol_set    ISO_2            2U    # ISO 2: Internat Ref Version
  1846. Xsymbol_set    OEM_1            7U    # OEM-1
  1847. Xsymbol_set    HP_ROMAN8        8U    # HP Roman-8
  1848. Xsymbol_set    PC_8            10U    # PC-8
  1849. Xsymbol_set    PC_8DN            11U    # PC-8 (D/N)
  1850. Xsymbol_set    HP_PIFONT        15U    # HP Pi Font
  1851. X
  1852. Xspacing        FIXED            0    # fixed font spacing
  1853. Xspacing        PROP            1    # proportional font spacing
  1854. X
  1855. Xstyle        UPRIGHT            0
  1856. Xstyle        ITALIC            1
  1857. X
  1858. Xstroke        ULTRA_THIN        -7
  1859. Xstroke        THIN            -5
  1860. Xstroke        LIGHT            -3
  1861. Xstroke        MEDIUM             0
  1862. Xstroke        BOLD             3
  1863. Xstroke        BLACK             5
  1864. Xstroke        ULTRA_BLACK         7
  1865. X
  1866. Xtypeface    LINE_PRINTER        0
  1867. Xtypeface    COURIER            3
  1868. Xtypeface    HELVETICA        4
  1869. Xtypeface    TIMES_ROMAN        5
  1870. Xtypeface    LETTER_GOTHIC        6
  1871. Xtypeface    PRESTIGE        8
  1872. Xtypeface    PRESENTATIONS        11
  1873. Xtypeface    OPTIMA            17
  1874. Xtypeface    GARAMOND        18
  1875. Xtypeface    COOPER_BLACK        19
  1876. Xtypeface    CORONET_BOLD        20
  1877. Xtypeface    BROADWAY        21
  1878. Xtypeface    BAUER_BODONI_BLACK_COND    22
  1879. Xtypeface    CENTURY_SCHOOLBOOK    23
  1880. Xtypeface    UNIVERSITY_ROMAN    24
  1881. X
  1882. Xpaper_source    CURRENT            0    # paper source unchanged
  1883. Xpaper_source    INTERNAL        1    # feed from internal tray
  1884. Xpaper_source    MANUAL            2    # paper from manual input
  1885. Xpaper_source    MANUAL_ENV        3    # envelope from manual input
  1886. Xpaper_source    LOWER            4    # lower cassette tray
  1887. X
  1888. Xpaper_size    EXECUTIVE        1    # 7.25" x 10.5" paper
  1889. Xpaper_size    LETTER            2    # 8.50" x 11.0" paper
  1890. Xpaper_size    LEGAL            3    # 8.50" x 14.0" paper
  1891. Xpaper_size    A4            26    # 210mm x 297mm paper
  1892. Xpaper_size    MONARCH            80    # letter envelope
  1893. Xpaper_size    COM10            81    # business envelope
  1894. Xpaper_size    DL            90    # 110mm x 220mm envelope
  1895. Xpaper_size    C5            91    # 162mm x 229mm envelope
  1896. X
  1897. X
  1898. X##############################################################################
  1899. X#
  1900. X# Page Dimensions (in dots)
  1901. X#
  1902. X# This section defines the dimensions of the page given particular "paper_size"
  1903. X# and "orientation" values.  This information was taken from the "LaserJet
  1904. X# Series II Technical Reference Manual".  Please don't change it.
  1905. X#
  1906. X#   A = physical page width
  1907. X#   B = physical page length
  1908. X#   C = logical page width
  1909. X#   D = max logical page length
  1910. X#   E = left physical page edge to left logical page edge
  1911. X#   F = right physical page edge to right logical page edge
  1912. X#   G = top physical page edge to top printable area edge
  1913. X#   H = bottom physical page edge to bottom printable area edge
  1914. X#
  1915. X#                             A     B     C     D     E     F     G     H
  1916. X#
  1917. Xpage_dim  letter     port  2550  3300  2400  3300    50   100    60    60
  1918. Xpage_dim  legal      port  2550  4200  2400  4200    50   100    60    60
  1919. Xpage_dim  executive  port  2175  3150  2025  3150    50   100    60    60
  1920. Xpage_dim  a4         port  2480  3507  2338  3507    50    92    60    58
  1921. Xpage_dim  com10      port  1237  2850  1087  2850    50   100    60    60
  1922. Xpage_dim  monarc     port  1162  2250  1012  2250    50   100    60    60
  1923. Xpage_dim  c5         port  1913  2704  1771  2704    50    92    60    58
  1924. Xpage_dim  dl         port  1299  2598  1157  2598    50    92    60    58
  1925. Xpage_dim  letter     land  3300  2550  3180  2550    60    60    50   100
  1926. Xpage_dim  legal      land  4200  2550  4080  2550    60    60    50   100
  1927. Xpage_dim  executive  land  3150  2175  3030  2175    60    60    50   100
  1928. Xpage_dim  a4         land  3507  2480  3389  2480    60    58    50    92
  1929. Xpage_dim  com10      land  2850  1237  2730  1237    60    60    50   100
  1930. Xpage_dim  monarc     land  2250  1162  2130  1162    60    60    50   100
  1931. Xpage_dim  c5         land  2704  1913  2586  1913    60    58    50    92
  1932. Xpage_dim  dl         land  2598  1299  2480  1299    60    58    50    92
  1933. X
  1934. END_OF_FILE_ljparam.dat
  1935.     size="`wc -c < ljparam.dat`"
  1936.     if test 9636 -ne "$size" ; then
  1937.     echo "ljparam.dat: extraction error - got $size chars"
  1938.     fi
  1939. fi
  1940. if test -f Makefile -a "$1" != "-c" ; then
  1941.     echo "Makefile: file exists - will not be overwritten"
  1942. else
  1943.     echo "x - Makefile (file 10 of 11, 1556 chars)"
  1944.     sed -e 's/^X//' << 'END_OF_FILE_Makefile' > Makefile
  1945. X
  1946. X# @(#) Makefile 1.1.1.1 90/06/22 17:40:59
  1947. X# Makefile for "ljinit" (generated by /local/bin/makemake version 1.00.09)
  1948. X# Created by bin@chinacat on Fri Jun 22 17:37:24 CDT 1990
  1949. X
  1950. XSHELL = /bin/sh
  1951. XCC = cc
  1952. XDEFS = 
  1953. XCOPTS = -O
  1954. XLOPTS = 
  1955. XLIBS = 
  1956. XDEBUG = -g -DDEBUG
  1957. XLINTFLAGS = -DLINT
  1958. X
  1959. XTARG = ljinit
  1960. XOTHERS = 
  1961. X
  1962. XSRCS = main.c param.c cmd.c misc.c
  1963. X
  1964. XOBJS = main.o param.o cmd.o misc.o
  1965. X
  1966. X# Any edits below this line will be lost if "makemake" is rerun!
  1967. X# Commands may be inserted after the '#%custom' line at the end of this file.
  1968. X
  1969. XCFLAGS = $(COPTS) $(DEFS) # $(DEBUG)
  1970. XLFLAGS = $(LOPTS) # $(DEBUG)
  1971. X
  1972. Xall:        $(TARG) $(OTHERS)
  1973. Xinstall:    all        ; inst Install
  1974. Xclean:                ; rm -f $(TARG) $(OBJS) a.out core $(TARG).lint
  1975. Xclobber:    clean        ; inst -u Install
  1976. Xlint:        $(TARG).lint
  1977. X
  1978. X$(TARG):        $(OBJS)
  1979. X        $(CC) $(LFLAGS) -o $@ $(OBJS) $(LIBS)
  1980. X
  1981. X$(TARG).lint:    $(TARG)
  1982. X        lint $(LINTFLAGS) $(DEFS) $(SRCS) $(LIBS) > $@
  1983. X
  1984. Xmain.o: ljinit.h main.c patchlevel.h
  1985. Xparam.o: ljinit.h param.c
  1986. Xcmd.o: cmd.c ljinit.h
  1987. Xmisc.o: ljinit.h misc.c
  1988. X
  1989. Xmake:        ;
  1990. X        /local/bin/makemake -i -v1.00.09 -aMakefile \
  1991. X            -DSHELL='$(SHELL)' -DCC='$(CC)' -DDEFS='$(DEFS)' \
  1992. X            -DCOPTS='$(COPTS)' -DLOPTS='$(LOPTS)' -DLIBS='$(LIBS)' \
  1993. X            -DDEBUG='$(DEBUG)' -DLINTFLAGS='$(LINTFLAGS)' \
  1994. X            -DOTHERS='$(OTHERS)' $(TARG) $(SRCS)
  1995. X
  1996. X#%custom - commands below this line will be maintained if 'makemake' is rerun
  1997. X
  1998. XSOURCES = README ljinit.h patchlevel.h main.c param.c cmd.c misc.c \
  1999. X    ljconfig.dat ljparam.dat Makefile testsheet
  2000. X
  2001. Xshar:        ljinit.shar
  2002. Xljinit.shar:    $(SOURCES)        ; shar $(SOURCES) > $@
  2003. X
  2004. Xbom:                    ; what $(SOURCES)
  2005. X
  2006. END_OF_FILE_Makefile
  2007.     size="`wc -c < Makefile`"
  2008.     if test 1556 -ne "$size" ; then
  2009.     echo "Makefile: extraction error - got $size chars"
  2010.     fi
  2011. fi
  2012. if test -f testsheet -a "$1" != "-c" ; then
  2013.     echo "testsheet: file exists - will not be overwritten"
  2014. else
  2015.     echo "x - testsheet (file 11 of 11, 5894 chars)"
  2016.     sed -e 's/^X//' << 'END_OF_FILE_testsheet' > testsheet
  2017. XLine 01    <<< the quick brown fox jumped over the lazy dog >>>  Line 01
  2018. XLine 02    <<< the quick brown fox jumped over the lazy dog >>>  Line 02
  2019. XLine 03    <<< the quick brown fox jumped over the lazy dog >>>  Line 03
  2020. XLine 04    <<< the quick brown fox jumped over the lazy dog >>>  Line 04
  2021. XLine 05    <<< the quick brown fox jumped over the lazy dog >>>  Line 05
  2022. XLine 06    <<< the quick brown fox jumped over the lazy dog >>>  Line 06
  2023. XLine 07    <<< the quick brown fox jumped over the lazy dog >>>  Line 07
  2024. XLine 08    <<< the quick brown fox jumped over the lazy dog >>>  Line 08
  2025. XLine 09    <<< the quick brown fox jumped over the lazy dog >>>  Line 09
  2026. X
  2027. X---------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------=
  2028. X0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222
  2029. X0000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445
  2030. X1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
  2031. X---------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------==========----------=
  2032. X
  2033. XLine 17    <<< the quick brown fox jumped over the lazy dog >>>  Line 17
  2034. XLine 18    <<< the quick brown fox jumped over the lazy dog >>>  Line 18
  2035. XLine 19    <<< the quick brown fox jumped over the lazy dog >>>  Line 19
  2036. XLine 20    <<< the quick brown fox jumped over the lazy dog >>>  Line 20
  2037. XLine 21    <<< the quick brown fox jumped over the lazy dog >>>  Line 21
  2038. XLine 22    <<< the quick brown fox jumped over the lazy dog >>>  Line 22
  2039. XLine 23    <<< the quick brown fox jumped over the lazy dog >>>  Line 23
  2040. XLine 24    <<< the quick brown fox jumped over the lazy dog >>>  Line 24
  2041. XLine 25    <<< the quick brown fox jumped over the lazy dog >>>  Line 25
  2042. XLine 26    <<< the quick brown fox jumped over the lazy dog >>>  Line 26
  2043. XLine 27    <<< the quick brown fox jumped over the lazy dog >>>  Line 27
  2044. XLine 28    <<< the quick brown fox jumped over the lazy dog >>>  Line 28
  2045. XLine 29    <<< the quick brown fox jumped over the lazy dog >>>  Line 29
  2046. XLine 30    <<< the quick brown fox jumped over the lazy dog >>>  Line 30
  2047. XLine 31    <<< the quick brown fox jumped over the lazy dog >>>  Line 31
  2048. XLine 32    <<< the quick brown fox jumped over the lazy dog >>>  Line 32
  2049. XLine 33    <<< the quick brown fox jumped over the lazy dog >>>  Line 33
  2050. XLine 34    <<< the quick brown fox jumped over the lazy dog >>>  Line 34
  2051. XLine 35    <<< the quick brown fox jumped over the lazy dog >>>  Line 35
  2052. XLine 36    <<< the quick brown fox jumped over the lazy dog >>>  Line 36
  2053. XLine 37    <<< the quick brown fox jumped over the lazy dog >>>  Line 37
  2054. XLine 38    <<< the quick brown fox jumped over the lazy dog >>>  Line 38
  2055. XLine 39    <<< the quick brown fox jumped over the lazy dog >>>  Line 39
  2056. XLine 40    <<< the quick brown fox jumped over the lazy dog >>>  Line 40
  2057. XLine 41    <<< the quick brown fox jumped over the lazy dog >>>  Line 41
  2058. XLine 42    <<< the quick brown fox jumped over the lazy dog >>>  Line 42
  2059. XLine 43    <<< the quick brown fox jumped over the lazy dog >>>  Line 43
  2060. XLine 44    <<< the quick brown fox jumped over the lazy dog >>>  Line 44
  2061. XLine 45    <<< the quick brown fox jumped over the lazy dog >>>  Line 45
  2062. XLine 46    <<< the quick brown fox jumped over the lazy dog >>>  Line 46
  2063. XLine 47    <<< the quick brown fox jumped over the lazy dog >>>  Line 47
  2064. XLine 48    <<< the quick brown fox jumped over the lazy dog >>>  Line 48
  2065. XLine 49    <<< the quick brown fox jumped over the lazy dog >>>  Line 49
  2066. XLine 50    <<< the quick brown fox jumped over the lazy dog >>>  Line 50
  2067. XLine 51    <<< the quick brown fox jumped over the lazy dog >>>  Line 51
  2068. XLine 52    <<< the quick brown fox jumped over the lazy dog >>>  Line 52
  2069. XLine 53    <<< the quick brown fox jumped over the lazy dog >>>  Line 53
  2070. XLine 54    <<< the quick brown fox jumped over the lazy dog >>>  Line 54
  2071. XLine 55    <<< the quick brown fox jumped over the lazy dog >>>  Line 55
  2072. XLine 56    <<< the quick brown fox jumped over the lazy dog >>>  Line 56
  2073. XLine 57    <<< the quick brown fox jumped over the lazy dog >>>  Line 57
  2074. XLine 58    <<< the quick brown fox jumped over the lazy dog >>>  Line 58
  2075. XLine 59    <<< the quick brown fox jumped over the lazy dog >>>  Line 59
  2076. XLine 60    <<< the quick brown fox jumped over the lazy dog >>>  Line 60
  2077. XLine 61    <<< the quick brown fox jumped over the lazy dog >>>  Line 61
  2078. XLine 62    <<< the quick brown fox jumped over the lazy dog >>>  Line 62
  2079. XLine 63    <<< the quick brown fox jumped over the lazy dog >>>  Line 63
  2080. XLine 64    <<< the quick brown fox jumped over the lazy dog >>>  Line 64
  2081. XLine 65    <<< the quick brown fox jumped over the lazy dog >>>  Line 65
  2082. XLine 66    <<< the quick brown fox jumped over the lazy dog >>>  Line 66
  2083. XLine 67    <<< the quick brown fox jumped over the lazy dog >>>  Line 67
  2084. XLine 68    <<< the quick brown fox jumped over the lazy dog >>>  Line 68
  2085. XLine 69    <<< the quick brown fox jumped over the lazy dog >>>  Line 69
  2086. XLine 70    <<< the quick brown fox jumped over the lazy dog >>>  Line 70
  2087. X
  2088. X@(#) testsheet 1.1 90/06/20 23:04:26
  2089. END_OF_FILE_testsheet
  2090.     size="`wc -c < testsheet`"
  2091.     if test 5894 -ne "$size" ; then
  2092.     echo "testsheet: extraction error - got $size chars"
  2093.     fi
  2094. fi
  2095. echo "done - 11 files extracted"
  2096. exit 0
  2097. -- 
  2098. Chip Rosenthal                            |  You aren't some icon carved out
  2099. chip@chinacat.Unicom.COM                  |  of soap, sent down here to clean
  2100. Unicom Systems Development, 512-482-8260  |  up my reputation.  -John Hiatt
  2101.