/*****************************************************************************/ /* This source code is `/home/observer/wiro/bin/log_entry.c'. It is a */ /* function which */ /* records comments into the file /home/observer/wiro/logging/log. The */ /* comment can be no longer */ /* than 98 characters. A prototype for log_entry() is: */ /* */ /* #include */ /* #include */ /* void log_entry( char *comment ); */ /* */ /* If the file is opened sucessfully, a date and time stamp is appended to */ /* the file. The character string which is pointed to by the argument is */ /* then appended to the file on a new line. This string is indented one */ /* space for ease of reading. The file is then closed and this function */ /* relinquishes flow of control. If the file cannot be opened, then an */ /* error message is printed. */ /* JSW 27Sept93 */ /* Revisions: */ /* JSW 20Jan00 Ported to Linux. Renamed log_entry to avoid conflict. */ /*****************************************************************************/ #include #include void log_entry( char *comment ) { FILE *fp; time_t now; char s[ 100 ]; fp = fopen( "/home/observer/wiro/logging/log", "a" ); if( fp == NULL ) { printf( "\nUnable to open the log file.\n" ); printf( " Please verify that /home/observer/wiro/logging/log\n"); printf( " exists and is owned by observer./n"); } time( &now ); fprintf( fp, "%s", ctime( &now )); fprintf( fp, " %s\n", comment ); fclose( fp ); }