home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
TELECOM
/
rn_4_3_blars.lzh
/
last.c
< prev
next >
Wrap
Text File
|
1990-08-22
|
1KB
|
59 lines
/* $Header: last.c,v 4.3.2.1 89/12/20 23:23:07 sob Exp $
*
* $Log: last.c,v $
* Revision 4.3.2.1 89/12/20 23:23:07 sob
* .rnlast sometimes is a null file. This gives bogus information when
* restarting rn following an abnormal termination. This bug was reported
* by weening@gang-of-four.stanford.edu
*
* Revision 4.3 85/05/01 11:42:16 lwall
* Baseline for release with 4.3bsd.
*
*/
#include "EXTERN.h"
#include "common.h"
#include "rn.h"
#include "util.h"
#include "intrp.h"
#include "INTERN.h"
#include "last.h"
char *lastname = Nullch; /* path name of .rnlast file */
void
last_init(tcbuf)
char *tcbuf;
{
lastname = savestr(filexp(LASTNAME));
if ((tmpfp = fopen(lastname,"r")) != Nullfp &&
fgets(tcbuf,1024,tmpfp) != Nullch) {
tcbuf[strlen(tcbuf)-1] = '\0';
lastngname = savestr(tcbuf);
fgets(tcbuf,1024,tmpfp);
lasttime = atol(tcbuf);
fgets(tcbuf,1024,tmpfp);
lastactsiz = atol(tcbuf);
fclose(tmpfp);
}
else {
lastngname = nullstr;
lasttime = 0;
lastactsiz = 0;
}
}
/* put out certain values for next run of rn */
void
writelast()
{
if ((tmpfp = fopen(lastname,"w")) != Nullfp) {
fprintf(tmpfp,"%s\n%ld\n%ld\n",
(ngname==Nullch?nullstr:ngname),(long)lasttime,(long)lastactsiz);
fclose(tmpfp);
}
else
printf(cantcreate,lastname) FLUSH;
}