geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit 64d0e03e59ae7734f8a71ce7899ca3e3f22f701c
parent edbc6bce3a20468b4c81c700a373fcd73fce1cde
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun, 27 Feb 2011 10:39:40 +0100

Removing spurious whitespaces.

Diffstat:
arg.h | 2+-
handlr.c | 22+++++++++++-----------
handlr.h | 2+-
ind.h | 2+-
main.c | 42+++++++++++++++++++++---------------------
5 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/arg.h b/arg.h @@ -1,7 +1,7 @@ #ifndef ARG_H #define ARG_H -#define USED(x) ((void)(x)) +#define USED(x) ((void)(x)) extern char *argv0; diff --git a/handlr.c b/handlr.c @@ -1,5 +1,5 @@ /* - * Copy me if you can. + * Copy me if you can. * by 20h */ @@ -38,13 +38,13 @@ handledir(int sock, char *path, char *port, char *base, char *args, if(args == nil) { addr = gmallocz(512, 2); - if(gethostname(addr, 512) == -1) { - perror("gethostname"); - close(sock); + if(gethostname(addr, 512) == -1) { + perror("gethostname"); + close(sock); free(addr); free(pa); - return; - } + return; + } } else addr = gstrdup(args); @@ -52,12 +52,12 @@ handledir(int sock, char *path, char *port, char *base, char *args, b = strrchr(par + strlen(base), '/'); if(b != nil) { *b = '\0'; - tprintf(sock, "1..\t%s\t%s\t%s\r\n", + tprintf(sock, "1..\t%s\t%s\t%s\r\n", par + strlen(base), addr, port); } free(par); - ndir = scandir(pa, &dirent, 0, alphasort); + ndir = scandir(pa, &dirent, 0, alphasort); if(ndir < 0) { perror("scandir"); close(sock); @@ -92,7 +92,7 @@ handledir(int sock, char *path, char *port, char *base, char *args, free(pa); close(sock); return; -} +} void handlegph(int sock, char *file, char *port, char *base, char *args, @@ -118,7 +118,7 @@ handlegph(int sock, char *file, char *port, char *base, char *args, snprintf(addr, sizeof(addr), "%s", args); - for(i = 0; i < act->num; i++) { + for(i = 0; i < act->num; i++) { if(!strncmp(act->n[i]->e[3], "server", 6)) { free(act->n[i]->e[3]); act->n[i]->e[3] = gstrdup(addr); @@ -188,7 +188,7 @@ handlecgi(int sock, char *file, char *port, char *base, char *args, if(sear == nil) sear = ""; - execl(file, p, sear, args, nil); + execl(file, p, sear, args, nil); close(sock); return; diff --git a/handlr.h b/handlr.h @@ -1,5 +1,5 @@ /* - * Copy me if you can. + * Copy me if you can. * by 20h */ diff --git a/ind.h b/ind.h @@ -1,5 +1,5 @@ /* - * Copy me if you can. + * Copy me if you can. * by 20h */ diff --git a/main.c b/main.c @@ -1,5 +1,5 @@ /* - * Copy me if you can. + * Copy me if you can. * by 20h */ @@ -24,12 +24,12 @@ #include "arg.h" enum { - NOLOG = 0, - FILES = 1, - DIRS = 2, + NOLOG = 0, + FILES = 1, + DIRS = 2, HTTP = 4, ERRORS = 8, -}; +}; int glfd = -1; int loglvl = 15; @@ -97,21 +97,21 @@ securepath(char *p, int len) } void -logentry(char *host, char *port, char *qry, char *status) +logentry(char *host, char *port, char *qry, char *status) { time_t tim; struct tm *ptr; - char timstr[128]; + char timstr[128]; if(glfd >= 0) { - tim = time(0); - ptr = localtime(&tim); + tim = time(0); + ptr = localtime(&tim); - strftime(timstr, sizeof(timstr), "%a %b %d %H:%M:%S %Z %Y", + strftime(timstr, sizeof(timstr), "%a %b %d %H:%M:%S %Z %Y", ptr); - tprintf(glfd, "[%s|%s:%s] %s (%s)\n", - timstr, host, port, qry, status); + tprintf(glfd, "[%s|%s:%s] %s (%s)\n", + timstr, host, port, qry, status); } return; @@ -144,9 +144,9 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth, recvb + 4, recvb + 4, recvb + 4); if(len > sizeof(path)) len = sizeof(path); - send(sock, path, len, 0); - if(loglvl & HTTP) - logentry(clienth, clientp, recvc, "HTTP redirect"); + send(sock, path, len, 0); + if(loglvl & HTTP) + logentry(clienth, clientp, recvc, "HTTP redirect"); return; } @@ -183,10 +183,10 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth, "dir listing"); return; } - + send(sock, err, strlen(err), 0); - if(loglvl & ERRORS) - logentry(clienth, clientp, recvc, "not found"); + if(loglvl & ERRORS) + logentry(clienth, clientp, recvc, "not found"); close(sock); } @@ -251,7 +251,7 @@ main(int argc, char *argv[]) break; case 'd': dofork = 0; - break; + break; case 'v': loglvl = atoi(EARGF(usage())); break; @@ -260,7 +260,7 @@ main(int argc, char *argv[]) break; case 'g': group = EARGF(usage()); - break; + break; case 'i': bindip = EARGF(usage()); break; @@ -366,7 +366,7 @@ main(int argc, char *argv[]) perror("fork"); close(sock); break; - case 0: + case 0: handlerequest(sock, base, ohost, sport, clienth, clientp); return 1;