logswan

Fast Web log analyzer using probabilistic data structures
Log | Files | Refs | README | LICENSE

commit 54aaca1cd7b2907ef0eb7f5b99d5e515758ab48f
parent be8404010e766954ea4129fd8b878ff19a989bc1
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri,  8 Jan 2016 23:44:08 +0100

Moving global variables into main

Diffstat:
Msrc/logswan.c | 56+++++++++++++++++++++++++++-----------------------------
1 file changed, 27 insertions(+), 29 deletions(-)

diff --git a/src/logswan.c b/src/logswan.c @@ -5,7 +5,7 @@ /* http://www.logswan.org */ /* */ /* Created: 2015-05-31 */ -/* Last Updated: 2016-01-01 */ +/* Last Updated: 2016-01-08 */ /* */ /* Logswan is released under the BSD 3-Clause license. */ /* See LICENSE file for details. */ @@ -37,46 +37,44 @@ #include "output.h" #include "parse.h" -GeoIP *geoip, *geoipv6; - -clock_t begin, end; +void displayUsage() { + printf("USAGE : logswan [options] inputfile\n\n" \ + "Options are :\n\n" \ + " -h Display usage\n" \ + " -v Display version\n\n"); +} -char lineBuffer[LINE_MAX_LENGTH]; +int main (int argc, char *argv[]) { + GeoIP *geoip, *geoipv6; -Results results; -struct date parsedDate; -struct logLine parsedLine; -struct request parsedRequest; + clock_t begin, end; -struct sockaddr_in ipv4; -struct sockaddr_in6 ipv6; -int isIPv4, isIPv6; + char lineBuffer[LINE_MAX_LENGTH]; -uint64_t bandwidth; -int statusCode; -int hour; -int countryId; + Results results; + struct date parsedDate; + struct logLine parsedLine; + struct request parsedRequest; -struct stat logFileSize; -FILE *logFile; + struct sockaddr_in ipv4; + struct sockaddr_in6 ipv6; + uint8_t isIPv4, isIPv6; -const char *errstr; + uint64_t bandwidth; + uint16_t statusCode; + uint8_t hour; + uint16_t countryId; -int getoptFlag; + struct stat logFileSize; + FILE *logFile; -struct HLL uniqueIPv4, uniqueIPv6; + const char *errstr; -void displayUsage() { - printf("USAGE : logswan [options] inputfile\n\n" \ - "Options are :\n\n" \ - " -h Display usage\n" \ - " -v Display version\n\n"); -} + int8_t getoptFlag; -int main (int argc, char *argv[]) { + struct HLL uniqueIPv4, uniqueIPv6; char *intputFile; - #if defined(__OpenBSD__) if (pledge("stdio rpath", NULL) == -1) { err(EXIT_FAILURE, "pledge");