217 |
|
|
218 |
// check command line arguments |
// check command line arguments |
219 |
if (argc < 2) { |
if (argc < 2) { |
220 |
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"); |
221 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
222 |
} |
} |
223 |
|
|
233 |
|
|
234 |
} else if (scan_argv(argc, argv, "-p", arg_value)) { |
} else if (scan_argv(argc, argv, "-p", arg_value)) { |
235 |
if (strlen(arg_value) == 0) { |
if (strlen(arg_value) == 0) { |
236 |
fprintf(stderr, "Please specify number of processes!\n"); |
fprintf(stderr, "Error: Please specify number of processes!\n"); |
237 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
238 |
} |
} |
239 |
use_processes = TRUE; |
use_processes = TRUE; |
241 |
workers = atoi(arg_value); |
workers = atoi(arg_value); |
242 |
|
|
243 |
} else if (scan_argv(argc, argv, "-t", arg_value)) { |
} else if (scan_argv(argc, argv, "-t", arg_value)) { |
244 |
if (strlen(arg_value) == 0) { |
|
245 |
fprintf(stderr, "Please specify number of threads!\n"); |
if (strlen(arg_value) == 0) |
246 |
|
fprintf(stderr, "Error: Please specify number of threads!\n"), |
247 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
248 |
} |
|
249 |
use_processes = FALSE; |
use_processes = FALSE; |
250 |
is_worker_process = FALSE; |
is_worker_process = FALSE; |
251 |
workers = atoi(arg_value); |
workers = atoi(arg_value); |
252 |
|
|
253 |
} |
} |
254 |
|
|
255 |
|
if (!is_worker_process && workers < 1) |
256 |
|
fprintf(stderr, "Error: Number of threads/processes must be >0!\n"), |
257 |
|
exit(EXIT_FAILURE); |
258 |
|
|
259 |
if (VERBOSE && use_processes) { |
if (VERBOSE && use_processes) { |
260 |
fprintf(stdout, "===================================================== "); |
fprintf(stdout, "===================================================== "); |
269 |
if (!is_worker_process) { |
if (!is_worker_process) { |
270 |
|
|
271 |
if (argc < 4) { |
if (argc < 4) { |
272 |
fprintf(stderr, "Must give filename of image as third argument!\n"); |
fprintf(stderr, "Error: Must give filename of image as third argument!\n"); |
273 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
274 |
} |
} |
275 |
|
|