--- joko/Uni/BSArch/04/bmp_fractal.c 2006/07/02 12:33:35 1.17 +++ joko/Uni/BSArch/04/bmp_fractal.c 2006/07/02 12:41:56 1.18 @@ -5,7 +5,7 @@ * Uebung 4.4 */ -// $Id: bmp_fractal.c,v 1.17 2006/07/02 12:33:35 joko Exp $ +// $Id: bmp_fractal.c,v 1.18 2006/07/02 12:41:56 joko Exp $ #include #include @@ -217,7 +217,7 @@ // check command line arguments if (argc < 2) { - fprintf(stderr, "Can not run without arguments!\nPlease specify '-t {number of threads}' or '-p {number of processes}' and an image filename.\n"); + fprintf(stderr, "Error: Can not run without arguments!\nPlease specify '-t {number of threads}' or '-p {number of processes}' and an image filename.\n"); exit(EXIT_FAILURE); } @@ -233,7 +233,7 @@ } else if (scan_argv(argc, argv, "-p", arg_value)) { if (strlen(arg_value) == 0) { - fprintf(stderr, "Please specify number of processes!\n"); + fprintf(stderr, "Error: Please specify number of processes!\n"); exit(EXIT_FAILURE); } use_processes = TRUE; @@ -241,16 +241,20 @@ workers = atoi(arg_value); } else if (scan_argv(argc, argv, "-t", arg_value)) { - if (strlen(arg_value) == 0) { - fprintf(stderr, "Please specify number of threads!\n"); + + if (strlen(arg_value) == 0) + fprintf(stderr, "Error: Please specify number of threads!\n"), exit(EXIT_FAILURE); - } + use_processes = FALSE; is_worker_process = FALSE; workers = atoi(arg_value); } - + + if (!is_worker_process && workers < 1) + fprintf(stderr, "Error: Number of threads/processes must be >0!\n"), + exit(EXIT_FAILURE); if (VERBOSE && use_processes) { fprintf(stdout, "===================================================== "); @@ -265,7 +269,7 @@ if (!is_worker_process) { if (argc < 4) { - fprintf(stderr, "Must give filename of image as third argument!\n"); + fprintf(stderr, "Error: Must give filename of image as third argument!\n"); exit(EXIT_FAILURE); }