diff options
Diffstat (limited to 'charf.c')
| -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.*/ |
