Browse Source

Commandline argument handling, builds but still nonfunctional...

master
Zenithium 4 months ago
parent
commit
a68f8fe764
Signed by: zenithium GPG Key ID: 38864E2AF5991B22
  1. 26
      src/argparse.c
  2. 9
      src/ceapot.c
  3. 5
      src/include/argparse.h
  4. 8
      src/main.c

26
src/argparse.c

@ -0,0 +1,26 @@
#include <argparse.h>
#include <stdio.h>
#include <string.h>
void
checkforhelp(int argc, char *argv[])
{
char *helppage;
helppage =
"ceapot - a HTCPCP implementation in C (server)\n-h --help - show this page\n-k start|stop|restart - send various control signals to the server\n-p --port - specify a port (default: 80)\n";
if(argv[1] == "-h" || argv[1] == "--help" || argc == 0)
printf("%s", helppage);
}
int
checkforstr(int argc, char *argv[], char *chkstr)
{
int i;
for(i = 0; i < argc; i++)
{
if(strcmp(chkstr, argv[i]) == 0)
return 0;
}
return -1;
}

9
src/ceapot.c

@ -0,0 +1,9 @@
#include <stdio.h>
#include <argparse.h>
int
main(int argc, char *argv[])
{
checkforhelp(argc, argv);
return 0;
}

5
src/include/argparse.h

@ -0,0 +1,5 @@
void
checkforhelp(int argc, char *argv[]);
int
checkforstr(int argc, char *argv[], char *chkstr);

8
src/main.c

@ -1,8 +0,0 @@
#include <stdio.h>
int
main()
{
printf("placeholder");
return 0;
}
Loading…
Cancel
Save