add man pages + add -n option to nobotgate-access

This commit is contained in:
kento2 2026-09-09 03:26:53 +02:00
parent 107ec67105
commit 26aa9c3b7e
4 changed files with 57 additions and 4 deletions

View file

@ -3,7 +3,9 @@
#include <libowfat/str.h>
#include <unistd.h>
#define dieusage() die(100, argv0, " PROG ARGS");
#define dieusage() die(100, argv0, " [-n] PROG ARGS");
static int consume=1;
static void consume_headers(void) {
char buf[2048];
@ -19,12 +21,21 @@ static void consume_headers(void) {
int main(int argc, char **argv)
{
char *header;
(void)argc;
int i;
errmsg_iam(*argv);
for (i=1;i<argc;i++) {
if (argv[i][0]!='-') break;
if (argv[i][1]=='-' && !argv[i][2]) break;
switch (argv[i][1]) {
case 'n': consume=0; break;
default: dieusage();
}
}
argc-=i;argv+=i;
if (argc<2) dieusage();
consume_headers();
if (consume)
consume_headers();
header = "HTTP/1.0 200 OK\r\n"
"Connection: close\r\n"