/*****************************************************************************/ /* This source code is `/usr/local/wiro/lib/log.c'. It allows observers to */ /* record comments into a file. By default their comments are appended to */ /* /data/log; however, the observer is invited to specify any path and */ /* filename. If the file is opened sucessfully, a date and time stamp is */ /* appended to the file and sent to the screen. The prompt `> ' appears */ /* on this line and each suceeding line until the end of the comment is */ /* indicated by responding to the prompt with `.'. If the file cannot */ /* be opened, then an error message is printed and the observer is invited */ /* to specify a different file or quit. The file is closed and this */ /* routine relinquishes flow of control after the comment is terminated. */ /* JSW 23Sept93 */ /*****************************************************************************/ /* Port to Linux. JSW 18Jan00 */ #include #include FILE *fp; char s1[ 100 ]; char s[ 100 ]; GetLine( t, lim ) char t[]; int lim; { int c, i; for( i=0; i.'.\n\n" ); time( &now ); strcpy( s, ctime( &now ) ); printf( "> %s", s ); while( strcmp( s, " .\n" ) != 0 ) { fprintf( fp, "%s", s ); printf( "> " ); GetLine( s1, 98 ); strcpy( s, " " ); strcat( s, s1 ); } fclose( fp ); }