|
|
1.1 ! root 1: /* $Header: last.c,v 4.3 85/05/01 11:42:16 lwall Exp $ ! 2: * ! 3: * $Log: last.c,v $ ! 4: * Revision 4.3 85/05/01 11:42:16 lwall ! 5: * Baseline for release with 4.3bsd. ! 6: * ! 7: */ ! 8: ! 9: #include "EXTERN.h" ! 10: #include "common.h" ! 11: #include "rn.h" ! 12: #include "util.h" ! 13: #include "intrp.h" ! 14: #include "INTERN.h" ! 15: #include "last.h" ! 16: ! 17: char *lastname = Nullch; /* path name of .rnlast file */ ! 18: ! 19: void ! 20: last_init(tcbuf) ! 21: char *tcbuf; ! 22: { ! 23: lastname = savestr(filexp(LASTNAME)); ! 24: if ((tmpfp = fopen(lastname,"r")) != Nullfp) { ! 25: fgets(tcbuf,1024,tmpfp); ! 26: tcbuf[strlen(tcbuf)-1] = '\0'; ! 27: lastngname = savestr(tcbuf); ! 28: fgets(tcbuf,1024,tmpfp); ! 29: lasttime = atol(tcbuf); ! 30: fgets(tcbuf,1024,tmpfp); ! 31: lastactsiz = atol(tcbuf); ! 32: fclose(tmpfp); ! 33: } ! 34: else { ! 35: lastngname = nullstr; ! 36: lasttime = 0; ! 37: lastactsiz = 0; ! 38: } ! 39: } ! 40: ! 41: /* put out certain values for next run of rn */ ! 42: ! 43: void ! 44: writelast() ! 45: { ! 46: if ((tmpfp = fopen(lastname,"w")) != Nullfp) { ! 47: fprintf(tmpfp,"%s\n%ld\n%ld\n",ngname,(long)lasttime,(long)lastactsiz); ! 48: fclose(tmpfp); ! 49: } ! 50: else ! 51: printf(cantcreate,lastname) FLUSH; ! 52: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.