diff options
| author | Julian Weigt <juw@posteo.de> | 2026-02-09 22:11:31 +0100 |
|---|---|---|
| committer | Julian Weigt <juw@posteo.de> | 2026-02-09 22:11:31 +0100 |
| commit | 98399651862197ddf0f8215460ca91c8592c761f (patch) | |
| tree | b5d62ca1318b5159b3cd262c295f8c3d67c897d7 | |
| parent | b89e863851e4c5a0279129d423634d077fc85daf (diff) | |
Print message after each user input.
| -rw-r--r-- | charf.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -518,7 +518,7 @@ void* handle_threads(void* arguments){ pthread_join(args->threads[i], NULL); printf("In main: Thread %d has ended.\n", i); } - printf("All calculations finished.\n"); + printf("All calculations finished.\n\n"); printf(args->message); } @@ -567,8 +567,14 @@ int main() { do { getLine(prmpt, buff, sz); if( 0 == strcmp(buff,"q") || 0 == strcmp(buff,"quit") || 0 == strcmp(buff,"exit") ){ - abort = true; - if(finished >= NUM_THREADS) user_input_cont = false; + if(finished < NUM_THREADS){ + printf("Aborting calculations.\n"); + abort = true; + } + else{ + printf("Stopping program.\n"); + user_input_cont = false; + } } else if( 0 == strcmp(buff,"r")) print_records(exponents,records_ratio,records_index); else if( 0 == strcmp(buff,"t")*strcmp(buff,"p")){ @@ -578,6 +584,8 @@ int main() { getLine("Enter file name:\n", buff, sz); print_records_to_file(exponents,records_ratio,records_index,buff,format); } + else printf("Command \"%s\" unrecognized.\n",buff); + printf("\n"); } while(user_input_cont); /*Wait for thread handler thread to complete.*/ |
