comparison sciwebd.c @ 2:5fa3d2f479b2

sci: initial upload support
author David Demelier <markand@malikania.fr>
date Thu, 10 Jun 2021 10:39:21 +0200
parents f1de39079243
children 3051ef92173a
comparison
equal deleted inserted replaced
1:5afdb14df924 2:5fa3d2f479b2
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdnoreturn.h>
4 #include <unistd.h>
5
6 #include "http.h"
7 #include "log.h"
8
9 const char *sock = VARDIR "/run/sci.sock";
10
11 noreturn static void
12 usage(void)
13 {
14 fprintf(stderr, "usage: %s [-f] [-s sock]\n", getprogname());
15 exit(1);
16 }
17
18 static void
19 init(void)
20 {
21 log_open(getprogname());
22 }
23
24 static void
25 finish(void)
26 {
27 log_finish();
28 }
29
1 int 30 int
2 main(void) 31 main(int argc, char **argv)
3 { 32 {
33 int ch;
34 void (*run)(void) = &(http_cgi_run);
35
36 setprogname("sciwebd");
37
38 while ((ch = getopt(argc, argv, "fs:")) != -1) {
39 switch (ch) {
40 case 'f':
41 run = &(http_fcgi_run);
42 break;
43 case 's':
44 sock = optarg;
45 break;
46 default:
47 usage();
48 break;
49 }
50 }
51
52 init();
53 run();
54 finish();
4 } 55 }