From 1c70bda212c5200f25bb893e7ced9e79c3aa233a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 1 Mar 2019 17:13:38 -0800 Subject: [PATCH] Tidying up --- arg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arg.c b/arg.c index f8d7de7..db5a9e5 100644 --- a/arg.c +++ b/arg.c @@ -12,9 +12,9 @@ #include #include -#define EXIT_SUCCESS 0 -#define EXIT_NO_MATCH 1 -#define EXIT_BAD_USAGE -1 +const int EXIT_SUCCESS = 0; +const int EXIT_NO_MATCH = 1; +const int EXIT_BAD_USAGE = -1; int main(int argc, char **argv) { @@ -32,14 +32,14 @@ int main(int argc, char **argv) if (argv[i+1] && argv[i+1][0] != '-') // --flag puts(argv[i+1]); // value of the flag return EXIT_SUCCESS; - } else if (arg[flaglen] == '=') { // --flag=... + } else if (arg[flaglen] == '=') { // --flag= puts(&arg[flaglen+1]); return EXIT_SUCCESS; } } if (ischarflag && arg[0] == '-' && arg[1] != '-') { - // If flag is single-character without a value, e.g. -f, look - // for it among other single character flags like -xfy. + // If flag is single-character, e.g. -f, look for it among other + // single character flags like -xfy. for (char *c = &arg[1]; *c; c++) { if (*c == flag[1]) return EXIT_SUCCESS;