1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
static char rcsid[] ="@(#)$Id: audit.c,v 5.3 1993/02/09 19:04:38 syd Exp $";
/*******************************************************************************
* The Elm Mail System - $Revision: 5.3 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Philip Brown filter@bolthole.com
*
*******************************************************************************
* $Log: audit.c,v $
* Revision 5.3 1993/02/09 19:04:38 syd
* use standard include method on time.h style includes
*
* Revision 5.2 1993/01/27 21:30:10 syd
* fix include syntax
*
* Revision 5.1 1993/01/27 19:40:18 syd
* Initial checkin
*
*
******************************************************************************/
/** allow date/time to be combined with username in verbose audit
**/
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#ifdef I_SYSTIME
# include <sys/time.h>
#endif
#include "defs.h"
#include "filter.h"
#include "s_filter.h"
extern int errno;
char *
date_n_user()
{
static char date[NLEN];
static char *stuff = NULL;
time_t now;
now = time(NULL);
if (!strftime(date, NLEN, "%c", localtime(&now)))
return (username);
if (stuff)
free(stuff);
if (!(stuff = malloc(strlen(username) + strlen(date) + 3)))
return (username);
sprintf(stuff, "%s %s", date, username);
return(stuff);
}
char *
datestring()
{
static char date[NLEN];
time_t now;
now = time(NULL);
if (!strftime(date, NLEN, "%c", localtime(&now)))
return ("[strftime failed?]" );
return(date);
}
|