# include # include # include "ppc_fetch_line.h" int main ( ); void timestamp ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: ppc_fetch_line_test() tests ppc_fetch_line(). Licensing: This code is distributed under the MIT license. Modified: 07 September 2023 Author: John Burkardt */ { # define BUFLEN 255 char buf[BUFLEN]; int lineno = 0; char *s; printf ( "\n" ); printf ( "ppc_fetch_line_test():\n" ); printf ( " C version.\n" ); printf ( " Test ppc_fetch_line().\n" ); printf ( "\n" ); while ( ( s = fetch_line ( buf, BUFLEN, stdin, &lineno ) ) != NULL ) { printf ( "%3d: %s\n", lineno, s ); } /* Terminate. */ printf ( "\n" ); printf ( "ppc_fetch_line_test():\n" ); printf ( " Normal end of execution.\n" ); printf ( "\n" ); timestamp ( ); return 0; } /******************************************************************************/ void timestamp ( ) /******************************************************************************/ /* Purpose: timestamp() prints the current YMDHMS date as a time stamp. Example: 17 June 2014 09:45:54 AM Licensing: This code is distributed under the MIT license. Modified: 17 June 2014 Author: John Burkardt */ { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct tm *tm; time_t now; now = time ( NULL ); tm = localtime ( &now ); strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); printf ( "%s\n", time_buffer ); return; # undef TIME_SIZE }