improved helpstring.
This commit is contained in:
parent
97fb8de5da
commit
187bb3f761
|
@ -1,8 +1,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static const char Help[] = "Reads a file and outputs to a file while also printing contents.";
|
static const char doc[] =
|
||||||
static const char Usage[] = "INPUT_FILE [OUTPUT_FILE]";
|
"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 {
|
struct arguments {
|
||||||
char* inFile;
|
char* inFile;
|
||||||
|
@ -11,7 +13,7 @@ struct arguments {
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
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
|
// 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};
|
struct arguments arguments = {NULL, NULL};
|
||||||
|
|
||||||
|
@ -23,7 +25,7 @@ int main(int argc, char* argv[]) {
|
||||||
arguments.inFile = argv[1];
|
arguments.inFile = argv[1];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("%s\n%s\n", Usage, Help);
|
printf("%s\n%s\n", args_doc, doc);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue