%%s 0/0/0 %%d D 1.1 25-Mar-82 12:10:31 v1.1 1 0 %%c Version 1.1 is the Spring 1982 Distribution of the LBL/Hughes release %%c of the Software Tools Virtual Operating System software and documentation. %%T %%I 1 #-h- pack.r 1416 asc 25-mar-82 08:15:54 v1.1 (sw-tools v1.1) #-h- defns 54 asc 25-mar-82 08:15:43 v1.1 (sw-tools v1.1) define(CHARS_PER_COLUMN,16) define(DEFAULT_COLUMNS,5) #-h- main 676 asc 25-mar-82 08:15:44 v1.1 (sw-tools v1.1) DRIVER(pack) integer ncol, i, j, n integer getarg, ctoi filedes unit filedes open character arg(FILENAMESIZE) string usestr "usage: pack [-n] [file] ..." call query(usestr) ncol = DEFAULT_COLUMNS n = 0 for (i=1; getarg(i, arg, FILENAMESIZE) != EOF; i=i+1) { if (arg(1) == '-' & arg(2) != EOS) { j = 2 ncol = ctoi(arg, j) ncol = max(ncol, 1) } else { n = n + 1 if (arg(1) == '-') unit = STDIN else { unit = open(arg, READ) if (unit == ERR) call cant(arg) } call pakfil(unit, ncol) if (unit != STDIN) call close(unit) } } if (n == 0) call pakfil(STDIN, ncol) DRETURN end #-h- pakfil 467 asc 25-mar-82 08:15:45 v1.1 (sw-tools v1.1) # pakfil - routine to read words from unit and pack them onto STDOUT subroutine pakfil(unit, ncol) filedes unit integer ncol, rm, nxtcol, i integer getlin, getwrd character obuf(MAXLINE), buf(MAXLINE), word(MAXLINE) rm = ncol * CHARS_PER_COLUMN call inpack(nxtcol, rm, obuf, STDOUT) while (getlin(buf, unit) != EOF) { i = 1 while (getwrd(buf, i, word) > 0) call dopack(word, nxtcol, rm, obuf, STDOUT) } call flpack(nxtcol, rm, obuf, STDOUT) return end #-h- pack.fmt 661 asc 25-mar-82 08:15:55 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Pack (1) 29-Oct-80 pack words into columns .sy pack [-n] [file] ... .ds pack takes the words (groups of characters separated by blanks or tabs) found on the specified files (standard input if none are specified) and outputs them to standard output in columns, 16 spaces wide, ordered from left to right. The characters used to achieve the separation of columns are TAB characters, such that those terminals which support hardware tabs can be driven efficiently. By default, five (5) columns are generated; this value can be overridden through the specification of the -n switch, where n is a decimal number. .fl .sa .di .au Joe Sventek .bu %%E 1