From 273f348fa84fd4d7882f7aae67202eb5e89a4d0a Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 13 Feb 2012 17:06:42 -0700 Subject: [PATCH] remove libowfat (will not compile) --- Makefile | 58 ++++------------------------ README.auth | 20 ---------- SPEED | 32 ---------------- TODO | 3 +- buffer.h | 70 ---------------------------------- buffer_1.c | 7 ---- buffer_2.c | 7 ---- buffer_flush.c | 10 ----- buffer_put.c | 17 --------- buffer_putflush.c | 7 ---- buffer_puts.c | 6 --- buffer_putspace.c | 7 ---- buffer_putulong.c | 8 ---- buffer_putulonglong.c | 8 ---- buffer_stubborn.c | 15 -------- byte.h | 38 ------------------- byte_copy.c | 28 -------------- byte_diff.c | 21 ---------- cgi-post.c | 55 --------------------------- contrib/fnord-auth-0.1.tgz | Bin 3361 -> 0 bytes convert.pl | 40 ------------------- fmt.h | 76 ------------------------------------- fmt_ulong.c | 11 ------ fmt_ulonglong.c | 12 ------ fnord-conf | 33 ---------------- httpd.c => fnord.c | 0 http | 2 - scan.h | 61 ----------------------------- scan_ulong.c | 13 ------- scan_ulonglong.c | 13 ------- str.h | 43 --------------------- str_chr.c | 13 ------- str_copy.c | 13 ------- str_diff.c | 20 ---------- str_diffn.c | 21 ---------- str_len.c | 12 ------ str_start.c | 14 ------- 37 files changed, 8 insertions(+), 806 deletions(-) delete mode 100644 README.auth delete mode 100644 SPEED delete mode 100644 buffer.h delete mode 100644 buffer_1.c delete mode 100644 buffer_2.c delete mode 100644 buffer_flush.c delete mode 100644 buffer_put.c delete mode 100644 buffer_putflush.c delete mode 100644 buffer_puts.c delete mode 100644 buffer_putspace.c delete mode 100644 buffer_putulong.c delete mode 100644 buffer_putulonglong.c delete mode 100644 buffer_stubborn.c delete mode 100644 byte.h delete mode 100644 byte_copy.c delete mode 100644 byte_diff.c delete mode 100644 cgi-post.c delete mode 100644 contrib/fnord-auth-0.1.tgz delete mode 100644 convert.pl delete mode 100644 fmt.h delete mode 100644 fmt_ulong.c delete mode 100644 fmt_ulonglong.c delete mode 100755 fnord-conf rename httpd.c => fnord.c (100%) delete mode 100755 http delete mode 100644 scan.h delete mode 100644 scan_ulong.c delete mode 100644 scan_ulonglong.c delete mode 100644 str.h delete mode 100644 str_chr.c delete mode 100644 str_copy.c delete mode 100644 str_diff.c delete mode 100644 str_diffn.c delete mode 100644 str_len.c delete mode 100644 str_start.c diff --git a/Makefile b/Makefile index 48378be..52e5f51 100644 --- a/Makefile +++ b/Makefile @@ -1,58 +1,14 @@ -VERSION=$(shell head -n 1 CHANGES | tr -d :) +VERSION := $(shell head -n 1 CHANGES | tr -d :) -CFLAGS += -Os -fomit-frame-pointer -#CFLAGS=-g +CFLAGS = -DFNORD='fnord/$(VERSION)' all: fnord fnord-cgi fnord-idx -fnord: httpd - cp -p $^ $@ - -strip -R .note -R .comment $@ +fnord-cgi: httpd.c +fnord-cgi: CFLAGS += -DCGI -httpd: httpd.o libowfat.a - $(CC) -o $@ $^ $(CFLAGS) - -fnord-cgi: httpd-cgi.o libowfat.a - $(CC) -o $@ $^ $(CFLAGS) - -strip -R .note -R .comment $@ - -fnord-idx: httpd-idx.o libowfat.a - $(CC) -o $@ $^ $(CFLAGS) - -strip -R .note -R .comment $@ - -libowfat.a: httpd.o buffer_1.o buffer_puts.o buffer_flush.o buffer_put.o \ -buffer_putulong.o buffer_2.o buffer_putspace.o buffer_stubborn.o \ -buffer_putflush.o str_copy.o fmt_ulong.o byte_diff.o byte_copy.o \ -str_len.o str_diff.o str_chr.o str_diffn.o str_start.o scan_ulong.o - ar cru $@ $^ - -ranlib $@ - -httpd.o: httpd.c - $(CC) -pipe $(CFLAGS) -c $^ -DFNORD=\"fnord/$(VERSION)\" - -httpd-cgi.o: httpd.c - $(CC) -pipe $(CFLAGS) -c httpd.c -o $@ -DCGI -DFNORD=\"fnord/$(VERSION)\" - -httpd-idx.o: httpd.c - $(CC) -pipe $(CFLAGS) -c httpd.c -o $@ -DDIR_LIST -DFNORD=\"fnord/$(VERSION)\" - -%.o: %.c - $(CC) -pipe $(CFLAGS) -c $^ - -.PHONY: rename clean install server -server: fnord - tcpserver -v -RHl localhost 0 8000 ./fnord +fnord-idx: httpd.c +fnord-idx: CFLAGS += -DDIR_LIST clean: - rm -f *.[oa] httpd fnord fnord-cgi fnord-idx - -install: - test -d /command || mkdir /command - -CURNAME=$(notdir $(shell pwd)) - -tar: rename - cd .. && tar cvvf fnord-$(VERSION).tar.bz2 --use=bzip2 --exclude CVS --exclude bin-* --exclude .cvsignore --exclude default fnord-$(VERSION) - -rename: - if test $(CURNAME) != fnord-$(VERSION); then cd .. && mv $(CURNAME) fnord-$(VERSION); fi + rm -f *.[oa] fnord fnord-cgi fnord-idx diff --git a/README.auth b/README.auth deleted file mode 100644 index a49f9c0..0000000 --- a/README.auth +++ /dev/null @@ -1,20 +0,0 @@ -The auth patch was contributed by Nicolas George. Here is the excerpt from his -email describing how to use it. Firstly, #define AUTH or add -DAUTH to CFLAGS. - - Then, I have implemented some basic handling of HTTP authentication. The - concept is that if there is a file .http-auth in the root of one site, - then it is an executable (most likely a script) that handles - authorizations. It is called with first argument the virtual host name, - second argument the path to the requested file, and third argument the - value of the Authorization header, if present. If it exists - successfully, access is granted, else 401. - - An example of .http-auth that grants the access only to the user Cigaes - with password foober is: - - #!/bin/sh - [ x"$3" = x"Basic Q2lnYWVzOmZvb2Jhcg==" ] - - The format of the Authorization is not very convenient. The mangled - string is the base64 encoding of "$username:$password". - diff --git a/SPEED b/SPEED deleted file mode 100644 index f6742da..0000000 --- a/SPEED +++ /dev/null @@ -1,32 +0,0 @@ -fnord is meant to be used under Linux with the diet libc -(http://www.fefe.de/dietlibc/). These are actual apache bench results, -all on localhost on a 100k JPEG test file, 1000 requests with a -concurrency of 10. - -To be fair, I linked thttpd, mini_httpd and fnord against the diet libc. -I did not try this with apache, though. Since apache does not exec -anything, it should not matter much, though. - -mini_httpd forks for each request, apparently does not support -keep-alive and compared to fnord does not incur the overhead of execve -for each request. - -thttpd is the fastest web server known to me. - -Values are time in seconds for the whole transaction (1000 downloads, 10 -parallel connections). - -server software keep-alive no keep-alive ----------------------------------------------------------------- -mini_httpd 1.15c 1.690 0.943 -apache 1.3.22 1.236 1.178 -thttpd 2.21b 0.896 0.839 -fnord 1.008 1.331 -fnord w/ sendfile 0.316 0.912 - -Please note that fnord actually plays in the same league as others even -without keep-alive and sendfile support. That is surprising since fnord -has one fork() _and_ one execve() as overhead for each request! As the -difference between keep-alive and non-keep-alive shows, that difference -is not very large. That is the achievement of the diet libc, which -reduces the normally significant libc overhead to zero. diff --git a/TODO b/TODO index aea8a33..94ddcce 100644 --- a/TODO +++ b/TODO @@ -1,2 +1 @@ -investigate CGI keep-alive - +* Investigate CGI keep-alive diff --git a/buffer.h b/buffer.h deleted file mode 100644 index ad414fd..0000000 --- a/buffer.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef BUFFER_H -#define BUFFER_H - -typedef struct buffer { - char *x; - unsigned int p; - unsigned int n; - unsigned int a; - int fd; - int (*op)(); -} buffer; - -#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, 0, (len), (fd), (op) } -#define BUFFER_INIT_READ(op,fd,buf,len) BUFFER_INIT(op,fd,buf,len) /*obsolete*/ -#define BUFFER_INSIZE 8192 -#define BUFFER_OUTSIZE 8192 - -extern void buffer_init(buffer* b,int (*op)(),int fd,char* y,unsigned int ylen); - -extern int buffer_flush(buffer* b); -extern int buffer_put(buffer* b,const char* x,unsigned int len); -extern int buffer_putalign(buffer* b,const char* x,unsigned int len); -extern int buffer_putflush(buffer* b,const char* x,unsigned int len); -extern int buffer_puts(buffer* b,const char* x); -extern int buffer_putsalign(buffer* b,const char* x); -extern int buffer_putsflush(buffer* b,const char* x); - -extern int buffer_putspace(buffer* b); - -#define buffer_PUTC(s,c) \ - ( ((s)->a != (s)->p) \ - ? ( (s)->x[(s)->p++] = (c), 0 ) \ - : buffer_put((s),&(c),1) \ - ) - -extern int buffer_get(buffer* b,char* x,unsigned int len); -extern int buffer_bget(buffer* b,char* x,unsigned int len); -extern int buffer_feed(buffer* b); -extern int buffer_getc(buffer* b,char* x); -extern int buffer_getn(buffer* b,char* x,unsigned int len); -extern int buffer_get_token(buffer* b,char* x,unsigned int len,const char* charset,unsigned int setlen); -#define buffer_getline(b,x,len) buffer_get_token((b),(x),(len),"\n",1) - -extern char *buffer_peek(buffer* b); -extern void buffer_seek(buffer* b,unsigned int len); - -#define buffer_PEEK(s) ( (s)->x + (s)->p ) -#define buffer_SEEK(s,len) ( (s)->p += (len) ) - -#define buffer_GETC(s,c) \ - ( ((s)->p < (s>->n) \ - ? ( *(c) = *buffer_PEEK(s), buffer_SEEK((s),1), 1 ) \ - : buffer_get((s),(c),1) \ - ) - -extern int buffer_copy(buffer* out,buffer* in); - -extern int buffer_putulong(buffer *b,unsigned long l); -extern int buffer_put8long(buffer *b,unsigned long l); -extern int buffer_putxlong(buffer *b,unsigned long l); -extern int buffer_putlong(buffer *b,unsigned long l); -extern int buffer_putulonglong(buffer *b,unsigned long long l); - -extern buffer *buffer_0; -extern buffer *buffer_0small; -extern buffer *buffer_1; -extern buffer *buffer_1small; -extern buffer *buffer_2; - -#endif diff --git a/buffer_1.c b/buffer_1.c deleted file mode 100644 index e1d9538..0000000 --- a/buffer_1.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "buffer.h" - -char buffer_1_space[BUFFER_INSIZE]; -static buffer it = BUFFER_INIT(write,1,buffer_1_space,sizeof buffer_1_space); -buffer *buffer_1 = ⁢ - diff --git a/buffer_2.c b/buffer_2.c deleted file mode 100644 index ea31d21..0000000 --- a/buffer_2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "buffer.h" - -char buffer_2_space[BUFFER_INSIZE]; -static buffer it = BUFFER_INIT(write,2,buffer_2_space,sizeof buffer_2_space); -buffer *buffer_2 = ⁢ - diff --git a/buffer_flush.c b/buffer_flush.c deleted file mode 100644 index 6db8c7b..0000000 --- a/buffer_flush.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "buffer.h" - -extern int buffer_stubborn(int (*op)(),int fd,const char* buf, unsigned int len); - -extern int buffer_flush(buffer* b) { - register int p; - if (!(p=b->p)) return 0; /* buffer already empty */ - b->p=0; - return buffer_stubborn(b->op,b->fd,b->x,p); -} diff --git a/buffer_put.c b/buffer_put.c deleted file mode 100644 index d53b6cc..0000000 --- a/buffer_put.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "byte.h" -#include "buffer.h" - -extern int buffer_stubborn(int (*op)(),int fd,const char* buf, unsigned int len); - -int buffer_put(buffer* b,const char* buf,unsigned int len) { - if (len>b->a-b->p) { /* doesn't fit */ - if (buffer_flush(b)==-1) return -1; - if (len>b->a) { - if (buffer_stubborn(b->op,b->fd,buf,len)<0) return -1; - return 0; - } - } - byte_copy(b->x+b->p, len, buf); - b->p+=len; - return 0; -} diff --git a/buffer_putflush.c b/buffer_putflush.c deleted file mode 100644 index 9e8e87e..0000000 --- a/buffer_putflush.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "buffer.h" - -int buffer_putflush(buffer* b,const char* x,unsigned int len) { - if (buffer_put(b,x,len)<0) return -1; - if (buffer_flush(b)<0) return -1; - return 0; -} diff --git a/buffer_puts.c b/buffer_puts.c deleted file mode 100644 index e53f675..0000000 --- a/buffer_puts.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "str.h" -#include "buffer.h" - -int buffer_puts(buffer* b,const char* x) { - return buffer_put(b,x,str_len(x)); -} diff --git a/buffer_putspace.c b/buffer_putspace.c deleted file mode 100644 index 48fea2a..0000000 --- a/buffer_putspace.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "str.h" -#include "buffer.h" - -int buffer_putspace(buffer* b) { - static char space=' '; - return buffer_put(b,&space,1); -} diff --git a/buffer_putulong.c b/buffer_putulong.c deleted file mode 100644 index 0e6da90..0000000 --- a/buffer_putulong.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "buffer.h" -#include "fmt.h" - -int buffer_putulong(buffer *b,unsigned long l) { - char buf[FMT_ULONG]; - return buffer_put(b,buf,fmt_ulong(buf,l)); -} - diff --git a/buffer_putulonglong.c b/buffer_putulonglong.c deleted file mode 100644 index 861acf5..0000000 --- a/buffer_putulonglong.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "buffer.h" -#include "fmt.h" - -int buffer_putulonglong(buffer *b,unsigned long long l) { - char buf[FMT_ULONG]; - return buffer_put(b,buf,fmt_ulonglong(buf,l)); -} - diff --git a/buffer_stubborn.c b/buffer_stubborn.c deleted file mode 100644 index c94a1d0..0000000 --- a/buffer_stubborn.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "buffer.h" - -int buffer_stubborn(int (*op)(),int fd,const char* buf, unsigned int len) { - int w; - while (len) { - if ((w=op(fd,buf,len))<0) { - if (errno == EINTR) continue; - return -1; - }; - buf+=w; - len-=w; - } - return 0; -} diff --git a/byte.h b/byte.h deleted file mode 100644 index e598124..0000000 --- a/byte.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef BYTE_H -#define BYTE_H - -#include - -#ifndef __pure__ -#define __pure__ -#endif - -/* byte_chr returns the smallest integer i between 0 and len-1 - * inclusive such that one[i] equals needle, or len it not found. */ -unsigned int byte_chr(const void* haystack, unsigned int len, char needle) __pure__; - -/* byte_rchr returns the largest integer i between 0 and len-1 inclusive - * such that one[i] equals needle, or len if not found. */ -unsigned int byte_rchr(const void* haystack,unsigned int len,char needle) __pure__; - -/* byte_copy copies in[0] to out[0], in[1] to out[1], ... and in[len-1] - * to out[len-1]. */ -void byte_copy(void* out, unsigned int len, const void* in); - -/* byte_copyr copies in[len-1] to out[len-1], in[len-2] to out[len-2], - * ... and in[0] to out[0] */ -void byte_copyr(void* out, unsigned int len, const void* in); - -/* byte_diff returns negative, 0, or positive, depending on whether the - * string a[0], a[1], ..., a[len-1] is lexicographically smaller - * than, equal to, or greater than the string b[0], b[1], ..., - * b[len-1]. When the strings are different, byte_diff does not read - * bytes past the first difference. */ -int byte_diff(const void* a, unsigned int len, const void* b) __pure__; - -/* byte_zero sets the bytes out[0], out[1], ..., out[len-1] to 0 */ -void byte_zero(void* out, unsigned len); - -#define byte_equal(s,n,t) (!byte_diff((s),(n),(t))) - -#endif diff --git a/byte_copy.c b/byte_copy.c deleted file mode 100644 index 26c01a8..0000000 --- a/byte_copy.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "byte.h" - -/* byte_copy copies in[0] to out[0], in[1] to out[1], ... and in[len-1] - * to out[len-1]. */ -void byte_copy(void* out, unsigned int len, const void* in) { - register char* s=out; - register const char* t=in; - register const char* u=t+len; - if (len>127) { - while ((unsigned long)s&(sizeof(unsigned long)-1)) { - if (t==u) break; *s=*t; ++s; ++t; - } - /* s (destination) is now unsigned long aligned */ -#ifndef __i386__ - if (!((unsigned long)t&(sizeof(unsigned long)-1))) -#endif - while (t+sizeof(unsigned long)<=u) { - *(unsigned long*)s=*(unsigned long*)t; - s+=sizeof(unsigned long); t+=sizeof(unsigned long); - } - } - for (;;) { - if (t==u) break; *s=*t; ++s; ++t; - if (t==u) break; *s=*t; ++s; ++t; - if (t==u) break; *s=*t; ++s; ++t; - if (t==u) break; *s=*t; ++s; ++t; - } -} diff --git a/byte_diff.c b/byte_diff.c deleted file mode 100644 index b7c0864..0000000 --- a/byte_diff.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "byte.h" - -/* byte_diff returns negative, 0, or positive, depending on whether the - * string one[0], one[1], ..., one[len-1] is lexicographically smaller - * than, equal to, or greater than the string one[0], one[1], ..., - * one[len-1]. When the strings are different, byte_diff does not read - * bytes past the first difference. */ -int byte_diff(const void* a, unsigned int len, const void* b) { - register const char* s=a; - register const char* t=b; - register const char* u=t+len; - register int j; - j=0; - for (;;) { - if (t==u) break; if ((j=(*s-*t))) break; ++s; ++t; - if (t==u) break; if ((j=(*s-*t))) break; ++s; ++t; - if (t==u) break; if ((j=(*s-*t))) break; ++s; ++t; - if (t==u) break; if ((j=(*s-*t))) break; ++s; ++t; - } - return j; -} diff --git a/cgi-post.c b/cgi-post.c deleted file mode 100644 index 2a30cc2..0000000 --- a/cgi-post.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include - -int main() { - char* method=getenv("REQUEST_METHOD"); - if (!method) { - __write1("Content-Type: text/plain\r\n\r\nFatal: $REQUEST_METHOD not set!\n"); - return 1; - } - if (!strcmp(method,"GET")) { - char* c=getenv("QUERY_STRING"); - __write1("Content-Type: text/plain\r\n\r\n"); - if (c) - write(1,c,strlen(c)); - else { - __write1("Fatal: $QUERY_STRING not set!\n"); - return 1; - } - } else if (!strcmp(method,"POST")) { - char* c=getenv("CONTENT_TYPE"); - char* d=getenv("CONTENT_LENGTH"); - int l; - if (!c) { - __write1("Content-Type: text/plain\r\n\r\nFatal: $CONTENT_TYPE not set!\n"); - return 1; - } - if (!d) { - __write1("Content-Type: text/plain\r\n\r\nFatal: $CONTENT_LENGTH not set!\n"); - return 1; - } - { - char* e; - l=strtoul(d,&e,10); - if (e==d || *e) { - __write1("Content-Type: text/plain\r\n\r\nFatal: $CONTENT_LENGTH not a number: "); - __write1(d); - __write1("\n"); - return 1; - } - } - __write1("Content-Type: "); __write1(c); __write1("\r\n"); - __write1("Content-Length: "); __write1(d); __write1("\r\n\r\n"); - while (l>0) { - char buf[2048]; - int r; - r=read(0,buf,sizeof(buf)); - if (r==-1) return 1; - if (r==0) break; - l-=r; - write(1,buf,r); - } - } else { - puts("Content-Type: text/plain\r\n\r\nFatal: $REQUEST_METHOD is neither GET nor POST!\n"); - } -} diff --git a/contrib/fnord-auth-0.1.tgz b/contrib/fnord-auth-0.1.tgz deleted file mode 100644 index 8f805b691c4ab4981a1d90497ee7ac2d21ed1f4b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3361 zcmV++4c_t}iwFRVd5=^4l2mzkNqv&3|W%Ykku#5A* zd;H@sCx<^AoUM|Ff|J|R^*iTZ*EZAn?{>RA#P2AZn@>Plr4V<)|M~o%jhqM~-;Sq7 z$N=Ai$8qhUfW~wOPGd!%pfM>w&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YeZ zGt@wxQv;##cTE1m0a!lug|D*Y7PAfPW>JvTgbJ20Clc?2(qAzBG>;0+<27t=FBrZB za^y&=_mKQ!0BG1RUxGfbP6?KJPWQhAYaJfQTf2+5n&YkA$y>|u?md)u=PuqF=Y74{ z&{8GsEUI2mWcy+D8vQ3+Z+BX#`}opmEVgi%IXZNn+?l?<}7(}Pw!F16Du!c3P;gR5fF1qBP08jt`Rrafs diff --git a/convert.pl b/convert.pl deleted file mode 100644 index 3fd803e..0000000 --- a/convert.pl +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - -use Compress::Zlib; - -$PWD=`pwd`; -chomp $PWD; -push @dirs,$PWD; - -while ($#dirs>=0) { - my $x=shift @dirs; - opendir DIR,$x || die "can't chdir to $x\n"; - foreach $i (readdir DIR) { - next if (substr($i,0,1) eq "."); - if (-d "$x/$i") { - push @dirs,"$x/$i"; - } elsif (-f "$x/$i") { - next if ($i =~ m/\.gz$/); - my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat("$x/$i"); - my $gzmtime=(stat("$x/$i.gz"))[9]; - if (not defined $gzmtime or $gzmtime<$mtime) { - print "gzipping $x/$i...\n"; - if ($#ARGV<0) { - open FILE,"$x/$i" || die "can't open $x/$i\n"; - my $gz = gzopen("$x/$i.gz","wb") - or die "can't open $x/$i.gz: $gzerrno\n"; - while () { - $gz->gzwrite($_) - or die "error writing: $gzerrno\n"; - } - $gz->gzclose; - close FILE; - utime $atime, $mtime, "$x/$i.gz" or die "can't utime $x/$i.gz\n"; - my $gzsize=(stat("$x/$i.gz"))[7]; - unlink "$x/$i.gz" if ($gzsize>=$size); - } - } - } - } - closedir DIR; -} diff --git a/fmt.h b/fmt.h deleted file mode 100644 index 03290d6..0000000 --- a/fmt.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef FMT_H -#define FMT_H - -#include "str.h" - -#define FMT_ULONG 40 /* enough space to hold 2^128 - 1 in decimal, plus \0 */ -#define FMT_8LONG 44 /* enough space to hold 2^128 - 1 in octal, plus \0 */ -#define FMT_XLONG 33 /* enough space to hold 2^128 - 1 in hexadecimal, plus \0 */ -#define FMT_LEN ((char *) 0) /* convenient abbreviation */ - -/* The formatting routines do not append \0! - * Use them like this: buf[fmt_ulong(buf,number)]=0; */ - -/* convert signed src integer -23 to ASCII '-','2','3', return length. - * If dest is not NULL, write result to dest */ -unsigned int fmt_long(char *dest,signed long src); - -/* convert unsigned src integer 23 to ASCII '2','3', return length. - * If dest is not NULL, write result to dest */ -unsigned int fmt_ulong(char *dest,unsigned long src); - -/* same for long long */ -unsigned int fmt_ulonglong(char *dest,unsigned long long src); - -/* convert unsigned src integer 0x23 to ASCII '2','3', return length. - * If dest is not NULL, write result to dest */ -unsigned int fmt_xlong(char *dest,unsigned long src); - -/* convert unsigned src integer 023 to ASCII '2','3', return length. - * If dest is not NULL, write result to dest */ -unsigned int fmt_8long(char *dest,unsigned long src); - -#define fmt_uint(dest,src) fmt_ulong(dest,src) -#define fmt_int(dest,src) fmt_long(dest,src) -#define fmt_xint(dest,src) fmt_xlong(dest,src) -#define fmt_8int(dest,src) fmt_8long(dest,src) - -/* Like fmt_ulong, but prepend '0' while length is smaller than padto. - * Does not truncate! */ -unsigned int fmt_ulong0(char *,unsigned long src,unsigned int padto); - -#define fmt_uint0(buf,src,padto) fmt_ulong0(buf,src,padto) - -/* convert src double 1.7 to ASCII '1','.','7', return length. - * If dest is not NULL, write result to dest */ -unsigned int fmt_double(char *dest, double d,int max,int prec); - -/* if src is negative, write '-' and return 1. - * if src is positive, write '+' and return 1. - * otherwise return 0 */ -unsigned int fmt_plusminus(char *dest,int src); - -/* if src is negative, write '-' and return 1. - * otherwise return 0. */ -unsigned int fmt_minus(char *dest,int src); - -/* copy str to dest until \0 byte, return number of copied bytes. */ -unsigned int fmt_str(char *dest,const char *src); - -/* copy str to dest until \0 byte or limit bytes copied. - * return number of copied bytes. */ -unsigned int fmt_strn(char *dest,const char *src,unsigned int limit); - -/* "foo" -> " foo" - * write padlen-srclen spaces, if that is >= 0. Then copy srclen - * characters from src. Truncate only if total length is larger than - * maxlen. Return number of characters written. */ -unsigned int fmt_pad(char* dest,const char* src,unsigned int srclen,unsigned int padlen,unsigned int maxlen); - -/* "foo" -> "foo " - * append padlen-srclen spaces after dest, if that is >= 0. Truncate - * only if total length is larger than maxlen. Return number of - * characters written. */ -unsigned int fmt_fill(char* dest,unsigned int srclen,unsigned int padlen,unsigned int maxlen); - -#endif diff --git a/fmt_ulong.c b/fmt_ulong.c deleted file mode 100644 index 712e502..0000000 --- a/fmt_ulong.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fmt.h" - -unsigned int fmt_ulong(char *dest,unsigned long i) { - register unsigned long len,tmp,len2; - /* first count the number of bytes needed */ - for (len=1, tmp=i; tmp>9; ++len) tmp/=10; - if (dest) - for (tmp=i, dest+=len, len2=len+1; --len2; tmp/=10) - *--dest = (tmp%10)+'0'; - return len; -} diff --git a/fmt_ulonglong.c b/fmt_ulonglong.c deleted file mode 100644 index 6148761..0000000 --- a/fmt_ulonglong.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "fmt.h" - -unsigned int fmt_ulonglong(char *dest,unsigned long long i) { - register unsigned long len,len2; - register unsigned long long tmp; - /* first count the number of bytes needed */ - for (len=1, tmp=i; tmp>9; ++len) tmp/=10; - if (dest) - for (tmp=i, dest+=len, len2=len+1; --len2; tmp/=10) - *--dest = (tmp%10)+'0'; - return len; -} diff --git a/fnord-conf b/fnord-conf deleted file mode 100755 index 697422c..0000000 --- a/fnord-conf +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -set -e - -acct=$1 -logacct=$2 -dir=$3 -webroot=$4 -myip=$5 - -if test x$webroot = x; then - echo "fnord-conf: usage: fnord-conf acct logacct /fnord /webroot [ myip ]" - exit 1; -fi - -# install stuff -mkdir -p $dir -echo "#!/bin/sh" > $dir/run -echo "cd $webroot" >> $dir/run -echo "exec envuidgid $acct tcpserver -RHl localhost ${myip:-0} 80 fnord 2>&1" >> $dir/run -chmod 755 $dir/run - -# tell old daemontools that it should spawn a log process, too -chmod a+t $dir - -# install logging stuff -mkdir $dir/log -echo "#!/bin/sh" > $dir/log/run -echo "exec setuidgid $logacct multilog t ./main" >> $dir/log/run -chmod 755 $dir/log/run - -mkdir $dir/log/main -chown $logacct $dir/log/main diff --git a/httpd.c b/fnord.c similarity index 100% rename from httpd.c rename to fnord.c diff --git a/http b/http deleted file mode 100755 index f971002..0000000 --- a/http +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -tcpserver -RHl localhost 0 80 fnord-idx . diff --git a/scan.h b/scan.h deleted file mode 100644 index b6a00a6..0000000 --- a/scan.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef SCAN_H -#define SCAN_H - -#include -#ifndef __pure__ -#define __pure__ -#endif - -/* interpret src as ASCII decimal number, write number to dest and - * return the number of bytes that were parsed */ -extern unsigned int scan_ulong(const char *src,unsigned long *dest); - -/* same, for long long */ -extern unsigned int scan_ulonglong(const char *src,unsigned long long *dest); - -/* interpret src as ASCII hexadecimal number, write number to dest and - * return the number of bytes that were parsed */ -extern unsigned int scan_xlong(const char *src,unsigned long *dest); - -/* interpret src as ASCII octal number, write number to dest and - * return the number of bytes that were parsed */ -extern unsigned int scan_8long(const char *src,unsigned long *dest); - -/* interpret src as signed ASCII decimal number, write number to dest - * and return the number of bytes that were parsed */ -extern unsigned int scan_long(const char *src,signed long *dest); - -extern unsigned int scan_uint(const char *src,unsigned int *dest); -extern unsigned int scan_xint(const char *src,unsigned int *dest); -extern unsigned int scan_8int(const char *src,unsigned int *dest); -extern unsigned int scan_int(const char *src,signed int *dest); - -extern unsigned int scan_ushort(const char *src,unsigned short *dest); -extern unsigned int scan_xshort(const char *src,unsigned short *dest); -extern unsigned int scan_8short(const char *src,unsigned short *dest); -extern unsigned int scan_short(const char *src,signed short *dest); - -/* interpret src as double precision floating point number, - * write number to dest and return the number of bytes that were parsed */ -extern unsigned int scan_double(const char *in, double *dest); - -/* if *src=='-', set *dest to -1 and return 1. - * if *src=='+', set *dest to 1 and return 1. - * otherwise set *dest to 1 return 0. */ -extern unsigned int scan_plusminus(const char *src,signed int *dest); - -/* return the highest integer n<=limit so that isspace(in[i]) for all 0<=i<=n */ -extern unsigned int scan_whitenskip(const char *in,unsigned int limit) __pure__; - -/* return the highest integer n<=limit so that !isspace(in[i]) for all 0<=i<=n */ -extern unsigned int scan_nonwhitenskip(const char *in,unsigned int limit) __pure__; - -/* return the highest integer n<=limit so that in[i] is element of - * charset (ASCIIZ string) for all 0<=i<=n */ -extern unsigned int scan_charsetnskip(const char *in,const char *charset,unsigned int limit) __pure__; - -/* return the highest integer n<=limit so that in[i] is not element of - * charset (ASCIIZ string) for all 0<=i<=n */ -extern unsigned int scan_noncharsetnskip(const char *in,const char *charset,unsigned int limit) __pure__; - -#endif diff --git a/scan_ulong.c b/scan_ulong.c deleted file mode 100644 index 02d3f2b..0000000 --- a/scan_ulong.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "scan.h" - -unsigned int scan_ulong(const char *src,unsigned long *dest) { - register const char *tmp=src; - register int l=0; - register unsigned char c; - while ((c=*tmp-'0')<10) { - l=l*10+c; - ++tmp; - } - *dest=l; - return tmp-src; -} diff --git a/scan_ulonglong.c b/scan_ulonglong.c deleted file mode 100644 index c28594d..0000000 --- a/scan_ulonglong.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "scan.h" - -unsigned int scan_ulonglong(const char *src,unsigned long long *dest) { - register const char *tmp=src; - register unsigned long long int l=0; - register unsigned char c; - while ((c=*tmp-'0')<10) { - l=l*10+c; - ++tmp; - } - *dest=l; - return tmp-src; -} diff --git a/str.h b/str.h deleted file mode 100644 index 5d59345..0000000 --- a/str.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef STR_H -#define STR_H - -#include -#ifndef __pure__ -#define __pure__ -#endif - -/* str_copy copies leading bytes from in to out until \0. - * return number of copied bytes. */ -extern unsigned int str_copy(char *out,const char *in); - -/* str_diff returns negative, 0, or positive, depending on whether the - * string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than, - * equal to, or greater than the string b[0], b[1], ..., b[m-1]=='\0'. - * If the strings are different, str_diff does not read bytes past the - * first difference. */ -extern int str_diff(const char *a,const char *b) __pure__; - -/* str_diffn returns negative, 0, or positive, depending on whether the - * string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than, - * equal to, or greater than the string b[0], b[1], ..., b[m-1]=='\0'. - * If the strings are different, str_diffn does not read bytes past the - * first difference. The strings will be considered equal if the first - * limit characters match. */ -extern int str_diffn(const char *a,const char *b,unsigned int limit) __pure__; - -/* str_len returns the index of \0 in s */ -extern unsigned int str_len(const char *s) __pure__; - -/* str_chr returns the index of the first occurance of needle or \0 in haystack */ -extern unsigned int str_chr(const char *haystack,char needle) __pure__; - -/* str_rchr returns the index of the last occurance of needle or \0 in haystack */ -extern unsigned int str_rchr(const char *haystack,char needle) __pure__; - -/* str_start returns 1 if the b is a prefix of a, 0 otherwise */ -extern int str_start(const char *a,const char *b) __pure__; - -/* convenience shortcut to test for string equality */ -#define str_equal(s,t) (!str_diff((s),(t))) - -#endif diff --git a/str_chr.c b/str_chr.c deleted file mode 100644 index 347ef00..0000000 --- a/str_chr.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "str.h" - -unsigned int str_chr(const char *in, char needle) { - register const char* t=in; - register const char c=needle; - for (;;) { - if (!*t || *t==c) break; ++t; - if (!*t || *t==c) break; ++t; - if (!*t || *t==c) break; ++t; - if (!*t || *t==c) break; ++t; - } - return t-in; -} diff --git a/str_copy.c b/str_copy.c deleted file mode 100644 index 48b22c0..0000000 --- a/str_copy.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "str.h" - -unsigned int str_copy(char *out,const char *in) { - register char* s=out; - register const char* t=in; - for (;;) { - if (!(*s=*t)) break; ++s; ++t; - if (!(*s=*t)) break; ++s; ++t; - if (!(*s=*t)) break; ++s; ++t; - if (!(*s=*t)) break; ++s; ++t; - } - return s-out; -} diff --git a/str_diff.c b/str_diff.c deleted file mode 100644 index fe74e80..0000000 --- a/str_diff.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "byte.h" - -/* str_diff returns negative, 0, or positive, depending on whether the - * string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than, - * equal to, or greater than the string b[0], b[1], ..., b[m-1]=='\0'. - * When the strings are different, str_diff does not read bytes past the - * first difference. */ -int str_diff(const char* a, const char* b) { - register const char* s=a; - register const char* t=b; - register int j; - j=0; - for (;;) { - if ((j=(*s-*t))) break; if (!*t) break; ++s; ++t; - if ((j=(*s-*t))) break; if (!*t) break; ++s; ++t; - if ((j=(*s-*t))) break; if (!*t) break; ++s; ++t; - if ((j=(*s-*t))) break; if (!*t) break; ++s; ++t; - } - return j; -} diff --git a/str_diffn.c b/str_diffn.c deleted file mode 100644 index a54904c..0000000 --- a/str_diffn.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "byte.h" - -/* str_diff returns negative, 0, or positive, depending on whether the - * string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than, - * equal to, or greater than the string b[0], b[1], ..., b[m-1]=='\0'. - * When the strings are different, str_diff does not read bytes past the - * first difference. */ -int str_diffn(const char* a, const char* b, unsigned int limit) { - register const char* s=a; - register const char* t=b; - register const char* u=t+limit; - register int j; - j=0; - for (;;) { - if (t>=u) break; if ((j=(*s-*t))) break; if (!*t) break; ++s; ++t; - if (t>=u) break; if ((j=(*s-*t))) break; if (!*t) break; ++s; ++t; - if (t>=u) break; if ((j=(*s-*t))) break; if (!*t) break; ++s; ++t; - if (t>=u) break; if ((j=(*s-*t))) break; if (!*t) break; ++s; ++t; - } - return j; -} diff --git a/str_len.c b/str_len.c deleted file mode 100644 index cf1541a..0000000 --- a/str_len.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "str.h" - -unsigned int str_len(const char *in) { - register const char* t=in; - for (;;) { - if (!*t) break; ++t; - if (!*t) break; ++t; - if (!*t) break; ++t; - if (!*t) break; ++t; - } - return t-in; -} diff --git a/str_start.c b/str_start.c deleted file mode 100644 index c49ea19..0000000 --- a/str_start.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "str.h" - -int str_start (register const char *s, register const char *t) -{ - register char x ; - - for (;;) - { - x = *t++; if (!x) return 1; if (x != *s++) return 0; - x = *t++; if (!x) return 1; if (x != *s++) return 0; - x = *t++; if (!x) return 1; if (x != *s++) return 0; - x = *t++; if (!x) return 1; if (x != *s++) return 0; - } -}