Introduction
Introduction Statistics Contact Development Disclaimer Help
changed logging format - fiche - A pastebin adjusted for gopher use
git clone git://vernunftzentrum.de/fiche.git
Log
Files
Refs
LICENSE
---
commit 157353707e17bc4c8ac4dd6743711bedb7a5a526
parent 1d425525a1cdc53210a94c1288ab580aab5fb1ab
Author: solusipse <[email protected]>
Date: Tue, 9 Sep 2014 03:26:21 +0200
changed logging format
Diffstat:
fiche.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/fiche.c b/fiche.c
@@ -131,18 +131,21 @@ void perform_connection(int listen_socket)
void display_date()
{
- printf("%s", get_date());
+ printf("%s\n", get_date());
}
char *get_date()
{
time_t rawtime;
struct tm *timeinfo;
+ char *timechar;
time(&rawtime);
timeinfo = localtime(&rawtime);
+ timechar = asctime(timeinfo);
+ timechar[strlen(timechar)-1] = 0;
- return asctime(timeinfo);
+ return timechar;
}
struct client_data get_client_address(struct sockaddr_in client_address)
@@ -155,7 +158,7 @@ struct client_data get_client_address(struct sockaddr_in cl…
if (hostp == NULL)
{
printf("ERROR: Couldn't obtain client's hostname\n");
- data.hostname = "error";
+ data.hostname = "n/a";
}
else
data.hostname = hostp->h_name;
@@ -164,7 +167,7 @@ struct client_data get_client_address(struct sockaddr_in cl…
if (hostaddrp == NULL)
{
printf("ERROR: Couldn't obtain client's address\n");
- data.ip_address = "error";
+ data.ip_address = "n/a";
}
else
data.ip_address = hostaddrp;
@@ -179,9 +182,9 @@ void save_log(char *slug, char *hostaddrp, char *h_name)
char contents[256];
if (slug != NULL)
- snprintf(contents, sizeof contents, "\n%s%s|%s|%s%s", get_date(), …
+ snprintf(contents, sizeof contents, "%s -- %s -- %s (%s)\n", slug,…
else
- snprintf(contents, sizeof contents, "\n%s%s|%s|%s%s", get_date(), …
+ snprintf(contents, sizeof contents, "%s -- %s -- %s (%s)\n", "rej"…
FILE *fp;
fp = fopen(LOG, "a");
You are viewing proxied material from vernunftzentrum.de. 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.