dbw@ariel.UUCP (DAVE B. WOOD) (10/20/86)
Many of you have asked for what I have, which includes Bruce Townsend's invaluable nroff table generating stuff and some of my own HP LaserJet stuff. Bruce's stuff is available from mod.sources, but is reproduced here (sorry); my own laserjet table.c for one of the font cartridges is included also. I also put in three lp interface models, also for use with the same font cartridge. You're pretty much on your own administering the lp system. From mod.sources, Bruce Townsend's posting: From mtune!mtunf!mtung!mtunh!akguc!akgua!gatech!seismo!harvard!talcott!panda!sources-request Thu Apr 3 16:25:39 1986 Relay-Version: version B 2.10.2 9/3/84; site ariel.UUCP Path: ariel!mtune!mtunf!mtung!mtunh!akguc!akgua!gatech!seismo!harvard!talcott!panda!sources-request From: sources-request@panda.UUCP Newsgroups: mod.sources Subject: compile/decompile nroff driver tables (USG only) Message-ID: <1596@panda.UUCP> Date: 3 Apr 86 21:25:39 GMT Date-Received: 9 Apr 86 08:10:06 GMT Sender: jpn@panda.UUCP Lines: 1707 Approved: jpn@panda.UUCP Mod.sources: Volume 4, Issue 48 Submitted by: utzoo!bnr-vpa!bruce (Bruce Townsend) This program is intended for USG systems only, since Berkelely has a different driver table format, and I understand that many (all?) Berkeley systems have the necessary tools supplied. My submission includes a program for building tables from a source, a man page (term.5) explaining the source, a program that does the inverse operation of building a source from existing binary tables (useful for modifying existing tables) and various bits of documentation. The program is not guaranteed to be portable to all USG systems, as I did not have access to any other than my own, but it does run on at least two other machines, and it should not be too much work to port to any USG machine. Following is the shar archive of the source. Thanks, -Bruce Townsend Mail path: {utzoo, utcs}!bnr-vpa!bruce :----------------------CUT HERE-------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # Makefile # README # charlist # elbat.c # tabXXX.c # table.c # table.doc # term.5 # term.h # tabLJ.7300 # tabLJ.vax # README_HPLjet # HPLjet # HPLjet_Server # HPLjet_remote # This archive created: Mon Oct 20 09:21:56 1986 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'Makefile' then echo shar: "will not over-write existing file 'Makefile'" else cat << \SHAR_EOF > 'Makefile' # Makefile for table.c, method of producing a single terminal # table for nroff under USG UNIX. # Makefile written by Bruce Townsend (utcs!bnr-vpa!bruce) # and Ian Darwin (utcs!darwin!ian) # March 6, 1985. TABFILES = tabljet DESTDIR = /usr/lib/term LINTTAB = tabljet DEFS = CFLAGS = $(DEFS) -O LDFLAGS = -s LFLAGS = $(DEFS) $(TABFILES): dummy_file $(MAKE) -$(MAKEFLAGS) table.o $@.o cc $(LDFLAGS) table.o $@.o ./a.out $@ # This dummy_file should never exist, it is a kludge to get Make to # always execute cc. dummy_file: @rm -f dummy_file all: $(TABFILES) install: $(TABFILES) mv $(TABFILES) $(DESTDIR) lint: table.c lint $(LFLAGS) table.c $(LINTTAB).c elbat: elbat.o cc $(LDFLAGS) elbat.o -o elbat clean: rm -f a.out tab*.o elbat.o SHAR_EOF fi if test -f 'README' then echo shar: "will not over-write existing file 'README'" else cat << \SHAR_EOF > 'README' There are two programs in this package. "table", written by Bruce Townsend with help from Ian Darwin, prepares an nroff driver table from a source file. "elbat", written by Matt Crawford and modified for USG UNIX by Bruce Townsend, is the inverse operation - it decompiles an nroff driver table, producing a source file. The Makefile should not need modification other than to add new names of terminal drivers, of the form "tabXXX" where "XXX" is a mnemonic for a terminal, e.g. tab450 for a Diablo 450 in 10-pitch mode. These names are added to the TABFILES definition in the Makefile. The format for Berkeley tab files is different and thus this package will not work on Berkely systems without substantial hacking. You may want to change CFLAGS, LDFLAGS, etc. to your taste or de-bugging preference. To compile the elbat program, type "make elbat". To de-compile a file, type "elbat /usr/lib/term/tabXXX > tabXXX.c" To compile a tabXXX file (say tab450), type "make tab450". Of course, you need the tab450.c source before you do this. Do NOT FORGET to include the tabXXX name in the TABFILES definition in the Makefile first. Be VERY CAREFULL with "make install" (try "make -n install first). Read the table.doc file and the term.5 man page for more info. I have updated the term.5 man page to reflect this program. IF YOU HAVE PROBLEMS... It is quite possible that some or all of the integers stored in the tabfile are long, not int. On our machine, long = int = 32 bits, so I do not know which is appropriate. Read the table.doc file for more info. Acknowledgements: Ian Darwin tested out the first (very buggy) version of this utility, and suggested many useful changes, including the introduction of the Makefile. Matt Crawford wrote the elbat program originally for Berkeley systems. -Bruce Townsend Voice Processing Applications, Bell-Northern Research, Ottawa, Ontario. Mail path: {utzoo, utcs, bnr-di, bnr-mtl}!bnr-vpa!bruce SHAR_EOF fi if test -f 'charlist' then echo shar: "will not over-write existing file 'charlist'" else cat << \SHAR_EOF > 'charlist' TABLE OF NROFF CHARACTER INPUT NAMES IN THE ORDER THEY APPEAR IN THE codetab[] TABLE (see term(5)) _______________ Name Number (Octal) _______________ <sp> 000 ! 001 " 002 # 003 $ 004 % 005 & 006 ' 007 ( 010 ) 011 * 012 + 013 , 014 - 015 . 016 / 017 0 020 1 021 2 022 3 023 4 024 5 025 6 026 7 027 8 030 9 031 : 032 ; 033 < 034 = 035 > 036 ? 037 @ 040 A 041 B 042 C 043 D 044 E 045 F 046 G 047 H 050 I 051 J 052 K 053 L 054 M 055 N 056 O 057 P 060 Q 061 R 062 S 063 T 064 U 065 V 066 W 067 X 070 Y 071 Z 072 [ 073 \ 074 ] 075 ^ 076 _ 077 ` 100 a 101 b 102 c 103 d 104 e 105 f 106 g 107 h 110 i 111 j 112 k 113 l 114 m 115 n 116 o 117 p 120 q 121 r 122 s 123 t 124 u 125 v 126 w 127 x 130 y 131 z 132 { 133 | 134 } 135 ~ 136 \| 137 \(hy 140 \(bu 141 \(sq 142 \(em 143 \(ru 144 \(14 145 \(12 146 \(34 147 \- 150 \(fi 151 \(fl 152 \(ff 153 \(Fi 154 \(Fl 155 \(de 156 \(dg 157 \(sc 160 \(fm 161 \(aa 162 \(ga 163 \(ul 164 \(sl 165 \^ 166 \<sp> 167 \(*a 170 \(*b 171 \(*g 172 \(*d 173 \(*e 174 \(*z 175 \(*y 176 \(*h 177 \(*i 200 \(*k 201 \(*l 202 \(*m 203 \(*n 204 \(*c 205 \(*o 206 \(*p 207 \(*r 210 \(*s 211 \(*t 212 \(*u 213 \(*f 214 \(*x 215 \(*q 216 \(*w 217 \(*G 220 \(*D 221 \(*H 222 \(*L 223 \(*C 224 \(*P 225 \(*S 226 \(*T 227 \(*U 230 \(*F 231 \(*Q 232 \(*W 233 \(sr 234 \(ts 235 \(rn 236 \(>= 237 \(<= 240 \(== 241 \(mi 242 \(~= 243 \(ap 244 \(!= 245 \(-> 246 \(<- 247 \(ua 250 \(da 251 \(eq 252 \(mu 253 \(di 254 \(+- 255 \(cu 256 \(ca 257 \(sb 260 \(sp 261 \(ib 262 \(ip 263 \(if 264 \(pd 265 \(gr 266 \(no 267 \(is 270 \(pt 271 \(es 272 \(mo 273 \(pl 274 \(rg 275 \(co 276 \(br 277 \(ct 300 \(dd 301 \(rh 302 \(lh 303 \(** 304 \(bs 305 \(or 306 \(ci 307 \(lt 310 \(lb 311 \(rt 312 \(rb 313 \(lk 314 \(rk 315 \(bv 316 \(lf 317 \(rf 320 \(lc 321 \(rc 322 SHAR_EOF fi if test -f 'elbat.c' then echo shar: "will not over-write existing file 'elbat.c'" else cat << \SHAR_EOF > 'elbat.c' /* elbat: a program to de-compile nroff drive tables so they can ** be fiddled with. ** ** usage: elbat tabXXX > tabXXX.c ** ** Matt Crawford, University of Chicago, 10 May 1984 ** ihnp4!oddjob!matt crawford@anl-mcs.arpa ** ** Modified by: Bruce Townsend, Bell Northern-Research, March 6 1985 ** - Changed for USG UNIX systems. ** */ #include <stdio.h> #include <ctype.h> #include <fcntl.h> #include "term.h" void loadtab(), vprint(); char *codelabel[] = { "space", "!", "\"", "#", "$", "%", "&", "' close", "(", ")", "*", "+", ",", "- hyphen", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\\", "]", "^", "_ dash", "` open", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "narrow sp", "hyphen", "bullet", "square", "3/4 em", "rule", "1/4", "1/2", "3/4", "minus", "fi", "fl", "ff", "ffi", "ffl", "degree", "dagger", "section", "foot mark", "acute accent", "grave accent", "underrule", "slash (longer)", "half narrow space", "unpaddable space", "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega", "Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi", "Sigma", "Tau", "Upsilon", "Phi", "Psi", "Omega", "square root", "terminal sigma", "root en", ">=", "<=", "identically equal", "equation minus", "approx =", "approximates", "not equal", "right arrow", "left arrow", "up arrow", "down arrow", "eqn equals", "multiply", "divide", "plus-minus", "cup (union)", "cap (intersection)", "subset of", "superset of", "improper subset", " improper superset", "infinity", "pt deriv", "gradient", "not", "integral", "proportional to", "empty set", "member of", "equation plus", "registration mk", "copyright mk", "box rule", "cent sign", "dbl dagger", "right hand", "left hand", "math * ", "bell system sign", "or (was star)", "circle", "left top of big curly", "left bottom of big curly", "right top of big curly", "right bottom of big curly", "left center of big curly", "right center of big curly", "bold vertical rule", "left bottom of big bracket", "right bottom of big bracket", "left top of big bracket", "right top of big bracket", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", /* No idea what these are */ }; struct t t; struct t_stor t_stor; main(argc, argv) char **argv; { register int c; register char **endptr = &t.zzz; register FILE *twfp; char labelbuf[64]; if (argc != 2) { fprintf (stderr, "Usage: elbat tabXXX > tabXXX.c\n"); exit(1); } loadtab(argv[1]); if ( (twfp = fopen("term.h", "r")) == NULL ) { perror("term.h"); exit(1); } while ( (c = getc(twfp)) != EOF && c != /*{*/ '}') putc(c, stdout); fclose(twfp); printf(/*{*/ "} t = {\n" /*}*/); /* Stupid emacs! */ printf("/*bset */\t\t0%o,\n", t.bset); printf("/*breset */\t\t0%o,\n", t.breset); #define intshow(memb) \ printf("/*%-8s*/\t\t%d,\n", "memb", t.memb) intshow(Hor); intshow(Vert); intshow(Newline); intshow(Char); intshow(Em); intshow(Halfline); intshow(Adj); #define show(memb) \ printf("/*%-8s*/\t\t\"", "memb");\ vprint(t.memb);\ printf("\",\n") show(twinit); show(twrest); show(twnl); show(hlr); show(hlf); show(flr); show(bdon); show(bdoff); show(iton); show(itoff); show(ploton); show(plotoff); show(up); show(down); show(right); show(left); while ( **--endptr == '\0' ) ; for ( c = 0; c < 256-32 /* Not all 256-32 chars are in use */ && &t.codetab[c] <= endptr; c++ ) { sprintf(labelbuf, "/* %s */", codelabel[c]); printf("%-20s\t\"", labelbuf); if ( t.codetab[c][0] ) vprint(t.codetab[c]); else if ( t.codetab[c][1] ) { printf("\\000"); vprint(t.codetab[c]+1); } else printf("\\000\\0"); printf("\",\n"); } printf(/*{*/ "};\n"); exit(0); } void vprint(str) register char *str; { while ( str && *str ) { char c[5]; if ( isascii(*str) && isprint(*str) && *str != '\\' && *str != '"' ) { c[0] = *str; c[1] = '\0'; } else switch ( *str ) { case '\\': case '"': c[0] = '\\'; c[1] = *str; c[2] = '\0'; break; case '\b': strcpy(c, "\\b"); break; case '\t': strcpy(c, "\\t"); break; case '\n': strcpy(c, "\\n"); break; case '\r': strcpy(c, "\\r"); break; default: sprintf(c, "\\%03.3o", (int)*str & 0377); break; } fputs(c, stdout); str++; } } void loadtab( tname ) char *tname; { register int tfd; int c_size, *ip; register char **pp, *mptr; extern char *malloc(); if( (tfd=open(tname, O_RDONLY)) < 0 ) { perror( tname ); exit(1); } read(tfd, &c_size, sizeof(int)); read(tfd, &t_stor, sizeof(t_stor)); mptr = malloc (c_size); read(tfd, mptr, c_size); t.bset = t_stor.bset; t.breset = t_stor.breset; t.Hor = t_stor.Hor; t.Vert = t_stor.Vert; t.Newline = t_stor.Newline; t.Char = t_stor.Char; t.Em = t_stor.Em; t.Halfline = t_stor.Halfline; t.Adj = t_stor.Adj; ip = &t_stor.twinit; for ( pp = &t.twinit; pp < &t.zzz;) *pp++ = mptr + *ip++; } SHAR_EOF fi if test -f 'tabXXX.c' then echo shar: "will not over-write existing file 'tabXXX.c'" else cat << \SHAR_EOF > 'tabXXX.c' /* This is an example of a source file for an nroff driver table. * It is a very stripped down version of a Diablo 450 in 10 pitch. * The integer settings (bset - Adj) are correct for this terminal * but only ascii charcters and some simple special charcters are * included. Therefore, it is not intended as a source for a useful * driver table, but rather as a starting point so that you can * hack up your own. */ #include <termio.h> /* Req'd only for bset, breset */ #define INCH 240 struct { int bset; int breset; int Hor; int Vert; int Newline; int Char; int Em; int Halfline; int Adj; char *twinit; char *twrest; char *twnl; char *hlr; char *hlf; char *flr; char *bdon; char *bdoff; char *iton; char *itoff; char *ploton; char *plotoff; char *up; char *down; char *right; char *left; char *codetab[256-32]; char *zzz; } t = { /*bset */ 0, /*breset */ ONLCR | OCRNL | ONLRET, /*Hor */ INCH / 60, /*Vert */ INCH / 48, /*Newline */ INCH / 6, /*Char */ INCH / 10, /*Em */ INCH / 10, /*Halfline*/ INCH / 12, /*Adj */ INCH / 10, /*twinit */ "", /*twrest */ "", /*twnl */ "", /*hlr */ "", /*hlf */ "", /*flr */ "", /*bdon */ "", /*bdoff */ "", /*iton */ "", /*itoff */ "", /*ploton */ "", /*plotoff */ "", /*up */ "", /*down */ "", /*right */ "", /*left */ "", /* space */ "\001 ", /* ! */ "\001!", /* " */ "\001\"", /* # */ "\001#", /* $ */ "\001$", /* % */ "\001%", /* & */ "\001&", /* ' close */ "\001'", /* ( */ "\001(", /* ) */ "\001)", /* * */ "\001*", /* + */ "\001+", /* , */ "\001,", /* - hyphen */ "\001-", /* . */ "\001.", /* / */ "\001/", /* 0 */ "\2010", /* 1 */ "\2011", /* 2 */ "\2012", /* 3 */ "\2013", /* 4 */ "\2014", /* 5 */ "\2015", /* 6 */ "\2016", /* 7 */ "\2017", /* 8 */ "\2018", /* 9 */ "\2019", /* : */ "\001:", /* ; */ "\001;", /* < */ "\001<", /* = */ "\001=", /* > */ "\001>", /* ? */ "\001?", /* @ */ "\001@", /* A */ "\201A", /* B */ "\201B", /* C */ "\201C", /* D */ "\201D", /* E */ "\201E", /* F */ "\201F", /* G */ "\201G", /* H */ "\201H", /* I */ "\201I", /* J */ "\201J", /* K */ "\201K", /* L */ "\201L", /* M */ "\201M", /* N */ "\201N", /* O */ "\201O", /* P */ "\201P", /* Q */ "\201Q", /* R */ "\201R", /* S */ "\201S", /* T */ "\201T", /* U */ "\201U", /* V */ "\201V", /* W */ "\201W", /* X */ "\201X", /* Y */ "\201Y", /* Z */ "\201Z", /* [ */ "\001[", /* \ */ "\001\\", /* ] */ "\001]", /* ^ */ "\001^", /* _ dash */ "\001_", /* ` open */ "\001`", /* a */ "\201a", /* b */ "\201b", /* c */ "\201c", /* d */ "\201d", /* e */ "\201e", /* f */ "\201f", /* g */ "\201g", /* h */ "\201h", /* i */ "\201i", /* j */ "\201j", /* k */ "\201k", /* l */ "\201l", /* m */ "\201m", /* n */ "\201n", /* o */ "\201o", /* p */ "\201p", /* q */ "\201q", /* r */ "\201r", /* s */ "\201s", /* t */ "\201t", /* u */ "\201u", /* v */ "\201v", /* w */ "\201w", /* x */ "\201x", /* y */ "\201y", /* z */ "\201z", /* { */ "\001{", /* | */ "\001|", /* } */ "\001}", /* ~ */ "\001~", /* narrow sp */ "\000\0", /* hyphen */ "\001-", /* bullet */ "\000\0", /* square */ "\000\0", /* 3/4 em */ "\001-", /* rule */ "\001_", /* 1/4 */ "\0031/4", /* 1/2 */ "\0031/2", /* 3/4 */ "\0033/4", /* minus */ "\001-", /* fi */ "\202fi", /* fl */ "\202fl", /* ff */ "\202ff", /* ffi */ "\203ffi", /* ffl */ "\203ffl", /* degree */ "\000\0", /* dagger */ "\000\0", /* section */ "\000\0", /* foot mark */ "\000\0", /* acute accent */ "\000\0", /* grave accent */ "\000\0", /* underrule */ "\001_", /* slash (longer) */ "\001/", /* half narrow space */ "\000\0", /* unpaddable space */ "\001 ", /* alpha */ "\000\0", /* beta */ "\000\0", /* gamma */ "\000\0", /* epsilon */ "\000\0", /* zeta */ "\000\0", /* eta */ "\000\0", /* theta */ "\000\0", /* iota */ "\000\0", /* kappa */ "\000\0", /* lambda */ "\000\0", /* mu */ "\000\0", /* nu */ "\000\0", /* xi */ "\000\0", /* omicron */ "\000\0", /* pi */ "\000\0", /* rho */ "\000\0", /* sigma */ "\000\0", /* tau */ "\000\0", /* upsilon */ "\000\0", /* phi */ "\000\0", /* chi */ "\000\0", /* psi */ "\000\0", /* omega */ "\000\0", /* Gamma */ "\000\0", /* Delta */ "\000\0", /* Theta */ "\000\0", /* Lambda */ "\000\0", /* Xi */ "\000\0", /* Pi */ "\000\0", /* Sigma */ "\000\0", /* Tau */ "\000\0", /* Upsilon */ "\000\0", /* Phi */ "\000\0", /* Psi */ "\000\0", /* Omega */ "\000\0", /* square root */ "\000\0", /* terminal sigma */ "\000\0", /* root en */ "\000\0", /* >= */ "\000\0", /* <= */ "\000\0", /* identically equal */ "\000\0", /* equation minus */ "\000\0", /* approx = */ "\000\0", /* approximates */ "\000\0", /* not equal */ "\000\0", /* right arrow */ "\000\0", /* left arrow */ "\000\0", /* up arrow */ "\000\0", /* down arrow */ "\000\0", /* eqn equals */ "\000\0", /* multiply */ "\000\0", /* divide */ "\000\0", /* plus-minus */ "\000\0", /* cup (union) */ "\000\0", /* cap (intersection) */ "\000\0", /* subset of */ "\000\0", /* superset of */ "\000\0", /* improper subset */ "\000\0", /* improper superset */ "\000\0", /* infinity */ "\000\0", /* pt deriv */ "\000\0", /* gradient */ "\000\0", /* not */ "\000\0", /* integral */ "\000\0", /* proportional to */ "\000\0", /* empty set */ "\000\0", /* member of */ "\000\0", /* equation plus */ "\001+", /* registration mk */ "\000\0", /* copyright mk */ "\000\0", /* box rule */ "\001|", /* cent sign */ "\000\0", /* dbl dagger */ "\000\0", /* right hand */ "\000\0", /* left hand */ "\000\0", /* math * */ "\001*", /* bell system sign */ "\000\0", /* or (was star) */ "\001|", /* circle */ "\000\0", /* left top of big curly */ "\001|", /* left bottom of big curly */ "\001|", /* right top of big curly */ "\001|", /* right bottom of big curly */ "\001|", /* left center of big curly */ "\001|", /* right center of big curly */ "\001|", /* bold vertical rule */ "\001|", /* left bottom of big bracket */ "\001|", /* right bottom of big bracket */ "\001|", /* left top of big bracket */ "\001|", /* right top of big bracket */ "\001|", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", /* ??? */ "\000\0", }; SHAR_EOF fi if test -f 'table.c' then echo shar: "will not over-write existing file 'table.c'" else cat << \SHAR_EOF > 'table.c' /* * * TABLE - A PROGRAM TO PREPARE NROFF DRIVER TABLES * copyright (c) 1985 by Bruce Townsend and Bell-Northern Research. * Permission hereby granted to use, distribute, modify, or copy * except for profit, providing this disclaimer is included. * * The contributions of Ian Darwin (the Makefile, cleaning up the * code, etc) are gratefully acknowledged. * * Version 1.2 - * * The program has been substantially modified from version 1.1 * The major bug in version 1.1 was that zero-width characters * were not handled properly. This has been fixed. * * Please send bug reports to Bruce Townsend (utcs!bnr-vpa!bruce) * * Usage: * 1) Build a file tabXXX.c, where XXX is some reasonable * acronym for the terminal or printer you want to drive * (peruse existing names to see what's reasonable!). * Make this file by hacking up one of the existing * table entries. * 2) If the amount of char data that the structure * references is very large, you may want to redefine * C_SIZE * 3) check to see whether <sgtty.h> or <termio.h> should * be #included in the tabXXX.c file. One of these include * files may be necessary to provide settings for t.bset, * t.breset. This is instead of the previous tendency to code * octal magic numbers in these fields. * 4) Enter your new table into the Makefile; just add the * name "tabXXX" to the TABFILES definition. * 5) Type "make tabXXX" where tabXXX is the same name * you chose before. * 6) Locate the tabfile in the proper place (on our system * the directory is /usr/lib/term * * */ #define C_SIZE 10000 /* The maximum amount of character data allowed in the initialized structure t - increase if necessary */ #include <stdio.h> #include "term.h" /* This file contains the definition of the the structures t and t_stor */ /************* DO NOT ALTER ANYTHING AFTER THIS POINT ***************/ extern struct t t; struct t_stor t_stor; char c_data[C_SIZE]; char *c_pointer[256]; int c_length[256]; char *c_end = c_data; int n_strings, c_size; main (argc, argv) int argc; char *argv[]; { FILE *table; int i, j, i_len, j_len; char *tail, *start, *char_pointer, *strcpy(); if (argc != 2) { /* Need a file name argument */ fprintf (stderr, "Usage: table \"file\"\n"); exit (1); } /* Open the file */ if ((table = fopen (argv[1], "w")) == NULL) { fprintf (stderr, "File %s not opened for writing\n", argv[1]); exit (1); } /* Copy the integer values from the initialized structure to the storage structure */ t_stor.bset = t.bset; t_stor.breset = t.breset; t_stor.Hor = t.Hor; t_stor.Vert = t.Vert; t_stor.Newline = t.Newline; t_stor.Char = t.Char; t_stor.Em = t.Em; t_stor.Halfline = t.Halfline; t_stor.Adj = t.Adj; /* Add the character strings into a character array */ addstring (t.twinit); addstring (t.twrest); addstring (t.twnl); addstring (t.hlr); addstring (t.hlf); addstring (t.flr); addstring (t.bdon); addstring (t.bdoff); addstring (t.iton); addstring (t.itoff); addstring (t.ploton); addstring (t.plotoff); addstring (t.up); addstring (t.down); addstring (t.right); addstring (t.left); for (i = 0; i < 256 - 32; i++) addchar (t.codetab[i]); /* eliminate strings which are tails of other strings */ for (i = 0; i < n_strings; i++) { if (! c_pointer[i]) continue; /* String cleared out */ i_len = c_length[i]; for (j = 0; j < n_strings; j++) { if (i == j || ! c_pointer[j]) continue; j_len = c_length[j]; if (i_len <= j_len) { /* string i could be tail of string j */ tail = c_pointer[j] + j_len - i_len; if (! char_comp (c_pointer[i], tail, i_len)) { c_pointer[i] = 0; break; } } } } /* Compress the c_data array */ char_pointer = c_data; for (i = j = 0; i < n_strings; i++) { if (! (start = c_pointer[i])) continue; c_pointer[j] = char_pointer; c_length[j++] = c_length[i]; for (i_len = c_length[i]; i_len--;) *char_pointer++ = *start++; *char_pointer++ = 0; } n_strings = j; c_size = char_pointer - c_data; /* Now find each string in this table and provide an index to it */ t_stor.twinit = findstring (t.twinit); t_stor.twrest = findstring (t.twrest); t_stor.twnl = findstring (t.twnl); t_stor.hlr = findstring (t.hlr); t_stor.hlf = findstring (t.hlf); t_stor.flr = findstring (t.flr); t_stor.bdon = findstring (t.bdon); t_stor.bdoff = findstring (t.bdoff); t_stor.iton = findstring (t.iton); t_stor.itoff = findstring (t.itoff); t_stor.ploton = findstring (t.ploton); t_stor.plotoff = findstring (t.plotoff); t_stor.up = findstring (t.up); t_stor.down = findstring (t.down); t_stor.right = findstring (t.right); t_stor.left = findstring (t.left); for (i = 0; i < 256 - 32; i++) { t_stor.codetab[i] = findchar (t.codetab[i]); } t_stor.zzz = 0; /* Write the character storage block size */ if (fwrite (&c_size, sizeof (c_size), 1, table) != 1) write_err (); if (fwrite (&t_stor, sizeof (t_stor), 1, table) != 1) write_err (); if (fwrite (c_data, sizeof (*c_data), c_size, table) != c_size) write_err (); if (fclose (table)) { fprintf (stderr, "File %s not closed properly\n", argv[1]); exit (1); } } addstring (string) char *string; { c_pointer[n_strings] = c_end; c_end += (c_length[n_strings] = strlen (string)) + 1; if (c_end >= c_data + C_SIZE) { fprintf (stderr, "Table size too small, increase it!\n"); exit(1); } strcpy (c_pointer[n_strings++], string); } addchar (string) char *string; { c_pointer[n_strings] = c_end; c_end += (c_length[n_strings] = strlen (string + 2) + 2) + 1; if (c_end >= c_data + C_SIZE) { fprintf (stderr, "Table size too small, increase it!\n"); exit(1); } *c_pointer[n_strings] = *string++; /* Copy in first two bytes */ *(c_pointer[n_strings]+1) = *string++; strcpy (c_pointer[n_strings++] + 2, string); /* Copy the rest */ } char_comp (str1, str2, len) char *str1, *str2; int len; { while (len--) { if (*str1++ != *str2++) return (1); } return (0); } findstring (string) char *string; { int c_len, s_len, i; for (i = 0; i < n_strings; i++) { if ((c_len = c_length[i]) >= (s_len = strlen (string))) { if (!char_comp (string, c_pointer[i] + c_len - s_len, s_len)) return (c_pointer[i] + c_len - s_len - c_data); } } fprintf (stderr, "Serious bug! string not found in table\n"); exit(1); /* NOTREACHED */ } findchar (string) char *string; { int c_len, s_len, i; for (i = 0; i < n_strings; i++) { if ((c_len = c_length[i]) >= (s_len = strlen (string+2) + 2)) { if (!char_comp (string, c_pointer[i] + c_len - s_len, s_len)) return (c_pointer[i] + c_len - s_len - c_data); } } fprintf (stderr, "Serious bug! character not found in table\n"); exit(1); /* NOTREACHED */ } write_err () { fprintf (stderr, "Write to file failed\n"); exit (1); } SHAR_EOF fi if test -f 'table.doc' then echo shar: "will not over-write existing file 'table.doc'" else cat << \SHAR_EOF > 'table.doc' DOCUMENTATION OF NROFF TAB FILE UTILITY -Bruce Townsend, Bell-Northern Research, March 1985 (utcs!bnr-vpa!bruce) This file contains some documentation for the table program. This program makes printer and terminal driver tables suitable for nroff. The development of this program was motivated by the lack of any other means to prepare custom nroff driver tables, for those systems which do not have the original source that prepared the driver tables (usually found in /usr/lib/term). The format for the tables imbodied in this program was deduced from a "term" manual page, and by examining the contents of several existing tab files. Therefore, this program is not definitive in any sense, but is intended as a help for those who (like myself) do not have access to any formal tools that make these tab files. Also it is possible that this program will require modification for systems where the size of an integer is not 32 bits. The system that this program was developed on is an HP9000 (System III) and the data sizes are: long 32 int 32 short 16 char 8 As I have not had access to different machines, I do not know whether certain data in the tab file is of int or long type, since that type is the same on our machine. I have assumed int type. If your luck is really bad, I suppose it is possible that the format of the tab file is different across various implementations. The format of the tab file is: Type Name Size on HP9000 Description ---- ---- -------------- ----------- int c_size 4 bytes - The amount of character data in bytes that follows the t_stor structure. In fact the size of the file in bytes should be: c_size + sizeof (c_size) + sizeof (t_stor) (On our machine: c_size + 1004) struct { 1000 bytes - This is the storage for the "t" int bset; structure with one change. All the elements int breset; of the t structure which were pointers to int Hor; strings are now integer indexes to one int Vert; large character array. int Newline; int Char; int Em; int Halfline; int Adj; int twinit; int twrest; int twnl; int hlr; int hlf; int flr; int bdon; int bdoff; int iton; int itoff; int ploton; int plotoff; int up; int down; int right; int left; int codetab[256-32]; int zzz; } t_stor; char array[c_size] (variable size)- This is the storage for the strings pointed to by the indexes. How to Use the Table Program ---------------------------- Examine the "term" manual page which explains the purpose of each of the items in the "t" structure. Make a copy of the tabXXX.c program and edit it, replacing XXX with a suitable mnemonic. Initialize the t structure to the integer or character string values that are necessary for the terminal or printer in question. You have a high degree of flexibility here, and variable-width characters, overstrike combinations, etc are easy to implement. The only catch here is determining which index of the t.codetab[] array corresponds to which nroff printable character. This information is not in the manual page. After some experimentation, I have made a table which list the characters I know about. The table has some holes in it, but is as complete as I can make it. If anyone has additions or corrections, please let me know. The table is found in the file charlist. Also, the comments in tabXXX.c should help. WARNING: ALL CHARACTER STRINGS IN THE codetab[] array MUST be at least two characters in size, not counting the null terminator. The typical definition for a zero-width string which prints nothing is "\000\0" and NOT "". THIS IS VERY IMPORTANT, because it is necessary to allow the first byte of these strings to be zero in the case of zero-width strings that do print something. E.G. the string "\000^\b" is a zero-width "hat" character. If the amount of char data is very large, you may need to increase the definition of C_SIZE in table.c. It is now set at 10000 characters. The table.c program will burp out a message to this effect if necessary. The t.bset and t.breset flags will need definitions from either <termio.h> or <sgtty.h>. Include whichever is appropriate for your system in tabXXX.c. After the tabXXX.c file has been edited, place it in the same directory as table.c and the Makefile, and compile the table with: make tabXXX This will compile and run a program which will in turn make the tab file. Move the tabfile to its destination directory (likely /usr/term/tab). Run nroff as: nroff -TXXX ... (for example): nroff -T630P ... Debugging is not easy. You can use the supplied program which takes a tab file (tabXXX) and makes a source file (tabXXX.c). The program is called elbat (reverse of table) Do this by: elbat tabXXX > tabXXX.c and compare to your original tabXXX.c Do this for tab files that you have already to check that the format is the same on your system as on mine. The Table Program ----------------- As mentioned before, this program is not to be considered a definitive one. It works for HP9000's as far as I can tell. However, it does have the feature of compressing the supplied character data as much as possible. If one string is the tail of another (e.g. the strings abcdef and def), than only the largest string is stored. The smaller is indexed into the middle of the larger. Repeated strings (including the null string) are only stored once. It should generate a tabfile very close to the size of the distributed tables. Check by using elbat on a distributed table, compile using the table utility, and compare the sizes. The character data will almost certainly be stored in a different order than in the distributed table, so "cmp -l" will find most bytes different. However, the nroff results using the two files should be identical. The program has not been extensively tested. There may be bugs or misinformation. Let me know of any problems. If the tab files produced by this program do not work at all on your system, then it may be that the data types for c_size, and t_stor.whatever are incorrect. (Long instead of int?) You can get an indication by looking at the first word (int or long?) of an existing tab file. This is the amount of char data stored in the file. Subtract it from the size of the file in bytes. The result will be the size of the t_stor structure plus the size of the c_size variable. The t_stor structure has 250 elements in it. If each is 4 bytes, as on our system, and the c_size variable is 4 bytes also, then the result of the previous subtraction should be 1004. If the sizeof(int) on your system is 16 bits, then the difference should be 502. If it is not, then perhaps the types (some or all) of c_size, and the elements in t_stor should be changed to reflect this. Good luck! I can be reached at: utcs!bnr-vpa!bruce (UUCP) or (613) 726 - 3008 (Phone) (Ottawa, Canada) SHAR_EOF fi if test -f 'term.5' then echo shar: "will not over-write existing file 'term.5'" else cat << \SHAR_EOF > 'term.5' .TH TERM 5 .SH NAME term \- terminal driving tables for nroff .SH DESCRIPTION .IR Nroff (1) uses driving tables to customize its output for various types of output devices, such as printing terminals, special word-processing terminals (such as Diablo, Qume, or NEC Spinwriter mechanisms), or special output filter programs. These driving tables are written as C programs, compiled, and installed in \f3/usr/lib/term/tab\f2name\fP , where .I name\^ is the name for that terminal type as given in .IR term (7). The structure of the tables is as follows: .PP .nf .ta 5m 10m 15m 20m 25m 30m 35m 40m 45m 50m 55m 60m #define INCH 240 struct { int bset; int breset; int Hor; int Vert; int Newline; int Char; int Em; int Halfline; int Adj; char *twinit; char *twrest; char *twnl; char *hlr; char *hlf; char *flr; char *bdon; char *bdoff; char *iton; char *itoff; char *ploton; char *plotoff; char *up; char *down; char *right; char *left; char *codetab[256\-32]; char *zzz; } t; .fi .DT .PP The meanings of the various fields are as follows: .TP 10 .I bset\^ bits to set in the .I c_oflag\^ field of the .I termio\^ structure (see .IR tty (4)) before output. .TP 10 .I breset\^ bits to reset in the .I c_oflag\^ field of the .I termio\^ structure befov%output. .TP 10 .I Hor\^ horizontal resolution in fractions of an inch. .TP 10 .I Vert\^ vertical resolution in fractions of an inch. .TP 10 .I Newline\^ space moved by a newline (linefeed) character in fractions of an inch. .TP 10 .I Char\^ quantum of character sizes, in fractions of an inch. (i.e., a character is a multiple of Char units wide) .TP 10 .I Em\^ size of an em in fractions of an inch. .TP 10 .I Halfline\^ space moved by a half-linefeed (or half-reverse-linefeed) character in fractions of an inch. .TP 10 .I Adj\^ quantum of white space, in fractions of an inch. (i.e., white spaces are a multiple of Adj units wide) .IP Note: if this is less than the size of the space character (in units of Char; see below for how the sizes of characters are defined), .I nroff\^ will output fractional spaces using plot mode. Also, if the .B \-e switch to .I nroff\^ is used, Adj is set equal to Hor by .IR nroff . .TP 10 .I twinit\^ set of characters used to initialize the terminal in a mode suitable for .IR nroff . .TP 10 .I twrest\^ set of characters used to restore the terminal to normal mode. .TP 10 .I twnl\^ set of characters used to move down one line. .TP 10 .I hlr\^ set of characters used to move up one-half line. .TP 10 .I hlf\^ set of characters used to move down one-half line. .TP 10 .I flr\^ set of characters used to move up one line. .TP 10 .I bdon\^ set of characters used to turn on hardware boldface mode, if any. .I Nroff\^ assumes that boldface mode is reset automatically by the .I twnl\^ string, because many letter-quality printers reset the boldface mode when they receive a carriage return; the .I twnl\^ string should include whatever characters are necessary to reset the boldface mode. .TP 10 .I bdoff\^ set of characters used to turn off hardware boldface mode, if any. .TP 10 .I iton\^ set of characters used to turn on hardware italics mode, if any. .TP 10 .I itoff\^ set of characters used to turn off hardware italics mode, if any. .TP 10 .I ploton\^ set of characters used to turn on hardware plot mode (for Diablo type mechanisms), if any. .TP 10 .I plotoff\^ set of characters used to turn off hardware plot mode (for Diablo type mechanisms), if any. .TP 10 .I up\^ set of characters used to move up one resolution unit (Vert) in plot mode, if any. .TP 10 .I down\^ set of characters used to move down one resolution unit (Vert) in plot mode, if any. .TP 10 .I right\^ set of characters used to move right one resolution unit (Hor) in plot mode, if any. .TP 10 .I left\^ set of characters used to move left one resolution unit (Hor) in plot mode, if any. .TP 10 .I codetab\^ definition of characters needed to print an .I nroff\^ character on the terminal. The first byte is the number of character units (Char) needed to hold the character; i.e., ``\\001'' is one unit wide, ``\\002'' is two units wide, etc. The high-order bit (0200) is on if the character is to be underlined in underline mode (.ul). The rest of the bytes are the characters used to produce the character in question. If the character has the sign (0200) bit on, it is a code to move the terminal in plot mode. It is encoded as: .RS .IP "0100 bit on" 15 vertical motion. .IP "0100 bit off" 15 horizontal motion. .IP "040 bit on" 15 negative (up or left) motion. .IP "040 bit off" 15 positive (down or right) motion. .IP "037 bits" 15 number of such motions to make. .RE .TP 10 .I zzz\^ a zero terminator at the end. .PP All quantities which are in units of fractions of an inch should be expressed as .RI INCH* num / denom , where .I num\^ and .I denom\^ are respectively the numerator and denominator of the fraction; i.e., 1/48 of an inch would be written as ``INCH/48''. .PP If any sequence of characters does not pertain to the output device, that sequence should be given as a null string. .PP If you have source license: .br The source code for the terminal .I name\^ is in .BI /usr/src/cmd/text/roff.d/terms.d/tab name .c. When a new terminal type is added, the file .I maketerms.c\^ should be updated to `#include' the source to that driving table; note that the various terminal types are grouped into ``parts'' labelled .BR PART1 , .BR PART2 , and .BR PART3 . If necessary, more parts can be added. Other changes necessary to .I maketerms.c\^ are left as an exercise to the reader. The makefile .I terms.mk\^ in that directory should then be updated. .PP If you do not have source license, but have Bruce Townsend's .I table\^ utility: .br The source code for the terminal .I name\^ is in a file called .BI tab name .c. When a new terminal type is added, the file .I Makefile\^ in the same directory should be updated. Just add the name .BI tab name to the definition of .BR TABFILES . Then type .BI "make tab" name. Store the result in .B /usr/lib/term. .SH FILES /usr/lib/term/tab\f2name\fP driving tables .br tab\f2name\fP.c source for driving tables .SH SEE ALSO troff(1), term(7) SHAR_EOF fi if test -f 'term.h' then echo shar: "will not over-write existing file 'term.h'" else cat << \SHAR_EOF > 'term.h' #ifndef INCH #define INCH 240 #endif struct t { int bset; int breset; int Hor; int Vert; int Newline; int Char; int Em; int Halfline; int Adj; char *twinit; char *twrest; char *twnl; char *hlr; char *hlf; char *flr; char *bdon; char *bdoff; char *iton; char *itoff; char *ploton; char *plotoff; char *up; char *down; char *right; char *left; char *codetab[256-32]; char *zzz; }; struct t_stor { /* This structure will be stored in the tab file */ int bset; int breset; int Hor; int Vert; int Newline; int Char; int Em; int Halfline; int Adj; int twinit; int twrest; int twnl; int hlr; int hlf; int flr; int bdon; int bdoff; int iton; int itoff; int ploton; int plotoff; int up; int down; int right; int left; int codetab[256-32]; int zzz; }; SHAR_EOF fi if test -f 'tabLJ.7300' then echo shar: "will not over-write existing file 'tabLJ.7300'" else cat << \SHAR_EOF > 'tabLJ.7300' begin 644 tabljet.7300 M #%0 L ! 4 H & !@ 4 & $ M ! ( ( &P L 9 $@ !D ! 0 M !L B !; "D %K *P "X Q - #< Z ! M8@ #T ! #"0 NH !# "B@ $8 *J 20 $P !/ M 4@ %4 !8 6P %X !A 9 &< !J ;0 J0 M !P <P '8 !Y ? '\ "" A0 (@ "+ C@ M )$ "4 EP )H "= H *, "F J0 *P "O ML@ +4 "X NP +X #! Q ,< #* S0 - %H M !90 -, #6 V0 -P #? X@ .4 #H ZP .X M #Q ] /< #Z _0 0 $# !!@ 0D $, !#P M 1( $5 !& 1L $> !(0 P\ $D !)P Q( ** ! M*@ 2\ ** !: 3, $X !/0 HH %" !1@ 4H %. M !4P 5@ %= #$@ 6( %B !90 6@ *J #$@ 6L M %N !=0 7X &% !C 9$ &< !I0 :H &M !L M ;P '# !R@ =D '< !Y0 >X 'W " @ @4 *G " M"@ A8 (= "* C, (X #$@ C\ )+ #$@ E0 )7 M "7@ FL ,2 #$@ G8 )[ "@ H4 ** "C0 Q( M *2 "EP IL *? #$@ J0 *G "J@ JT *R #$@ M Q( ,2 #$@ Q( *U "N0 L@ +3 "W Q( ,2 # M$@ NH +M "\@ P\ +W "_ P$ ,% #"0 Q( ,/ M ## P\ ,/ ##P P\ ,/ ##P P\ ,/ ##P P\ M ,/ #$@ Q( ,2 #$@ Q( ,2 #$@ Q( ,2 #$@ M Q( ,2 #$@ * !LF82TQ4AL] !LI<S-"#@ ;*7,Q4PX #P ;)F$M M,5( &R9A*S%2 @ 2$ 2( 2, 20 24 28 2@ 2D 2P 2X @3 M@3$ @3( @3, @30 @34 @38 @3< @3@ @3D 3H 3L 3P 3X 3\ 4 M@4$ @4( @4, @40 @44 @48 @4< @4@ @4D @4H @4L @4P @4T @4X @4\ M@5 @5$ @5( @5, @50 @54 @58 @5< @5@ @5D @5H 5L 5P 5T 5X M@6$ @6( @6, @60 @64 @68 @6< @6@ @6D @6H @6L @6P @6T @6X @6\ M@7 @7$ @7( @7, @70 @74 @78 @7< @7@ @7D @7H 7L 7T 7X 6\( M*P "6UT S$O- #,2\R ,S+S0 @F9I ()F; ""9F8 @V9F:0"#9F9L 'D M;\0 7P(+0 !)P !8 !7P !( !H6."**$ 8!"HL)\@N( 8 I@2^A & M;^(\P@ !/ @M & 8X'!+*'C/,( 8!N@L)\HN( 4\(+0 !:0 !:P !@%S$ MH2?!H2?E@@ !@'6B+(( :$H@R^B & 8X'!+*'C8Z'!8('! %O 'A+<,B MP2+C & ;Z+"?.*" & ;\&"?N&B & =,&"?J-^@>$ 78 6\(+P !@"\M MPH(GI">"X@ !H76#=:( :)\@N,MPX)@H@ !HB_#+80MXURB %/"#T :(O MA%RB &B6UV$6UVBXRW# & /L(MY2W# %9 %O"%L(70 !@%M=+<*")Z1@ M@N( 8!/PJ$M@BVAX@ !Y%_$ $^"%\ 3P(7P !/0A? $M $]"'X 3T( M+P "+3X CPM %\"%X 3T 7@ 2\ 2L(7P !50 ";V\ 8!O@<%@H>%@ MH>%@@<$ :)<XRV$+<,OH@ !@"V"X2S!H@ !@'PG@F"CQB>A8(+F $K %R F"$\ 6,(3P !8P@O %\"#T CT^ (\/0 !*@ !3P !? #F end SHAR_EOF fi if test -f 'tabLJ.vax' then echo shar: "will not over-write existing file 'tabLJ.vax'" else cat << \SHAR_EOF > 'tabLJ.vax' begin 644 tabljet.vax M/ , L ! 4 H & !@ 4 & $ ! M ( ( &P L 9 $@ !D ! 0 !L M B ; $ "D !K 0 *P "X Q - #< Z 8@$ M #T ! "0, .H" !# B@( $8 "J @ 20 $P !/ M4@ %4 !8 6P %X !A 9 &< !J ;0 *0" !P M <P '8 !Y ? '\ "" A0 (@ "+ C@ )$ M "4 EP )H "= H *, "F J0 *P "O L@ M +4 "X NP +X #! Q ,< #* S0 - !H 0 M90$ -, #6 V0 -P #? X@ .4 #H ZP .X #Q M ] /< #Z _0 ! # 0 !@$ D! , 0 #P$ !(! M 5 0 & $ !L! > 0 (0$ !(# D 0 )P$ P# "* @ *@$ M "\! "* @ : $ #,! X 0 /0$ (H" !" 0 1@$ $H! !. 0 M4P$ %@! != 0 # , &(! !B 0 90$ &@! "J @ # , &L! !N M 0 =0$ 'X! "% 0 C $ )$! "< 0 I0$ *H! "M 0 L $ +P! M ## 0 R@$ -D! #< 0 Y0$ .X! #W 0 @( 4" "G @ "@( M !8" = @ * ( #," X @ # , #\" !+ @ # , %0" !7 @ M7@( &L" , P # , '8" ![ @ @ ( (4" "* @ C0( P# "2 M @ EP( )L" "? @ # , *0" "G @ J@( *T" "R @ # , P# M , P # , P# "U @ N0( ,@" #3 @ W ( P# , P # , M .H" #M @ \@( !(# #W @ _ ( $# % P "0, P# 2 P M#P, !(# 2 P $@, !(# 2 P $@, !(# 2 P $@, !(# 2 M P %0, !4# 5 P %0, !4# 5 P %0, !4# 5 P %0, !4# M 5 P %0, * !LF82TQ4AL] !LI<S-"#@ ;*7,Q4PX #P ;)F$M M,5( &R9A*S%2 @ 2$ 2( 2, 20 24 28 2@ 2D 2P 2X @3 M@3$ @3( @3, @30 @34 @38 @3< @3@ @3D 3H 3L 3P 3X 3\ 4 M@4$ @4( @4, @40 @44 @48 @4< @4@ @4D @4H @4L @4P @4T @4X @4\ M@5 @5$ @5( @5, @50 @54 @58 @5< @5@ @5D @5H 5L 5P 5T 5X M@6$ @6( @6, @60 @64 @68 @6< @6@ @6D @6H @6L @6P @6T @6X @6\ M@7 @7$ @7( @7, @70 @74 @78 @7< @7@ @7D @7H 7L 7T 7X 6\( M*P "6UT S$O- #,2\R ,S+S0 @F9I ()F; ""9F8 @V9F:0"#9F9L 'D M;\0 7P(+0 !)P !8 !7P !( !H6."**$ 8!"HL)\@N( 8 I@2^A & M;^(\P@ !/ @M & 8X'!+*'C/,( 8!N@L)\HN( 4\(+0 !:0 !:P !@%S$ MH2?!H2?E@@ !@'6B+(( :$H@R^B & 8X'!+*'C8Z'!8('! %O 'A+<,B MP2+C & ;Z+"?.*" & ;\&"?N&B & =,&"?J-^@>$ 78 6\(+P !@"\M MPH(GI">"X@ !H76#=:( :)\@N,MPX)@H@ !HB_#+80MXURB %/"#T :(O MA%RB &B6UV$6UVBXRW# & /L(MY2W# %9 %O"%L(70 !@%M=+<*")Z1@ M@N( 8!/PJ$M@BVAX@ !Y%_$ $^"%\ 3P(7P !/0A? $M $]"'X 3T( M+P "+3X CPM %\"%X 3T 7@ 2\ 2L(7P !50 ";V\ 8!O@<%@H>%@ MH>%@@<$ :)<XRV$+<,OH@ !@"V"X2S!H@ !@'PG@F"CQB>A8(+F $K %R M"$\ 6,(3P !8P@O %\"#T CT^ (\/0 !*@ !3P !? ,((7M"N @"&Z>K@Q0T%"N!-6 $OS14+X$&0+5<-!0K@C04._8&P ! end SHAR_EOF fi if test -f 'README_HPLjet' then echo shar: "will not over-write existing file 'README_HPLjet'" else cat << \SHAR_EOF > 'README_HPLjet' These are lp interface models for running a HP LaserJet with the Courier P&L font cartridge. They are for both local use and remote (uux-based) use. On the local machine, a banner page is generated, and the proper escape sequences are generated for the Courier or LP fonts in portrait or landscape mode (line spacing, page size, etc.). For remote operation the "server" interface is just a dumb byte-dumper, which dumps the "bannerized" and "escapized" output generated by the "client" interface. On central machine with printer: HPLjet for printing files from the machine; administered as the interface for class Serial, printer HPLjet HPLjet_server (linked to dumb_S on a 7300) to print remotely generated output; administered as class Serial, printer Other On remote machines: HPLjet_remote (linked to dumb_remote on 7300); administered as class Remote, printer HPLjet, device /dev/null. It uses uux to get the output over to the server for printing by the dumb HPLjet_server. SHAR_EOF fi if test -f 'HPLjet' then echo shar: "will not over-write existing file 'HPLjet'" else cat << \SHAR_EOF > 'HPLjet' # lp interface for HP 2686A Laserjet printer # assumes font cartridge 92286L Courier P&L # # All output is printed after the printer setup strings # are sent, unless the -f option is given, in which case # no printer setup is done. # # (not)SCCS @(#)ljet 0.0 x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" printer=`basename $0` for i in $5 do case "$i" in [Pp][Oo][Rr][Tt]*) MODE=0 ;; [Ll][Aa][Nn][Dd]*) MODE=1 ;; [Cc][Oo][Uu][Rr]*) FONT=0 ;; [Ll][Pp]|[Ll][Ii][Nn][Ee]*) FONT=2 ;; f | -f) setup=NO ;; r | -r) raw=YES ;; esac done # set VMI values for portrait or landscape, # courier (12pt, squashed into 10pt line spacing) or lp (8.5pt) fonts # page print area is 10.5in by 8.0in case ${MODE}${FONT} in 00) VMI=7.6364 ; TXTLGTH=42 ;; 02) VMI=5.7273 ; TXTLGTH=42 ;; 10) VMI=8.00 ; TXTLGTH=32 ;; 12) VMI=5.8182 ; TXTLGTH=32 ;; *) VMI=7.64 ; TXTLGTH=42 ;; esac LINEWRAP="&s1C" # disables line wraparound ("&s0C" enables) TOPMGN="12c1e" # 1/4 inch # \033&l12c1E means 12/48 inch per line (VMI), 1 line top margin if [ \( "$6" = "-raw" \) -o \( x$raw = "YES" \) ] then stty -opost ixon <&1 else stty -tabs ixon <&1 fi if [ x$setup = xNO ] then echo "\033E\c" else echo "\033E\033&l${MODE}o${TOPMGN}${TXTLGTH}F\033${LINEWRAP}\033&l${VMI}C\033&k${FONT}S\c" fi echo "$x\r\n$x\r\n$x\r\n$x\r\n" banner "$2" echo "\r\n" user=`grep "^$2:" /etc/passwd | line | cut -d: -f5` if [ -n "$user" ] then echo "User: $user\n" else echo "\r\n" fi echo "Request id: $1 Printer: $printer\n" date echo "\r\n" if [ -n "$3" ] then banner $3 fi echo "\014\c" copies=$4 shift; shift; shift; shift; shift if [ x$1 = "x-raw" ] then shift fi files="$*" i=1 while [ $i -le $copies ] do for file in $files do cat ${file} 2>&1 echo "\014\c" # flushes the last page done i=`expr $i + 1` done echo "\033E\c" # flushes output, resets the machine exit 0 SHAR_EOF chmod +x 'HPLjet' fi if test -f 'HPLjet_Server' then echo shar: "will not over-write existing file 'HPLjet_Server'" else cat << \SHAR_EOF > 'HPLjet_Server' # lp interface for dumb serial line printer server (pass-through) # # not SCCS @(#)dumb_Server 0.0 copies=$4 options=$5 raw=$6 shift; shift; shift; shift; shift if [ "$1" = "-raw" ] then stty -opost ixon <&1 shift else stty -tabs ixon <&1 fi files="$*" i=1 while [ $i -le $copies ] do for file in $files do cat "$file" 2>&1 done i=`expr $i + 1` done echo "\033E\c" exit 0 SHAR_EOF fi if test -f 'HPLjet_remote' then echo shar: "will not over-write existing file 'HPLjet_remote'" else cat << \SHAR_EOF > 'HPLjet_remote' # lp interface for HP 2686A Laserjet printer # modified for ISN dialout operation # assumes font cartridge 92286L Courier P&L # # All output is printed after the printer setup strings # are sent, unless the -f option is given, in which case # no printer setup is done. # # (not)SCCS @(#)ljet 0.0 . /usr/spool/lp/interface/remote x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" printer=`basename $0` for i in $5 do case "$i" in [Pp][Oo][Rr][Tt]*) MODE=0 ;; [Ll][Aa][Nn][Dd]*) MODE=1 ;; [Cc][Oo][Uu][Rr]*) FONT=0 ;; [Ll][Pp]|[Ll][Ii][Nn][Ee]*) FONT=2 ;; f | -f) setup=NO ;; r | -r) raw=YES options=-or ;; esac done # set VMI values for portrait or landscape, # courier (12pt, squashed into 10pt line spacing) or lp (8.5pt) fonts # page print area is 10.5in by 8.0in case ${MODE}${FONT} in 00) VMI=7.6364 ; TXTLGTH=42 ;; 02) VMI=5.7273 ; TXTLGTH=42 ;; 10) VMI=8.00 ; TXTLGTH=32 ;; 12) VMI=5.8182 ; TXTLGTH=32 ;; *) VMI=7.64 ; TXTLGTH=42 ;; esac LINEWRAP="&s1C" # disables line wraparound ("&s0C" enables) TOPMGN="12c1e" # 1/4 inch # \033&l12c1E means 12/48 inch per line (VMI), 1 line top margin if [ \( "$6" = "-raw" \) -o \( x$raw = "YES" \) ] then options=-or fi ( # everything from here is sent through uux if [ x$setup = xNO ] then echo "\033E\c" else echo "\033E\033&l${MODE}o${TOPMGN}${TXTLGTH}F\033${LINEWRAP}\033&l${VMI}C\033&k${FONT}S\c" fi echo "$x\r\n$x\r\n$x\r\n$x\r\n" banner "$2" echo "\r\n" user=`grep "^$2:" /etc/passwd | line | cut -d: -f5` if [ -n "$user" ] then echo "User: $user\n" else echo "\r\n" fi echo "Request id: $1 Printer: $printer\n" date echo "\r\n" if [ -n "$3" ] then banner $3 fi echo "\014\c" copies=$4 shift; shift; shift; shift; shift if [ x$1 = "x-raw" ] then shift fi files="$*" for file in $files do cat ${file} 2>&1 echo "\014\c" # flushes the last page done echo "\033E\c" # flushes output, resets the machine ) | uux - "$MACHINE!lp $options -n$copies -" exit 0 SHAR_EOF chmod +x 'HPLjet_remote' fi exit 0 # End of shell archive