Skip to content

Commit

Permalink
Use variable for program name
Browse files Browse the repository at this point in the history
  • Loading branch information
jlecour authored and bagder committed Mar 31, 2023
1 parent 47616d4 commit d00a63b
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions urler.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@

#include "version.h"

#define OUTPUT_URL 0 /* default */
#define OUTPUT_SCHEME 1
#define OUTPUT_USER 2
#define OUTPUT_PASSWORD 3
#define OUTPUT_OPTIONS 4
#define OUTPUT_HOST 5
#define OUTPUT_PORT 6
#define OUTPUT_PATH 7
#define OUTPUT_QUERY 8
#define OUTPUT_FRAGMENT 9
#define OUTPUT_ZONEID 10
#define PROGNAME "urler"

static void help(const char *msg)
{
if(msg != NULL)
Expand Down Expand Up @@ -65,23 +78,10 @@ static void help(const char *msg)

static void show_version(void)
{
fputs("urler version " URLER_VERSION_TXT "\n", stdout);
fputs(PROGNAME " version " URLER_VERSION_TXT "\n", stdout);
exit(0);
}

#define OUTPUT_URL 0 /* default */
#define OUTPUT_SCHEME 1
#define OUTPUT_USER 2
#define OUTPUT_PASSWORD 3
#define OUTPUT_OPTIONS 4
#define OUTPUT_HOST 5
#define OUTPUT_PORT 6
#define OUTPUT_PATH 7
#define OUTPUT_QUERY 8
#define OUTPUT_FRAGMENT 9
#define OUTPUT_ZONEID 10


struct option {
const char *url;
const char *host;
Expand Down Expand Up @@ -276,8 +276,9 @@ int main(int argc, const char **argv)
curl_free(nurl);
}
else {
fprintf(stderr, "not enough input to show %s (urle -h for help)\n",
name);
fprintf(stderr, "not enough input to show %s (%s -h for help)\n",
name,
PROGNAME);
exit_status = 1;
}
}
Expand All @@ -288,7 +289,8 @@ int main(int argc, const char **argv)
curl_free(nurl);
}
else {
fprintf(stderr, "not enough input for a URL (urle -h for help)\n");
fprintf(stderr, "not enough input for a URL (%s -h for help)\n",
PROGNAME);
exit_status = 1;
}
}
Expand Down

0 comments on commit d00a63b

Please sign in to comment.