# include "../hdr/defines.h"
Program to print parts or all of an SCCS file.
Arguments to the program may appear in any order
and consist of keyletters, which begin with '-',
If a direcory is given as an argument, each
SCCS file within the directory is processed as if
it had been specifically named. If a name of '-'
is given, the standard input is read for a list
of names of SCCS files to be processed.
Non-SCCS files are ignored.
# define BLANK(p) while (!(*p == ' ' || *p == '\t')) p++;
Set flags for 'fatal' to issue message, call clean-up
routine, and terminate processing.
Fflags
= FTLMSG
| FTLCLN
| FTLEXIT
;
The following loop processes keyletters and arguments.
Note that these are processed only once for each
for (j
= 1; j
< argc
; j
++)
if (argv
[j
][0] == '-' && (c
= argv
[j
][1])) {
case 'e': /* print everything but body */
case 's': /* print only delta desc. and stats */
case 'd': /* print whole delta table */
case 'a': /* print all deltas */
case 'i': /* print inc, exc, and ignore info */
case 'u': /* print users allowed to do deltas */
case 'f': /* print flags */
case 't': /* print descriptive user-text */
case 'b': /* print body */
case 'y': /* delta cutoff */
case 'c': /* time cutoff */
if (*p
&& date_ab(p
,&cutoff
))
fatal("bad date/time (cm5)");
case 'r': /* reverse time cutoff */
if (*p
&& date_ab(p
,&revcut
))
fatal ("bad date/time (cm5)");
fatal("unknown key letter (cm1)");
if (had
[c
- 'a']++ && testklt
++)
fatal("key letter twice (cm2)");
fatal("missing file arg (cm3)");
fatal("both 'c' and 'r' keyletters specified (pr2)");
Change flags for 'fatal' so that it will return to this
routine (main) instead of terminating processing.
Call 'prt' routine for each file argument.
for (j
= 1; j
< argc
; j
++)
Routine that actually performs the 'prt' functions.
if (setjmp(Fjmp
)) /* set up to return here from 'fatal' */
return; /* and return to caller of prt */
HADD
= HADI
= HADU
= HADF
= HADT
= 1;
if (!HADU
&& !HADF
&& !HADT
&& !HADB
)
HADR
= HADS
= HADA
= HADI
= HADY
= HADC
= 0;
fatal("s and i conflict (pr1)");
if (*p
++ != CTLCHAR
|| *p
!= HEAD
)
fatal("not an sccs file (co2)");
while ((p
= lineread(NOEOF
)) && *p
++ == CTLCHAR
&&
*p
++ == STATS
&& !stopdel
) {
if (!HADA
&& del
.type
!= 'D') {
date_ab(del
.datetime
,&bindate
);
date_ab(del
.datetime
,&bindate
);
if (HADY
&& (equal(del
.osid
,ysid
) || !(*ysid
)))
while ((p
= lineread(NOEOF
)) && *p
++ == CTLCHAR
) {
printit(file
,"Included:\t",p
);
printit(file
,"Excluded:\t",p
);
printit(file
,"Ignored:\t",p
);
printit(file
,"MRs:\t",p
);
"format error at line %d (co4)",linenum
));
if (stopdel
&& !(line
[0] == CTLCHAR
&& line
[1] == BUSERNAM
))
printf("\nUsers allowed to make deltas --\n");
while ((p
= lineread(NOEOF
)) && *p
!= CTLCHAR
) {
while ((p
= lineread(NOEOF
)) && *p
++ == CTLCHAR
&&
printf("\t%s",flagdesc
[*p
- 'a']);
printf("\nDescription --\n");
while ((p
= lineread(NOEOF
)) && *p
!= CTLCHAR
) {
while (p
= lineread(EOF
))
register struct delent
*delp
;
while ((n
= lineread(NOEOF
)) &&
!(*n
++ == CTLCHAR
&& *n
== ch
))
k
= fgets(line
,512,iptr
);
fatal("premature eof (co5)");
register struct delent
*delp
;
statistics
[length(statistics
) - 1] = '\0';
printf("%c %s\t%s\t%s\t%s\t%s\t%s",delp
->type
,delp
->osid
,
delp
->datetime
,delp
->pgmr
,delp
->serial
,delp
->pred
,statistics
);
cp
[length(cp
) - 1] = '\0';