# HG changeset patch # User Karl Heuer # Date 761944931 0 # Node ID 45b117ac2dbc3e80bf1076d2102e47d37c40331b # Parent 6741685c0bb7f23c139f67be0a334bcb62103bd8 (get_time): Simplify; avoid calling index. (main): exit on EOF. diff -r 6741685c0bb7 -r 45b117ac2dbc lib-src/profile.c --- a/lib-src/profile.c Tue Feb 22 04:46:12 1994 +0000 +++ b/lib-src/profile.c Tue Feb 22 19:22:11 1994 +0000 @@ -54,8 +54,6 @@ char * get_time () { - char *result = time_string; - int i; if (watch_not_started) return ((char *) 0); /* call reset_watch first ! */ gettimeofday (&TV2, tzp); @@ -64,10 +62,8 @@ TV2.tv_usec += 1000000; TV2.tv_sec--; } - sprintf (result,"%lu.%6lu", + sprintf (time_string, "%lu.%06lu", TV2.tv_sec - TV1.tv_sec, TV2.tv_usec - TV1.tv_usec); - for (result = index (result, '.') + 1; *result == ' '; result++) - *result = '0'; return time_string; } @@ -75,9 +71,8 @@ main () { char inp[10]; - while (1) + while (gets (inp)) { - gets (inp); switch (inp[0]) { case 'z': @@ -90,4 +85,5 @@ exit (0); } } + exit (1); }