|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 1822 (0x71e)
Types: TextFile
Names: »cat.c«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
└─⟦this⟧ »cph85dist/rman/daemon/cat.c«
#ifndef lint
static char *RCSid = "$Header: cat.c,v 1.6 85/08/27 15:16:11 broome Exp $";
#endif
/*
* $Log: cat.c,v $
* Revision 1.6 85/08/27 15:16:11 broome
* Last cleanup before release.
*
* Revision 1.5 85/07/06 16:55:41 broome
*
* Revision 1.4 85/07/03 17:34:11 broome
*
* Revision 1.3 85/07/03 15:41:37 broome
* Safety check before major revisions...
*
* Revision 1.2 85/07/02 21:05:36 broome
*
* Revision 1.1 85/06/25 11:23:29 broome
* Initial revision
*/
#include "defs.h"
#include "response.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
cat (argc, argv)
int argc;
char *argv[];
{
extern int errno;
struct stat statb;
struct where *wp;
char line[256];
long date;
FILE *fp;
wp = find (--argc, ++argv);
if (wp->found) {
(void) stat (wp->man, &statb); /* stat the unformatted form */
date = statb.st_mtime; /* last modification date */
if (stat (wp->cat, &statb) < 0 || /* doesn't exist */
statb.st_size == 0 || /* zero length */
statb.st_mtime < date) /* out of date */
if (format (wp->man, wp->cat))
return;
if ((fp = fopen (wp->cat, "r")) == NULL) /* should have it ! */
printf ("%d Cannot open %s: errno %d.\r\n", ERR_NOFILE,
wp->cat, errno);
else {
printf ("%d Here comes the man page for %s! (%s)\r\n", OK_COMING,
wp->name, wp->cat);
while (fgets (line, 256, fp)) /* don't bother with \n => \r\n */
fputs (line, stdout);
puts (".\r");
fclose (fp);
}
} else /* path not found */
notfound (wp);
}