6 #define HTTPD_VERSION "1.0"
8 #define IS_OPTARG(a, s, l) a[1] == s || \
9 strcmp(a + 1, "-" l) == 0
11 static const char *prg_name;
12 static const char *srv_dir =
"/var/html";
17 printf(
"%s (QDNix) v%s\n", prg_name, HTTPD_VERSION);
18 printf(
"Copyright (C) 2023 d0p1\n");
19 printf(
"License BSD-3: <https://directory.fsf.org/wiki/License:BSD-3-Clause>\n");
20 printf(
"This is free software: you are free to change and redistribute it.\n");
21 printf(
"There is NO WARRANTY, to the extent permitted by law.\n");
28 printf(
"Usage: %s [OPTION].. [DIR]\n\n", prg_name);
29 printf(
"Arguments:\n");
30 printf(
"\tDIR\t\tHTML page directory (default: %s)\n", srv_dir);
31 printf(
"\tOptions:\n");
32 printf(
"\t-h,--help\tdisplay this menu and exit\n");
33 printf(
"\t-V,--version\toutput version information and exit\n");
38 main(
int argc,
char *
const argv[])
45 signal(SIGPIPE, SIG_IGN);
47 for (idx = 0; idx < argc; idx++)
49 if (IS_OPTARG(argv[idx],
'V',
"version"))
53 if (IS_OPTARG(argv[idx],
'h',
"help"))
58 return (EXIT_SUCCESS);