Introduction
Introduction Statistics Contact Development Disclaimer Help
tprintf is now dprintf, which is in libc. - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit d22ff2f488be69cd455837b5dfdff0aad1aea812
parent 93c55f39d5bd322b6dc9bf13fb2025264dc52341
Author: Christoph Lohmann <[email protected]>
Date: Sun, 11 Jun 2017 19:27:15 +0200
tprintf is now dprintf, which is in libc.
Thanks Bob, for the suggestion!
Diffstat:
M handlr.c | 10 +++++-----
M ind.c | 14 +-------------
M ind.h | 1 -
M main.c | 6 +++---
4 files changed, 9 insertions(+), 22 deletions(-)
---
diff --git a/handlr.c b/handlr.c
@@ -41,7 +41,7 @@ handledir(int sock, char *path, char *port, char *base, char …
b = strrchr(par + strlen(base), '/');
if(b != nil) {
*b = '\0';
- tprintf(sock, "1..\t%s\t%s\t%s\r\n",
+ dprintf(sock, "1..\t%s\t%s\t%s\r\n",
par + strlen(base), ohost, port);
}
free(par);
@@ -64,14 +64,14 @@ handledir(int sock, char *path, char *port, char *base, cha…
if(stat(file, &st) >= 0 && S_ISDIR(st.st_mode))
type = gettype("index.gph");
e = file + strlen(base);
- tprintf(sock, "%c%s\t%s\t%s\t%s\r\n", *type->type,
+ dprintf(sock, "%c%s\t%s\t%s\t%s\r\n", *type->type,
dirent[i]->d_name, e, ohost, port);
free(file);
free(dirent[i]);
}
free(dirent);
}
- tprintf(sock, ".\r\n");
+ dprintf(sock, ".\r\n");
free(pa);
}
@@ -94,7 +94,7 @@ handlegph(int sock, char *file, char *port, char *base, char …
freeelem(act->n[i]);
act->n[i] = nil;
}
- tprintf(sock, ".\r\n");
+ dprintf(sock, ".\r\n");
freeindex(act);
}
@@ -235,7 +235,7 @@ handledcgi(int sock, char *file, char *port, char *base, ch…
printelem(sock, el, ohost, port);
freeelem(el);
}
- tprintf(sock, ".\r\n");
+ dprintf(sock, ".\r\n");
wait(NULL);
if (path != nil)
diff --git a/ind.c b/ind.c
@@ -271,24 +271,12 @@ printelem(int fd, Elems *el, char *addr, char *port)
free(el->e[4]);
el->e[4] = xstrdup(port);
}
- tprintf(fd, "%.1s%s\t%s\t%s\t%s\r\n", el->e[0], el->e[1], el->e[2],
+ dprintf(fd, "%.1s%s\t%s\t%s\t%s\r\n", el->e[0], el->e[1], el->e[2],
el->e[3], el->e[4]);
return;
}
-void
-tprintf(int fd, char *fmt, ...)
-{
- va_list fmtargs;
-
- va_start(fmtargs, fmt);
- vdprintf(fd, fmt, fmtargs);
- va_end(fmtargs);
-
- return;
-}
-
int
initlogging(char *logf)
{
diff --git a/ind.h b/ind.h
@@ -43,7 +43,6 @@ void addelem(Elems *e, char *s);
void freeindex(Indexs *i);
void freeelem(Elems *e);
char *readln(int fd);
-void tprintf(int fd, char *fmt, ...);
int initlogging(char *logf);
void stoplogging(int fd);
char *smprintf(char *fmt, ...);
diff --git a/main.c b/main.c
@@ -117,7 +117,7 @@ logentry(char *host, char *port, char *qry, char *status)
strftime(timstr, sizeof(timstr), "%a %b %d %H:%M:%S %Z %Y",
ptr);
- tprintf(glfd, "[%s|%s:%s] %s (%s)\n",
+ dprintf(glfd, "[%s|%s:%s] %s (%s)\n",
timstr, ahost, port, qry, status);
free(ahost);
}
@@ -214,7 +214,7 @@ handlerequest(int sock, char *base, char *ohost, char *port…
return;
}
- tprintf(sock, err, recvc);
+ dprintf(sock, err, recvc);
if(loglvl & ERRORS)
logentry(clienth, clientp, recvc, "not found");
}
@@ -299,7 +299,7 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *por…
void
usage(void)
{
- tprintf(2, "usage: %s [-d] [-l logfile] [-v loglvl] [-b base]"
+ dprintf(2, "usage: %s [-d] [-l logfile] [-v loglvl] [-b base]"
" [-p port] [-o sport] [-u user] [-g group] [-h host]"
" [-i IP]\n",
argv0);
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.