Print the file name if we use the default. Consider the header_flag for the
default name. Correct the help() desc for the --header flag (it takes no arg).
printf("\n");
printf("Application Options:\n");
printf(" -o, --output FILE Write output to FILE\n");
- printf(" --header FILE Write header to FILE\n");
+ printf(" --header Write header instead of .c file\n");
printf("\n");
exit (0);
}
if (output_file == NULL) {
- output_file = "out.c";
+ output_file = output_header ? "out.h" : "out.c";
+ printf("Writing to file: %s\n", output_file);
}
output = fopen (output_file, "w");
printf("\n");
printf("Application Options:\n");
printf(" -o, --output FILE Write output to FILE\n");
- printf(" --header FILE Write header to FILE\n");
+ printf(" --header Write header instead of .c file\n");
printf("\n");
exit (0);
}
if (output_file == NULL) {
- output_file = "out.c";
+ output_file = output_header ? "out.h" : "out.c";
+ printf("Writing to file: %s\n", output_file);
}
output = fopen (output_file, "w");