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: }

Defined functions

last_init defined in line 19; used 2 times
writelast defined in line 43; used 3 times

Defined variables

lastname defined in line 17; used 4 times
Last modified: 1985-06-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1086
Valid CSS Valid XHTML 1.0 Strict