#-h- cprsym 246 asc 24-apr-81 09:15:58 [002,100] # symbols for compress and expand tools # put on a file called 'cprsym' # Used only by compress and expand #must have RCODE > (MAXCHUNK + BLANK) or RCODE = 0 define(RCODE,125) define(MAXCHUNK,arith(RCODE,-,incr(BLANK))) define(THRESH,4) #-h- expand.r 1064 asc 24-apr-81 09:15:59 [002,100] #-h- main 452 asc 24-apr-81 09:14:36 [002,100] ## expand - uncompress input files include cprsym DRIVER(expand) character buf(MAXLINE) integer getarg, open integer i call query("usage: expand [file] ...") for (i=1; getarg(i, buf, MAXLINE) != EOF; i=i+1) { if (buf(1) == MINUS & buf(2) == EOS) int = STDIN else { int = open(buf,READ) if (int == ERR) call cant(buf) } call xpd (int) if (int != STDIN) call close(int) } if (i == 1) call xpd(STDIN) DRETURN end #-h- xpd 488 asc 24-apr-81 09:14:37 [002,100] ## xpd - uncompress file -int- subroutine xpd (int) character getch character c, code while(getch(code,int) != EOF) if (code == RCODE) #expand repetition { if (getch(c,int) == EOF) break if (getch(code,int) == EOF) break for (code = code - BLANK; code >0; code = code - 1) call putc(c) } else { for (code = code - BLANK; code > 0; code = code - 1) { if (getch(c,int) == EOF) break call putc(c) } if (c == EOF) break } return end #-h- expand.rof 739 asc 06-may-81 07:39:39 [002,100] .pl 60 .bp .rm 70 .in 0 .he 'EXPAND'1.15.79'EXPAND' .fo ''-#-' .fi NAME .br .in 7 expand - uncompress input files .sp 1 .in SYNOPSIS .br .in 7 expand [file ...] .sp 1 .in DESCRIPTION .br .in 7 Expand expands files previously compressed by 'cpress'. If no input files are given, or if the filename '-' appears, input will be read from the standard input. .sp 1 .in FILES .br .in 7 .sp 1 .in SEE ALSO .br .in 7 cpress .sp 1 .in DIAGNOSTICS .br .in 7 A message is printed if an input file cannot be opened; further processing is terminated. .sp 1 .in AUTHORS .br .in 7 .sp 1 Original from Kernighan & Plauger's 'Software Tools', with minor modifications by Debbie Scherrer. .sp 1 .in BUGS .br .in 7