improved helpstring.

This commit is contained in:
Gabe Venberg 2023-09-07 11:38:55 -05:00
parent 97fb8de5da
commit 187bb3f761

View file

@ -1,8 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
static const char Help[] = "Reads a file and outputs to a file while also printing contents.";
static const char Usage[] = "INPUT_FILE [OUTPUT_FILE]";
static const char doc[] =
"Reads a file and outputs to a file while also printing contents.\n"
"If OUTPUT_FILE is not given, will only output to stdout";
static const char args_doc[] = "INPUT_FILE [OUTPUT_FILE]";
struct arguments {
char* inFile;
@ -11,7 +13,7 @@ struct arguments {
int main(int argc, char* argv[]) {
// for some reason, when doing this with a serial port, log.log never gets written to. I think this is becasue the
// program is terminated with ctrl-c, so the file descriptors dont close?.
// program is terminated with ctrl-c, so the file descriptors dont close? adding fflushes fixes it, but I shouldnt need to add that.
struct arguments arguments = {NULL, NULL};
@ -23,7 +25,7 @@ int main(int argc, char* argv[]) {
arguments.inFile = argv[1];
break;
default:
printf("%s\n%s\n", Usage, Help);
printf("%s\n%s\n", args_doc, doc);
return EXIT_FAILURE;
break;
}