static char sccsid
[] = "@(#)uulog.c 4.1 (Berkeley) 9/11/82";
* uulog - this program will append all update files in
* directory (LOGDIR) to the log file (logf) and remove the
* -n - nominal time for delete of lock file
* -s - system name for search
* -u - user name for search
* -x - turn on debug outputs
register struct direct
*dirp
;
extern int onintr(), intr1();
char buf
[BUFSIZ
], u
[20], s
[20];
while (argc
>1 && argv
[1][0] == '-') {
printf("-d option removed\n");
nomtime
= atoi(&argv
[1][2]); break;
Debug
= atoi(&argv
[1][2]);
printf("unknown flag %s\n", argv
[1]); break;
DEBUG(4, "%s\n", "START");
if (ulockf(LOGLOCK
, nomtime
) != 0)
if ((plogf
= fopen(LOGFILE
, "a")) == NULL
) {
printf("can't open %s\n", LOGFILE
);
ASSERT(lsp
!= NULL
, "CAN NOT OPEN %s", LOGDIR
);
while ((dirp
= readdir(lsp
)) != NULL
) {
DEBUG(4, "file-%s\n", dirp
->d_name
);
if (prefix(LOGPREFIX
, dirp
->d_name
)) {
DEBUG(4, "copy file %s\n", dirp
->d_name
);
if (appendf(plogf
, dirp
->d_name
) == SUCCESS
) {
if (user
== NULL
&& system
== NULL
)
plogf
= fopen(LOGFILE
, "r");
ASSERT(plogf
!= NULL
, "CAN NOT OPEN %s", LOGFILE
);
while (fgets(buf
, BUFSIZ
, plogf
) != NULL
) {
sscanf(buf
, "%s%s", u
, s
);
if (user
!= NULL
&& !prefix(user
, u
))
if (system
!= NULL
&& !prefix(system
, s
))
* onintr - interrupt routine
* appendf(fp, entryf) append file (entryf) to fp file
* FAIL - file not readable
if ((pentryf
= fopen(entryf
, "r")) == NULL
) {
/* file entryf not readable */
while (fgets(ltext
, 512, pentryf
)) fputs(ltext
, fp
);