mirror of
https://github.com/ksherlock/gopher.git
synced 2024-12-28 19:32:21 +00:00
more flags
This commit is contained in:
parent
7287f069ba
commit
2b310a2161
1
flags.h
1
flags.h
@ -5,6 +5,7 @@ typedef struct Flags {
|
|||||||
|
|
||||||
int _0:1; // -1 (use http 1.0)
|
int _0:1; // -1 (use http 1.0)
|
||||||
int _9:1; // -9 (use http 0.9)
|
int _9:1; // -9 (use http 0.9)
|
||||||
|
int _i:1; // -i (include http headers)
|
||||||
int _O:1; // -O (file name from url)
|
int _O:1; // -O (file name from url)
|
||||||
int _v:1; // -v (verbose)
|
int _v:1; // -v (verbose)
|
||||||
|
|
||||||
|
22
main.c
22
main.c
@ -91,6 +91,7 @@ void help(void)
|
|||||||
fputs("gopher [options] url\n", stdout);
|
fputs("gopher [options] url\n", stdout);
|
||||||
fputs("-h display help information.\n", stdout);
|
fputs("-h display help information.\n", stdout);
|
||||||
fputs("-V display version information.\n", stdout);
|
fputs("-V display version information.\n", stdout);
|
||||||
|
fputs("-i display http headers.\n", stdout);
|
||||||
fputs("-O write output to file.\n", stdout);
|
fputs("-O write output to file.\n", stdout);
|
||||||
fputs("-o <file> write output to <file> instead of stdout.\n", stdout);
|
fputs("-o <file> write output to <file> instead of stdout.\n", stdout);
|
||||||
fputs("-0 use HTTP 1.0\n", stdout);
|
fputs("-0 use HTTP 1.0\n", stdout);
|
||||||
@ -152,23 +153,19 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (mf == -1)
|
if (mf == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Marinetti 3.0b3 or higher is required.\n");
|
fprintf(stderr, "Marinetti 3.0b3 or greater is required.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&flags, 0, sizeof(flags));
|
memset(&flags, 0, sizeof(flags));
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "o:OhVv09")) != -1)
|
while ((ch = getopt(argc, argv, "o:hiOVv09")) != -1)
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case 'V':
|
|
||||||
fputs("gopher v 0.2\n", stdout);
|
|
||||||
exit(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'v':
|
case 'i':
|
||||||
flags._v = 1;
|
flags._i = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
@ -181,6 +178,10 @@ int main(int argc, char **argv)
|
|||||||
flags._o = NULL;
|
flags._o = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'v':
|
||||||
|
flags._v = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case '9':
|
case '9':
|
||||||
flags._9 = 1;
|
flags._9 = 1;
|
||||||
flags._0 = 0;
|
flags._0 = 0;
|
||||||
@ -191,6 +192,11 @@ int main(int argc, char **argv)
|
|||||||
flags._9 = 0;
|
flags._9 = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'V':
|
||||||
|
fputs("gopher v 0.2\n", stdout);
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
case ':':
|
case ':':
|
||||||
|
Loading…
Reference in New Issue
Block a user