goaccess-0.9.4/0000755000000000000000000000000012573425132010266 500000000000000goaccess-0.9.4/ChangeLog0000644000000000000000000004452712573423734012002 00000000000000Changes to GoAccess 0.9.4 - Tuesday, September 08, 2015 - Fixed inability to parse color due to a missing POSIX extension. ERR: Invalid bg/fg color pairs - Added `%~` specifier to move forward through a log string until a non-space char is found. - Added the ability to parse static files containing a query string `--all-static-files`. - Added the ability to parse native Squid access.log format. - Added the ability to log invalid requests to a file `--invalid-requests`. - Added additional overall metric - total valid requests. - Fixed a few issues in the configuration script. Changes to GoAccess 0.9.3 - Wednesday, August 26, 2015 - Added the ability to set custom colors on the terminal output. - Added the ability to process logs incrementally. - Added a default color palette (Monokai) to the config file. - Added column headers for every enabled metric on each panel. - Added cumulative time served metric. - Added maximum time served metric (slowest running requests). - Added the ability to parse the query string specifier '%q' from a log file. - Added CloudFlare status codes. - Added command option to disable column name metrics --no-column-names. - Added AWS Elastic Load Balancing to the list of predefined log/date/time formats. - Added DragonFly BSD to the list of OSs. - Added Slackbot to the list of crawlers/browsers. - Disabled REFERRERS by default. - Ensure bandwidth metric is displayed only if the %b specifier is parsed. - Fixed issue where the '--sort-panel' option wouldn't sort certain panels. - Fixed several compiler warnings. - Set predefined static files when no config file is used. - Updated Windows 10 user agent from 6.4 (wrong) to 10.0.(actual) Changes to GoAccess 0.9.2 - Monday, July 06, 2015 - Added ability to fully parse browsers that contain spaces within a token. - Added multiple user agents to the list of browsers. - Added the ability to handle time served in milliseconds as a decimal number `%L`. - Added the ability to parse a timestamp in microseconds. - Added the ability to parse Google Cloud Storage access logs. - Added the ability to set a custom title and header in the HTML report. - Added '%x' as timestamp log-format specifier. - Ensure agents' hash table is destroyed upon exiting the program. - Ensure 'Game Systems' are processed correctly. - Ensure visitors panel header is updated depending if crawlers are parsed or not. - Fixed issue where the date value was set as time value in the config dialog. - Fixed memory leak in the hits metrics when using the in-memory storage (GLib). Changes to GoAccess 0.9.1 - Tuesday, May 26, 2015 - Added additional Nginx-specific status codes. - Added Applebot to the list of web crawlers. - Added Microsoft Edge to the list of browsers. - Added the ability to highlight active panel through --hl-header. - Ensure dump_struct is used only if using __GLIBC__. - Ensure goaccess image has an alt attribute on the HTML output for valid HTML5. - Ensure the config file path is displayed when something goes wrong (FATAL). - Ensure there is a character indicator to see which panel is active. - Fixed Cygwin compile issue attempting to use -rdynamic. - Fixed issue where a single IP did not get excluded after an IP range. - Fixed issue where requests show up in the wrong view even when --no-query-string is used. - Fixed issue where some browsers were not recognized or marked as 'unknown'. - Fixed memory leak when excluding an IP range. - Fixed overflows on sort comparison functions. - Fixed segfault when using on-disk storage and loading persisted data with -a. - Removed keyphrases menu item from HTML output. - Split iOS devices from Mac OS X. Changes to GoAccess 0.9 - Thursday, March 19, 2015 - Added ability to double decode an HTTP referer and agent. - Added ability to sort views through the command line on initial load. - Added additional data values to the backtrace report. - Added additional graph to represent the visitors metric on the HTML output. - Added AM_PROG_CC_C_O to configure.ac - Added 'Android Lollipop' to the list of operating systems. - Added 'average time served' metric to all panels. - Added 'bandwidth' metric to all panels. - Added command line option to disable summary metrics on the CSV output. - Added numeric formatting to the HTML output to improve readability. - Added request method specifier to the default W3C log format. - Added support for GeoIP Country IPv6 and GeoIP City IPv6 through --geoip-database. - Added the ability to ignore parsing and displaying given panel(s). - Added the ability to ignore referer sites from being counted. A good case scenario is to ignore own domains. i.e., owndomain.tld. This also allows ignoring hosts using wildcards. For instance, *.mydomain.tld or www.mydomain.* or www?.mydomain.tld - Added time/hour distribution module. e.g., 00-23. - Added 'visitors' metrics to all panels. - Added Windows 10 (v6.4) to the real windows user agents. - Changed AC_PREREQ macro version so it builds on old versions of autoconf. - Changed GEOIP database load to GEOIP_MEMORY_CACHE for faster lookups. - Changed maximum number of choices to display per panel to 366 fron 300. - Ensure config file is read from home dir if unable to open it from %sysconfdir% path. - Fixed array overflows when exceeding MAX_* limits on command line options. - Fixed a SEGFAULT where sscanf could not handle special chars within the referer. - Fixed character encoding on geolocation output (ISO-8859 to UTF8). - Fixed issue on wild cards containing '?' at the end of the string. - Fixed issue where a 'Nothing valid to process' error was triggered when the number of invalid hits was equal to the number of valid hits. - Fixed issue where outputting to a file left a zero-byte file in pwd. - Improved parsing of operating systems. - Refactored log parser so it allows with ease the addition of new modules. This also attempts to decouple the core functionality from the rendering functions. It also gives the flexibility to add children metrics to root metrics for any module. e.g., Request A was visited by IP1, IP2, IP3, etc. - Restyled HTML output. Changes to GoAccess 0.8.5 - Sunday, September 14, 2014 - Fixed SEGFAULT when parsing a malformed request that doesn't have HTTP status. Changes to GoAccess 0.8.4 - Monday, September 08, 2014 - Added ability to handle nginx non-standard status code 444 as 404. `--444-as-404` - Added and updated operating systems, and browsers. - Added excluded IP hits count to the general statistics panel on all reports. - Added HTTP nonstandard code '444' to the status code list. - Added the ability to count client errors (4xx) to the unique visitors count. Now by default it omits client errors (4xx) from being added to the unique visitors count as they are probably not welcomed visitors. 4xx errors are always counted in panels other than visitors, OS & browsers. `--4xx-to-unique-count` - Removed request status field restriction. This allows parsing logs that contain only a valid date, IPv4/6 and host. - Fixed issue when excluding IPv4/v6 ranges. - Fixed compile error due to missing include for type off_t (gcc 4.1). Changes to GoAccess 0.8.3 - Monday, July 28, 2014 - Fixed SEGFAULT when parsing a CLF log format and using --ignore-crawlers. - Fixed parsing conflict between some Opera browsers and Chrome. - Fixed parsing of several feed readers that are Firefox/Safari-based. - Fixed Steam detection. - Added Huawei to the browser's list and removed it from the OS's list. Changes to GoAccess 0.8.2 - Monday, July 20, 2014 - Added ability to parse dates containing whitespaces in between, e.g., Jul 15 20:13:59 (syslog format). - Added a variety of browsers, game systems, feed readers, and podcasts. - Added a '-V --version' command line option. - Added missing up/down arrows to the help section. - Added the ability to ignore crawlers using the '--ignore-crawlers' option. - Added the ability to ignore multiple IPv4/v6 and IP ranges. - Added the PATCH method according to RFC 5789. - Fixed GeoLocation percent issue for the JSON, CSV and HTML outputs. - Fixed memory leak when excluding one or multiple IPs. Changes to GoAccess 0.8.1 - Monday, June 16, 2014 - Added ability to add/remove static files by extension through the config file. - Added ability to print backtrace on segmentation fault. - Escaped JSON strings correctly according to [RFC4627]. - Fixed encoding issue when extracting keyphrases for some HTTP referers. - Fixed issue where HTML bar graphs were not shown due to numeric locale. - Fixed issue with URIs containing "\r?\n" thus breaking the corresponding output. - Make sure request string is URL decoded on all outputs. Changes to GoAccess 0.8 - Tuesday, May 20, 2014 - Added APT-HTTP to the list of browsers. - Added data persistence and ability to load data from disk. - Added IE11 to the list of browsers. - Added IEMobile to the list of browsers. - Added multiple command line options. - Added Nagios check_http to the list of browsers. - Added parsing progress metrics - total requests / requests per second. - Added the ability to parse a GeoLiteCity.dat to get the city given an IPv4. - Change the way the configuration file is parsed. This will parse all configuration options under ~/.goaccessrc or the specified config file and will feed getopt_long with the extracted key/value pairs. This also allows the ability to have comments on the config file which won't be overwritten. - Ensure autoconf determines the location of ncurses headers. - Fixed issue where geo_location_data was NULL. - Fixed issue where GoAccess did not run without a tty allocated to it. - Fixed potential memory leak on --log-file realpath(). - Fixed Solaris build errors. - Implemented an on-memory hash database using Tokyo Cabinet. This implementation allows GoAccess not to rely on GLib's hash table if one is needed. - Implemented large file support using an on-disk B+ Tree database. This implementation allows GoAccess not to hold everything in memory but instead it uses an on-disk B+ Tree database. - Trimmed leading and trailing whitespaces from keyphrases module. Changes to GoAccess 0.7.1 - Monday, February 17, 2014 - Added ability to get real OS names using --real-os. (Android, Windows, Mac) - Added ability to log debug messages to a file. - Added ability to parse tab-separated log format strings. - Added ability to support terminals without colors. - Added ability to turn off color output by using --no-color flag. - Added command line option to append HTTP method to request. - Added command line option to append HTTP protocol to request. - Added long options to command-line. - Added missing Win 9x 4.90 (Windows Me) user-agent. - Added missing Windows RT user-agent. - Ensure mouse click does not reset expanded module if it is the same. - Fixed Amazon CloudFront tab-separated log format. - Fixed "FreeBSD style" ncursesw built into system. - Fixed HTML report issue where data cell would not wrap. - Fixed issue when isatty() could not find a valid file descriptor. - Fixed SymbianOS user-agent and retrieve its version. Changes to GoAccess 0.7 - Monday, December 15, 2013 - Added a command line option to ignore request query strings. - Added additional compiler flags & fixed several warnings. - Added additional static file extensions. - Added country per IP to HOSTS module (HTML & JSON). - Added DEBUG mode to Makefile & -O2 to default release. - Added GEOLOCATION report to all outputs - includes continents/countries. - Added IP resolver to HTML and JSON output. - Added module numbers to each module header. - Added the ability to output JSON and CSV. - Added Windows NT 6.3 (Win 8.1) to the list. - Fixed buffer overflow issue with realpath. - New HTML report - HTML5 + CSS styles. - Properly split request line into the three request modules. Changes to GoAccess 0.6.1 - Monday, October 07, 2013 - Added active module indication by name. - Added additional crawlers to the list. - Added custom configuration file option. - Added human-readable string when unable to open log. - Added missing include when compiling on OSX 10.6. - Added optional mouse support to the main dashboard. - Added the ability to select active module by number (keys). - Added the rest of HTTP methods according to RFC2616. - Changed referring site sscanf format to process multiple URLs. - Changed the default color scheme to monochrome. - Fixed issue where %T was not processing floating-point numbers. - Fixed percentage issue for browsers and os modules. - Fixed SIGSEGV when reading from stdin to stdout. - Improved performance when expanding a module. - Reduced memory consumption by decreasing number of dns threads. - Removed ^UP/^DOWN due to a key mapping conflict. Changes to GoAccess 0.6 - Monday, July 15, 2013 - Moved away from the original pop-up UI to a new expandable dashboard allowing data to be processed in real-time. - Added the ability to search across the whole dashboard with the option to use regular expressions. - Added the ability to independently sort each module. - Implemented the ability to parse the time taken to serve the request, in microseconds and seconds. - Added a predefined log format/date for the Amazon CloudFront (Download Distribution). - Config window now accepts [ENTER] to continue or F10. - Added parsing/processing indicators. - Updated the hosts module so it shows the reverse DNS as a sub node. - Sanitized HTML output with html entities for special chars. - Fixed issue where Opera +15 was identified as Chrome. - Fixed a bunch of minor fixes and changes. - Added and updated list of browsers and operating systems. - Improved memory usage and better performance in general. Changes to GoAccess 0.5 - Monday, June 04, 2012 - Added the ability to parse a custom format string. - Added ability to output a full stats report to a file. - Added support for IPv6 - Fixed issue on Opera agents where version was not recognized correctly. - Fixed issue on empty Google query strings. - Fixed google cache key-phrases. - Added a new include sys/socket.h - BSD - Added a key shortcut to scroll top/bottom. - Fixed other minor fixes and changes. Changes to GoAccess 0.4.2 - Monday, January 03, 2011 - Fixed a minor bug when adding monthly totals on visitors subwin. - UTF-8 support has been implemented. Now it should handle properly wide-character/UTF-8. Run ./configure --enable-utf8 - Since GoAccess does not link to librt, -lrt has been removed. (OS X doesn't include librt) Changes to GoAccess 0.4.1 - Monday, December 13, 2010 - Ability to pass a flag to ./configure so GeoIP can be enabled if needed. - More flexibility when resizing the terminal. Should work fine with the standard 80x24. - Implemented a pipeline from stdin, so the input doesn't have to be only a file. Changes to GoAccess 0.4 - Tuesday, November 30, 2010 - Rewrote hash tables iterative code to avoid the use of GHashTableIter, this way it works with all GLib > 2.0.0. - Implemented list of agents for specific hosts. - Added graphs to the unique_visitors subwin. - Various bug fixes and code cleanups (mainly in the subwin modules). - Bandwidth per day, and host was implemented as well. Changes to GoAccess 0.3.3 - Monday, September 27, 2010 - Fixed a request size parsing issue. Due to malformed syntax on the HTTP protocol, bandwidth was reset to 0. Ex. "HEAD /" 400 20392 - Fixed a segfault when goaccess was executed without any options but with an additional unknown argument. - Tarball's filename was changed. Changes to GoAccess 0.3.2 - Thursday, September 09, 2010 - Fixed an agent parsing issue. As a result, operating systems were not properly counted. Changes to GoAccess 0.3.1 - Friday, September 03, 2010 - Added a color scheme implementation Changes to GoAccess 0.3 - Sunday, August 29, 2010 - Fixed invalid entries when parsing status codes - Implemented a real support for LFS - Handles files larger than 2 GiB on 32-bit systems - Added a more detailed and comprehensive browser and os report - Fixed a segmentation fault on pop-up window search if haystack was null - Added bandwidth details for requested files - Added percentage details on modules 2, 3, 4, 5, 10, 11 - Implemented support for 'vhost_combined' log format - Fixed a potential segmentation fault when resizing main window - Position of data/graphs will change depending on # of hits - A counter for total requests since initial parse was implemented - Code cleanups Changes to GoAccess 0.2 - Sunday, July 25, 2010 - Implemented real-time statistics (RTS). Data will be appended as the log file grows. Equivalent to 'tail -f' on Unix systems - Added a keyphrases report coming from Google search engine. This includes, raw, cache, and translation queries. - Implemented screen resize functionality - Various small speed increases & code cleanup - Fixed a memory leak when invalid entries were parsed - Simplify the "process_unique_data" function - Simplify creation of the "unique visitors" hash-key. - Fix a potential buffer overflow. Changes to GoAccess 0.1.2 - Monday, July 12 2010 - Fixed a segmentation fault when parsing logs with unusual request type. Ex. "GET HTTP/1.1 HTTP/1.1" Changes to GoAccess 0.1.1 - Saturday, July 10 2010 - Added an enhanced error handling - Added Glibc LFS - Added an extra macro on configure.ac to check against GHashTableIter. ./configure might not check for glib 2.16 that introduced 'GHashTableIter'. - Clean up code a little bit - Fixed a segmentation fault when displaying the help text on x86_64. - Fixed casts associated with "g_hash_table_iter_next". - Fixed two format strings. (If the error was ever triggered, it'd most likely lead to a segfault.) - Fixed assignments in conditions. In case the assignment is actually intended, put extra parenthesis around it. This will shut GCC (and others) up. - Fixed comparison between signed and unsigned integer types. - Fixed includes. - Fixed function declarations. Tuesday, July 06, 21:12:29 2010 Gerardo Orellana (goaccess at prosoftcorp.com) - Initial release 0.1 goaccess-0.9.4/config/0000755000000000000000000000000012573425132011533 500000000000000goaccess-0.9.4/config/goaccess.conf0000644000000000000000000003162112573423633014120 00000000000000###################################### # Date/Time Format Options ###################################### # The time as %H:%M:%S # # The hour (24-hour clock) [00,23]; leading zeros are permitted but not required. # The minute [00,59]; leading zeros are permitted but not required. # The seconds [00,60]; leading zeros are permitted but not required. # See `man strftime` for more details # #time-format %H:%M:%S # # Google Cloud Storage or # The time that the request was completed, in microseconds since the Unix # epoch. # #time-format %f # # The date_format variable followed by a space, specifies # the log format date containing any combination of regular # characters and special format specifiers. They all begin with a # percentage (%) sign. See `man strftime` # # Apache log date format. The following date format works with any # of the Apache's log formats below. # #date-format %d/%b/%Y # # AWS | Amazon CloudFront (Download Distribution) # AWS | Elastic Load Balancing # W3C (IIS) # #date-format %Y-%m-%d # # Google Cloud Storage or # The time that the request was completed, in microseconds since the Unix # epoch. # #date-format %f ###################################### # Log Format Options ###################################### # The log_format variable followed by a space or \t for # tab-delimited, specifies the log format string. # # NOTE: If the time/date is a timestamp in seconds or microseconds # %x must be used instead of %d & %t to represent the date & time. # # NCSA Combined Log Format # #log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" # # NCSA Combined Log Format with Virtual Host # #log-format %^:%^ %h %^[%d:%t %^] "%r" %s %b "%R" "%u" # # Common Log Format (CLF) # #log-format %h %^[%d:%t %^] "%r" %s %b # # Common Log Format (CLF) with Virtual Host # #log-format %^:%^ %h %^[%d:%t %^] "%r" %s %b # # W3C # #log-format %d %t %h %^ %^ %^ %^ %r %^ %s %b %^ %^ %u %R # # AWS | Amazon CloudFront (Download Distribution) # #log-format %d\t%t\t%^\t%b\t%h\t%m\t%^\t%r\t%s\t%R\t%u\t%^ # # AWS | Elastic Load Balancing # #log-format %dT%t.%^ %^ %h:%^ %^ %T %^ %^ %^ %s %^ %b "%r" "%u" # # Google Cloud Storage # #log-format "%x","%h",%^,%^,"%m","%U","%s",%^,"%b","%D",%^,"%R","%u" ###################################### # UI Options ###################################### # Prompt log/date configuration window on program start. # config-dialog false # Choose among color schemes # 1 : Default grey scheme # 2 : Green scheme # color-scheme 1 # Color highlight active panel. # hl-header true # Set HTML report page title and header. # #html-report-title My Awesome Web Stats # Turn off colored output. This is the default output on # terminals that do not support colors. # true : for no color output # false : use color-scheme # no-color false # Don't write column names in the terminal output. By default, it displays # column names for each available metric in every panel. # no-column-names false # Disable progress metrics. # no-progress false # Enable mouse support on main dashboard. # with-mouse false # Disable summary metrics on the CSV output.. # no-csv-summary false # Custom colors for the terminal output # Tailor GoAccess to suit your own tastes. # # Color Syntax: # DEFINITION space/tab colorFG#:colorBG# [attributes,PANEL] # # FG# = foreground color number [-1...255] (-1 = default terminal color) # BG# = background color number [-1...255] (-1 = default terminal color) # # Optionally: # # It is possible to apply color attributes, such as: # bold,underline,normal,reverse,blink. # Multiple attributes are comma separated # # If desired, it is possible to apply custom colors per panel, that is, a # metric in the REQUESTS panel can be of color A, while the same metric in the # BROWSERS panel can be of color B. # # The following is a 256 color scheme (Monokai palette) # #color COLOR_MTRC_HITS color197:color-1 #color COLOR_MTRC_VISITORS color148:color-1 #color COLOR_MTRC_DATA color7:color-1 #color COLOR_MTRC_BW color81:color-1 #color COLOR_MTRC_AVGTS color247:color-1 #color COLOR_MTRC_CUMTS color95:color-1 #color COLOR_MTRC_MAXTS color186:color-1 #color COLOR_MTRC_PROT color141:color-1 #color COLOR_MTRC_MTHD color81:color-1 #color COLOR_MTRC_PERC color186:color-1 #color COLOR_MTRC_PERC color186:color-1 VISITORS #color COLOR_MTRC_PERC color186:color-1 OS #color COLOR_MTRC_PERC color186:color-1 BROWSERS #color COLOR_MTRC_PERC color186:color-1 VISIT_TIMES #color COLOR_MTRC_PERC_MAX color208:color-1 #color COLOR_MTRC_PERC_MAX color208:color-1 VISITORS #color COLOR_MTRC_PERC_MAX color208:color-1 OS #color COLOR_MTRC_PERC_MAX color208:color-1 BROWSERS #color COLOR_MTRC_PERC_MAX color208:color-1 VISIT_TIMES #color COLOR_PANEL_COLS color242:color-1 #color COLOR_BARS color186:color-1 #color COLOR_ERROR color231:color197 #color COLOR_SELECTED color0:color215 #color COLOR_PANEL_ACTIVE color7:color240 #color COLOR_PANEL_HEADER color7:color237 #color COLOR_PANEL_DESC color242:color-1 #color COLOR_OVERALL_LBLS color251:color-1 #color COLOR_OVERALL_VALS color148:color-1 #color COLOR_OVERALL_PATH color186:color-1 #color COLOR_ACTIVE_LABEL color7:color237 #color COLOR_BG color7:color-1 #color COLOR_DEFAULT color7:color-1 #color COLOR_PROGRESS color7:color141 ###################################### # File Options ###################################### # Specify the path to the input log file. If set, it will take # priority over -f from the command line. # #log-file /var/log/apache2/access.log # Send all debug messages to the specified file. Needs to configured # with --enable-debug # #debug-file debug.log # Specify a custom configuration file to use. If set, it will take # priority over the global configuration file (if any). # #config-file # Log invalid requests to the specified file. # #invalid-requests # Do not load the global configuration file. # #no-global-config false ###################################### # Parse Options ###################################### # Consider the following extensions as static files # The actual '.' is required and extensions are case sensitive # static-file .css static-file .CSS static-file .dae static-file .DAE static-file .eot static-file .EOT static-file .gif static-file .GIF static-file .ico static-file .ICO static-file .jpeg static-file .JPEG static-file .jpg static-file .JPG static-file .js static-file .JS static-file .map static-file .MAP static-file .mp3 static-file .MP3 static-file .pdf static-file .PDF static-file .png static-file .PNG static-file .svg static-file .SVG static-file .swf static-file .SWF static-file .ttf static-file .TTF static-file .txt static-file .TXT static-file .woff static-file .WOFF # Exclude an IPv4 or IPv6 from being counted. # Ranges can be included as well using a dash in between # the IPs (start-end). # #exclude-ip 127.0.0.1 #exclude-ip 192.168.0.1-192.168.0.100 #exclude-ip ::1 #exclude-ip 0:0:0:0:0:ffff:808:804-0:0:0:0:0:ffff:808:808 # Enable a list of user-agents by host. For faster parsing, do not # enable this flag. # agent-list false # Include HTTP request method if found. This will create a # request key containing the request method + the actual request. # http-method true # Include HTTP request protocol if found. This will create a # request key containing the request protocol + the actual request. # http-protocol true # Ignore request's query string. # i.e., www.google.com/page.htm?query => www.google.com/page.htm # # Note: Removing the query string can greatly decrease memory # consumption, especially on timestamped requests. # no-query-string false # Disable IP resolver on terminal output. # no-term-resolver false # Write output to stdout given one of the following formats: # csv : A comma-separated values (CSV) # json : JSON (JavaScript Object Notation) # html : HTML report # #output-format json # Display real OS names. e.g, Windows XP, Snow Leopard. # real-os true # Enable IP resolver on HTML|JSON output. # with-output-resolver false # Treat non-standard status code 444 as 404. # 444-as-404 false # Add 4xx client errors to the unique visitors count. # 4xx-to-unique-count false # Decode double-encoded values. # double-decode false # Ignore crawlers from being counted. # This will ignore robots listed under browsers.c # Note that it will count them towards the total # number of requests, but excluded from any of the panels. # ignore-crawlers false # Ignore parsing and displaying the given panel. # #ignore-panel VISITORS #ignore-panel REQUESTS #ignore-panel REQUESTS_STATIC #ignore-panel NOT_FOUND #ignore-panel HOSTS #ignore-panel OS #ignore-panel BROWSERS #ignore-panel VISIT_TIMES ignore-panel REFERRERS #ignore-panel REFERRING_SITES ignore-panel KEYPHRASES #ignore-panel GEO_LOCATION #ignore-panel STATUS_CODES # Ignore referers from being counted. # This supports wild cards. For instance, # '*' matches 0 or more characters (including spaces) # '?' matches exactly one character # #ignore-referer *.domain.com #ignore-referer ww?.domain.* # Sort panel on initial load. # Sort options are separated by comma. # Options are in the form: PANEL,METRIC,ORDER # # Available metrics: # BY_HITS # BY_VISITORS # BY_DATA # BY_BW # BY_AVGTS # BY_CUMTS # BY_MAXTS # BY_PROT # BY_MTHD # Available orders: # ASC # DESC # #sort-panel VISITORS,BY_DATA,ASC #sort-panel REQUESTS,BY_HITS,ASC #sort-panel REQUESTS_STATIC,BY_HITS,ASC #sort-panel NOT_FOUND,BY_HITS,ASC #sort-panel HOSTS,BY_HITS,ASC #sort-panel OS,BY_HITS,ASC #sort-panel BROWSERS,BY_HITS,ASC #sort-panel VISIT_TIMES,BY_DATA,DESC #sort-panel REFERRERS,BY_HITS,ASC #sort-panel REFERRING_SITES,BY_HITS,ASC #sort-panel KEYPHRASES,BY_HITS,ASC #sort-panel GEO_LOCATION,BY_HITS,ASC #sort-panel STATUS_CODES,BY_HITS,ASC ###################################### # GeoIP Options # Only if configured with --enable-geoip ###################################### # Standard GeoIP database for less memory usage. # #std-geoip false # Specify path to GeoIP database file. i.e., GeoLiteCity.dat # .dat file needs to be downloaded from maxmind.com. # # For IPv4 City database: # wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz # gunzip GeoLiteCity.dat.gz # # For IPv6 City database: # wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz # gunzip GeoLiteCityv6.dat.gz # # For IPv6 Country database: # wget -N http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz # gunzip GeoIPv6.dat.gz # # Note: `geoip-city-data` is an alias of `geoip-database` # #geoip-database /usr/local/share/GeoIP/GeoLiteCity.dat ###################################### # Tokyo Cabinet Options # Only if configured with --enable-tcb=btree ###################################### # GoAccess has the ability to process logs incrementally through the on-disk # B+Tree database. # # It works in the following way: # - A data set must be persisted first with --keep-db-files, then the same data # set can be loaded with --load-from-disk. # - If new data is passed (piped or through a log file), it will append it to # the original data set. # - To preserve the data at all times, --keep-db-files must be used. # - If --load-from-disk is used without --keep-db-files, database files will be # deleted upon closing the program. # On-disk B+ Tree # Persist parsed data into disk. This should be set to # the first dataset prior to use `load-from-disk`. # Setting it to false will delete all database files # when exiting the program. #keep-db-files true # On-disk B+ Tree # Load previously stored data from disk. # Database files need to exist. See `keep-db-files`. #load-from-disk false # On-disk B+ Tree # Path where the on-disk database files are stored. # The default value is the /tmp directory. # #db-path /tmp # On-disk B+ Tree # Set the size in bytes of the extra mapped memory. # The default value is 0. # #xmmap 0 # On-disk B+ Tree # Max number of leaf nodes to be cached. # Specifies the maximum number of leaf nodes to be cached. # If it is not more than 0, the default value is specified. # The default value is 1024. # #cache-lcnum 1024 # On-disk B+ Tree # Specifies the maximum number of non-leaf nodes to be cached. # If it is not more than 0, the default value is specified. # The default value is 512. # #cache-ncnum 512 # On-disk B+ Tree # Specifies the number of members in each leaf page. # If it is not more than 0, the default value is specified. # The default value is 128. # #tune-lmemb 128 # On-disk B+ Tree # Specifies the number of members in each non-leaf page. # If it is not more than 0, the default value is specified. # The default value is 256. # #tune-nmemb 256 # On-disk B+ Tree # Specifies the number of elements of the bucket array. # If it is not more than 0, the default value is specified. # The default value is 32749. # Suggested size of the bucket array is about from 1 to 4 # times of the number of all pages to be stored. # #tune-bnum 32749 # On-disk B+ Tree # Specifies that each page is compressed with ZLIB|BZ2 encoding. # Disabled by default. # #compression zlib goaccess-0.9.4/depcomp0000755000000000000000000005064312572061142011567 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # A tabulation character. tab=' ' # A newline character. nl=' ' if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form 'foo.o: dependent.h', # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ < "$tmpdepfile" > "$depfile" sed ' s/[ '"$tab"'][ '"$tab"']*/ /g s/^ *// s/ *\\*$// s/^[^:]*: *// /^$/d /:$/d s/$/ :/ ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' "$nl" < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: goaccess-0.9.4/src/0000755000000000000000000000000012573425132011055 500000000000000goaccess-0.9.4/src/browsers.h0000664000000000000000000000211612573351524013021 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef BROWSERS_H_INCLUDED #define BROWSERS_H_INCLUDED #define BROWSER_TYPE_LEN 13 typedef struct GBrowser_ { char browser_type[BROWSER_TYPE_LEN]; int hits; } GBrowser; char *verify_browser (char *str, char *browser_type); int is_crawler (const char *agent); #endif goaccess-0.9.4/src/xmalloc.h0000664000000000000000000000201512573351524012610 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef XMALLOC_H_INCLUDED #define XMALLOC_H_INCLUDED char *xstrdup (const char *s); void *xcalloc (size_t nmemb, size_t size); void *xmalloc (size_t size); void *xrealloc (void *oldptr, size_t size); #endif goaccess-0.9.4/src/gdns.h0000664000000000000000000000330612573351524012110 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef GDNS_H_INCLUDED #define GDNS_H_INCLUDED #define H_SIZE 1025 #define QUEUE_SIZE 400 typedef struct GDnsThread_ { pthread_cond_t not_empty; pthread_cond_t not_full; pthread_mutex_t mutex; pthread_t thread; } GDnsThread; typedef struct GDnsQueue_ { int head; int tail; int size; int capacity; char buffer[QUEUE_SIZE][H_SIZE]; } GDnsQueue; extern GDnsThread gdns_thread; char *gqueue_dequeue (GDnsQueue * q); char *reverse_ip (char *str); int gqueue_empty (GDnsQueue * q); int gqueue_enqueue (GDnsQueue * q, char *item); int gqueue_find (GDnsQueue * q, const char *item); int gqueue_full (GDnsQueue * q); int gqueue_size (GDnsQueue * q); void dns_resolver (char *addr); void gdns_free_queue (void); void gdns_init (void); void gdns_queue_free (void); void gdns_thread_create (void); void gqueue_destroy (GDnsQueue * q); void gqueue_init (GDnsQueue * q, int capacity); #endif goaccess-0.9.4/src/settings.h0000644000000000000000000000701312573351524013012 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef SETTINGS_H_INCLUDED #define SETTINGS_H_INCLUDED #include #include "commons.h" #define MAX_LINE_CONF 512 #define MAX_EXTENSIONS 64 #define MAX_IGNORE_IPS 64 #define MAX_IGNORE_REF 64 #define MAX_CUSTOM_COLORS 64 #define NO_CONFIG_FILE "No config file used" typedef enum { COMBINED, VCOMBINED, COMMON, VCOMMON, W3C, CLOUDFRONT, CLOUDSTORAGE, AWSELB, } LOGTYPE; /* predefined log dates */ typedef struct GPreConfTime_ { const char *fmt24; const char *usec; } GPreConfTime; /* predefined log dates */ typedef struct GPreConfDate_ { const char *apache; const char *w3c; const char *usec; } GPreConfDate; /* predefined log formats */ typedef struct GPreConfLog_ { const char *combined; const char *vcombined; const char *common; const char *vcommon; const char *w3c; const char *cloudfront; const char *cloudstorage; const char *awselb; } GPreConfLog; typedef struct GConfKeyword_ { const unsigned short key_id; const char *keyword; } GConfKeyword; typedef struct GConf_ { char *date_format; char *debug_log; char *geoip_database; char *html_report_title; char *iconfigfile; char *ifile; char *ignore_ips[MAX_IGNORE_IPS]; char *ignore_panels[TOTAL_MODULES]; char *ignore_referers[MAX_IGNORE_REF]; char *invalid_requests_log; char *log_format; char *output_format; char *sort_panels[TOTAL_MODULES]; char *time_format; const char *colors[MAX_CUSTOM_COLORS]; const char *static_files[MAX_EXTENSIONS]; int all_static_files; int append_method; int append_protocol; int bandwidth; int client_err_to_unique_count; int code444_as_404; int color_scheme; int double_decode; int enable_html_resolver; int geo_db; int hl_header; int ignore_crawlers; int ignore_qstr; int list_agents; int load_conf_dlg; int load_global_config; int mouse_support; int no_color; int no_column_names; int no_csv_summary; int no_progress; int output_html; int real_os; int serve_usecs; int skip_term_resolver; int color_idx; int ignore_ip_idx; int ignore_panel_idx; int ignore_referer_idx; int sort_panel_idx; int static_file_idx; size_t static_file_max_len; /* TokyoCabinet */ char *db_path; int64_t xmmap; int cache_lcnum; int cache_ncnum; int compression; int keep_db_files; int load_from_disk; int tune_bnum; int tune_lmemb; int tune_nmemb; } GConf; char *get_selected_date_str (size_t idx); char *get_selected_time_str (size_t idx); char *get_selected_format_str (size_t idx); size_t get_selected_format_idx (void); extern GConf conf; int ignore_panel (GModule mod); int parse_conf_file (int *argc, char ***argv); void free_cmd_args (void); void set_default_static_files (void); #endif goaccess-0.9.4/src/parser.c0000644000000000000000000012165112573357401012446 00000000000000/** * parser.c -- web log parsing * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ /* * "_XOPEN_SOURCE" is required for the GNU libc to export "strptime(3)" * correctly. */ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #define _XOPEN_SOURCE 700 #include #include #if HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #include "tcbtdb.h" #else #include "glibht.h" #endif #ifdef HAVE_LIBGEOIP #include "geolocation.h" #endif #include "parser.h" #include "browsers.h" #include "goaccess.h" #include "error.h" #include "opesys.h" #include "util.h" #include "xmalloc.h" /* private prototypes */ /* key/data generators for each module */ static int gen_visitor_key (GKeyData * kdata, GLogItem * glog); static int gen_404_key (GKeyData * kdata, GLogItem * glog); static int gen_browser_key (GKeyData * kdata, GLogItem * glog); static int gen_host_key (GKeyData * kdata, GLogItem * glog); static int gen_keyphrase_key (GKeyData * kdata, GLogItem * glog); static int gen_os_key (GKeyData * kdata, GLogItem * glog); static int gen_referer_key (GKeyData * kdata, GLogItem * glog); static int gen_ref_site_key (GKeyData * kdata, GLogItem * glog); static int gen_request_key (GKeyData * kdata, GLogItem * glog); static int gen_static_request_key (GKeyData * kdata, GLogItem * glog); static int gen_status_code_key (GKeyData * kdata, GLogItem * glog); static int gen_visit_time_key (GKeyData * kdata, GLogItem * glog); #ifdef HAVE_LIBGEOIP static int gen_geolocation_key (GKeyData * kdata, GLogItem * glog); #endif /* insertion routines */ static void insert_data (int data_nkey, const char *data, GModule module); static void insert_root (int root_nkey, const char *root, GModule module); /* insertion metric routines */ static void insert_hit (int data_nkey, int uniq_nkey, int root_nkey, GModule module); static void insert_visitor (int uniq_nkey, GModule module); static void insert_bw (int data_nkey, uint64_t size, GModule module); static void insert_cumts (int data_nkey, uint64_t ts, GModule module); static void insert_maxts (int data_nkey, uint64_t ts, GModule module); static void insert_method (int data_nkey, const char *method, GModule module); static void insert_protocol (int data_nkey, const char *proto, GModule module); static void insert_agent (int data_nkey, int agent_nkey, GModule module); /* *INDENT-OFF* */ static GParse paneling[] = { { VISITORS, gen_visitor_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, NULL, }, { REQUESTS, gen_request_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, insert_method, insert_protocol, NULL, }, { REQUESTS_STATIC, gen_static_request_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, insert_method, insert_protocol, NULL, }, { NOT_FOUND, gen_404_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, insert_method, insert_protocol, NULL, }, { HOSTS, gen_host_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, insert_agent, }, { OS, gen_os_key, insert_data, insert_root, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, insert_method, insert_protocol, NULL, }, { BROWSERS, gen_browser_key, insert_data, insert_root, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, NULL, }, { REFERRERS, gen_referer_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, NULL, }, { REFERRING_SITES, gen_ref_site_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, NULL, }, { KEYPHRASES, gen_keyphrase_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, NULL, }, #ifdef HAVE_LIBGEOIP { GEO_LOCATION, gen_geolocation_key, insert_data, insert_root, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, NULL, }, #endif { STATUS_CODES, gen_status_code_key, insert_data, insert_root, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, NULL, }, { VISIT_TIMES, gen_visit_time_key, insert_data, NULL, insert_hit, insert_visitor, insert_bw, insert_cumts, insert_maxts, NULL, NULL, NULL, }, }; /* *INDENT-ON* */ static void new_modulekey (GKeyData * kdata) { GKeyData key = { .data = NULL, .data_key = NULL, .data_nkey = 0, .root = NULL, .root_key = NULL, .root_nkey = 0, .uniq_key = NULL, .uniq_nkey = 0, }; *kdata = key; } static GParse * panel_lookup (GModule module) { int i, num_panels = ARRAY_SIZE (paneling); for (i = 0; i < num_panels; i++) { if (paneling[i].module == module) return &paneling[i]; } return NULL; } /* allocate memory for ht raw data */ GRawData * new_grawdata (void) { GRawData *raw_data = xmalloc (sizeof (GRawData)); memset (raw_data, 0, sizeof *raw_data); return raw_data; } /* allocate memory for raw data items */ GRawDataItem * new_grawdata_item (unsigned int size) { GRawDataItem *item = xcalloc (size, sizeof (GRawDataItem)); return item; } /* free memory allocated in raw data */ void free_raw_data (GRawData * raw_data) { #ifdef HAVE_LIBTOKYOCABINET int i; for (i = 0; i < raw_data->size; i++) { if (raw_data->items[i].key != NULL) free (raw_data->items[i].key); if (raw_data->items[i].value != NULL) free (raw_data->items[i].value); } #endif free (raw_data->items); free (raw_data); } void reset_struct (GLog * logger) { logger->invalid = 0; logger->processed = 0; logger->resp_size = 0LL; logger->valid = 0; } GLog * init_log (void) { GLog *glog = xmalloc (sizeof (GLog)); memset (glog, 0, sizeof *glog); return glog; } GLogItem * init_log_item (GLog * logger) { GLogItem *glog; logger->items = xmalloc (sizeof (GLogItem)); glog = logger->items; memset (glog, 0, sizeof *glog); glog->agent = NULL; glog->browser = NULL; glog->browser_type = NULL; glog->continent = NULL; glog->country = NULL; glog->date = NULL; glog->host = NULL; glog->keyphrase = NULL; glog->method = NULL; glog->os = NULL; glog->os_type = NULL; glog->protocol = NULL; glog->qstr = NULL; glog->ref = NULL; glog->req_key = NULL; glog->req = NULL; glog->status = NULL; glog->time = NULL; glog->uniq_key = NULL; glog->resp_size = 0LL; glog->serve_time = 0; strncpy (glog->site, "", REF_SITE_LEN); glog->site[REF_SITE_LEN - 1] = '\0'; return glog; } static void free_logger (GLogItem * glog) { if (glog->agent != NULL) free (glog->agent); if (glog->browser != NULL) free (glog->browser); if (glog->browser_type != NULL) free (glog->browser_type); if (glog->continent != NULL) free (glog->continent); if (glog->country != NULL) free (glog->country); if (glog->date != NULL) free (glog->date); if (glog->host != NULL) free (glog->host); if (glog->keyphrase != NULL) free (glog->keyphrase); if (glog->method != NULL) free (glog->method); if (glog->os != NULL) free (glog->os); if (glog->os_type != NULL) free (glog->os_type); if (glog->protocol != NULL) free (glog->protocol); if (glog->qstr != NULL) free (glog->qstr); if (glog->ref != NULL) free (glog->ref); if (glog->req_key != NULL) free (glog->req_key); if (glog->req != NULL) free (glog->req); if (glog->status != NULL) free (glog->status); if (glog->time != NULL) free (glog->time); if (glog->uniq_key != NULL) free (glog->uniq_key); free (glog); } #define B16210(x) (((x) >= '0' && (x) <= '9') ? ((x) - '0') : (toupper((x)) - 'A' + 10)) static void decode_hex (char *url, char *out) { char *ptr; const char *c; for (c = url, ptr = out; *c; c++) { if (*c != '%' || !isxdigit (c[1]) || !isxdigit (c[2])) { *ptr++ = *c; } else { *ptr++ = (B16210 (c[1]) * 16) + (B16210 (c[2])); c += 2; } } *ptr = 0; } static char * decode_url (char *url) { char *out, *decoded; if ((url == NULL) || (*url == '\0')) return NULL; out = decoded = xstrdup (url); decode_hex (url, out); if (conf.double_decode) decode_hex (decoded, out); strip_newlines (out); return trim_str (out); } /* Process keyphrases from Google search, cache, and translate. * Note that the referer hasn't been decoded at the entry point * since there could be '&' within the search query. */ static int extract_keyphrase (char *ref, char **keyphrase) { char *r, *ptr, *pch, *referer; int encoded = 0; if (!(strstr (ref, "http://www.google.")) && !(strstr (ref, "http://webcache.googleusercontent.com/")) && !(strstr (ref, "http://translate.googleusercontent.com/"))) return 1; /* webcache.googleusercontent */ if ((r = strstr (ref, "/+&")) != NULL) return 1; /* webcache.googleusercontent */ else if ((r = strstr (ref, "/+")) != NULL) r += 2; /* webcache.googleusercontent */ else if ((r = strstr (ref, "q=cache:")) != NULL) { pch = strchr (r, '+'); if (pch) r += pch - r + 1; } /* www.google.* or translate.googleusercontent */ else if ((r = strstr (ref, "&q=")) != NULL || (r = strstr (ref, "?q=")) != NULL) r += 3; else if ((r = strstr (ref, "%26q%3D")) != NULL || (r = strstr (ref, "%3Fq%3D")) != NULL) encoded = 1, r += 7; else return 1; if (!encoded && (ptr = strchr (r, '&')) != NULL) *ptr = '\0'; else if (encoded && (ptr = strstr (r, "%26")) != NULL) *ptr = '\0'; referer = decode_url (r); if (referer == NULL || *referer == '\0') return 1; referer = char_replace (referer, '+', ' '); *keyphrase = trim_str (referer); return 0; } #ifdef HAVE_LIBGEOIP static int extract_geolocation (GLogItem * glog, char *continent, char *country) { if (geo_location_data == NULL) return 1; geoip_get_country (glog->host, country, glog->type_ip); geoip_get_continent (glog->host, continent, glog->type_ip); return 0; } #endif /* parses a URI and extracts the *host* part from it * i.e., //www.example.com/path?googleguy > www.example.com */ static int extract_referer_site (const char *referer, char *host) { char *url, *begin, *end; int len = 0; if ((referer == NULL) || (*referer == '\0')) return 1; url = strdup (referer); if ((begin = strstr (url, "//")) == NULL) goto clean; begin += 2; if ((len = strlen (begin)) == 0) goto clean; if ((end = strchr (begin, '/')) != NULL) len = end - begin; if (len == 0) goto clean; if (len >= REF_SITE_LEN) len = REF_SITE_LEN - 1; memcpy (host, begin, len); host[len] = '\0'; free (url); return 0; clean: free (url); return 1; } /* returns 1 if the request seems to be a static file */ static int verify_static_content (char *req) { char *nul = req + strlen (req); const char *ext = NULL, *pch = NULL; int elen = 0, i; if (strlen (req) < conf.static_file_max_len) return 0; for (i = 0; i < conf.static_file_idx; ++i) { ext = conf.static_files[i]; if (ext == NULL || *ext == '\0') continue; elen = strlen (ext); if (conf.all_static_files && (pch = strchr (req, '?')) != NULL && pch - req > elen) { pch -= elen; if (0 == strncmp (ext, pch, elen)) return 1; continue; } if (!memcmp (nul - elen, ext, elen)) return 1; } return 0; } static const char * extract_method (const char *token) { const char *lookfor = NULL; if ((lookfor = "OPTIONS", !memcmp (token, lookfor, 7)) || (lookfor = "GET", !memcmp (token, lookfor, 3)) || (lookfor = "HEAD", !memcmp (token, lookfor, 4)) || (lookfor = "POST", !memcmp (token, lookfor, 4)) || (lookfor = "PUT", !memcmp (token, lookfor, 3)) || (lookfor = "DELETE", !memcmp (token, lookfor, 6)) || (lookfor = "TRACE", !memcmp (token, lookfor, 5)) || (lookfor = "CONNECT", !memcmp (token, lookfor, 7)) || (lookfor = "PATCH", !memcmp (token, lookfor, 5)) || (lookfor = "options", !memcmp (token, lookfor, 7)) || (lookfor = "get", !memcmp (token, lookfor, 3)) || (lookfor = "head", !memcmp (token, lookfor, 4)) || (lookfor = "post", !memcmp (token, lookfor, 4)) || (lookfor = "put", !memcmp (token, lookfor, 3)) || (lookfor = "delete", !memcmp (token, lookfor, 6)) || (lookfor = "trace", !memcmp (token, lookfor, 5)) || (lookfor = "connect", !memcmp (token, lookfor, 7)) || (lookfor = "patch", !memcmp (token, lookfor, 5))) return lookfor; return NULL; } static int invalid_protocol (const char *token) { const char *lookfor = NULL; return !((lookfor = "HTTP/1.0", !memcmp (token, lookfor, 8)) || (lookfor = "HTTP/1.1", !memcmp (token, lookfor, 8))); } static char * parse_req (char *line, char **method, char **protocol) { char *req = NULL, *request = NULL, *proto = NULL, *dreq = NULL; const char *meth; ptrdiff_t rlen; meth = extract_method (line); /* couldn't find a method, so use the whole request line */ if (meth == NULL) { request = xstrdup (line); } /* method found, attempt to parse request */ else { req = line + strlen (meth); if ((proto = strstr (line, " HTTP/1.0")) == NULL && (proto = strstr (line, " HTTP/1.1")) == NULL) { return alloc_string ("-"); } req++; if ((rlen = proto - req) <= 0) return alloc_string ("-"); request = xmalloc (rlen + 1); strncpy (request, req, rlen); request[rlen] = 0; if (conf.append_method) (*method) = strtoupper (xstrdup (meth)); if (conf.append_protocol) (*protocol) = strtoupper (xstrdup (++proto)); } if ((dreq = decode_url (request)) && dreq != '\0') { free (request); return dreq; } return request; } static char * parse_string (char **str, char end, int cnt) { int idx = 0; char *pch = *str, *p; do { if (*pch == end) idx++; if ((*pch == end && cnt == idx) || *pch == '\0') { size_t len = (pch - *str + 1); p = xmalloc (len); memcpy (p, *str, (len - 1)); p[len - 1] = '\0'; *str += len - 1; return trim_str (p); } /* advance to the first unescaped delim */ if (*pch == '\\') pch++; } while (*pch++); return NULL; } static void find_alpha (char **str) { char *s = *str; while (*s) { if (isspace (*s)) s++; else break; } *str += s - *str; } static int parse_specifier (GLogItem * glog, char **str, const char *p) { struct tm tm; const char *dfmt = conf.date_format; const char *tfmt = conf.time_format; char *pch, *sEnd, *bEnd, *tkn = NULL; double serve_secs = 0.0; uint64_t bandw = 0, serve_time = 0; errno = 0; memset (&tm, 0, sizeof (tm)); switch (*p) { /* date */ case 'd': if (glog->date) return 1; /* parse date format including dates containing spaces, * i.e., syslog date format (Jul 15 20:10:56) */ tkn = parse_string (&(*str), p[1], count_matches (dfmt, ' ') + 1); if (tkn == NULL) return 1; if (str_to_time (tkn, dfmt, &tm) != 0) { free (tkn); return 1; } glog->date = tkn; break; /* time */ case 't': if (glog->time) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; if (str_to_time (tkn, tfmt, &tm) != 0) { free (tkn); return 1; } glog->time = tkn; break; /* date/time as decimal, i.e., timestamps, ms/us */ case 'x': if (glog->time && glog->date) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; if (str_to_time (tkn, tfmt, &tm) != 0) { free (tkn); return 1; } glog->date = xstrdup (tkn); glog->time = tkn; break; /* remote hostname (IP only) */ case 'h': if (glog->host) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; if (invalid_ipaddr (tkn, &glog->type_ip)) { free (tkn); return 1; } glog->host = tkn; break; /* request method */ case 'm': if (glog->method) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; if (!extract_method (tkn)) { free (tkn); return 1; } glog->method = tkn; break; /* request not including method or protocol */ case 'U': if (glog->req) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL || *tkn == '\0') return 1; if ((glog->req = decode_url (tkn)) == NULL) return 1; free (tkn); break; /* query string alone, e.g., ?param=goaccess&tbm=shop */ case 'q': if (glog->qstr) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL || *tkn == '\0') return 1; if ((glog->qstr = decode_url (tkn)) == NULL) return 1; free (tkn); break; /* request protocol */ case 'H': if (glog->protocol) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; if (invalid_protocol (tkn)) { free (tkn); return 1; } glog->protocol = tkn; break; /* request, including method + protocol */ case 'r': if (glog->req) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; glog->req = parse_req (tkn, &glog->method, &glog->protocol); free (tkn); break; /* Status Code */ case 's': if (glog->status) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; strtol (tkn, &sEnd, 10); if (tkn == sEnd || *sEnd != '\0' || errno == ERANGE) { free (tkn); return 1; } glog->status = tkn; break; /* size of response in bytes - excluding HTTP headers */ case 'b': if (glog->resp_size) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; bandw = strtol (tkn, &bEnd, 10); if (tkn == bEnd || *bEnd != '\0' || errno == ERANGE) bandw = 0; glog->resp_size = bandw; conf.bandwidth = 1; free (tkn); break; /* referrer */ case 'R': if (glog->ref) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) tkn = alloc_string ("-"); if (tkn != NULL && *tkn == '\0') { free (tkn); tkn = alloc_string ("-"); } if (strcmp (tkn, "-") != 0) { extract_keyphrase (tkn, &glog->keyphrase); extract_referer_site (tkn, glog->site); } glog->ref = tkn; break; /* user agent */ case 'u': if (glog->agent) return 1; tkn = parse_string (&(*str), p[1], 1); if (tkn != NULL && *tkn != '\0') { /* Make sure the user agent is decoded (i.e.: CloudFront) * and replace all '+' with ' ' (i.e.: w3c) */ glog->agent = char_replace (decode_url (tkn), '+', ' '); free (tkn); break; } else if (tkn != NULL && *tkn == '\0') { free (tkn); tkn = alloc_string ("-"); } /* must be null */ else { tkn = alloc_string ("-"); } glog->agent = tkn; break; /* time taken to serve the request, in milliseconds as a decimal number */ case 'L': /* ignore it if we already have served time */ if (glog->serve_time) break; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; serve_secs = strtoull (tkn, &bEnd, 10); if (tkn == bEnd || *bEnd != '\0' || errno == ERANGE) serve_secs = 0; /* convert it to microseconds */ glog->serve_time = (serve_secs > 0) ? serve_secs * MILS : 0; conf.serve_usecs = 1; /* flag */ free (tkn); break; /* time taken to serve the request, in seconds with a milliseconds * resolution */ case 'T': /* ignore it if we already have served time */ if (glog->serve_time) break; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; if (strchr (tkn, '.') != NULL) serve_secs = strtod (tkn, &bEnd); else serve_secs = strtoull (tkn, &bEnd, 10); if (tkn == bEnd || *bEnd != '\0' || errno == ERANGE) serve_secs = 0; /* convert it to microseconds */ glog->serve_time = (serve_secs > 0) ? serve_secs * SECS : 0; conf.serve_usecs = 1; /* flag */ free (tkn); break; /* time taken to serve the request, in microseconds */ case 'D': /* ignore it if we already have served time */ if (glog->serve_time) break; tkn = parse_string (&(*str), p[1], 1); if (tkn == NULL) return 1; serve_time = strtoull (tkn, &bEnd, 10); if (tkn == bEnd || *bEnd != '\0' || errno == ERANGE) serve_time = 0; glog->serve_time = serve_time; conf.serve_usecs = 1; /* flag */ free (tkn); break; /* move forward through str until not a space */ case '~': find_alpha (&(*str)); break; /* everything else skip it */ default: if ((pch = strchr (*str, p[1])) != NULL) *str += pch - *str; } return 0; } static int parse_format (GLogItem * glog, char *str) { const char *p; const char *lfmt = conf.log_format; int special = 0; if (str == NULL || *str == '\0') return 1; /* iterate over the log format */ for (p = lfmt; *p; p++) { if (*p == '%') { special++; continue; } if (special && *p != '\0') { if ((str == NULL) || (*str == '\0')) return 0; /* attempt to parse format specifiers */ if (parse_specifier (glog, &str, p) == 1) return 1; special = 0; } else if (special && isspace (p[0])) { return 1; } else { str++; } } return 0; } static int valid_line (char *line) { /* invalid line */ if ((line == NULL) || (*line == '\0')) return 1; /* ignore comments */ if (*line == '#' || *line == '\n') return 1; return 0; } static void lock_spinner (void) { if (parsing_spinner != NULL && parsing_spinner->state == SPN_RUN) pthread_mutex_lock (&parsing_spinner->mutex); } static void unlock_spinner (void) { if (parsing_spinner != NULL && parsing_spinner->state == SPN_RUN) pthread_mutex_unlock (&parsing_spinner->mutex); } static void strip_qstring (char *req) { char *qmark; if ((qmark = strchr (req, '?')) != NULL) { if ((qmark - req) > 0) *qmark = '\0'; } } static void inc_resp_size (GLog * logger, uint64_t resp_size) { logger->resp_size += resp_size; #ifdef TCB_BTREE ht_inc_u64_from_str_key (ht_general_stats, "bandwidth", resp_size); #endif } static void count_invalid (GLog * logger, const char *line, int test) { logger->invalid++; #ifdef TCB_BTREE if (!test) ht_inc_int_from_str_key (ht_general_stats, "failed_requests", 1); #else (void) test; #endif if (conf.invalid_requests_log) LOG_INVALID (("%s", line)); } static void count_valid (GLog * logger, int test) { lock_spinner (); logger->valid++; #ifdef TCB_BTREE if (!test) ht_inc_int_from_str_key (ht_general_stats, "valid_requests", 1); #else (void) test; #endif unlock_spinner (); } static void count_process (GLog * logger, int test) { lock_spinner (); logger->processed++; #ifdef TCB_BTREE if (!test) ht_inc_int_from_str_key (ht_general_stats, "total_requests", 1); #else (void) test; #endif unlock_spinner (); } static int excluded_ip (GLog * logger, GLogItem * glog, int test) { if (conf.ignore_ip_idx && ip_in_range (glog->host)) { logger->excluded_ip++; #ifdef TCB_BTREE if (!test) ht_inc_int_from_str_key (ht_general_stats, "excluded_ip", 1); #else (void) test; #endif return 0; } return 1; } static int exclude_crawler (GLogItem * glog) { return conf.ignore_crawlers && is_crawler (glog->agent) ? 0 : 1; } static int is_static (GLogItem * glog) { return verify_static_content (glog->req); } static int is_404 (GLogItem * glog) { /* is this a 404? */ if (glog->status && !memcmp (glog->status, "404", 3)) return 1; /* treat 444 as 404? */ else if (glog->status && !memcmp (glog->status, "444", 3) && conf.code444_as_404) return 1; return 0; } static int insert_keymap (const char *key, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); return ht_insert_keymap (metrics->keymap, key); } static int insert_uniqmap (char *uniq_key, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); return ht_insert_uniqmap (metrics->uniqmap, uniq_key); } static void insert_root (int root_nkey, const char *root, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_insert_str_from_int_key (metrics->rootmap, root_nkey, root); } static void insert_data (int nkey, const char *data, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_insert_str_from_int_key (metrics->datamap, nkey, data); } static void insert_hit (int data_nkey, int uniq_nkey, int root_nkey, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_insert_hit (metrics->hits, data_nkey, uniq_nkey, root_nkey); } static void insert_visitor (int uniq_nkey, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_inc_int_from_int_key (metrics->visitors, uniq_nkey, 1); } static void insert_bw (int data_nkey, uint64_t size, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_inc_u64_from_int_key (metrics->bw, data_nkey, size); } static void insert_cumts (int data_nkey, uint64_t ts, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_inc_u64_from_int_key (metrics->cumts, data_nkey, ts); } static void insert_maxts (int data_nkey, uint64_t ts, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_max_u64_from_int_key (metrics->maxts, data_nkey, ts); } static void insert_method (int nkey, const char *data, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_insert_str_from_int_key (metrics->methods, nkey, data ? data : "---"); } static void insert_protocol (int nkey, const char *data, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_insert_str_from_int_key (metrics->protocols, nkey, data ? data : "---"); } static void insert_agent (int data_nkey, int agent_nkey, GModule module) { GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); ht_insert_host_agent (metrics->agents, data_nkey, agent_nkey); } /* The following generates a unique key to identity unique visitors. * The key is made out of the IP, date, and user agent. * Note that for readability, doing a simple snprintf/sprintf should * suffice, however, memcpy is the fastest solution */ static char * get_uniq_visitor_key (GLogItem * glog) { char *ua, *key; size_t s1, s2, s3; ua = deblank (xstrdup (glog->agent)); s1 = strlen (glog->host); s2 = strlen (glog->date); s3 = strlen (ua); /* includes terminating null */ key = xmalloc (s1 + s2 + s3 + 3); memcpy (key, glog->host, s1); key[s1] = '|'; memcpy (key + s1 + 1, glog->date, s2 + 1); key[s1 + s2 + 1] = '|'; memcpy (key + s1 + s2 + 2, ua, s3 + 1); free (ua); return key; } static char * gen_unique_req_key (GLogItem * glog) { char *key; size_t s1 = 0, s2 = 0, s3 = 0; /* nothing to do */ if (!conf.append_method && !conf.append_protocol) return xstrdup (glog->req); /* still nothing to do */ if (!glog->method && !glog->protocol) return xstrdup (glog->req); s1 = strlen (glog->req); if (glog->method) s2 = strlen (glog->method); if (glog->protocol) s3 = strlen (glog->protocol); /* includes terminating null */ key = xmalloc (s1 + s2 + s3 + 3); /* append request */ memcpy (key, glog->req, s1); if (glog->method) { key[s1] = '|'; memcpy (key + s1 + 1, glog->method, s2 + 1); } if (glog->protocol) { key[s1 + s2 + 1] = '|'; memcpy (key + s1 + s2 + 2, glog->protocol, s3 + 1); } return key; } /* Append the query string to the request, and therefore, it modifies the * original glog->req */ static void append_query_string (char **req, const char *qstr) { char *r; size_t s1, s2; s1 = strlen (*req); s2 = strlen (qstr); r = xmalloc (s1 + s2 + 2); memcpy (r, *req, s1); memcpy (r + s1, qstr, s2 + 1); free (*req); *req = r; } static void get_kdata (GKeyData * kdata, char *data_key, char *data) { /* inserted in keymap */ kdata->data_key = data_key; /* inserted in datamap */ kdata->data = data; } static int gen_visitor_key (GKeyData * kdata, GLogItem * glog) { if (!glog->date) return 1; get_kdata (kdata, glog->date, glog->date); return 0; } static int gen_req_key (GKeyData * kdata, GLogItem * glog) { glog->req_key = gen_unique_req_key (glog); if (glog->req && glog->qstr) append_query_string (&glog->req, glog->qstr); get_kdata (kdata, glog->req_key, glog->req); return 0; } static int gen_request_key (GKeyData * kdata, GLogItem * glog) { if (!glog->req || glog->is_404 || glog->is_static) return 1; return gen_req_key (kdata, glog); } static int gen_404_key (GKeyData * kdata, GLogItem * glog) { if (glog->req && glog->is_404) return gen_req_key (kdata, glog); return 1; } static int gen_static_request_key (GKeyData * kdata, GLogItem * glog) { if (glog->req && glog->is_static) return gen_req_key (kdata, glog); return 1; } static int gen_host_key (GKeyData * kdata, GLogItem * glog) { if (!glog->host) return 1; get_kdata (kdata, glog->host, glog->host); return 0; } static int gen_browser_key (GKeyData * kdata, GLogItem * glog) { char *agent = NULL; char browser_type[BROWSER_TYPE_LEN] = ""; if (glog->agent == NULL || *glog->agent == '\0') return 1; agent = xstrdup (glog->agent); glog->browser = verify_browser (agent, browser_type); glog->browser_type = xstrdup (browser_type); /* e.g., Firefox 11.12 */ kdata->data = glog->browser; kdata->data_key = glog->browser; /* Firefox */ kdata->root = glog->browser_type; kdata->root_key = glog->browser_type; free (agent); return 0; } static int gen_os_key (GKeyData * kdata, GLogItem * glog) { char *agent = NULL; char os_type[OPESYS_TYPE_LEN] = ""; if (glog->agent == NULL || *glog->agent == '\0') return 1; agent = xstrdup (glog->agent); glog->os = verify_os (agent, os_type); glog->os_type = xstrdup (os_type); /* e.g., Linux,Ubuntu 10.12 */ kdata->data = glog->os; kdata->data_key = glog->os; /* Linux */ kdata->root = glog->os_type; kdata->root_key = glog->os_type; free (agent); return 0; } static int gen_referer_key (GKeyData * kdata, GLogItem * glog) { if (!glog->ref) return 1; get_kdata (kdata, glog->ref, glog->ref); return 0; } static int gen_ref_site_key (GKeyData * kdata, GLogItem * glog) { if (glog->site[0] == '\0') return 1; get_kdata (kdata, glog->site, glog->site); return 0; } static int gen_keyphrase_key (GKeyData * kdata, GLogItem * glog) { if (!glog->keyphrase) return 1; get_kdata (kdata, glog->keyphrase, glog->keyphrase); return 0; } #ifdef HAVE_LIBGEOIP static int gen_geolocation_key (GKeyData * kdata, GLogItem * glog) { char continent[CONTINENT_LEN] = ""; char country[COUNTRY_LEN] = ""; if (extract_geolocation (glog, continent, country) == 1) return 1; if (country[0] != '\0') glog->country = xstrdup (country); if (continent[0] != '\0') glog->continent = xstrdup (continent); kdata->data_key = glog->country; kdata->data = glog->country; kdata->root = glog->continent; kdata->root_key = glog->continent; return 0; } #endif static int gen_status_code_key (GKeyData * kdata, GLogItem * glog) { const char *status = NULL, *type = NULL; if (!glog->status) return 1; type = verify_status_code_type (glog->status); status = verify_status_code (glog->status); kdata->data = (char *) status; kdata->data_key = (char *) status; kdata->root = (char *) type; kdata->root_key = (char *) type; return 0; } static int gen_visit_time_key (GKeyData * kdata, GLogItem * glog) { char *hmark = NULL; char hour[HOUR_LEN] = ""; /* %H */ if (!glog->time) return 1; /* if not a timestamp, then it must be a string containing the hour. * this is faster than actual date conversion */ if (!has_timestamp (conf.time_format) && (hmark = strchr (glog->time, ':'))) { if ((hmark - glog->time) > 0) *hmark = '\0'; get_kdata (kdata, glog->time, glog->time); return 0; } /* otherwise it attempts to convert the date given a time format, * though this is slower */ memset (hour, 0, sizeof *hour); if (convert_date (hour, glog->time, conf.time_format, "%H", HOUR_LEN) != 0) return 1; if (hour == '\0') return 1; free (glog->time); glog->time = xstrdup (hour); get_kdata (kdata, glog->time, glog->time); return 0; } static int include_uniq (GLogItem * glog) { int u = conf.client_err_to_unique_count; if (!glog->status || glog->status[0] != '4' || (u && glog->status[0] == '4')) return 1; return 0; } static void set_datamap (GLogItem * glog, GKeyData * kdata, const GParse * parse) { GModule module; module = parse->module; /* insert data */ parse->datamap (kdata->data_nkey, kdata->data, module); /* insert root */ if (parse->rootmap) parse->rootmap (kdata->root_nkey, kdata->root, module); /* insert hits */ if (parse->hits) parse->hits (kdata->data_nkey, kdata->uniq_nkey, kdata->root_nkey, module); /* insert visitors */ if (parse->visitor && kdata->uniq_nkey != 0) parse->visitor (kdata->data_nkey, module); /* insert bandwidth */ if (parse->bw) parse->bw (kdata->data_nkey, glog->resp_size, module); /* insert averages time served */ if (parse->cumts) parse->cumts (kdata->data_nkey, glog->serve_time, module); /* insert averages time served */ if (parse->maxts) parse->maxts (kdata->data_nkey, glog->serve_time, module); /* insert method */ if (parse->method && conf.append_method) parse->method (kdata->data_nkey, glog->method, module); /* insert protocol */ if (parse->protocol && conf.append_protocol) parse->protocol (kdata->data_nkey, glog->protocol, module); /* insert agent */ if (parse->agent && conf.list_agents) parse->agent (kdata->data_nkey, glog->agent_nkey, module); } static void map_log (GLogItem * glog, const GParse * parse, GModule module) { GKeyData kdata; char *uniq_key = NULL; new_modulekey (&kdata); if (parse->key_data (&kdata, glog) == 1) return; /* each module requires a data key/value */ if (parse->datamap && kdata.data_key) kdata.data_nkey = insert_keymap (kdata.data_key, module); /* each module contains a uniq visitor key/value */ if (parse->visitor && glog->uniq_key && include_uniq (glog)) { uniq_key = ints_to_str (glog->uniq_nkey, kdata.data_nkey); /* unique key already exists? */ if ((kdata.uniq_nkey = insert_uniqmap (uniq_key, module)) == 0) free (uniq_key); } /* root keys are optional */ if (parse->rootmap && kdata.root_key) kdata.root_nkey = insert_keymap (kdata.root_key, module); /* each module requires a root key/value */ if (parse->datamap && kdata.data_key) set_datamap (glog, &kdata, parse); } static void process_log (GLogItem * glog) { GModule module; /* insert one unique visitor key per request to avoid the * overhead of storing one key per module */ glog->uniq_nkey = ht_insert_unique_key (glog->uniq_key); /* store unique user agents and retrieve its numeric key. it maintains two * maps, one for key -> value, and another map for value -> key*/ if (conf.list_agents) { glog->agent_nkey = ht_insert_agent_key (glog->agent); ht_insert_agent_val (glog->agent_nkey, glog->agent); } for (module = 0; module < TOTAL_MODULES; module++) { const GParse *parse = panel_lookup (module); if (!parse) continue; if (ignore_panel (module)) continue; map_log (glog, parse, module); } } /* process a line from the log and store it accordingly */ static int pre_process_log (GLog * logger, char *line, int test) { GLogItem *glog; if (valid_line (line)) { count_invalid (logger, line, test); return 0; } count_process (logger, test); glog = init_log_item (logger); /* parse a line of log, and fill structure with appropriate values */ if (parse_format (glog, line)) { count_invalid (logger, line, test); goto cleanup; } /* must have the following fields */ if (glog->host == NULL || glog->date == NULL || glog->req == NULL) { count_invalid (logger, line, test); goto cleanup; } /* agent will be null in cases where %u is not specified */ if (glog->agent == NULL) glog->agent = alloc_string ("-"); /* testing log only */ if (test) { count_valid (logger, test); goto cleanup; } /* ignore host or crawlers */ if (excluded_ip (logger, glog, test) == 0) goto cleanup; if (exclude_crawler (glog) == 0) goto cleanup; if (ignore_referer (glog->site)) goto cleanup; /* check if we need to remove the request's query string */ if (conf.ignore_qstr) strip_qstring (glog->req); if (is_404 (glog)) glog->is_404 = 1; else if (is_static (glog)) glog->is_static = 1; glog->uniq_key = get_uniq_visitor_key (glog); inc_resp_size (logger, glog->resp_size); process_log (glog); count_valid (logger, test); cleanup: free_logger (glog); return 0; } static int read_log (GLog ** logger, int n) { FILE *fp = NULL; char line[LINE_BUFFER] = ""; int i = 0, test = -1 == n ? 0 : 1; /* no data piped, no log passed, load from disk only then */ if (conf.load_from_disk && !conf.ifile && isatty (STDIN_FILENO)) { (*logger)->load_from_disk_only = 1; return 0; } /* no log passed, but data piped */ if (!isatty (STDIN_FILENO) && !conf.ifile) { fp = stdin; (*logger)->piping = 1; } /* make sure we can open the log (if not reading from stdin) */ if (!(*logger)->piping && (fp = fopen (conf.ifile, "r")) == NULL) FATAL ("Unable to open the specified log file. %s", strerror (errno)); while (fgets (line, LINE_BUFFER, fp) != NULL) { if (n >= 0 && i++ == n) break; /* start processing log line */ if (pre_process_log ((*logger), line, test)) { if (!(*logger)->piping) fclose (fp); return 1; } } /* definitely not portable! */ if ((*logger)->piping) freopen ("/dev/tty", "r", stdin); /* close log file if not a pipe */ if (!(*logger)->piping) fclose (fp); return 0; } void verify_formats (void) { if (conf.time_format == NULL || *conf.time_format == '\0') FATAL ("No time format was found on your conf file."); if (conf.date_format == NULL || *conf.date_format == '\0') FATAL ("No date format was found on your conf file."); if (conf.log_format == NULL || *conf.log_format == '\0') FATAL ("No log format was found on your conf file."); } /* entry point to parse the log line by line */ int parse_log (GLog ** logger, char *tail, int n) { int test = -1 == n ? 0 : 1; verify_formats (); /* process tail data and return */ if (tail != NULL) { if (pre_process_log ((*logger), tail, test)) return 1; return 0; } return read_log (logger, n); } /* make sure we have valid hits */ int test_format (GLog * logger) { if (parse_log (&logger, NULL, NUM_TESTS)) FATAL ("Error while processing file"); /* it did not process any records, and since we're loading the dataset from * disk, then it is safe to assume is right */ if (logger->load_from_disk_only) return 0; if (logger->valid == 0) return 1; return 0; } goaccess-0.9.4/src/gdashboard.h0000644000000000000000000000752112573351524013254 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #ifndef GDASHBOARD_H_INCLUDED #define GDASHBOARD_H_INCLUDED #include #include "ui.h" /* *INDENT-OFF* */ #define DASH_HEAD_POS 0 /* header line pos */ #define DASH_EMPTY_POS 1 /* empty line pos */ #define DASH_COLS_POS 2 /* empty line pos */ #define DASH_DASHES_POS 3 /* empty line pos */ #define DASH_DATA_POS 4 /* data line pos */ #define DASH_NON_DATA 5 /* items without stats */ #define DASH_COL_ROWS 2 /* number of rows for column values + dashed lines */ #define DASH_COLLAPSED 12 /* total lines per module */ #define DASH_EXPANDED 32 /* total lines when expanded */ #define DASH_INIT_X 1 /* x-axis offset */ #define DASH_BW_LEN 11 /* max bandwidth length */ #define DASH_SRV_TM_LEN 9 /* max served time length */ #define DASH_SPACE 1 /* space between data */ #define MTRC_ID_COUNTRY 0 #define MTRC_ID_CITY 1 #define MTRC_ID_HOSTNAME 2 #define COLUMN_HITS_LEN 4 #define COLUMN_VIS_LEN 4 typedef struct GDashStyle_ { const int color_visitors; const int color_hits; const int color_data; const int color_bw; const int color_percent; const int color_bars; const int color_avgts; const int color_cumts; const int color_maxts; const int color_method; const int color_protocol; } GDashStyle; typedef struct GDashRender_ { WINDOW *win; int y; int w; int idx; int sel; } GDashRender; typedef struct GDashData_ { GMetrics *metrics; short is_subitem; } GDashData; typedef struct GDashModule_ { GDashData *data; GModule module; const char *head; const char *desc; int alloc_data; /* alloc data items */ int dash_size; /* dashboard size */ int data_len; int hits_len; int holder_size; /* hash table size */ int ht_size; /* hash table size */ int idx_data; /* idx data */ int max_hits; int method_len; int perc_len; int visitors_len; unsigned short pos_y; } GDashModule; typedef struct GDash_ { int total_alloc; GDashModule module[TOTAL_MODULES]; } GDash; /* Function Prototypes */ GDashData * new_gdata (uint32_t size); GDash *new_gdash (void); GHolder *new_gholder (uint32_t size); int get_num_collapsed_data_rows(void); int get_num_expanded_data_rows(void); int perform_next_find (GHolder * h, GScroll * scroll); int render_find_dialog (WINDOW * main_win, GScroll * scroll); int set_module_from_mouse_event (GScroll *scroll, GDash *dash, int y); uint32_t get_ht_size_by_module (GModule module); void *add_hostname_node (void *ptr_holder); void display_content (WINDOW * win, GLog * logger, GDash * dash, GScroll * scroll); void free_dashboard (GDash * dash); void free_holder_by_module (GHolder ** holder, GModule module); void free_holder (GHolder ** holder); void load_data_to_dash (GHolder * h, GDash * dash, GModule module, GScroll * scroll); void load_holder_data (GRawData * raw_data, GHolder * h, GModule module, GSort sort); void load_host_to_holder (GHolder * h, char *ip); void reset_find (void); void reset_scroll_offsets (GScroll * scroll); /* *INDENT-ON* */ #endif goaccess-0.9.4/src/commons.c0000664000000000000000000001106612573351524012625 00000000000000/** * commons.c -- holds different data types * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #include #include #include #include #include "commons.h" #include "error.h" #include "util.h" #include "xmalloc.h" /* processing time */ time_t end_proc; time_t timestamp; time_t start_proc; /* resizing/scheme */ size_t real_size_y = 0; size_t term_h = 0; size_t term_w = 0; static GEnum MODULES[] = { {"VISITORS", VISITORS}, {"REQUESTS", REQUESTS}, {"REQUESTS_STATIC", REQUESTS_STATIC}, {"NOT_FOUND", NOT_FOUND}, {"HOSTS", HOSTS}, {"OS", OS}, {"BROWSERS", BROWSERS}, {"VISIT_TIMES", VISIT_TIMES}, {"REFERRERS", REFERRERS}, {"REFERRING_SITES", REFERRING_SITES}, {"KEYPHRASES", KEYPHRASES}, #ifdef HAVE_LIBGEOIP {"GEO_LOCATION", GEO_LOCATION}, #endif {"STATUS_CODES", STATUS_CODES}, }; /* calculate hits percentage */ float get_percentage (unsigned long long total, unsigned long long hit) { return ((float) (hit * 100) / (total)); } void display_storage (void) { #ifdef TCB_BTREE fprintf (stdout, "Built using Tokyo Cabinet On-Disk B+ Tree.\n"); #elif TCB_MEMHASH fprintf (stdout, "Built using Tokyo Cabinet On-Memory Hash database.\n"); #else fprintf (stdout, "Built using GLib On-Memory Hash database.\n"); #endif } void display_version (void) { fprintf (stdout, "GoAccess - %s.\n", GO_VERSION); fprintf (stdout, "For more details visit: http://goaccess.io\n"); fprintf (stdout, "Copyright (C) 2009-2015 GNU GPL'd, by Gerardo Orellana\n"); } int get_module_enum (const char *str) { return str2enum (MODULES, ARRAY_SIZE (MODULES), str); } int str2enum (const GEnum map[], int len, const char *str) { int i; for (i = 0; i < len; ++i) { if (!strcmp (str, map[i].str)) return map[i].idx; } return -1; } GSLList * list_create (void *data) { GSLList *node = xmalloc (sizeof (GSLList)); node->data = data; node->next = NULL; return node; } GSLList * list_insert_append (GSLList * node, void *data) { GSLList *newnode; newnode = list_create (data); newnode->next = node->next; node->next = newnode; return newnode; } GSLList * list_insert_prepend (GSLList * list, void *data) { GSLList *newnode; newnode = list_create (data); newnode->next = list; return newnode; } GSLList * list_find (GSLList * node, int (*func) (void *, void *), void *data) { while (node) { if (func (node->data, data) > 0) return node; node = node->next; } return NULL; } int list_remove_nodes (GSLList * list) { GSLList *tmp; while (list != NULL) { tmp = list->next; if (list->data) free (list->data); free (list); list = tmp; } return 0; } int list_foreach (GSLList * node, int (*func) (void *, void *), void *user_data) { while (node) { if (func (node->data, user_data) != 0) return -1; node = node->next; } return 0; } int list_count (GSLList * node) { int count = 0; while (node != 0) { count++; node = node->next; } return count; } GAgents * new_gagents (void) { GAgents *agents = xmalloc (sizeof (GAgents)); memset (agents, 0, sizeof *agents); return agents; } GAgentItem * new_gagent_item (uint32_t size) { GAgentItem *item = xcalloc (size, sizeof (GAgentItem)); return item; } void format_date_visitors (GMetrics * metrics) { char date[DATE_LEN] = ""; /* Ymd */ char *datum = metrics->data; memset (date, 0, sizeof *date); /* verify we have a valid date conversion */ if (convert_date (date, datum, "%Y%m%d", "%d/%b/%Y", DATE_LEN) == 0) { free (datum); metrics->data = xstrdup (date); return; } LOG_DEBUG (("invalid date: %s", datum)); free (datum); metrics->data = xstrdup ("---"); } int has_timestamp (const char *fmt) { if (strcmp ("%s", fmt) == 0) return 1; return 0; } goaccess-0.9.4/src/error.h0000644000000000000000000000466012573357401012310 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef ERROR_H_INCLUDED #define ERROR_H_INCLUDED #ifndef COMMONS #include "commons.h" #endif #ifdef HAVE_NCURSESW_NCURSES_H #include #elif HAVE_NCURSES_NCURSES_H #include #elif HAVE_NCURSES_H #include #elif HAVE_CURSES_H #include #endif #include #define TRACE_SIZE 128 #define FATAL(fmt, ...) do { \ (void) endwin (); \ fprintf (stderr, "\nGoAccess - version %s - %s %s\n", GO_VERSION, __DATE__, \ __TIME__); \ fprintf (stderr, "Config file: %s\n", conf.iconfigfile ?: NO_CONFIG_FILE); \ fprintf (stderr, "\nFatal error has occurred"); \ fprintf (stderr, "\nError occured at: %s - %s - %d\n", __FILE__, \ __FUNCTION__, __LINE__); \ fprintf (stderr, fmt, ##__VA_ARGS__); \ fprintf (stderr, "\n\n"); \ LOG_DEBUG ((fmt, ##__VA_ARGS__)); \ exit(EXIT_FAILURE); \ } while (0) void dbg_fprintf (const char *fmt, ...); void dbg_log_close (void); void dbg_log_open (const char *file); void invalid_fprintf (const char *fmt, ...); void invalid_log_close (void); void invalid_log_open (const char *path); void set_signal_data (void *p); #if defined(__GLIBC__) void sigsegv_handler (int sig); #endif #endif goaccess-0.9.4/src/sort.c0000664000000000000000000003006712573351524012143 00000000000000/** * sort.c -- functions related to sort functionality * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "settings.h" #include "util.h" #include "sort.h" /* *INDENT-OFF* */ const int sort_choices[][SORT_MAX_OPTS] = { {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, SORT_BY_PROT, SORT_BY_MTHD, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, SORT_BY_PROT, SORT_BY_MTHD, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, SORT_BY_PROT, SORT_BY_MTHD, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, #ifdef HAVE_LIBGEOIP {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, #endif {SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, -1}, }; static GEnum FIELD[] = { {"BY_HITS" , SORT_BY_HITS } , {"BY_VISITORS" , SORT_BY_VISITORS } , {"BY_DATA" , SORT_BY_DATA } , {"BY_BW" , SORT_BY_BW } , {"BY_AVGTS" , SORT_BY_AVGTS } , {"BY_CUMTS" , SORT_BY_CUMTS } , {"BY_MAXTS" , SORT_BY_MAXTS } , {"BY_PROT" , SORT_BY_PROT } , {"BY_MTHD" , SORT_BY_MTHD } , }; static GEnum ORDER[] = { {"ASC" , SORT_ASC } , {"DESC" , SORT_DESC } , }; GSort module_sort[TOTAL_MODULES] = { {VISITORS , SORT_BY_DATA , SORT_DESC } , {REQUESTS , SORT_BY_HITS , SORT_DESC } , {REQUESTS_STATIC , SORT_BY_HITS , SORT_DESC } , {NOT_FOUND , SORT_BY_HITS , SORT_DESC } , {HOSTS , SORT_BY_HITS , SORT_DESC } , {OS , SORT_BY_HITS , SORT_DESC } , {BROWSERS , SORT_BY_HITS , SORT_DESC } , {VISIT_TIMES , SORT_BY_DATA , SORT_ASC } , {REFERRERS , SORT_BY_HITS , SORT_DESC } , {REFERRING_SITES , SORT_BY_HITS , SORT_DESC } , {KEYPHRASES , SORT_BY_HITS , SORT_DESC } , #ifdef HAVE_LIBGEOIP {GEO_LOCATION , SORT_BY_HITS , SORT_DESC } , #endif {STATUS_CODES , SORT_BY_HITS , SORT_DESC } , }; /* *INDENT-ON* */ /* sort data ascending */ static int cmp_data_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; return strcmp (ia->metrics->data, ib->metrics->data); } /* sort data descending */ static int cmp_data_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; return strcmp (ib->metrics->data, ia->metrics->data); } /* sort numeric descending */ static int cmp_num_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; int va = ia->metrics->hits; int vb = ib->metrics->hits; return (va < vb) - (va > vb); } /* sort numeric ascending */ static int cmp_num_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; int va = ia->metrics->hits; int vb = ib->metrics->hits; return (va > vb) - (va < vb); } /* sort numeric descending */ static int cmp_vis_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; int va = ia->metrics->visitors; int vb = ib->metrics->visitors; return (va < vb) - (va > vb); } /* sort numeric ascending */ static int cmp_vis_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; int va = ia->metrics->visitors; int vb = ib->metrics->visitors; return (va > vb) - (va < vb); } /* sort raw numeric descending */ static int cmp_raw_num_desc (const void *a, const void *b) { const GRawDataItem *ia = a; const GRawDataItem *ib = b; GDataMap *amap = ia->value; GDataMap *bmap = ib->value; int va = amap->data; int vb = bmap->data; return (va < vb) - (va > vb); } /* sort bandwidth descending */ static int cmp_bw_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; uint64_t va = ia->metrics->bw.nbw; uint64_t vb = ib->metrics->bw.nbw; return (va < vb) - (va > vb); } /* sort bandwidth ascending */ static int cmp_bw_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; uint64_t va = ia->metrics->bw.nbw; uint64_t vb = ib->metrics->bw.nbw; return (va > vb) - (va < vb); } /* sort usec descending */ static int cmp_avgts_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; uint64_t va = ia->metrics->avgts.nts; uint64_t vb = ib->metrics->avgts.nts; return (va < vb) - (va > vb); } /* sort usec ascending */ static int cmp_avgts_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; uint64_t va = ia->metrics->avgts.nts; uint64_t vb = ib->metrics->avgts.nts; return (va > vb) - (va < vb); } /* sort usec descending */ static int cmp_cumts_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; uint64_t va = ia->metrics->cumts.nts; uint64_t vb = ib->metrics->cumts.nts; return (va < vb) - (va > vb); } /* sort usec ascending */ static int cmp_cumts_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; uint64_t va = ia->metrics->cumts.nts; uint64_t vb = ib->metrics->cumts.nts; return (va > vb) - (va < vb); } /* sort usec descending */ static int cmp_maxts_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; uint64_t va = ia->metrics->maxts.nts; uint64_t vb = ib->metrics->maxts.nts; return (va < vb) - (va > vb); } /* sort usec ascending */ static int cmp_maxts_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; uint64_t va = ia->metrics->maxts.nts; uint64_t vb = ib->metrics->maxts.nts; return (va > vb) - (va < vb); } /* sort protocol ascending */ static int cmp_proto_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; return strcmp (ia->metrics->protocol, ib->metrics->protocol); } /* sort protocol descending */ static int cmp_proto_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; return strcmp (ib->metrics->protocol, ia->metrics->protocol); } /* sort method ascending */ static int cmp_mthd_asc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; return strcmp (ia->metrics->method, ib->metrics->method); } /* sort method descending */ static int cmp_mthd_desc (const void *a, const void *b) { const GHolderItem *ia = a; const GHolderItem *ib = b; return strcmp (ib->metrics->method, ia->metrics->method); } int get_sort_field_enum (const char *str) { return str2enum (FIELD, ARRAY_SIZE (FIELD), str); } int get_sort_order_enum (const char *str) { return str2enum (ORDER, ARRAY_SIZE (ORDER), str); } void set_initial_sort (const char *smod, const char *sfield, const char *ssort) { int module, field, order; if ((module = get_module_enum (smod)) == -1) return; if ((field = get_sort_field_enum (sfield)) == -1) return; if ((order = get_sort_order_enum (ssort)) == -1) return; if (!can_sort_module (module, field)) return; module_sort[module].field = field; module_sort[module].sort = order; } int can_sort_module (GModule module, int field) { int i, can_sort = 0; for (i = 0; -1 != sort_choices[module][i]; i++) { if (sort_choices[module][i] != field) continue; if (SORT_BY_AVGTS == field && !conf.serve_usecs) continue; if (SORT_BY_CUMTS == field && !conf.serve_usecs) continue; if (SORT_BY_MAXTS == field && !conf.serve_usecs) continue; else if (SORT_BY_BW == field && !conf.bandwidth) continue; else if (SORT_BY_PROT == field && !conf.append_protocol) continue; else if (SORT_BY_MTHD == field && !conf.append_method) continue; can_sort = 1; break; } return can_sort; } void parse_initial_sort (void) { int i; char *view; char module[SORT_MODULE_LEN], field[SORT_FIELD_LEN], order[SORT_ORDER_LEN]; for (i = 0; i < conf.sort_panel_idx; ++i) { view = conf.sort_panels[i]; if (sscanf (view, "%15[^','],%11[^','],%4s", module, field, order) != 3) continue; set_initial_sort (module, field, order); } } /* apply user defined sort */ void sort_holder_items (GHolderItem * items, int size, GSort sort) { switch (sort.field) { case SORT_BY_HITS: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_num_desc); else qsort (items, size, sizeof (GHolderItem), cmp_num_asc); break; case SORT_BY_VISITORS: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_vis_desc); else qsort (items, size, sizeof (GHolderItem), cmp_vis_asc); break; case SORT_BY_DATA: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_data_desc); else qsort (items, size, sizeof (GHolderItem), cmp_data_asc); break; case SORT_BY_BW: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_bw_desc); else qsort (items, size, sizeof (GHolderItem), cmp_bw_asc); break; case SORT_BY_AVGTS: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_avgts_desc); else qsort (items, size, sizeof (GHolderItem), cmp_avgts_asc); break; case SORT_BY_CUMTS: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_cumts_desc); else qsort (items, size, sizeof (GHolderItem), cmp_cumts_asc); break; case SORT_BY_MAXTS: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_maxts_desc); else qsort (items, size, sizeof (GHolderItem), cmp_maxts_asc); break; case SORT_BY_PROT: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_proto_desc); else qsort (items, size, sizeof (GHolderItem), cmp_proto_asc); break; case SORT_BY_MTHD: if (sort.sort == SORT_DESC) qsort (items, size, sizeof (GHolderItem), cmp_mthd_desc); else qsort (items, size, sizeof (GHolderItem), cmp_mthd_asc); break; } } /* sort raw data for the first run (default sort) */ GRawData * sort_raw_data (GRawData * raw, int ht_size) { qsort (raw->items, ht_size, sizeof (GRawDataItem), cmp_raw_num_desc); return raw; } goaccess-0.9.4/src/error.c0000644000000000000000000000676212573357401012310 00000000000000/** * error.c -- error handling * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #include #include #include #if defined(__GLIBC__) #include #endif #include #include #include "error.h" #include "parser.h" static FILE *log_file; static GLog *log_data; static FILE *log_invalid; void dbg_log_open (const char *path) { if (path != NULL) { log_file = fopen (path, "w"); if (log_file == NULL) return; } } void dbg_log_close (void) { if (log_file != NULL) fclose (log_file); } void invalid_log_open (const char *path) { if (path != NULL) { log_invalid = fopen (path, "w"); if (log_invalid == NULL) return; } } void invalid_log_close (void) { if (log_invalid != NULL) fclose (log_invalid); } void set_signal_data (void *p) { log_data = p; } #if defined(__GLIBC__) static void dump_struct (FILE * fp) { int pid = getpid (); if (!log_data) return; fprintf (fp, "==%d== VALUES AT CRASH POINT\n", pid); fprintf (fp, "==%d==\n", pid); fprintf (fp, "==%d== Line number: %u\n", pid, log_data->processed); fprintf (fp, "==%d== Offset: %u\n", pid, log_data->offset); fprintf (fp, "==%d== Invalid data: %u\n", pid, log_data->invalid); fprintf (fp, "==%d== Piping: %d\n", pid, log_data->piping); fprintf (fp, "==%d== Response size: %llu bytes\n", pid, log_data->resp_size); fprintf (fp, "==%d==\n", pid); } void sigsegv_handler (int sig) { char **messages; FILE *fp = stderr; int pid = getpid (); size_t size, i; void *trace_stack[TRACE_SIZE]; (void) endwin (); fprintf (fp, "\n==%d== GoAccess %s crashed by Signal %d\n", pid, GO_VERSION, sig); fprintf (fp, "==%d==\n", pid); dump_struct (fp); size = backtrace (trace_stack, TRACE_SIZE); messages = backtrace_symbols (trace_stack, size); fprintf (fp, "==%d== STACK TRACE:\n", pid); fprintf (fp, "==%d==\n", pid); for (i = 0; i < size; i++) fprintf (fp, "==%d== %zu %s\n", pid, i, messages[i]); fprintf (fp, "==%d==\n", pid); fprintf (fp, "==%d== Please report it by opening an issue on GitHub:\n", pid); fprintf (fp, "==%d== https://github.com/allinurl/goaccess/issues\n\n", pid); exit (EXIT_FAILURE); } #endif #pragma GCC diagnostic ignored "-Wformat-nonliteral" void dbg_fprintf (const char *fmt, ...) { va_list args; if (!log_file) return; va_start (args, fmt); vfprintf (log_file, fmt, args); fflush (log_file); va_end (args); } void invalid_fprintf (const char *fmt, ...) { va_list args; if (!log_invalid) return; va_start (args, fmt); vfprintf (log_invalid, fmt, args); fflush (log_invalid); va_end (args); } #pragma GCC diagnostic warning "-Wformat-nonliteral" goaccess-0.9.4/src/config.h.in0000644000000000000000000001272112573361520013023 00000000000000/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* "Build using BZ2" */ #undef HAVE_BZ2 /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H /* Define to 1 if you have the `floor' function. */ #undef HAVE_FLOOR /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO /* Define to 1 if you have the `gethostbyaddr' function. */ #undef HAVE_GETHOSTBYADDR /* Define to 1 if you have the `gethostbyname' function. */ #undef HAVE_GETHOSTBYNAME /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `GeoIP' library (-lGeoIP). */ #undef HAVE_LIBGEOIP /* Define to 1 if you have the `glib-2.0' library (-lglib-2.0). */ #undef HAVE_LIBGLIB_2_0 /* Define to 1 if you have the `ncurses' library (-lncurses). */ #undef HAVE_LIBNCURSES /* Define to 1 if you have the `ncursesw' library (-lncursesw). */ #undef HAVE_LIBNCURSESW /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the `tokyocabinet' library (-ltokyocabinet). */ #undef HAVE_LIBTOKYOCABINET /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if you have the `malloc' function. */ #undef HAVE_MALLOC /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the header file. */ #undef HAVE_NCURSESW_NCURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_NCURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if the system has the type `ptrdiff_t'. */ #undef HAVE_PTRDIFF_T /* Define to 1 if you have the `realloc' function. */ #undef HAVE_REALLOC /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoull' function. */ #undef HAVE_STRTOULL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* "Build using ZLIB" */ #undef HAVE_ZLIB /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* "Build using on-disk B+ Tree database" */ #undef TCB_BTREE /* "Build using on-memory hash database" */ #undef TCB_MEMHASH /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Debug option */ #undef _DEBUG /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #undef _LARGEFILE_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `long int' if does not define. */ #undef off_t /* Define to `unsigned int' if does not define. */ #undef size_t goaccess-0.9.4/src/geolocation.c0000664000000000000000000002010512573351525013450 00000000000000/** * geolocation.c -- GeoLocation related functions * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBGEOIP #include #include #endif #include "geolocation.h" #include "error.h" #include "util.h" GeoIP *geo_location_data; /* Get continent name concatenated with code */ static const char * get_continent_name_and_code (const char *continentid) { if (memcmp (continentid, "NA", 2) == 0) return "NA North America"; else if (memcmp (continentid, "OC", 2) == 0) return "OC Oceania"; else if (memcmp (continentid, "EU", 2) == 0) return "EU Europe"; else if (memcmp (continentid, "SA", 2) == 0) return "SA South America"; else if (memcmp (continentid, "AF", 2) == 0) return "AF Africa"; else if (memcmp (continentid, "AN", 2) == 0) return "AN Antarctica"; else if (memcmp (continentid, "AS", 2) == 0) return "AS Asia"; else return "-- Location Unknown"; } /* Geolocation data */ GeoIP * geoip_open_db (const char *db) { GeoIP *geoip; geoip = GeoIP_open (db, GEOIP_MEMORY_CACHE); if (geoip == NULL) FATAL ("Unable to open GeoIP database: %s\n", db); GeoIP_set_charset (geoip, GEOIP_CHARSET_UTF8); LOG_DEBUG (("Opened GeoIP City database: %s\n", db)); return geoip; } static void geoip_set_country (const char *country, const char *code, char *loc) { if (country && code) sprintf (loc, "%s %s", code, country); else sprintf (loc, "%s", "Country Unknown"); } static void geoip_set_city (const char *city, const char *region, char *loc) { sprintf (loc, "%s, %s", city ? city : "N/A City", region ? region : "N/A Region"); } static void geoip_set_continent (const char *continent, char *loc) { if (continent) sprintf (loc, "%s", get_continent_name_and_code (continent)); else sprintf (loc, "%s", "Continent Unknown"); } static GeoIPRecord * get_geoip_record (const char *addr, GTypeIP type_ip) { GeoIPRecord *rec = NULL; if (TYPE_IPV4 == type_ip) rec = GeoIP_record_by_name (geo_location_data, addr); else if (TYPE_IPV6 == type_ip) rec = GeoIP_record_by_name_v6 (geo_location_data, addr); return rec; } static void geoip_set_country_by_record (const char *ip, char *location, GTypeIP type_ip) { GeoIPRecord *rec = NULL; const char *country = NULL, *code = NULL, *addr = ip; if (conf.geoip_database == NULL || geo_location_data == NULL) return; /* Custom GeoIP database */ if ((rec = get_geoip_record (addr, type_ip))) { country = rec->country_name; code = rec->country_code; } geoip_set_country (country, code, location); if (rec != NULL) { GeoIPRecord_delete (rec); } } static int geoip_get_geoid (const char *addr, GTypeIP type_ip) { int geoid = 0; if (TYPE_IPV4 == type_ip) geoid = GeoIP_id_by_name (geo_location_data, addr); else if (TYPE_IPV6 == type_ip) geoid = GeoIP_id_by_name_v6 (geo_location_data, addr); return geoid; } static const char * geoip_get_country_by_geoid (const char *addr, GTypeIP type_ip) { const char *country = NULL; if (TYPE_IPV4 == type_ip) country = GeoIP_country_name_by_name (geo_location_data, addr); else if (TYPE_IPV6 == type_ip) country = GeoIP_country_name_by_name_v6 (geo_location_data, addr); return country; } static void geoip_set_country_by_geoid (const char *ip, char *location, GTypeIP type_ip) { const char *country = NULL, *code = NULL, *addr = ip; int geoid = 0; if (geo_location_data == NULL) return; geoid = geoip_get_geoid (addr, type_ip); country = geoip_get_country_by_geoid (addr, type_ip); code = GeoIP_code_by_id (geoid); geoip_set_country (country, code, location); } void geoip_get_country (const char *ip, char *location, GTypeIP type_ip) { unsigned char rec = GeoIP_database_edition (geo_location_data); switch (rec) { case GEOIP_COUNTRY_EDITION: if (TYPE_IPV4 == type_ip) geoip_set_country_by_geoid (ip, location, TYPE_IPV4); break; case GEOIP_COUNTRY_EDITION_V6: if (TYPE_IPV6 == type_ip) geoip_set_country_by_geoid (ip, location, TYPE_IPV6); break; case GEOIP_CITY_EDITION_REV0: case GEOIP_CITY_EDITION_REV1: if (TYPE_IPV4 == type_ip) geoip_set_country_by_record (ip, location, TYPE_IPV4); break; case GEOIP_CITY_EDITION_REV0_V6: case GEOIP_CITY_EDITION_REV1_V6: if (TYPE_IPV6 == type_ip) geoip_set_country_by_record (ip, location, TYPE_IPV6); break; } } static void geoip_set_continent_by_record (const char *ip, char *location, GTypeIP type_ip) { GeoIPRecord *rec = NULL; const char *continent = NULL, *addr = ip; if (conf.geoip_database == NULL || geo_location_data == NULL) return; /* Custom GeoIP database */ if ((rec = get_geoip_record (addr, type_ip))) continent = rec->continent_code; geoip_set_continent (continent, location); if (rec != NULL) { GeoIPRecord_delete (rec); } } static void geoip_set_continent_by_geoid (const char *ip, char *location, GTypeIP type_ip) { const char *continent = NULL, *addr = ip; int geoid = 0; if (geo_location_data == NULL) return; geoid = geoip_get_geoid (addr, type_ip); continent = GeoIP_continent_by_id (geoid); geoip_set_continent (continent, location); } void geoip_get_continent (const char *ip, char *location, GTypeIP type_ip) { unsigned char rec = GeoIP_database_edition (geo_location_data); switch (rec) { case GEOIP_COUNTRY_EDITION: if (TYPE_IPV4 == type_ip) geoip_set_continent_by_geoid (ip, location, TYPE_IPV4); break; case GEOIP_COUNTRY_EDITION_V6: if (TYPE_IPV6 == type_ip) geoip_set_continent_by_geoid (ip, location, TYPE_IPV6); break; case GEOIP_CITY_EDITION_REV0: case GEOIP_CITY_EDITION_REV1: if (TYPE_IPV4 == type_ip) geoip_set_continent_by_record (ip, location, TYPE_IPV4); break; case GEOIP_CITY_EDITION_REV0_V6: case GEOIP_CITY_EDITION_REV1_V6: if (TYPE_IPV6 == type_ip) geoip_set_continent_by_record (ip, location, TYPE_IPV6); break; } } static void geoip_set_city_by_record (const char *ip, char *location, GTypeIP type_ip) { GeoIPRecord *rec = NULL; const char *city = NULL, *region = NULL, *addr = ip; /* Custom GeoIP database */ if ((rec = get_geoip_record (addr, type_ip))) { city = rec->city; region = rec->region; } geoip_set_city (city, region, location); if (rec != NULL) { GeoIPRecord_delete (rec); } } /* Custom GeoIP database - i.e., GeoLiteCity.dat */ void geoip_get_city (const char *ip, char *location, GTypeIP type_ip) { unsigned char rec = GeoIP_database_edition (geo_location_data); if (conf.geoip_database == NULL || geo_location_data == NULL) return; switch (rec) { case GEOIP_CITY_EDITION_REV0: case GEOIP_CITY_EDITION_REV1: if (TYPE_IPV4 == type_ip) geoip_set_city_by_record (ip, location, TYPE_IPV4); break; case GEOIP_CITY_EDITION_REV0_V6: case GEOIP_CITY_EDITION_REV1_V6: if (TYPE_IPV6 == type_ip) geoip_set_city_by_record (ip, location, TYPE_IPV6); break; } } int set_geolocation (char *host, char *continent, char *country, char *city) { int type_ip = 0; if (geo_location_data == NULL) return 1; if (invalid_ipaddr (host, &type_ip)) return 1; geoip_get_country (host, country, type_ip); geoip_get_continent (host, continent, type_ip); if (conf.geoip_database) geoip_get_city (host, city, type_ip); return 0; } goaccess-0.9.4/src/glibht.h0000664000000000000000000000576312573351525012440 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef GLIBHT_H_INCLUDED #define GLIBHT_H_INCLUDED #ifdef HAVE_LIBGLIB_2_0 #include #endif #include #include "parser.h" #include "gstorage.h" /* tables for the whole app */ extern GHashTable *ht_agent_keys; extern GHashTable *ht_agent_vals; extern GHashTable *ht_hostnames; extern GHashTable *ht_unique_keys; /* *INDENT-OFF* */ GRawData *parse_raw_data (GHashTable * ht, int ht_size, GModule module); uint32_t get_ht_size_by_metric (GModule module, GMetric metric); uint32_t get_ht_size (GHashTable * ht); int ht_inc_int_from_int_key (GHashTable * ht, int data_nkey, int inc); int ht_inc_int_from_str_key (GHashTable * ht, char *key, int inc); int ht_inc_u64_from_int_key (GHashTable * ht, int data_nkey, uint64_t inc); int ht_insert_agent(const char *key); int ht_insert_agent_key (const char *key); int ht_insert_agent_val (int nkey, const char *key); int ht_insert_hit (GHashTable * ht, int data_nkey, int uniq_nkey, int root_nkey); int ht_insert_host_agent (GHashTable * ht, int data_nkey, int agent_nkey); int ht_insert_keymap(GHashTable *ht, const char *value); int ht_insert_nkey_nval (GHashTable * ht, int nkey, int nval); int ht_insert_str_from_int_key (GHashTable * ht, int nkey, const char *value); int ht_insert_uniqmap (GHashTable * ht, char *uniq_key); int ht_insert_unique_key (const char *key); int ht_max_u64_from_int_key (GHashTable * ht, int data_nkey, uint64_t newval); char *get_host_agent_val (int agent_nkey); char *get_hostname (const char *host); char *get_node_from_key (int data_nkey, GModule module, GMetric metric); char *get_root_from_key (int root_nkey, GModule module); char * get_str_from_int_key (GHashTable *ht, int nkey); int get_int_from_keymap (const char *key, GModule module); int get_int_from_str_key (GHashTable * ht, const char *key); int get_num_from_key (int data_nkey, GModule module, GMetric metric); int process_host_agents (char *host, char *agent); uint64_t get_cumulative_from_key (int data_nkey, GModule module, GMetric metric); unsigned int get_uint_from_str_key (GHashTable *ht, const char *key); void free_storage (void); void *get_host_agent_list (int data_nkey); void init_storage (void); void free_agent_list (void); /* *INDENT-ON* */ #endif goaccess-0.9.4/src/gdns.c0000664000000000000000000001305612573351525012107 00000000000000/** * gdns.c -- hosts resolver * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define _MULTI_THREADED #ifdef __FreeBSD__ #include #endif #if HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "gdns.h" #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #else #include "glibht.h" #endif #include "error.h" #include "goaccess.h" #include "util.h" #include "xmalloc.h" GDnsThread gdns_thread; static GDnsQueue *gdns_queue; /* initialize queue */ void gqueue_init (GDnsQueue * q, int capacity) { q->head = 0; q->tail = -1; q->size = 0; q->capacity = capacity; } /* get current size of queue */ int gqueue_size (GDnsQueue * q) { return q->size; } /* is the queue empty */ int gqueue_empty (GDnsQueue * q) { return q->size == 0; } /* is the queue full */ int gqueue_full (GDnsQueue * q) { return q->size == q->capacity; } /* destroy queue */ void gqueue_destroy (GDnsQueue * q) { free (q); } /* add item to the queue */ int gqueue_enqueue (GDnsQueue * q, char *item) { if (gqueue_full (q)) return -1; q->tail = (q->tail + 1) % q->capacity; strcpy (q->buffer[q->tail], item); q->size++; return 0; } int gqueue_find (GDnsQueue * q, const char *item) { int i; if (gqueue_empty (q)) return 0; for (i = 0; i < q->size; i++) { if (strcmp (item, q->buffer[i]) == 0) return 1; } return 0; } /* remove an item from the queue */ char * gqueue_dequeue (GDnsQueue * q) { char *item; if (gqueue_empty (q)) return NULL; item = q->buffer[q->head]; q->head = (q->head + 1) % q->capacity; q->size--; return item; } /* get the corresponding host given an address */ static char * reverse_host (const struct sockaddr *a, socklen_t length) { char h[H_SIZE]; int flags, st; flags = NI_NAMEREQD; st = getnameinfo (a, length, h, H_SIZE, NULL, 0, flags); if (!st) return alloc_string (h); return alloc_string (gai_strerror (st)); } /* determine if IPv4 or IPv6 and resolve */ char * reverse_ip (char *str) { union { struct sockaddr addr; struct sockaddr_in6 addr6; struct sockaddr_in addr4; } a; if (str == NULL || *str == '\0') return NULL; memset (&a, 0, sizeof (a)); if (1 == inet_pton (AF_INET, str, &a.addr4.sin_addr)) { a.addr4.sin_family = AF_INET; return reverse_host (&a.addr, sizeof (a.addr4)); } else if (1 == inet_pton (AF_INET6, str, &a.addr6.sin6_addr)) { a.addr6.sin6_family = AF_INET6; return reverse_host (&a.addr, sizeof (a.addr6)); } return NULL; } /* producer */ void dns_resolver (char *addr) { pthread_mutex_lock (&gdns_thread.mutex); if (!gqueue_full (gdns_queue) && !gqueue_find (gdns_queue, addr)) { #ifndef HAVE_LIBTOKYOCABINET g_hash_table_replace (ht_hostnames, g_strdup (addr), NULL); #endif gqueue_enqueue (gdns_queue, addr); pthread_cond_broadcast (&gdns_thread.not_empty); } pthread_mutex_unlock (&gdns_thread.mutex); } /* consumer */ static void dns_worker (void GO_UNUSED (*ptr_data)) { char *ip = NULL, *host = NULL; while (1) { pthread_mutex_lock (&gdns_thread.mutex); /* wait until an item has been added to the queue */ while (gqueue_empty (gdns_queue)) pthread_cond_wait (&gdns_thread.not_empty, &gdns_thread.mutex); ip = gqueue_dequeue (gdns_queue); pthread_mutex_unlock (&gdns_thread.mutex); host = reverse_ip (ip); pthread_mutex_lock (&gdns_thread.mutex); if (!active_gdns) { if (host) free (host); break; } #ifdef HAVE_LIBTOKYOCABINET tcadbput2 (ht_hostnames, ip, host); free (host); #else if (host != NULL && active_gdns) g_hash_table_replace (ht_hostnames, g_strdup (ip), host); #endif pthread_cond_signal (&gdns_thread.not_full); pthread_mutex_unlock (&gdns_thread.mutex); } } /* init queue and dns thread */ void gdns_init (void) { gdns_queue = xmalloc (sizeof (GDnsQueue)); gqueue_init (gdns_queue, QUEUE_SIZE); if (pthread_cond_init (&(gdns_thread.not_empty), NULL)) FATAL ("Failed init thread condition"); if (pthread_cond_init (&(gdns_thread.not_full), NULL)) FATAL ("Failed init thread condition"); if (pthread_mutex_init (&(gdns_thread.mutex), NULL)) FATAL ("Failed init thread mutex"); } /* destroy queue */ void gdns_free_queue (void) { gqueue_destroy (gdns_queue); } /* create a dns thread */ void gdns_thread_create (void) { int thread; active_gdns = 1; thread = pthread_create (&(gdns_thread.thread), NULL, (void *) &dns_worker, NULL); if (thread) FATAL ("Return code from pthread_create(): %d", thread); pthread_detach (gdns_thread.thread); } goaccess-0.9.4/src/glibht.c0000664000000000000000000003244012573351525012423 00000000000000/** * glibc.c -- GLib functions * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #ifdef HAVE_LIBGLIB_2_0 #include #endif #include #include #include #include #include "glibht.h" #include "sort.h" #include "xmalloc.h" GStorage *ht_storage; /* tables for the whole app */ GHashTable *ht_agent_keys = NULL; GHashTable *ht_agent_vals = NULL; GHashTable *ht_hostnames = NULL; GHashTable *ht_unique_keys = NULL; static GHashTable * new_str_ht (GDestroyNotify d1, GDestroyNotify d2) { return g_hash_table_new_full (g_str_hash, g_str_equal, d1, d2); } static GHashTable * new_int_ht (GDestroyNotify d1, GDestroyNotify d2) { return g_hash_table_new_full (g_int_hash, g_int_equal, d1, d2); } static void free_hits (GO_UNUSED gpointer old_key, gpointer old_value, GO_UNUSED gpointer user_data) { GDataMap *map = old_value; free (map); } static void init_tables (GModule module) { ht_storage[module].module = module; ht_storage[module].metrics = new_ht_metrics (); /* Initialize metrics hash tables */ ht_storage[module].metrics->keymap = new_str_ht (g_free, g_free); ht_storage[module].metrics->datamap = new_int_ht (g_free, g_free); ht_storage[module].metrics->rootmap = new_int_ht (g_free, g_free); ht_storage[module].metrics->uniqmap = new_str_ht (g_free, g_free); ht_storage[module].metrics->hits = new_int_ht (g_free, NULL); ht_storage[module].metrics->visitors = new_int_ht (g_free, g_free); ht_storage[module].metrics->bw = new_int_ht (g_free, g_free); ht_storage[module].metrics->cumts = new_int_ht (g_free, g_free); ht_storage[module].metrics->maxts = new_int_ht (g_free, g_free); ht_storage[module].metrics->methods = new_int_ht (g_free, g_free); ht_storage[module].metrics->protocols = new_int_ht (g_free, g_free); ht_storage[module].metrics->agents = new_int_ht (g_free, NULL); } /* Initialize GLib hash tables */ void init_storage (void) { GModule module; ht_agent_keys = new_str_ht (g_free, g_free); ht_agent_vals = new_str_ht (g_free, g_free); ht_hostnames = new_str_ht (g_free, g_free); ht_unique_keys = new_str_ht (g_free, g_free); ht_storage = new_gstorage (TOTAL_MODULES); for (module = 0; module < TOTAL_MODULES; ++module) { init_tables (module); } } static void free_tables (GStorageMetrics * metrics) { g_hash_table_foreach (metrics->hits, free_hits, NULL); /* Initialize metrics hash tables */ g_hash_table_destroy (metrics->keymap); g_hash_table_destroy (metrics->datamap); g_hash_table_destroy (metrics->rootmap); g_hash_table_destroy (metrics->uniqmap); g_hash_table_destroy (metrics->hits); g_hash_table_destroy (metrics->visitors); g_hash_table_destroy (metrics->bw); g_hash_table_destroy (metrics->cumts); g_hash_table_destroy (metrics->maxts); g_hash_table_destroy (metrics->methods); g_hash_table_destroy (metrics->protocols); g_hash_table_destroy (metrics->agents); } void free_storage (void) { GModule module; g_hash_table_destroy (ht_agent_keys); g_hash_table_destroy (ht_agent_vals); g_hash_table_destroy (ht_hostnames); g_hash_table_destroy (ht_unique_keys); for (module = 0; module < TOTAL_MODULES; ++module) { free_tables (ht_storage[module].metrics); } } uint32_t get_ht_size (GHashTable * ht) { return g_hash_table_size (ht); } uint32_t get_ht_size_by_metric (GModule module, GMetric metric) { GHashTable *ht = get_storage_metric (module, metric); return get_ht_size (ht); } int ht_insert_keymap (GHashTable * ht, const char *value) { gpointer value_ptr; int nkey = 0, size = 0; if (ht == NULL) return (EINVAL); value_ptr = g_hash_table_lookup (ht, value); if (value_ptr != NULL) return (*(int *) value_ptr); size = get_ht_size (ht); /* the auto increment value starts at SIZE (hash table) + 1 */ nkey = size > 0 ? size + 1 : 1; g_hash_table_replace (ht, g_strdup (value), int2ptr (nkey)); return nkey; } int ht_insert_uniqmap (GHashTable * ht, char *uniq_key) { int nkey = 0, size = 0; if (ht == NULL) return (EINVAL); if ((g_hash_table_lookup (ht, uniq_key)) != NULL) return 0; size = get_ht_size (ht); /* the auto increment value starts at SIZE (hash table) + 1 */ nkey = size > 0 ? size + 1 : 1; g_hash_table_replace (ht, uniq_key, int2ptr (nkey)); return nkey; } int ht_insert_nkey_nval (GHashTable * ht, int nkey, int nval) { if (ht == NULL) return (EINVAL); if ((g_hash_table_lookup (ht, &nkey)) != NULL) return 1; g_hash_table_replace (ht, int2ptr (nkey), int2ptr (nval)); return 0; } /* store generic data into the given hash table */ int ht_insert_hit (GHashTable * ht, int data_nkey, int uniq_nkey, int root_nkey) { GDataMap *map; if (ht == NULL) return (EINVAL); map = g_hash_table_lookup (ht, &data_nkey); if (map != NULL) { map->data++; } else { map = xcalloc (1, sizeof (GDataMap)); map->data = 1; map->root = root_nkey; map->uniq = uniq_nkey; } g_hash_table_replace (ht, int2ptr (data_nkey), map); return 0; } static int find_host_agent_in_list (void *data, void *needle) { return (*(int *) data) == (*(int *) needle) ? 1 : 0; } int ht_insert_host_agent (GHashTable * ht, int data_nkey, int agent_nkey) { GSLList *list, *match; if (ht == NULL) return (EINVAL); list = g_hash_table_lookup (ht, &data_nkey); if (list != NULL) { if ((match = list_find (list, find_host_agent_in_list, &agent_nkey))) goto out; list = list_insert_prepend (list, int2ptr (agent_nkey)); } else { list = list_create (int2ptr (agent_nkey)); } g_hash_table_replace (ht, int2ptr (data_nkey), list); out: return 0; } int ht_insert_str_from_int_key (GHashTable * ht, int nkey, const char *value) { if (ht == NULL) return (EINVAL); g_hash_table_replace (ht, int2ptr (nkey), g_strdup (value)); return 0; } static int ht_inc_int_from_key (GHashTable * ht, void *key, int inc) { gpointer value_ptr; int add_value; if (ht == NULL) return (EINVAL); value_ptr = g_hash_table_lookup (ht, key); if (value_ptr != NULL) { add_value = (*(int *) value_ptr) + inc; } else { add_value = 0 + inc; } g_hash_table_replace (ht, key, int2ptr (add_value)); return 0; } static int ht_inc_u64_from_key (GHashTable * ht, void *key, uint64_t inc) { gpointer value_ptr; uint64_t add_value; if (ht == NULL) return (EINVAL); value_ptr = g_hash_table_lookup (ht, key); if (value_ptr != NULL) { add_value = (*(uint64_t *) value_ptr) + inc; } else { add_value = 0 + inc; } g_hash_table_replace (ht, key, uint642ptr (add_value)); return 0; } int ht_inc_int_from_int_key (GHashTable * ht, int data_nkey, int inc) { int ret, *key; if (ht == NULL) return (EINVAL); key = int2ptr (data_nkey); if ((ret = ht_inc_int_from_key (ht, key, inc)) != 0) free (key); return ret; } int ht_inc_u64_from_int_key (GHashTable * ht, int data_nkey, uint64_t inc) { int ret, *key; if (ht == NULL) return (EINVAL); key = int2ptr (data_nkey); if ((ret = ht_inc_u64_from_key (ht, key, inc)) != 0) free (key); return ret; } int ht_max_u64_from_int_key (GHashTable * ht, int data_nkey, uint64_t newval) { gpointer value_ptr; int *key; uint64_t curval = 0; if (ht == NULL) return (EINVAL); key = int2ptr (data_nkey); value_ptr = g_hash_table_lookup (ht, key); if (value_ptr != NULL) curval = (*(uint64_t *) value_ptr); if (curval < newval) { g_hash_table_replace (ht, key, uint642ptr (newval)); } else { free (key); } return 0; } int ht_inc_int_from_str_key (GHashTable * ht, char *key, int inc) { if (ht == NULL) return (EINVAL); return ht_inc_int_from_key (ht, key, inc); } int ht_insert_unique_key (const char *key) { return ht_insert_keymap (ht_unique_keys, key); } int ht_insert_agent_key (const char *key) { return ht_insert_keymap (ht_agent_keys, key); } int ht_insert_agent_val (int nkey, const char *key) { return ht_insert_str_from_int_key (ht_agent_vals, nkey, key); } static int get_int_from_int_key (GHashTable * ht, int nkey) { gpointer value_ptr; if (ht == NULL) return (EINVAL); value_ptr = g_hash_table_lookup (ht, &nkey); if (value_ptr != NULL) return (*(int *) value_ptr); return 0; } int get_int_from_str_key (GHashTable * ht, const char *key) { gpointer value_ptr; if (ht == NULL) return (EINVAL); value_ptr = g_hash_table_lookup (ht, key); if (value_ptr != NULL) return (*(int *) value_ptr); return 0; } unsigned int get_uint_from_str_key (GHashTable * ht, const char *key) { gpointer value_ptr; if (ht == NULL) return (EINVAL); value_ptr = g_hash_table_lookup (ht, key); if (value_ptr != NULL) return (*(unsigned int *) value_ptr); return 0; } char * get_str_from_int_key (GHashTable * ht, int nkey) { gpointer value_ptr; if (ht == NULL) return NULL; value_ptr = g_hash_table_lookup (ht, &nkey); if (value_ptr != NULL) return xstrdup ((char *) value_ptr); return NULL; } char * get_root_from_key (int root_nkey, GModule module) { GHashTable *ht = NULL; gpointer value_ptr; ht = get_storage_metric (module, MTRC_ROOTMAP); if (ht == NULL) return NULL; value_ptr = g_hash_table_lookup (ht, &root_nkey); if (value_ptr != NULL) return xstrdup ((char *) value_ptr); return NULL; } char * get_node_from_key (int data_nkey, GModule module, GMetric metric) { GHashTable *ht = NULL; GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); /* bandwidth modules */ switch (metric) { case MTRC_DATAMAP: ht = metrics->datamap; break; case MTRC_METHODS: ht = metrics->methods; break; case MTRC_PROTOCOLS: ht = metrics->protocols; break; default: ht = NULL; } if (ht == NULL) return NULL; return get_str_from_int_key (ht, data_nkey); } uint64_t get_cumulative_from_key (int data_nkey, GModule module, GMetric metric) { gpointer value_ptr; GHashTable *ht = NULL; GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); /* bandwidth modules */ switch (metric) { case MTRC_BW: ht = metrics->bw; break; case MTRC_CUMTS: ht = metrics->cumts; break; case MTRC_MAXTS: ht = metrics->maxts; break; default: ht = NULL; } if (ht == NULL) return 0; value_ptr = g_hash_table_lookup (ht, &data_nkey); if (value_ptr != NULL) return (*(uint64_t *) value_ptr); return 0; } int get_num_from_key (int data_nkey, GModule module, GMetric metric) { GHashTable *ht = NULL; GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); /* bandwidth modules */ switch (metric) { case MTRC_HITS: ht = metrics->hits; break; case MTRC_VISITORS: ht = metrics->visitors; break; default: ht = NULL; } if (ht == NULL) return 0; return get_int_from_int_key (ht, data_nkey); } char * get_hostname (const char *host) { int found; void *value_ptr; found = g_hash_table_lookup_extended (ht_hostnames, host, NULL, &value_ptr); if (found && value_ptr) return xstrdup (value_ptr); return NULL; } int get_int_from_keymap (const char *key, GModule module) { GHashTable *ht = get_storage_metric (module, MTRC_KEYMAP); return get_int_from_str_key (ht, key); } char * get_host_agent_val (int agent_nkey) { return get_str_from_int_key (ht_agent_vals, agent_nkey); } void * get_host_agent_list (int data_nkey) { GHashTable *ht; void *list; ht = get_storage_metric (HOSTS, MTRC_AGENTS); if ((list = g_hash_table_lookup (ht, &data_nkey))) return list; return NULL; } static void free_agent_values (GO_UNUSED gpointer k, gpointer v, GO_UNUSED gpointer data_ptr) { void *list = v; if (list != NULL) list_remove_nodes (list); } void free_agent_list (void) { GHashTable *ht = get_storage_metric (HOSTS, MTRC_AGENTS); g_hash_table_foreach (ht, (GHFunc) free_agent_values, NULL); } /* iterate over the key/value pairs in the hash table */ static void raw_data_iter (gpointer k, gpointer v, gpointer data_ptr) { GRawData *raw_data = data_ptr; raw_data->items[raw_data->idx].key = k; raw_data->items[raw_data->idx].value = v; raw_data->idx++; } /* store the key/value pairs from a hash table into raw_data */ GRawData * parse_raw_data (GHashTable * ht, int ht_size, GModule module) { GRawData *raw_data; raw_data = new_grawdata (); raw_data->size = ht_size; raw_data->module = module; raw_data->idx = 0; raw_data->items = new_grawdata_item (ht_size); g_hash_table_foreach (ht, (GHFunc) raw_data_iter, raw_data); sort_raw_data (raw_data, ht_size); return raw_data; } goaccess-0.9.4/src/settings.c0000664000000000000000000002147512573351525013020 00000000000000/** * settings.c -- goaccess configuration * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) #include #include #include #include #include #include #include "settings.h" #include "error.h" #include "util.h" #include "xmalloc.h" static char **nargv; static int nargc = 0; /* *INDENT-OFF* */ static const GPreConfLog logs = { "%h %^[%d:%t %^] \"%r\" %s %b \"%R\" \"%u\"", /* NCSA */ "%^:%^ %h %^[%d:%t %^] \"%r\" %s %b \"%R\" \"%u\"", /* NCSA + VHost */ "%h %^[%d:%t %^] \"%r\" %s %b", /* CLF */ "%^:%^ %h %^[%d:%t %^] \"%r\" %s %b", /* CLF+VHost */ "%d %t %h %^ %^ %^ %m %r %^ %s %b %^ %^ %u %R", /* W3C */ "%d\\t%t\\t%^\\t%b\\t%h\\t%m\\t%^\\t%r\\t%s\\t%R\\t%u\\t%^", /* CloudFront */ "\"%x\",\"%h\",%^,%^,\"%m\",\"%U\",\"%s\",%^,\"%b\",\"%D\",%^,\"%R\",\"%u\"", /* Cloud Storage */ "%dT%t.%^ %^ %h:%^ %^ %T %^ %^ %^ %s %^ %b \"%r\" \"%u\"", /* AWS Elastic Load Balancing */ }; static const GPreConfDate dates = { "%d/%b/%Y", /* Apache */ "%Y-%m-%d", /* W3C */ "%f", /* Cloud Storage*/ }; static const GPreConfTime times = { "%H:%M:%S", "%f", /* Cloud Storage*/ }; /* *INDENT-ON* */ /* Ignore the following options */ static const char *ignore_cmd_opts[] = { "help", "storage", "version", }; static int in_ignore_cmd_opts (const char *val) { size_t i; for (i = 0; i < ARRAY_SIZE (ignore_cmd_opts); i++) { if (strstr (val, ignore_cmd_opts[i]) != NULL) return 1; } return 0; } static char * get_config_file_path (void) { char *upath = NULL, *rpath = NULL; /* determine which config file to open, default or custom */ if (conf.iconfigfile != NULL) { rpath = realpath (conf.iconfigfile, NULL); if (rpath == NULL) FATAL ("Unable to open the specified config file. %s", strerror (errno)); return rpath; } /* otherwise, fallback to global config file, or * attempt to use the user's config file */ if (conf.load_global_config) { upath = get_global_config (); rpath = realpath (upath, NULL); if (upath) { free (upath); } } if (rpath == NULL) { upath = get_home (); rpath = realpath (upath, NULL); if (upath) { free (upath); } } return rpath; } /* Use predefined static files when no config file is used */ void set_default_static_files (void) { size_t i; const char *exts[] = { ".css", ".CSS", ".dae", ".DAE", ".eot", ".EOT", ".gif", ".GIF", ".ico", ".ICO", ".jpeg", ".JPEG", ".jpg", ".JPG", ".js", ".JS", ".map", ".MAP", ".mp3", ".MP3", ".pdf", ".PDF", ".png", ".PNG", ".svg", ".SVG", ".swf", ".SWF", ".ttf", ".TTF", ".txt", ".TXT", ".woff", ".WOFF", }; if (conf.static_file_idx > 0) return; for (i = 0; i < ARRAY_SIZE (exts); i++) { if (conf.static_file_max_len < strlen (exts[i])) conf.static_file_max_len = strlen (exts[i]); conf.static_files[conf.static_file_idx++] = exts[i]; } } /* clean command line arguments */ void free_cmd_args (void) { int i; if (nargc == 0) return; for (i = 0; i < nargc; i++) free (nargv[i]); free (nargv); } /* append extra value to argv */ static void append_to_argv (int *argc, char ***argv, char *val) { char **_argv = xrealloc (*argv, (*argc + 2) * sizeof (*_argv)); _argv[*argc] = val; _argv[*argc + 1] = '\0'; (*argc)++; *argv = _argv; } /* parses configuration file to feed getopt_long */ int parse_conf_file (int *argc, char ***argv) { char line[MAX_LINE_CONF + 1]; char *path = NULL, *val, *opt, *p; FILE *file; int i; size_t idx; /* assumes program name is on argv[0], though, it is not guaranteed */ append_to_argv (&nargc, &nargv, xstrdup ((char *) *argv[0])); /* determine which config file to open, default or custom */ path = get_config_file_path (); if (path == NULL) return ENOENT; /* could not open conf file, if so prompt conf dialog */ if ((file = fopen (path, "r")) == NULL) { free (path); return ENOENT; } while (fgets (line, sizeof line, file) != NULL) { if (line[0] == '\n' || line[0] == '\r' || line[0] == '#') continue; /* key */ idx = strcspn (line, " \t"); if (strlen (line) == idx) FATAL ("Malformed config key at line: %s", line); line[idx] = '\0'; /* make old config options backwards compatible by * substituting underscores with dashes */ while ((p = strpbrk (line, "_")) != NULL) *p = '-'; /* Ignore the following options when reading the config file */ if (in_ignore_cmd_opts (line)) continue; /* value */ val = line + (idx + 1); idx = strspn (val, " \t"); if (strlen (line) == idx) FATAL ("Malformed config value at line: %s", line); val = val + idx; val = trim_str (val); if (strcmp ("false", val) == 0) continue; /* set it as command line options */ opt = xmalloc (snprintf (NULL, 0, "--%s", line) + 1); sprintf (opt, "--%s", line); append_to_argv (&nargc, &nargv, opt); if (strcmp ("true", val) != 0) append_to_argv (&nargc, &nargv, xstrdup (val)); } /* give priority to command line arguments */ for (i = 1; i < *argc; i++) append_to_argv (&nargc, &nargv, xstrdup ((char *) (*argv)[i])); *argc = nargc; *argv = (char **) nargv; fclose (file); if (conf.iconfigfile == NULL) conf.iconfigfile = xstrdup (path); free (path); return 0; } /* return the index of the matched item, or -1 if no such item exists */ size_t get_selected_format_idx (void) { if (conf.log_format == NULL) return -1; if (strcmp (conf.log_format, logs.common) == 0) return COMMON; else if (strcmp (conf.log_format, logs.vcommon) == 0) return VCOMMON; else if (strcmp (conf.log_format, logs.combined) == 0) return COMBINED; else if (strcmp (conf.log_format, logs.vcombined) == 0) return VCOMBINED; else if (strcmp (conf.log_format, logs.w3c) == 0) return W3C; else if (strcmp (conf.log_format, logs.cloudfront) == 0) return CLOUDFRONT; else if (strcmp (conf.log_format, logs.cloudstorage) == 0) return CLOUDSTORAGE; else if (strcmp (conf.log_format, logs.awselb) == 0) return AWSELB; else return -1; } /* return the string of the matched item, or NULL if no such item exists */ char * get_selected_format_str (size_t idx) { char *fmt = NULL; switch (idx) { case COMMON: fmt = alloc_string (logs.common); break; case VCOMMON: fmt = alloc_string (logs.vcommon); break; case COMBINED: fmt = alloc_string (logs.combined); break; case VCOMBINED: fmt = alloc_string (logs.vcombined); break; case W3C: fmt = alloc_string (logs.w3c); break; case CLOUDFRONT: fmt = alloc_string (logs.cloudfront); break; case CLOUDSTORAGE: fmt = alloc_string (logs.cloudstorage); break; case AWSELB: fmt = alloc_string (logs.awselb); break; } return fmt; } char * get_selected_date_str (size_t idx) { char *fmt = NULL; switch (idx) { case COMMON: case VCOMMON: case COMBINED: case VCOMBINED: fmt = alloc_string (dates.apache); break; case AWSELB: case CLOUDFRONT: case W3C: fmt = alloc_string (dates.w3c); break; case CLOUDSTORAGE: fmt = alloc_string (dates.usec); break; } return fmt; } char * get_selected_time_str (size_t idx) { char *fmt = NULL; switch (idx) { case AWSELB: case CLOUDFRONT: case COMBINED: case COMMON: case VCOMBINED: case VCOMMON: case W3C: fmt = alloc_string (times.fmt24); break; case CLOUDSTORAGE: fmt = alloc_string (times.usec); break; } return fmt; } int ignore_panel (GModule mod) { int i; int module; char *view; for (i = 0; i < conf.ignore_panel_idx; ++i) { view = conf.ignore_panels[i]; if ((module = get_module_enum (view)) == -1) continue; if (mod == (unsigned int) module) return 1; } return 0; } goaccess-0.9.4/src/goaccess.h0000664000000000000000000000175312573351525012751 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef GOACCESS_H_INCLUDED #define GOACCESS_H_INCLUDED #include "ui.h" extern GSpinner *parsing_spinner; extern int active_gdns; /* kill dns pthread flag */ #endif goaccess-0.9.4/src/options.c0000644000000000000000000004375412573351525012655 00000000000000/** * options.c -- functions related to parsing program options * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #include #include #include #include #include #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #include "tcbtdb.h" #endif #include "options.h" #include "error.h" #include "util.h" static char short_options[] = "f:e:p:o:" #ifdef DEBUG "l:" #endif #ifdef HAVE_LIBGEOIP "g" #endif "acirmMhHqdsV"; /* *INDENT-OFF* */ struct option long_opts[] = { {"agent-list" , no_argument , 0 , 'a' } , {"config-dialog" , no_argument , 0 , 'c' } , {"hl-header" , no_argument , 0 , 'i' } , {"config-file" , required_argument , 0 , 'p' } , {"exclude-ip" , required_argument , 0 , 'e' } , {"help" , no_argument , 0 , 'h' } , {"http-method" , no_argument , 0 , 'M' } , {"http-protocol" , no_argument , 0 , 'H' } , {"log-file" , required_argument , 0 , 'f' } , {"version" , no_argument , 0 , 'V' } , #ifdef DEBUG {"debug-file" , required_argument , 0 , 'l' } , #endif {"invalid-requests" , required_argument , 0 , 0 } , {"444-as-404" , no_argument , 0 , 0 } , {"4xx-to-unique-count" , no_argument , 0 , 0 } , {"all-static-files" , no_argument , 0 , 0 } , {"color" , required_argument , 0 , 0 } , {"color-scheme" , required_argument , 0 , 0 } , {"date-format" , required_argument , 0 , 0 } , {"double-decode" , no_argument , 0 , 0 } , {"html-report-title" , required_argument , 0 , 0 } , {"ignore-crawlers" , no_argument , 0 , 0 } , {"ignore-panel" , required_argument , 0 , 0 } , {"ignore-referer" , required_argument , 0 , 0 } , {"log-format" , required_argument , 0 , 0 } , {"no-color" , no_argument , 0 , 0 } , {"no-column-names" , no_argument , 0 , 0 } , {"no-csv-summary" , no_argument , 0 , 0 } , {"no-global-config" , no_argument , 0 , 0 } , {"no-progress" , no_argument , 0 , 0 } , {"no-query-string" , no_argument , 0 , 'q' } , {"no-term-resolver" , no_argument , 0 , 'r' } , {"output-format" , required_argument , 0 , 'o' } , {"real-os" , no_argument , 0 , 0 } , {"sort-panel" , required_argument , 0 , 0 } , {"static-file" , required_argument , 0 , 0 } , {"storage" , no_argument , 0 , 's' } , {"time-format" , required_argument , 0 , 0 } , {"with-mouse" , no_argument , 0 , 'm' } , {"with-output-resolver" , no_argument , 0 , 'd' } , #ifdef HAVE_LIBGEOIP {"std-geoip" , no_argument , 0 , 'g' } , {"geoip-database" , required_argument , 0 , 0 } , {"geoip-city-data" , required_argument , 0 , 0 } , #endif #ifdef TCB_BTREE {"cache-lcnum" , required_argument , 0 , 0 } , {"cache-ncnum" , required_argument , 0 , 0 } , {"compression" , required_argument , 0 , 0 } , {"db-path" , required_argument , 0 , 0 } , {"keep-db-files" , no_argument , 0 , 0 } , {"load-from-disk" , no_argument , 0 , 0 } , {"tune-bnum" , required_argument , 0 , 0 } , {"tune-lmemb" , required_argument , 0 , 0 } , {"tune-nmemb" , required_argument , 0 , 0 } , {"xmmap" , required_argument , 0 , 0 } , #endif {0, 0, 0, 0} }; void cmd_help (void) { printf ("\nGoAccess - %s\n\n", GO_VERSION); printf ( "Usage: " "goaccess [ options ... ] -f log_file [-c][-M][-H][-q][-d][...]\n" "The following options can also be supplied to the command:\n\n" /* Log & Date Format Options */ "Log & Date Format Options\n\n" " --log-format= - Specify log format. Inner quotes need to be\n" " escaped, or use single quotes.\n" " --date-format= - Specify log date format. e.g., %%d/%%b/%%Y\n" " --time-format= - Specify log time format. e.g., %%H:%%M:%%S\n\n" /* User Interface Options */ "User Interface Options\n\n" " -c --config-dialog - Prompt log/date/time configuration window.\n" " -i --hl-header - Color highlight active panel.\n" " -m --with-mouse - Enable mouse support on main dashboard.\n" " --color= - Specify custom colors.\n" " See manpage for more details and options.\n" " --color-scheme=<1|2> - Color schemes: 1 => Grey, 2 => Green.\n" " --html-report-title= - Set HTML report page title and header.\n" " --no-color - Disable colored output.\n" " --no-column-names - Don't write column names in term output.\n" " --no-csv-summary - Disable summary metrics on the CSV output.\n" " --no-progress - Disable progress metrics.\n\n" /* File Options */ "File Options\n\n" " -f --log-file=<filename> - Path to input log file.\n" " -p --config-file=<filename> - Custom configuration file.\n" #ifdef DEBUG " -l --debug-file=<filename> - Send all debug messages to the\n" " specified file.\n" #endif " --invalid-requests=<filename> - Log invalid requests to the specified file.\n" " --no-global-config - Don't load global configuration file.\n\n" /* Parse Options */ "Parse Options\n\n" " -a --agent-list - Enable a list of user-agents by host.\n" " -d --with-output-resolver - Enable IP resolver on HTML|JSON output.\n" " -e --exclude-ip=<IP> - Exclude one or multiple IPv4/6. Allows\n" " IP ranges e.g. 192.168.0.1-192.168.0.10\n" " -H --http-protocol - Include HTTP request protocol if found.\n" " -M --http-method - Include HTTP request method if found.\n" " -o --output-format=csv|json - Output either a JSON or a CSV file.\n" " -q --no-query-string - Ignore request's query string.\n" " Removing the query string can greatly\n" " decrease memory consumption.\n" " -r --no-term-resolver - Disable IP resolver on terminal output.\n" " --444-as-404 - Treat non-standard status code 444 as 404.\n" " --4xx-to-unique-count - Add 4xx client errors to the unique\n" " visitors count.\n" " --all-static-files - Include static files with a query string.\n" " --double-decode - Decode double-encoded values.\n" " --ignore-crawlers - Ignore crawlers.\n" " --ignore-panel=PANEL - Ignore parsing/displaying the given panel.\n" " --ignore-referer=<needle> - Ignore a referer from being counted.\n" " Wild cards are allowed. i.e., *.bing.com\n" " --real-os - Display real OS names. e.g, Windows XP,\n" " Snow Leopard.\n" " --sort-panel=PANEL,METRIC,ORDER - Sort panel on initial load. For example:\n" " --sort-panel=VISITORS,BY_HITS,ASC\n" " See manpage for a list of panels/fields.\n" " --static-file=<extension> - Add static file extension. e.g.: .mp3\n" " Extensions are case sensitive.\n" /* GeoIP Options */ #ifdef HAVE_LIBGEOIP "GeoIP Options\n\n" " -g --std-geoip - Standard GeoIP database for less memory\n" " consumption.\n" " --geoip-database=<path> - Specify path to GeoIP database file.\n" " i.e., GeoLiteCity.dat, GeoIPv6.dat ...\n\n" #endif /* On-Disk Database Options */ #ifdef TCB_BTREE "On-Disk Database Options\n\n" " --keep-db-files - Persist parsed data into disk.\n" " --load-from-disk - Load previously stored data from disk.\n" " --db-path=<path> - Path of the database file. Default [%s]\n" " --xmmap=<number> - Set the size in bytes of the extra\n" " mapped memory. Default [%d]\n" " --cache-lcnum=<number> - Max number of leaf nodes to be cached.\n" " Default [%d]\n" " --cache-ncnum=<number> - Max number of non-leaf nodes to be cached.\n" " Default [%d]\n" " --tune-lmemb=<number> - Number of members in each leaf page.\n" " Default [%d]\n" " --tune-nmemb=<number> - Number of members in each non-leaf page.\n" " Default [%d]\n" " --tune-bnum=<number> - Number of elements of the bucket array.\n" " Default [%d]\n" #if defined(HAVE_ZLIB) || defined(HAVE_BZ2) " --compression=<zlib|bz2> - Specifies that each page is compressed\n" " with ZLIB|BZ2 encoding.\n\n" #endif #endif /* Other Options */ "Other Options\n\n" " -h --help - This help.\n" " -V --version - Display version information and exit.\n" " -s --storage - Display current storage method.\n" " e.g., B+ Tree, Hash.\n\n" "Examples can be found by running `man goaccess`.\n\n" "For more details visit: http://goaccess.io\n" "GoAccess Copyright (C) 2009-2015 GNU GPL'd, by Gerardo Orellana" "\n\n" #ifdef TCB_BTREE , TC_DBPATH, TC_MMAP, TC_LCNUM, TC_NCNUM, TC_LMEMB, TC_NMEMB, TC_BNUM #endif ); exit (EXIT_FAILURE); } /* *INDENT-ON* */ void verify_global_config (int argc, char **argv) { int o, idx = 0; conf.load_global_config = 1; while ((o = getopt_long (argc, argv, short_options, long_opts, &idx)) >= 0) { if (-1 == o || EOF == o) break; switch (o) { case 'p': conf.iconfigfile = optarg; break; case 0: if (!strcmp ("no-global-config", long_opts[idx].name)) conf.load_global_config = 0; break; case '?': exit (EXIT_FAILURE); } } for (idx = optind; idx < argc; idx++) cmd_help (); /* reset it to 1 */ optind = 1; } void read_option_args (int argc, char **argv) { int o, idx = 0; #ifdef HAVE_LIBGEOIP conf.geo_db = GEOIP_MEMORY_CACHE; #endif while ((o = getopt_long (argc, argv, short_options, long_opts, &idx)) >= 0) { if (-1 == o || EOF == o) break; switch (o) { case 'f': conf.ifile = optarg; break; case 'p': /* ignore it */ break; #ifdef HAVE_LIBGEOIP case 'g': conf.geo_db = GEOIP_STANDARD; break; #endif case 'e': if (conf.ignore_ip_idx < MAX_IGNORE_IPS) conf.ignore_ips[conf.ignore_ip_idx++] = optarg; break; case 'a': conf.list_agents = 1; break; case 'c': conf.load_conf_dlg = 1; break; case 'i': conf.hl_header = 1; break; case 'q': conf.ignore_qstr = 1; break; case 'o': conf.output_format = optarg; break; case 'l': conf.debug_log = optarg; dbg_log_open (conf.debug_log); break; case 'r': conf.skip_term_resolver = 1; break; case 'd': conf.enable_html_resolver = 1; break; case 'm': conf.mouse_support = 1; break; case 'M': conf.append_method = 1; break; case 'h': cmd_help (); break; case 'H': conf.append_protocol = 1; break; case 'V': display_version (); exit (EXIT_SUCCESS); break; case 0: if (!strcmp ("no-global-config", long_opts[idx].name)) break; /* ignore it */ /* colors */ if (!strcmp ("color", long_opts[idx].name) && conf.color_idx < MAX_CUSTOM_COLORS) conf.colors[conf.color_idx++] = optarg; /* color scheme */ if (!strcmp ("color-scheme", long_opts[idx].name)) conf.color_scheme = atoi (optarg); /* log format */ if (!strcmp ("log-format", long_opts[idx].name) && !conf.log_format) conf.log_format = unescape_str (optarg); /* time format */ if (!strcmp ("time-format", long_opts[idx].name) && !conf.time_format) conf.time_format = unescape_str (optarg); /* date format */ if (!strcmp ("date-format", long_opts[idx].name) && !conf.date_format) conf.date_format = unescape_str (optarg); /* invalid requests */ if (!strcmp ("invalid-requests", long_opts[idx].name)) { conf.invalid_requests_log = optarg; invalid_log_open (conf.invalid_requests_log); } /* static file */ if (!strcmp ("static-file", long_opts[idx].name) && conf.static_file_idx < MAX_EXTENSIONS) { if (conf.static_file_max_len < strlen (optarg)) conf.static_file_max_len = strlen (optarg); conf.static_files[conf.static_file_idx++] = optarg; } /* 4xx to unique count */ if (!strcmp ("4xx-to-unique-count", long_opts[idx].name)) conf.client_err_to_unique_count = 1; /* html report title */ if (!strcmp ("html-report-title", long_opts[idx].name)) conf.html_report_title = optarg; /* 444 as 404 */ if (!strcmp ("444-as-404", long_opts[idx].name)) conf.code444_as_404 = 1; /* all static files */ if (!strcmp ("all-static-files", long_opts[idx].name)) conf.all_static_files = 1; /* ignore crawlers */ if (!strcmp ("ignore-crawlers", long_opts[idx].name)) conf.ignore_crawlers = 1; /* ignore panel */ if (!strcmp ("ignore-panel", long_opts[idx].name) && conf.ignore_panel_idx < TOTAL_MODULES) conf.ignore_panels[conf.ignore_panel_idx++] = optarg; /* ignore referer */ if (!strcmp ("ignore-referer", long_opts[idx].name) && conf.ignore_referer_idx < MAX_IGNORE_REF) conf.ignore_referers[conf.ignore_referer_idx++] = optarg; /* sort view */ if (!strcmp ("sort-panel", long_opts[idx].name) && conf.sort_panel_idx < TOTAL_MODULES) conf.sort_panels[conf.sort_panel_idx++] = optarg; /* real os */ if (!strcmp ("real-os", long_opts[idx].name)) conf.real_os = 1; /* double decode */ if (!strcmp ("double-decode", long_opts[idx].name)) conf.double_decode = 1; /* no color */ if (!strcmp ("no-color", long_opts[idx].name)) conf.no_color = 1; /* no columns */ if (!strcmp ("no-column-names", long_opts[idx].name)) conf.no_column_names = 1; /* no csv summary */ if (!strcmp ("no-csv-summary", long_opts[idx].name)) conf.no_csv_summary = 1; /* no progress */ if (!strcmp ("no-progress", long_opts[idx].name)) conf.no_progress = 1; /* specifies the path of the GeoIP City database file */ if (!strcmp ("geoip-city-data", long_opts[idx].name) || !strcmp ("geoip-database", long_opts[idx].name)) conf.geoip_database = optarg; /* load data from disk */ if (!strcmp ("load-from-disk", long_opts[idx].name)) conf.load_from_disk = 1; /* keep database files */ if (!strcmp ("keep-db-files", long_opts[idx].name)) conf.keep_db_files = 1; /* specifies the path of the database file */ if (!strcmp ("db-path", long_opts[idx].name)) conf.db_path = optarg; /* set the size in bytes of the extra mapped memory */ if (!strcmp ("xmmap", long_opts[idx].name)) conf.xmmap = atoi (optarg); /* specifies the maximum number of leaf nodes to be cached */ if (!strcmp ("cache-lcnum", long_opts[idx].name)) conf.cache_lcnum = atoi (optarg); /* specifies the maximum number of non-leaf nodes to be cached */ if (!strcmp ("cache-ncnum", long_opts[idx].name)) conf.cache_ncnum = atoi (optarg); /* number of members in each leaf page */ if (!strcmp ("tune-lmemb", long_opts[idx].name)) conf.tune_lmemb = atoi (optarg); /* number of members in each non-leaf page */ if (!strcmp ("tune-nmemb", long_opts[idx].name)) conf.tune_nmemb = atoi (optarg); /* number of elements of the bucket array */ if (!strcmp ("tune-bnum", long_opts[idx].name)) conf.tune_bnum = atoi (optarg); /* specifies that each page is compressed with X encoding */ if (!strcmp ("compression", long_opts[idx].name)) { #ifdef HAVE_ZLIB if (!strcmp ("zlib", optarg)) conf.compression = TC_ZLIB; #endif #ifdef HAVE_BZ2 if (!strcmp ("bz2", optarg)) conf.compression = TC_BZ2; #endif } break; case 's': display_storage (); exit (EXIT_SUCCESS); case '?': exit (EXIT_FAILURE); default: exit (EXIT_FAILURE); } } for (idx = optind; idx < argc; idx++) cmd_help (); } ��������������������goaccess-0.9.4/src/geolocation.h��������������������������������������������������������������������0000664�0000000�0000000�00000003115�12573351525�013457� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include <config.h> #endif #ifndef GEOLOCATION_H_INCLUDED #define GEOLOCATION_H_INCLUDED #ifdef HAVE_LIBGEOIP #include <GeoIP.h> #endif #include "commons.h" #define CITY_LEN 28 #define CONTINENT_LEN 48 #define COUNTRY_LEN 48 + 3 /* Country + two-letter Code */ typedef struct GLocation_ { char city[CITY_LEN]; char continent[CONTINENT_LEN]; int hits; } GLocation; extern GeoIP *geo_location_data; GeoIP *geoip_open_db (const char *db); void geoip_get_city (const char *ip, char *location, GTypeIP type_ip); void geoip_get_continent (const char *ip, char *location, GTypeIP type_ip); void geoip_get_country (const char *ip, char *location, GTypeIP type_ip); int set_geolocation (char *host, char *continent, char *country, char *city); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/csv.c����������������������������������������������������������������������������0000644�0000000�0000000�00000017607�12573351525�011753� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * output.c -- output csv to the standard output stream * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <time.h> #include <unistd.h> #include <inttypes.h> #include "csv.h" #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #else #include "glibht.h" #endif #include "ui.h" #include "util.h" typedef struct GPanel_ { GModule module; void (*render) (FILE * fp, GHolder * h, int valid); } GPanel; static void print_csv_data (FILE * fp, GHolder * h, int valid); static GPanel paneling[] = { {VISITORS, print_csv_data}, {REQUESTS, print_csv_data}, {REQUESTS_STATIC, print_csv_data}, {NOT_FOUND, print_csv_data}, {HOSTS, print_csv_data}, {OS, print_csv_data}, {BROWSERS, print_csv_data}, {VISIT_TIMES, print_csv_data}, {REFERRERS, print_csv_data}, {REFERRING_SITES, print_csv_data}, {KEYPHRASES, print_csv_data}, #ifdef HAVE_LIBGEOIP {GEO_LOCATION, print_csv_data}, #endif {STATUS_CODES, print_csv_data}, }; static GPanel * panel_lookup (GModule module) { int i, num_panels = ARRAY_SIZE (paneling); for (i = 0; i < num_panels; i++) { if (paneling[i].module == module) return &paneling[i]; } return NULL; } static void escape_cvs_output (FILE * fp, char *s) { while (*s) { switch (*s) { case '"': fprintf (fp, "\"\""); break; default: fputc (*s, fp); break; } s++; } } static void print_csv_sub_items (FILE * fp, GHolder * h, int idx, int valid) { GSubList *sub_list = h->items[idx].sub_list; GSubItem *iter; float percent; int i = 0; if (sub_list == NULL) return; for (iter = sub_list->head; iter; iter = iter->next, i++) { percent = get_percentage (valid, iter->metrics->hits); percent = percent < 0 ? 0 : percent; fprintf (fp, "\"%d\",", i); /* idx */ fprintf (fp, "\"%d\",", idx); /* parent idx */ fprintf (fp, "\"%s\",", module_to_id (h->module)); fprintf (fp, "\"%d\",", iter->metrics->hits); fprintf (fp, "\"%d\",", iter->metrics->visitors); fprintf (fp, "\"%4.2f%%\",", percent); if (conf.bandwidth) fprintf (fp, "\"%lld\",", (long long) iter->metrics->bw.nbw); if (conf.serve_usecs) { fprintf (fp, "\"%lld\",", (long long) iter->metrics->avgts.nts); fprintf (fp, "\"%lld\",", (long long) iter->metrics->cumts.nts); fprintf (fp, "\"%lld\",", (long long) iter->metrics->maxts.nts); } if (conf.append_method && iter->metrics->method) fprintf (fp, "\"%s\"", iter->metrics->method); fprintf (fp, ","); if (conf.append_protocol && iter->metrics->protocol) fprintf (fp, "\"%s\"", iter->metrics->protocol); fprintf (fp, ","); fprintf (fp, "\""); escape_cvs_output (fp, iter->metrics->data); fprintf (fp, "\","); fprintf (fp, "\r\n"); /* parent idx */ } } /* generate CSV unique visitors stats */ static void print_csv_data (FILE * fp, GHolder * h, int valid) { GMetrics *nmetrics; int i; for (i = 0; i < h->idx; i++) { set_data_metrics (h->items[i].metrics, &nmetrics, valid); fprintf (fp, "\"%d\",", i); /* idx */ fprintf (fp, ","); /* no parent */ fprintf (fp, "\"%s\",", module_to_id (h->module)); fprintf (fp, "\"%d\",", nmetrics->hits); fprintf (fp, "\"%d\",", nmetrics->visitors); fprintf (fp, "\"%4.2f%%\",", nmetrics->percent); if (conf.bandwidth) fprintf (fp, "\"%lld\",", (long long) nmetrics->bw.nbw); if (conf.serve_usecs) { fprintf (fp, "\"%lld\",", (long long) nmetrics->avgts.nts); fprintf (fp, "\"%lld\",", (long long) nmetrics->cumts.nts); fprintf (fp, "\"%lld\",", (long long) nmetrics->maxts.nts); } if (conf.append_method && nmetrics->method) fprintf (fp, "\"%s\"", nmetrics->method); fprintf (fp, ","); if (conf.append_protocol && nmetrics->protocol) fprintf (fp, "\"%s\"", nmetrics->protocol); fprintf (fp, ","); fprintf (fp, "\""); escape_cvs_output (fp, nmetrics->data); fprintf (fp, "\"\r\n"); if (h->sub_items_size) print_csv_sub_items (fp, h, i, valid); free (nmetrics); } } #pragma GCC diagnostic ignored "-Wformat-nonliteral" /* general statistics info */ static void print_csv_summary (FILE * fp, GLog * logger) { long long t = 0LL; int i = 0, total = 0; off_t log_size = 0; char now[DATE_TIME]; const char *fmt; generate_time (); strftime (now, DATE_TIME, "%Y-%m-%d %H:%M:%S", now_tm); /* generated date time */ fmt = "\"%d\",,\"%s\",,,,,,,,\"%s\",\"%s\"\r\n"; fprintf (fp, fmt, i++, GENER_ID, now, OVERALL_DATETIME); /* total requests */ fmt = "\"%d\",,\"%s\",,,,,,,,\"%d\",\"%s\"\r\n"; total = logger->processed; fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_REQ); /* valid requests */ fmt = "\"%d\",,\"%s\",,,,,,,,\"%d\",\"%s\"\r\n"; total = logger->valid; fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_VALID); /* invalid requests */ total = logger->invalid; fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_FAILED); /* generated time */ fmt = "\"%d\",,\"%s\",,,,,,,,\"%llu\",\"%s\"\r\n"; t = (long long) end_proc - start_proc; fprintf (fp, fmt, i++, GENER_ID, t, OVERALL_GENTIME); /* visitors */ fmt = "\"%d\",,\"%s\",,,,,,,,\"%d\",\"%s\"\r\n"; total = get_ht_size_by_metric (VISITORS, MTRC_UNIQMAP); fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_VISITORS); /* files */ total = get_ht_size_by_metric (REQUESTS, MTRC_DATAMAP); fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_FILES); /* excluded hits */ total = logger->excluded_ip; fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_EXCL_HITS); /* referrers */ total = get_ht_size_by_metric (REFERRERS, MTRC_DATAMAP); fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_REF); /* not found */ total = get_ht_size_by_metric (NOT_FOUND, MTRC_DATAMAP); fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_NOTFOUND); /* static files */ total = get_ht_size_by_metric (REQUESTS_STATIC, MTRC_DATAMAP); fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_STATIC); /* log size */ if (!logger->piping) log_size = file_size (conf.ifile); fmt = "\"%d\",,\"%s\",,,,,,,,\"%jd\",\"%s\"\r\n"; fprintf (fp, fmt, i++, GENER_ID, (intmax_t) log_size, OVERALL_LOGSIZE); /* bandwidth */ fmt = "\"%d\",,\"%s\",,,,,,,,\"%lld\",\"%s\"\r\n"; fprintf (fp, fmt, i++, GENER_ID, logger->resp_size, OVERALL_BANDWIDTH); /* log path */ if (conf.ifile == NULL) conf.ifile = (char *) "STDIN"; fmt = "\"%d\",,\"%s\",,,,,,,,\"%s\",\"%s\"\r\n"; fprintf (fp, fmt, i++, GENER_ID, conf.ifile, OVERALL_LOG); } #pragma GCC diagnostic warning "-Wformat-nonliteral" /* entry point to generate a a csv report writing it to the fp */ void output_csv (GLog * logger, GHolder * holder) { GModule module; FILE *fp = stdout; if (!conf.no_csv_summary) print_csv_summary (fp, logger); for (module = 0; module < TOTAL_MODULES; module++) { const GPanel *panel = panel_lookup (module); if (!panel) continue; if (ignore_panel (module)) continue; panel->render (fp, holder + module, logger->valid); } fclose (fp); } �������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/color.c��������������������������������������������������������������������������0000644�0000000�0000000�00000043551�12573351525�012273� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * color.c -- functions related to custom color * Copyright (C) 2009-2015 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include <config.h> #endif #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "color.h" #include "commons.h" #include "error.h" #include "util.h" #include "xmalloc.h" static GSLList *color_list = NULL; static GSLList *pair_list = NULL; /* *INDENT-OFF* */ static GEnum CSTM_COLORS[] = { {"COLOR_MTRC_HITS" , COLOR_MTRC_HITS} , {"COLOR_MTRC_VISITORS" , COLOR_MTRC_VISITORS} , {"COLOR_MTRC_PERC" , COLOR_MTRC_PERC} , {"COLOR_MTRC_BW" , COLOR_MTRC_BW} , {"COLOR_MTRC_AVGTS" , COLOR_MTRC_AVGTS} , {"COLOR_MTRC_CUMTS" , COLOR_MTRC_CUMTS} , {"COLOR_MTRC_MAXTS" , COLOR_MTRC_MAXTS} , {"COLOR_MTRC_PROT" , COLOR_MTRC_PROT} , {"COLOR_MTRC_MTHD" , COLOR_MTRC_MTHD} , {"COLOR_MTRC_DATA" , COLOR_MTRC_DATA} , {"COLOR_MTRC_PERC_MAX" , COLOR_MTRC_PERC_MAX} , {"COLOR_PANEL_COLS" , COLOR_PANEL_COLS} , {"COLOR_BARS" , COLOR_BARS} , {"COLOR_ERROR" , COLOR_ERROR} , {"COLOR_SELECTED" , COLOR_SELECTED} , {"COLOR_PANEL_ACTIVE" , COLOR_PANEL_ACTIVE} , {"COLOR_PANEL_HEADER" , COLOR_PANEL_HEADER} , {"COLOR_PANEL_DESC" , COLOR_PANEL_DESC} , {"COLOR_OVERALL_LBLS" , COLOR_OVERALL_LBLS} , {"COLOR_OVERALL_VALS" , COLOR_OVERALL_VALS} , {"COLOR_OVERALL_PATH" , COLOR_OVERALL_PATH} , {"COLOR_ACTIVE_LABEL" , COLOR_ACTIVE_LABEL} , {"COLOR_BG" , COLOR_BG} , {"COLOR_DEFAULT" , COLOR_DEFAULT} , {"COLOR_PROGRESS" , COLOR_PROGRESS} , }; static const char *colors256_mono[] = { "COLOR_MTRC_HITS color7:color-1", "COLOR_MTRC_VISITORS color8:color-1", "COLOR_MTRC_DATA color7:color-1", "COLOR_MTRC_BW color8:color-1", "COLOR_MTRC_AVGTS color8:color-1", "COLOR_MTRC_CUMTS color8:color-1", "COLOR_MTRC_MAXTS color8:color-1", "COLOR_MTRC_PROT color8:color-1", "COLOR_MTRC_MTHD color7:color-1", "COLOR_MTRC_PERC color0:color-1 bold", "COLOR_MTRC_PERC color1:color-1 bold VISITORS", "COLOR_MTRC_PERC color1:color-1 bold OS", "COLOR_MTRC_PERC color1:color-1 bold BROWSERS", "COLOR_MTRC_PERC color1:color-1 bold VISIT_TIMES", "COLOR_MTRC_PERC_MAX color0:color-1 bold", "COLOR_MTRC_PERC_MAX color3:color-1 bold VISITORS", "COLOR_MTRC_PERC_MAX color3:color-1 bold OS", "COLOR_MTRC_PERC_MAX color3:color-1 bold BROWSERS", "COLOR_MTRC_PERC_MAX color3:color-1 bold VISIT_TIMES", "COLOR_PANEL_COLS color7:color-1", "COLOR_BARS color7:color-1", "COLOR_ERROR color7:color1", "COLOR_SELECTED color7:color8", "COLOR_PANEL_ACTIVE color0:color3", "COLOR_PANEL_HEADER color0:color7", "COLOR_PANEL_DESC color7:color-1", "COLOR_OVERALL_LBLS color7:color-1 bold", "COLOR_OVERALL_VALS color6:color-1 bold", "COLOR_OVERALL_PATH color3:color-1", "COLOR_ACTIVE_LABEL color4:color7", "COLOR_BG color7:color-1", "COLOR_DEFAULT color7:color-1", "COLOR_PROGRESS color0:color6", }; static const char *colors256_green[] = { "COLOR_MTRC_HITS color7:color-1", "COLOR_MTRC_VISITORS color8:color-1", "COLOR_MTRC_DATA color7:color-1", "COLOR_MTRC_BW color8:color-1", "COLOR_MTRC_AVGTS color8:color-1", "COLOR_MTRC_CUMTS color8:color-1", "COLOR_MTRC_MAXTS color8:color-1", "COLOR_MTRC_PROT color8:color-1", "COLOR_MTRC_MTHD color7:color-1", "COLOR_MTRC_PERC color0:color-1 bold", "COLOR_MTRC_PERC color1:color-1 bold VISITORS", "COLOR_MTRC_PERC color1:color-1 bold OS", "COLOR_MTRC_PERC color1:color-1 bold BROWSERS", "COLOR_MTRC_PERC color1:color-1 bold VISIT_TIMES", "COLOR_MTRC_PERC_MAX color0:color-1 bold", "COLOR_MTRC_PERC_MAX color3:color-1 bold VISITORS", "COLOR_MTRC_PERC_MAX color3:color-1 bold OS", "COLOR_MTRC_PERC_MAX color3:color-1 bold BROWSERS", "COLOR_MTRC_PERC_MAX color3:color-1 bold VISIT_TIMES", "COLOR_PANEL_COLS color7:color-1", "COLOR_BARS color7:color-1", "COLOR_ERROR color7:color1", "COLOR_SELECTED color7:color8", "COLOR_PANEL_ACTIVE color0:color3", "COLOR_PANEL_HEADER color0:color35", "COLOR_PANEL_DESC color7:color-1", "COLOR_OVERALL_LBLS color7:color-1 bold", "COLOR_OVERALL_VALS color6:color-1 bold", "COLOR_OVERALL_PATH color3:color-1", "COLOR_ACTIVE_LABEL color7:color35", "COLOR_BG color7:color-1", "COLOR_DEFAULT color7:color-1", "COLOR_PROGRESS color0:color6", }; static const char *colors8_mono[] = { "COLOR_MTRC_HITS color7:color-1", "COLOR_MTRC_VISITORS color0:color-1 bold", "COLOR_MTRC_DATA color7:color-1", "COLOR_MTRC_BW color0:color-1 bold", "COLOR_MTRC_AVGTS color0:color-1 bold", "COLOR_MTRC_CUMTS color0:color-1 bold", "COLOR_MTRC_MAXTS color0:color-1 bold", "COLOR_MTRC_PROT color0:color-1 bold", "COLOR_MTRC_MTHD color7:color-1 ", "COLOR_MTRC_PERC color0:color-1 bold", "COLOR_MTRC_PERC color1:color-1 bold VISITORS", "COLOR_MTRC_PERC color1:color-1 bold OS", "COLOR_MTRC_PERC color1:color-1 bold BROWSERS", "COLOR_MTRC_PERC color1:color-1 bold VISIT_TIMES", "COLOR_MTRC_PERC_MAX color0:color-1 bold", "COLOR_MTRC_PERC_MAX color3:color-1 bold VISITORS", "COLOR_MTRC_PERC_MAX color3:color-1 bold OS", "COLOR_MTRC_PERC_MAX color3:color-1 bold BROWSERS", "COLOR_MTRC_PERC_MAX color3:color-1 bold VISIT_TIMES", "COLOR_PANEL_COLS color7:color-1", "COLOR_BARS color7:color-1", "COLOR_ERROR color7:color1", "COLOR_SELECTED color0:color7", "COLOR_PANEL_ACTIVE color0:color3", "COLOR_PANEL_HEADER color0:color7", "COLOR_PANEL_DESC color7:color-1", "COLOR_OVERALL_LBLS color7:color-1 bold", "COLOR_OVERALL_VALS color6:color-1", "COLOR_OVERALL_PATH color3:color-1", "COLOR_ACTIVE_LABEL color4:color7", "COLOR_BG color7:color-1", "COLOR_DEFAULT color7:color-1", "COLOR_PROGRESS color0:color6", }; static const char *colors8_green[] = { "COLOR_MTRC_HITS color7:color-1", "COLOR_MTRC_VISITORS color0:color-1 bold", "COLOR_MTRC_DATA color7:color-1", "COLOR_MTRC_BW color0:color-1 bold", "COLOR_MTRC_AVGTS color0:color-1 bold", "COLOR_MTRC_CUMTS color0:color-1 bold", "COLOR_MTRC_MAXTS color0:color-1 bold", "COLOR_MTRC_PROT color0:color-1 bold", "COLOR_MTRC_MTHD color7:color-1 ", "COLOR_MTRC_PERC color0:color-1 bold", "COLOR_MTRC_PERC color1:color-1 bold VISITORS", "COLOR_MTRC_PERC color1:color-1 bold OS", "COLOR_MTRC_PERC color1:color-1 bold BROWSERS", "COLOR_MTRC_PERC color1:color-1 bold VISIT_TIMES", "COLOR_MTRC_PERC_MAX color0:color-1 bold", "COLOR_MTRC_PERC_MAX color3:color-1 bold VISITORS", "COLOR_MTRC_PERC_MAX color3:color-1 bold OS", "COLOR_MTRC_PERC_MAX color3:color-1 bold BROWSERS", "COLOR_MTRC_PERC_MAX color3:color-1 bold VISIT_TIMES", "COLOR_PANEL_COLS color7:color-1", "COLOR_BARS color2:color-1", "COLOR_ERROR color7:color1", "COLOR_SELECTED color0:color7", "COLOR_PANEL_ACTIVE color0:color3", "COLOR_PANEL_HEADER color0:color2", "COLOR_PANEL_DESC color7:color-1", "COLOR_OVERALL_LBLS color7:color-1 bold", "COLOR_OVERALL_VALS color6:color-1", "COLOR_OVERALL_PATH color3:color-1", "COLOR_ACTIVE_LABEL color0:color2", "COLOR_BG color7:color-1", "COLOR_DEFAULT color7:color-1", "COLOR_PROGRESS color0:color6", }; static const char *nocolors[] = { "COLOR_MTRC_HITS color0:color-1", "COLOR_MTRC_VISITORS color0:color-1", "COLOR_MTRC_DATA color0:color-1", "COLOR_MTRC_BW color0:color-1", "COLOR_MTRC_AVGTS color0:color-1", "COLOR_MTRC_CUMTS color0:color-1", "COLOR_MTRC_MAXTS color0:color-1", "COLOR_MTRC_PROT color0:color-1", "COLOR_MTRC_MTHD color0:color-1", "COLOR_MTRC_PERC color0:color-1", "COLOR_MTRC_PERC_MAX color0:color-1", "COLOR_PANEL_COLS color0:color-1", "COLOR_BARS color0:color-1", "COLOR_ERROR color0:color-1", "COLOR_SELECTED color0:color-1 reverse", "COLOR_PANEL_ACTIVE color0:color-1 reverse", "COLOR_PANEL_HEADER color0:color-1 reverse", "COLOR_PANEL_DESC color0:color-1", "COLOR_OVERALL_LBLS color0:color-1", "COLOR_OVERALL_VALS color0:color-1", "COLOR_OVERALL_PATH color0:color-1", "COLOR_ACTIVE_LABEL color0:color-1 reverse", "COLOR_BG color0:color-1", "COLOR_DEFAULT color0:color-1", "COLOR_PROGRESS color0:color-1 reverse", }; /* *INDENT-ON* */ /* Allocate memory for color elements */ static GColors * new_gcolors (void) { GColors *color = xcalloc (1, sizeof (GColors)); color->module = -1; return color; } static GColorPair * new_gcolorpair (void) { GColorPair *pair = xcalloc (1, sizeof (GColorPair)); /* Must be between 2 and COLOR_PAIRS-1. * Starts at 2 since COLOR_NORMAL has already been set */ pair->idx = 2; return pair; } void free_color_lists (void) { if (pair_list) list_remove_nodes (pair_list); if (color_list) list_remove_nodes (color_list); color_list = NULL; pair_list = NULL; } void set_normal_color (void) { GColorPair *pair = new_gcolorpair (); GColors *color = new_gcolors (); pair->idx = 1; pair->fg = COLOR_WHITE; pair->bg = -1; color->pair = pair; color->item = COLOR_NORMAL; pair_list = list_create (pair); color_list = list_create (color); init_pair (pair->idx, pair->fg, pair->bg); } GColors * color_overall_lbls (void) { return get_color (COLOR_OVERALL_LBLS); } GColors * color_overall_vals (void) { return get_color (COLOR_OVERALL_VALS); } GColors * color_overall_path (void) { return get_color (COLOR_OVERALL_PATH); } GColors * color_panel_header (void) { return get_color (COLOR_PANEL_HEADER); } GColors * color_panel_desc (void) { return get_color (COLOR_PANEL_DESC); } GColors * color_panel_active (void) { return get_color (COLOR_PANEL_ACTIVE); } GColors * color_selected (void) { return get_color (COLOR_SELECTED); } GColors * color_progress (void) { return get_color (COLOR_PROGRESS); } GColors * color_default (void) { return get_color (COLOR_DEFAULT); } GColors * color_error (void) { return get_color (COLOR_ERROR); } static int get_color_item_enum (const char *str) { return str2enum (CSTM_COLORS, ARRAY_SIZE (CSTM_COLORS), str); } /* Extract color from the given config string. * On success, returns a color between -1 (terminal default * foreground/background) to 255. * On error, returns -2 on error */ static int extract_color (char *color) { char *sEnd; int col = 0; if (strncasecmp (color, "color", 5) != 0) return -2; color += 5; col = strtol (color, &sEnd, 10); if (color == sEnd || *sEnd != '\0' || errno == ERANGE) return -2; /* ensure used color is supported by the terminal */ if (col > COLORS) FATAL ("Terminal doesn't support color: %d - max colors: %d", col, COLORS); return col; } static int parse_bg_fg_color (GColorPair * pair, const char *value) { char bgcolor[COLOR_STR_LEN] = "", fgcolor[COLOR_STR_LEN] = ""; int ret = 0; if (sscanf (value, "%8[^:]:%8[^ ]", fgcolor, bgcolor) != 2) return 1; if ((pair->bg = extract_color (bgcolor)) == -2) ret = 1; if ((pair->fg = extract_color (fgcolor)) == -2) ret = 1; return ret; } static void locate_attr_color (GColors * color, const char *attr) { if (strstr (attr, "bold")) color->attr |= A_BOLD; if (strstr (attr, "underline")) color->attr |= A_UNDERLINE; if (strstr (attr, "normal")) color->attr |= A_NORMAL; if (strstr (attr, "reverse")) color->attr |= A_REVERSE; if (strstr (attr, "standout")) color->attr |= A_REVERSE; if (strstr (attr, "blink")) color->attr |= A_BLINK; } static int parse_attr_color (GColors * color, const char *value) { char *line, *ptr, *start; int ret = 0; line = xstrdup (value); start = strchr (line, ' '); if ((!start) || (!*(start + 1))) { LOG_DEBUG (("attempted to parse color attr: %s\n", value)); goto clean; } start++; while (1) { if ((ptr = strpbrk (start, ", ")) != NULL) *ptr = 0; locate_attr_color (color, start); if (ptr == NULL) break; start = ptr + 1; } clean: free (line); return ret; } static int parse_module_color (GColors * color, const char *value) { char *line = xstrdup (value), *p; p = strrchr (line, ' '); if (!p || !*(p + 1)) { LOG_DEBUG (("attempted to parse color module: %s\n", value)); goto clean; } if ((color->module = get_module_enum (p + 1)) == -1) LOG_DEBUG (("attempted to parse color module: %s\n", value)); clean: free (line); return 0; } static int find_color_in_list (void *data, void *color) { GColors *new_color = color; GColors *old_color = data; if (old_color->item != new_color->item) return 0; if (old_color->module != new_color->module) return 0; return 1; } static int find_pair_in_list (void *data, void *color) { GColorPair *new_color = color; GColorPair *old_color = data; if (old_color->fg != new_color->fg) return 0; if (old_color->bg != new_color->bg) return 0; return 1; } static int find_color_item_in_list (void *data, void *needle) { GColors *color = data; GColorItem *item = needle; return color->item == (GColorItem) (*(int *) item) && color->module == -1; } static int find_color_item_module_in_list (void *data, void *needle) { GColors *color = data; GColors *item = needle; return color->item == item->item && color->module == item->module; } GColors * get_color (GColorItem item) { GColorItem normal = COLOR_NORMAL; GSLList *match = NULL; if ((match = list_find (color_list, find_color_item_in_list, &item))) return (GColors *) match->data; if ((match = list_find (color_list, find_color_item_in_list, &normal))) return (GColors *) match->data; /* should not get here */ FATAL ("Unable to find color item %d", item); } GColors * get_color_by_item_module (GColorItem item, GModule module) { GColors *needle = new_gcolors (), *color = NULL; GSLList *match = NULL; needle->module = module; needle->item = item; /* find color for specific item/module pair */ if ((match = list_find (color_list, find_color_item_module_in_list, needle))) color = match->data; /* attempt to find color by item (fallback) */ if (!color) color = get_color (item); free (needle); return color; } static void parse_color_line (GColorPair * pair, GColors * color, char *line) { char *val; int item = 0; size_t idx; /* key */ idx = strcspn (line, " \t"); if (strlen (line) == idx) FATAL ("Malformed color key at line: %s", line); line[idx] = '\0'; if ((item = get_color_item_enum (line)) == -1) FATAL ("Unable to find color key: %s", line); /* value */ val = line + (idx + 1); idx = strspn (val, " \t"); if (strlen (line) == idx) FATAL ("Malformed color value at line: %s", line); val = val + idx; /* get background/foreground color */ if (parse_bg_fg_color (pair, val) == 1) FATAL ("Invalid bg/fg color pairs at: %s %s", line, val); if (parse_attr_color (color, val) == 1) FATAL ("Invalid color attrs at: %s %s", line, val); if (parse_module_color (color, val) == 1) FATAL ("Invalid color module at: %s %s", line, val); color->item = item; } static void parse_color (char *line) { GSLList *match = NULL; GColors *color = NULL; GColorPair *pair = NULL; color = new_gcolors (); pair = new_gcolorpair (); parse_color_line (pair, color, line); if (pair_list == NULL) { pair_list = list_create (pair); } else if ((match = list_find (pair_list, find_pair_in_list, pair))) { free (pair); pair = (GColorPair *) match->data; } else { pair->idx += list_count (pair_list); pair_list = list_insert_prepend (pair_list, pair); } color->pair = pair; if (color_list == NULL) color_list = list_create (color); else if (list_find (color_list, find_color_in_list, color)) free (color); else color_list = list_insert_prepend (color_list, color); if (!match) { init_pair (color->pair->idx, color->pair->fg, color->pair->bg); } free (line); } static void parse_colors (const char *colors[], size_t n) { char *line; size_t i; for (i = 0; i < n; ++i) { line = strdup (colors[i]); /* did not find a valid format */ if (strchr (line, ':') == NULL) { free (line); continue; } parse_color (line); } } static void add_default_colors (void) { if (COLORS < 8) parse_colors (nocolors, ARRAY_SIZE (nocolors)); if (COLORS == 8 && COLORS <= 16 && conf.color_scheme == STD_GREEN) parse_colors (colors8_green, ARRAY_SIZE (colors8_green)); else if (COLORS >= 8 && COLORS <= 16) parse_colors (colors8_mono, ARRAY_SIZE (colors8_mono)); if (COLORS > 16 && conf.color_scheme == STD_GREEN) parse_colors (colors256_green, ARRAY_SIZE (colors256_green)); else if (COLORS > 16) parse_colors (colors256_mono, ARRAY_SIZE (colors256_mono)); } void set_colors (int force) { errno = 0; if (conf.color_idx > 0 && !force) parse_colors (conf.colors, conf.color_idx); else add_default_colors (); } �������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/gmenu.c��������������������������������������������������������������������������0000644�0000000�0000000�00000006431�12573351525�012264� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * gmenu.c -- goaccess menus * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "gmenu.h" #include "xmalloc.h" #include "ui.h" /* allocate memory for a new GMenu instance */ GMenu * new_gmenu (WINDOW * parent, int h, int w, int y, int x) { GMenu *menu = xmalloc (sizeof (GMenu)); memset (menu, 0, sizeof *menu); menu->count = 0; menu->idx = 0; menu->multiple = 0; menu->selectable = 0; menu->start = 0; menu->status = 0; menu->h = h; menu->w = w; menu->x = x; menu->y = y; menu->win = derwin (parent, menu->h, menu->w, menu->y, menu->x); return menu; } /* render an actual menu item */ static void draw_menu_item (GMenu * menu, char *s, int x, int y, int w, int checked, GColors * (*func) (void)) { char check, *lbl = NULL; if (menu->selectable) { check = checked ? 'x' : ' '; lbl = xmalloc (snprintf (NULL, 0, "[%c] %s", check, s) + 1); sprintf (lbl, "[%c] %s", check, s); draw_header (menu->win, lbl, "%s", y, x, w, (*func)); free (lbl); } else { draw_header (menu->win, s, "%s", y, x, w, (*func)); } } /* displays a menu to its associated window */ int post_gmenu (GMenu * menu) { GColors *(*func) (void); int i = 0, j = 0, start, end, height, total, checked = 0; if (menu == NULL) return 1; werase (menu->win); height = menu->h; start = menu->start; total = menu->size; end = height < total ? start + height : total; for (i = start; i < end; i++, j++) { func = i == menu->idx ? color_selected : color_default; checked = menu->items[i].checked ? 1 : 0; draw_menu_item (menu, menu->items[i].name, 0, j, menu->w, checked, func); } wrefresh (menu->win); return 0; } /* main work horse of the menu system processing input events */ void gmenu_driver (GMenu * menu, int c) { int i; switch (c) { case REQ_DOWN: if (menu->idx >= menu->size - 1) break; ++menu->idx; if (menu->idx >= menu->h && menu->idx >= menu->start + menu->h) menu->start++; post_gmenu (menu); break; case REQ_UP: if (menu->idx <= 0) break; --menu->idx; if (menu->idx < menu->start) --menu->start; post_gmenu (menu); break; case REQ_SEL: if (!menu->multiple) { for (i = 0; i < menu->size; i++) menu->items[i].checked = 0; } if (menu->items[menu->idx].checked) menu->items[menu->idx].checked = 0; else menu->items[menu->idx].checked = 1; post_gmenu (menu); break; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/opesys.h�������������������������������������������������������������������������0000664�0000000�0000000�00000002032�12573351525�012473� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef OPESYS_H_INCLUDED #define OPESYS_H_INCLUDED #define OPESYS_TYPE_LEN 10 typedef struct GOpeSys_ { char os_type[OPESYS_TYPE_LEN]; int hits; } GOpeSys; char *verify_os (const char *str, char *os_type); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/output.h�������������������������������������������������������������������������0000644�0000000�0000000�00000022446�12573351525�012522� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include <config.h> #endif #ifndef OUTPUT_H_INCLUDED #define OUTPUT_H_INCLUDED #define OUTPUT_N 10 #define REP_TITLE "Server Statistics" #include "commons.h" #include "parser.h" #define GO_LOGO "" \ "iVBORw0KGgoAAAANSUhEUgAAAMgAAAAeCAYAAABpP1GsAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI" \ "WXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wIOBC8F0NxENwAAFlpJREFUeNrtfHmUHdV55+8udWt9" \ "S+9amlavkrq1IDVSa7FGaAEbMIYBDIaxjBPZeAKYY4yTmDkmiWMnZxIPYYkdMoODDsYiTjAYRgZr" \ "hKRuhCy0oD4IgUBqtVpCQmrUWrrf67fVq7r3zh+81zw1CtgTRraU/p3zTr+q993v3lv17V9VA2MY" \ "wxj+42KhZX3k74tt+989R319/cfSNDU1jd2M8xDkQt3YcsfBxkwGghAy17Kutwn5gkXIFE5IDQUG" \ "Qq37FfBWRuuu3lxu42Gl0kWFeTmb/a3nmzhxIrNtew7n/F5KaSkDBuDwO++88+10Oq3GRG5MQX4v" \ "MNUwSCVjs11Kf1XDWE0FYzAIGdmwAqAB5LXGsFJIK/XcU6nUdf+v8zU2NlY4jvNAPB6/1TRNaK3f" \ "v8CEQGt9LAiCP9i8efP6MZE7v0AvxE3VUEqqOZ8VZ2zbVCFqJnIOkxDQgkUgBbPOATiEoIaxoMEw" \ "guL4BR8Rli0dFZI1NDQAAEzTjDDGbrAsC5RSMMbAGCt+rzAM4/MA0NHRMVqx/s25Wlpazpjj48K3" \ "+vp6TJs27eyh5OLFZ4R5HzVvKc/flO5CBb+QNrPAsrA1l8M004yahDzRwLnhEAL98UPTAH5RPNia" \ "y2GBZc21Kf2vNiHzDUKqKTAkte7Oab0awAu76+ow8/BhHDx4EJWVlQLAYsuyXErpiPcogUkpXVJX" \ "V2fu2LHDLwpeX18f8vm82dTU9CXDML5oGEYjpZRrrQ8qpV7L5/OrAWw/ePAgGhoapnLOvyWEWMAY" \ "qyaEnFZK7ZVS/vLIkSNPAsgdOnQI9fX11S0tLXdxzi/nnNdRSgOt9bYTJ048ceDAgReKC1JKxZqb" \ "m79mGMb1nPNJBbpDWutjUsptuVyuE8AbSqmyAt11hmFMIoT4Wut3lFJHlVJbc7lc5/jx4/f29/fL" \ "sRDrPMA002TjGLtqHGNr6jgvVY5jCvjqDwYH1wLArdFoWYTSFhNYTIE2X+tv/TCRGFxgWa5FyN9X" \ "MrZyfInnKYZlea2RUOqVg/n8VZtyuUTBitbYtv1EZWXlpw3DAIC01vp1pVQrY6ysMPxEGIbf6urq" \ "+unMmTOxe/duNDQ01Jmm+VQ0Gp3neR4opcWQDFprBEGAbDa7cXBw8MeO4/xLPB6HEAKEvH/btNaQ" \ "UsL3/f5MJnPr8PCwadv2mlgsRi3LAiFkhF8Yhshms2t6e3tv8Dyv1nGcVdFodKnneWfQaa2hlEIY" \ "hlv6+/u/LYT4XjQaXea67lnpgiDYMjg4eO2ePXtOjYVY5wHKCbEE8Ok4Y6WnByVwzQ8GB9feE48D" \ "AJ5IJgeV1jseGBq6//6hoZU/TCQG55qm61D6J7WGsbLJMOAQAjYqLLPfD8kWzDDNNUXmQogKwzAu" \ "LygHAKSllGsymczmEm9STgi5FgB2796N+vr6cZZl3V9eXj4vHo+DMTYi+IQQUEphmuYp13XDysrK" \ "JysrK1EU+hHrRgg45/A870AQBHnP835RVVVFXdcdUbYinWEYiEQiV7S2tq6yLOvySCSyNBaLfYiO" \ "UgrOeSCE2C+EmBGJRJZFo9F/i07atv3qnj17Ti1atGgsxDofYFLKDUJm2IUkvPCn938MDnYvtCy+" \ "I5frWOY4V1Gtw/35PC77IKfIg5BklNK7x32gXApAjwaeU0A7AT5dyGOIS+nUr8diV/6ouflFks1+" \ "xrIsUrSuAIaTyeRPlFKnLcu6pqA4jFJ68Zw5c6p37tw5YNt2q23bN7quWxyjAOwF8LTWOqa1XgBg" \ "mtbatm2bMcZGeAN4GsARpdQMAK1Syj2Msas9zxOGYUBrrQCszefzdyil2jjnD3LOpxJChBDiirKy" \ "shbrgzxrGMBjQRD8mBAyi1K6GMC4XC73hmmaHfYH1ycB4NEgCB4nhLQX6MYD2AQAv/71r8cU5LxQ" \ "EIAIQlz6gaUNJbCvoCk8xtjCizj/jvvh3CQTAq+EWsf4B8p1LKv1vIeHhpI3e16ZR+lTFYxdVuAc" \ "sYDLQcgWSulNtm0XBTgEsKu7u/u9Sy655JVcLgchBLTWIIRURKPRmwH8iDE2z7ZtlCjVm5lMZs6W" \ "LVtGigUXX3xxk23bWz3PK546DeD769evf6h04ZMnT57sed4zlmUVeb3NGPvmpk2bDgM43NHRUWPb" \ "9uOmaYJSWuW6blVJrhQJguCWRCJhpVKpZ/fv3387AF1XVzehurr6gRK6WBAEKxKJhDs8PPxsb2/v" \ "10YKF0uXoqura6yKdR4lVXLUKa8QG4AWrIIgZPTHMQm5zKa0VHEOPzw0lASAfimDIaW25LUuhlyC" \ "UNoUB2qEEPPZB15nkBDyZOH7O0qpF5UaaX+UEUI+A4BTShsL1h4AfK319i1btgRLliwZmVxrXRaG" \ "YRWlI7dpQEq57kNWjnOPEFJbpNNaT0un0z3t7e26vb1da60fp5TqQniUIITsLVkTDMOoKS8v/6MJ" \ "Eyasmz9/vpw9e/YPgyDIE0JeDsNwJLQyDGN8eXn5HRMnTlxfoHuooaEheqEqxwXpQRQgCXBQAfMK" \ "YsUJMG++YYi0UmEFpXsV8LQEAg1UU2B50dewwmek0AOMNPxyWqtAaz/UGigITEhIdbVSnxvlCary" \ "+fwvLrnkEmitz8gtAIBSOqW9vX2BUoqXCL7SWvsA8NJLL5XSshIaANBhGPqj98wYo5RSq7gGQggs" \ "y0JJeAStNSmGckqpZ4MgsIUQdxf5U0ohhIAQgjiO83XP82oHBgZuF0LMkVL+4VnoqOM433Bd96KD" \ "Bw/eMNYHOU+Q0jofAtvCklIrASrmuO6ju30/fD6dfv6RROLGHwwO/pf9+fz3h5Qqep1QA4dKvAcl" \ "wEgDQhBiaeBiVkxUgXzAecozzZtLG4MFS4uKigpUVlaiJDwqosJ13c9prXtKxtgA2s8i+KcKOUJR" \ "yGOU0rmFsKpU+DOEkP4SfoeVUitzudzMXC43J5fLzQnDcJaUclY2m73a9/0HNm/e/E3f95uCIPg7" \ "pdTh0vUzxmCaZltNTc3MLVu2rPR9f3IQBA8qpd4dtT5YljX50ksvXXyhKsgF2Um/JRKZ4FJ6oIpS" \ "q3jbJYDTUvqnldoaam1SoNWhNF7DmLYJIRrIhsD2vNZLivmJBnIJKX/+ehA8YhOyrJKxv27gvHjR" \ "ho7H4y/uq629yf2Y570+5OWU2n7q1Kk/9Txvk+M4xbJpJpPJ/OuxY8ceoZTWcc6vNE3z+lgsVl6k" \ "AYAwDPedPHny3mQy+Z5hGIsL/Ykqz/N2OI5zS8GLyDAMO48ePfoX+Xw+zxirNQzjaiHEFYZhbMjl" \ "coeEEPcBeDiZTP6kr6/vjUWLFl3GGFtfouyD2Wx2KJPJlEspHx0eHv5JX1/fnkWLFn2WMfZ8Cd0+" \ "AN9Yv379ujEFOU/wWdc1Y5TeMZ7zB4xRvxUEf6R0WwI/ANYnpTxWxtjXSnsfaaUgAUQoHQnBQsbe" \ "2zZ58gvMML4ihCjykFrrE2fxzCYhJFZyfCidTt+nlPpKJBJZWuIJ4Ps+lFIwDAOc8wBACkCMEDLC" \ "MwgCBEEwEu4QQo75vr+dMXZdsSCgtUY+nx+h45zDMAxIKQez2exBx3HaKaXwfR+5XA5aa7iui1Jv" \ "WKiG0SKvXC4HAHAcp5Ruq5Tyi52dnQfHcpDzAFe7Lp5Pp/2Vkcg/DEkZL2Psz/koi3A2q6CBHQz4" \ "y6RS73FClsYobSnGoJEz8wAQrY8O2PbdvpQPxxyntCS8dsOGDZ8bzXvevHmtQoi3SipdVaZpXpxM" \ "Ju/yfX+baZpesb9gnemNDAApKWUXpfT6kmQZJT0XAIhzzo8GQfAdxthfF3sWpmnCNM0znBdjTNu2" \ "3VIsKliWNdJfKSoWgNNKqf1a6+mMMbe4rrPQZQD8qrOz8+CyZcvQ2dk5loP8vuP5dBo3eR5WDQ/n" \ "H0sm/2JQylk+8IIE8mdRim4NfDcAJv3t4OBiAN3/mkq9m1Jq5rBS/y0Ajo4qBSc18HdHOZ+1s6yM" \ "UGBCSRKttdZrz7ambDY77Pv+qyWVI5cxdlN3d/dbvu+35PP5x5RSuVHDdmit7zxy5Mikt99++6Zs" \ "NntjGIb7Rj3GMqi1fkxrvbCrq+uu4eHh+3O53PVSyt1nedxlvdb6ug0bNlSkUqnx+Xz+dinlRqVU" \ "pui9Cn+7tda3bdy4cX4qlZqQz+e/LqXsUkplR9Ht0Frfsn79+r8CcEEqxwWP22KxM44vdxzx1Wi0" \ "5guue8YTh3cXuuuF/AUPVVefMW5lNFpzqWn+Rt728ssvP+N41qxZv/F6Z86cac+bN6+s9NzSpUvx" \ "qU99arRHqhZCjGjmsmXLAOBDdB0dHdUdHR3R0nNLliz5EF1ZWRmbP39+xcfNW1tby89GN4YxjGEM" \ "YxjDGM5bnO2diNbW1t/JHA0NDV5jY+MNzc3N7f+/9z36fYvW1taRGkNzc/MZv02dOvWcVCV/V/P+" \ "LvB7u7GmpiaTEPLHnPPSco0vpXzPsqxVlNIlr7/++qZPet4JEyYYnufdaJrmk5zzL7722mv/XF9f" \ "zwDUAogPDQ3trq2tbWaM9cRisQdffvnle86BQE42DOMF0zQHd+3adcYbVy0tLdM55//HNM2+Xbt2" \ "nbOGXUtLyyLDMJ4TQry0a9euz1+oCvJ7W+YVQoyzbfuvysrKSisnb58+ffpn8Xg85/s+b2lpuUcp" \ "9dyBAwf6Ghsbr+WczwjD8Km+vr6egpLZAL5EKQ2VUkOMsXd93z9sGMaXKaXHenp6ftrQ0GAQQj7D" \ "OZ+ilHqbUtohhHBisVjCtu23AIAxNtU0zZ9FIpHm8vLy65LJ5FtCiO8lk8l1LS0tKwEYSqmjlNKa" \ "bDb7vGman6eU7t6/f//mhoaGRsbYTZTSvp6enqcKAj8ewB2c884gCE5SShfncrlVpml+lXN+aO/e" \ "vS80NTV9gTE20ff9J03TZKZpmrFYbKC1tfWLQRBkent7nwUA0zQt0zSN8vLy7sKeb2aMNSilXuzt" \ "7e1ubGxsoJReSQgZKHTih3p6ep4BgMbGxqbCbwmttUMpHZBS9lBKrwbQo7WuopR2Z7PZvUKIayil" \ "ca31ECGECyGytm1nPM+jM2bM+Ibv+51BEJzinN9MKe0Pw7CPENKC99tOCUrpjlwulxdCfJ4QwoMg" \ "eIpSWk0pvYIQclprPcw5f2Xv3r3HzzsFWbFiBQHwZQD152BNEsDW1atXbwBA5s2b92PP827ZuHGj" \ "V6gKPU0ptUzT3DBu3LhAa72Uc77L87z7HMfp0lrfF41GJ+3ateu4bdsRzvkD8XjcDcNQhmH4tVQq" \ "1RWLxd5ljIny8vJFJ0+efDYSifwyFosFUkqDUprK5/Mvcc79IAjejUajwjTNpdFodEYkEkEQBPf7" \ "vn+v67p3CyEOUUq/F41GJ0opUWy8McZgGMbr2Wz2Rsdx9pSVlR2ilLKKiopLtm7d+m3P88oYY192" \ "HKdmaGjIi0Qic1Op1Huc8791Xfc+SukjjuPc5jhOt9b6K0NDQ3cwxi6ilF5UVVV1FaX0aFVVVWbr" \ "1q3rOOcOIaQ6CAI2bdq0VY7j/KHjOEcA3O553oNBEFwTi8WWcM6hlAo45w/19PQ809DQMNW27VWx" \ "WGxB4aHJrNb6x4lE4iLXdf/GNE1IKUEI2XD8+PFnPM/7R8/zlFKKMsbWJJPJNZTSOAAajUa/zhir" \ "OXny5GHHce4VQvyvXC53p+M4nyqUwbcnEokfGIbxB47jLLZt+4RS6qpEIvGibdsPOo6DMAzXO46z" \ "uaOjY7lSajnOUpb/pG0wgM2rV69e+0l4kKKCLDkHChIAeBDAhra2NjebzbZ6npcAgLa2tohSqpZS" \ "epgQchWANznnfiwWu9V13TeGh4e3CSH+U0VFRTuAtYQQhzHmCiH+dxAEd+Xz+S/FYjGTMbYpnU5P" \ "9zxvgeu6JBqNDkgpZ0spHxFCfFZKySmlYWdn50kAiEajTwO4W2u97qWXXrpz5syZ3zYMI6eUOkYp" \ "reGcPxYEwRuGYfyZbdu3BUHwp5RSu7y8/FrP8xQhZFMmk5kdiUSmA4BSymeMDVBKZ7muO9227UBr" \ "fZdhGAdTqdQrlmXdF4lEtqZSqTcMw7ghGo1eIaVMcc6/mUql3jVN8+loNOoVeDVxzk9rrbXjOFdH" \ "o9E/TyQSa0zT3B6NRi/1fX+G53l/PDQ0tFYI8YYQYgAAXNedaJrmbM/z7k0kEuuFEDsZYz5jrIlz" \ "vocQ8jeEkNsopWWxWOxqx3E2ZLPZe4QQjzPGPK21wRhLaq1fVUrFGWMrXNd9x7KsHZs3b/6zcePG" \ "uZMmTXrItu1rHMf5bn9/fxCLxZa4rrspk8kEhmG0RSKRgFI6aJrmdw8fPvyP8+fPt5VSVwL41jly" \ "EBEAH6kg9LdQEO8cLdrA+w/vgVJKCSHjtdZ7C6EOI4Q0AtjV39+vMpkMKKUHGGO1jLGEbduCc75K" \ "SrkFAA3DcCrnXBJCntq2bdvxIAhqDMNQjLFhx3FeU0r9TyFEJWOMDQ4OtqXT6bla6yNa67jWel9x" \ "Qdls1s3n801a68qpU6fOB1DHOVf5fJ4zxpTW+sDw8HCzlDKbSqWOZzKZCVrrQ5zzWiGE5Jwnbdve" \ "ppT6JwAIwzAPIMsYm2vb9jtKqT7LsuYKIV7M5XKnGWNljLGMZVk5xtg/h2F4kjFmpNPpBZlM5ptK" \ "qROU0jcACELIeErpsNb6KOe8TErZls/nby+EfK9yzqO+71/r+/7DSqkBSmkvABiGwTnnIgiCi9Lp" \ "9M1BEBxXSp0mhDRxzo8PDAz0pdPpiFLqPcaYRym1kslkezabbVRKnSSEVFJKh8Mw3B6GYTel9KJI" \ "JFJnmuY/RaPR6vLy8ie11l8G8Oi2bds2u647kXPucc5D0zSPEUKe0VonAfQSQp7v6+sLCt7GPocR" \ "lP3vDrFWrFiB1atXSwBzz3n8xzknhDRSSncCACHEZoxVEUL6AbQWwoZuKeV/l1J+hxCySCn1xMsv" \ "v5ysra01CCF1jDGmlHpXSpkvKM9NjLF7tNZvSil/EYZhbxiG11VUVPwcQJwQsh1AOyHk5yNWhNIM" \ "53w/IeTG8vLyQ9lsdialFEEQxAzDEEEQ9FNKr2SM8VQqNeC6bh1j7GcA/kVKeWthvlfDMFxdsPoB" \ "gAQhRCqlns7lcte7rqsppc/4vv9eNBpdJaVcCWBJGIaPB0FQJoQwhRCfrqioqOWc/8natWt76uvr" \ "awgh0xljhpRyA4BJhJA7ysrKhhhj97755puPNzc3+4yxqysqKmoIIckwDA8BgJRyL6X0VwDuLCsr" \ "SwghTqVSqRSldDpjbFcYhooQMo1zviafzx+VUj5aXV19CSEESqlMYd4wnU4fUEoNK6Vgmubz69at" \ "e66tre1213WvjcfjCILgvtbW1rknTpz4I9d1fyml/M8ABoMg+CmAGsMwlJTyFACsXr06CeDOwuec" \ "YMWKFSjMfX5VD9rbz6ygLl++/DceO7oDDACXXnrpb72GZcuWkTlz5nyi+5o9e/YnwmfhwoUfW4Gc" \ "MmXK3La2trc6Ojp2LFy4UC1fvvyZT/o+TZ8+/ftz5szRy5Yt+9FH0Z3l0ZczUPqi2FiZdwznBNOm" \ "TavyPO8yx3FaCCFvaq2f6+rq+kT+u+OUKVOwb98+zJ07d6LWum7nzp1bL7vsMmzYsGHswo9hDP9R" \ "8H8BM/XVggoDbGIAAAAASUVORK5CYII=" void output_html (GLog * logger, GHolder * holder); #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/gstorage.h�����������������������������������������������������������������������0000664�0000000�0000000�00000007406�12573351525�012776� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef GSTORAGE_H_INCLUDED #define GSTORAGE_H_INCLUDED #include "commons.h" typedef struct GStorageMetrics_ { /* Maps keys (string) to numeric values (integer). * This mitigates the issue of having multiple stores * with the same string key, and therefore, avoids unnecessary * memory usage (in most cases). * HEAD|/index.php -> 1 * POST|/index.php -> 2 * Windows XP -> 3 * Ubuntu 10.10 -> 4 * GET|Ubuntu 10.10 -> 5 * Linux -> 6 * 26/Dec/2014 -> 7 * Windows -> 8 */ void *keymap; /* Maps numeric keys to actual key values (strings), e.g., * 1 -> /index.php * 2 -> /index.php * 3 -> Windows XP * 4 -> Ubuntu 10.10 * 5 -> Ubuntu 10.10 * 7 -> 26/Dec/2014 */ void *datamap; /* Maps numeric keys of root elements to actual * key values (strings), e.g., * 6 -> Linux * 8 -> Windows */ void *rootmap; /* Maps a string key made from the numeric key of the IP/date/UA and the * numeric key from the data field of each module to numeric autoincremented * values. e.g., 1 -> unique visitor key (concatenated) with 4 -> data key = 14 * "14" -> 1 * "15" -> 2 */ void *uniqmap; /* Numeric key to a structure containing hits/root elements, e.g., * If root does not exist, it will have the value of 0 * 1 -> hits:10934 , root: 0 , * 2 -> hits:3231 , root: 0 , * 3 -> hits:500 , root: 8 , * 4 -> hits:200 , root: 6 , * 5 -> hits:200 , root: 6 , * 5 -> hits:2030 , root: 0 , */ void *hits; /* Maps numeric keys made from the uniqmap store to autoincremented values * (counter). * 10 -> 100 * 40 -> 56 */ void *visitors; /* Maps numeric data keys to bandwidth (in bytes). * 1 -> 1024 * 2 -> 2048 */ void *bw; /* Maps numeric data keys to cumulative time served (in usecs/msecs). * 1 -> 187 * 2 -> 208 */ void *cumts; /* Maps numeric data keys to max time served (in usecs/msecs). * 1 -> 1287 * 2 -> 2308 */ void *maxts; /* Maps numeric data keys to string values. * 1 -> GET * 2 -> POST */ void *methods; /* Maps numeric data keys to string values. * 1 -> HTTP/1.1 * 2 -> HTTP/1.0 */ void *protocols; /* Maps numeric unique user-agent keys to the * corresponding numeric value. * 1 -> 3 * 2 -> 4 */ void *agents; } GStorageMetrics; typedef struct GStorage_ { GModule module; GStorageMetrics *metrics; } GStorage; extern GStorage *ht_storage; GMetrics *new_gmetrics (void); GStorageMetrics *get_storage_metrics_by_module (GModule module); GStorageMetrics *new_ht_metrics (void); GStorage *new_gstorage (uint32_t size); int *int2ptr (int val); uint64_t *uint642ptr (uint64_t val); void *get_storage_metric_by_module (GModule module, GMetric metric); void *get_storage_metric (GModule module, GMetric metric); void set_data_metrics (GMetrics * ometrics, GMetrics ** nmetrics, int processed); #endif // for #ifndef GSTORAGE_H ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/tcabdb.h�������������������������������������������������������������������������0000664�0000000�0000000�00000006232�12573351525�012376� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include <config.h> #endif #ifndef TCABDB_H_INCLUDED #define TCABDB_H_INCLUDED #include <tcadb.h> #include "commons.h" #include "gstorage.h" #include "parser.h" #define DB_PARAMS 256 /* tables for the whole app */ extern TCADB *ht_agent_keys; extern TCADB *ht_agent_vals; extern TCADB *ht_general_stats; extern TCADB *ht_hostnames; extern TCADB *ht_unique_keys; /* *INDENT-OFF* */ GRawData *parse_raw_data (void *db, int ht_size, GModule module); uint32_t get_ht_size_by_metric (GModule module, GMetric metric); uint32_t get_ht_size (TCADB *adb); int agent_list_to_store(void); int find_host_agent_in_list (void *data, void *needle); int ht_inc_int_from_int_key (TCADB * adb, int data_nkey, int inc); int ht_inc_int_from_str_key (TCADB * adb, const char *key, int inc); int ht_inc_u64_from_int_key (TCADB * adb, int data_nkey, uint64_t inc); int ht_inc_u64_from_str_key (TCADB * adb, const char *key, uint64_t inc); int ht_insert_agent_key (const char *key); int ht_insert_agent_val(int nkey, const char *key); int ht_insert_hit (TCADB *adb, int data_nkey, int uniq_nkey, int root_nkey); int ht_insert_keymap (TCADB * adb, const char *value); int ht_insert_nkey_nval (TCADB * adb, int nkey, int nval); int ht_insert_str_from_int_key (TCADB *adb, int nkey, const char *value); int ht_insert_uniqmap (TCADB *adb, char *uniq_key); int ht_insert_unique_key (const char *key); int ht_max_u64_from_int_key (TCADB * adb, int data_nkey, uint64_t newval); char *get_host_agent_val (int agent_nkey); char *get_hostname (const char *host); char *get_node_from_key (int data_nkey, GModule module, GMetric metric); char *get_root_from_key (int root_nkey, GModule module); char *get_str_from_int_key (TCADB *adb, int nkey); int get_int_from_keymap (const char * key, GModule module); int get_int_from_str_key (TCADB *adb, const char *key); int get_num_from_key (int data_nkey, GModule module, GMetric metric); uint64_t get_cumulative_from_key (int data_nkey, GModule module, GMetric metric); unsigned int get_uint_from_str_key (TCADB * adb, const char *key); void *get_host_agent_list(int agent_nkey); void free_agent_list(void); void free_db_key (TCADB *adb); void free_storage (void); void init_storage (void); #ifdef TCB_MEMHASH int ht_insert_host_agent (TCADB * adb, int data_nkey, int agent_nkey); #endif GSLList * tclist_to_gsllist (TCLIST * tclist); /* *INDENT-ON* */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/commons.h������������������������������������������������������������������������0000664�0000000�0000000�00000012357�12573360016�012632� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include <config.h> #endif #ifndef COMMONS_H_INCLUDED #define COMMONS_H_INCLUDED #ifdef HAVE_LIBGEOIP #include <GeoIP.h> #endif #include <time.h> #include <stdint.h> /* Remove the __attribute__ stuff when the compiler is not GCC. */ #if !__GNUC__ #define __attribute__(x) /**/ #endif #define GO_UNUSED __attribute__((unused)) #define GO_VERSION "0.9.4" #define GO_WEBSITE "http://goaccess.io/" struct tm *now_tm; #define INT_TO_PTR(i) ((void *) (long) (i)) #define PTR_TO_INT(p) ((int) (long) (p)) /* Processing time */ extern time_t end_proc; extern time_t timestamp; extern time_t start_proc; /* resizing */ extern size_t real_size_y; extern size_t term_h; extern size_t term_w; #ifdef DEBUG #define LOG_DEBUG(x, ...) do { dbg_fprintf x; } while (0) #else #define LOG_DEBUG(x, ...) do { } while (0) #endif /* invalid requests log */ #define LOG_INVALID(x, ...) do { invalid_fprintf x; } while (0) #ifdef HAVE_LIBGEOIP #define TOTAL_MODULES 13 #else #define TOTAL_MODULES 12 #endif #define DATE_TIME 20 #define DATE_LEN 12 /* date length */ #define HOUR_LEN 3 /* hour length */ #define REQ_PROTO_LEN 9 #define REQ_METHOD_LEN 8 typedef enum { TYPE_IPINV, TYPE_IPV4, TYPE_IPV6 } GTypeIP; typedef enum { REQUEST, REQUEST_METHOD, REQUEST_PROTOCOL } GReqMeta; typedef enum METRICS { MTRC_KEYMAP, MTRC_ROOTMAP, MTRC_DATAMAP, MTRC_UNIQMAP, MTRC_HITS, MTRC_VISITORS, MTRC_BW, MTRC_CUMTS, MTRC_MAXTS, MTRC_METHODS, MTRC_PROTOCOLS, MTRC_AGENTS, } GMetric; typedef enum MODULES { VISITORS, REQUESTS, REQUESTS_STATIC, NOT_FOUND, HOSTS, OS, BROWSERS, VISIT_TIMES, REFERRERS, REFERRING_SITES, KEYPHRASES, #ifdef HAVE_LIBGEOIP GEO_LOCATION, #endif STATUS_CODES, } GModule; typedef struct GMetrics { /* metric id can be used to identified * a specific data field */ uint8_t id; char *data; char *method; char *protocol; float percent; int hits; int visitors; /* holder has a numeric value, while * dashboard has a displayable string value */ union { char *sbw; uint64_t nbw; } bw; /* holder has a numeric value, while * dashboard has a displayable string value */ union { char *sts; uint64_t nts; } avgts; /* holder has a numeric value, while * dashboard has a displayable string value */ union { char *sts; uint64_t nts; } cumts; /* holder has a numeric value, while * dashboard has a displayable string value */ union { char *sts; uint64_t nts; } maxts; } GMetrics; typedef struct GSubItem_ { GModule module; GMetrics *metrics; struct GSubItem_ *prev; struct GSubItem_ *next; } GSubItem; typedef struct GSubList_ { int size; struct GSubItem_ *head; struct GSubItem_ *tail; } GSubList; typedef struct GHolderItem_ { GSubList *sub_list; GMetrics *metrics; } GHolderItem; typedef struct GHolder_ { GHolderItem *items; /* items */ GModule module; /* current module */ int idx; /* index */ int holder_size; /* total number of allocated items */ int ht_size; /* total number of data items */ int sub_items_size; /* total number of sub items */ } GHolder; typedef struct GEnum_ { const char *str; int idx; } GEnum; typedef struct GDataMap_ { int data; int uniq; int root; } GDataMap; typedef struct GAgentItem_ { char *agent; } GAgentItem; typedef struct GAgents_ { int size; struct GAgentItem_ *items; } GAgents; /* single linked-list */ typedef struct GSLList_ { void *data; struct GSLList_ *next; } GSLList; /* *INDENT-OFF* */ GAgents *new_gagents (void); GAgentItem *new_gagent_item (uint32_t size); float get_percentage (unsigned long long total, unsigned long long hit); int get_module_enum (const char *str); int has_timestamp (const char *fmt); int str2enum (const GEnum map[], int len, const char *str); void display_storage (void); void display_version (void); /* single linked-list */ GSLList *list_create (void *data); GSLList *list_find (GSLList * node, int (*func) (void *, void *), void *data); GSLList *list_insert_append (GSLList * node, void *data); GSLList *list_insert_prepend (GSLList * list, void *data); int list_count (GSLList * list); int list_foreach (GSLList * node, int (*func) (void *, void *), void *user_data); int list_remove_nodes (GSLList * list); void format_date_visitors (GMetrics * metrics); /* *INDENT-ON* */ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/json.h���������������������������������������������������������������������������0000644�0000000�0000000�00000001753�12573351525�012131� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include <config.h> #endif #ifndef JSON_H_INCLUDED #define JSON_H_INCLUDED #include "parser.h" void output_json (GLog * logger, GHolder * holder); #endif ���������������������goaccess-0.9.4/src/options.h������������������������������������������������������������������������0000664�0000000�0000000�00000001762�12573351525�012655� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef OPTIONS_H_INCLUDED #define OPTIONS_H_INCLUDED void cmd_help (void); void read_option_args (int argc, char **argv); void verify_global_config (int argc, char **argv); #endif ��������������goaccess-0.9.4/src/tcabdb.c�������������������������������������������������������������������������0000664�0000000�0000000�00000042430�12573351525�012371� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * tcabdb.c -- Tokyo Cabinet database functions * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #include <errno.h> #include <tcutil.h> #include <stdlib.h> #include <stdbool.h> #include <stdint.h> #include <string.h> #include "tcabdb.h" #include "tcbtdb.h" #ifdef HAVE_LIBGEOIP #include "geolocation.h" #endif #include "error.h" #include "sort.h" #include "util.h" #include "xmalloc.h" GStorage *ht_storage; /* tables for the whole app */ TCADB *ht_agent_keys = NULL; TCADB *ht_agent_vals = NULL; TCADB *ht_general_stats = NULL; TCADB *ht_hostnames = NULL; TCADB *ht_unique_keys = NULL; static int tc_adb_open (TCADB * adb, const char *params) { /* attempt to open the database */ if (!tcadbopen (adb, params)) return 1; return 0; } /* Close the database handle */ static int tc_db_close (TCADB * adb, char *dbname) { if (adb == NULL) return 1; /* close the database */ if (!tcadbclose (adb)) FATAL ("Unable to close DB: %s", dbname); /* delete the object */ tcadbdel (adb); #ifdef TCB_BTREE /* remove database file */ if (!conf.keep_db_files && !tcremovelink (dbname)) LOG_DEBUG (("Unable to remove DB: %s\n", dbname)); #endif free (dbname); return 0; } static TCADB * tc_adb_create (char *path) { char params[DB_PARAMS] = ""; TCADB *adb = tcadbnew (); #ifdef TCB_MEMHASH xstrncpy (params, path, DB_PARAMS); #endif #ifdef TCB_BTREE tc_db_get_params (params, path); #endif if (tc_adb_open (adb, params)) { free (path); LOG_DEBUG (("params: %s", params)); FATAL ("Unable to open an abstract database: %s", params); } free (path); return adb; } static char * get_dbname (const char *dbname, int module) { char *path = NULL; #ifdef TCB_MEMHASH (void) dbname; (void) module; path = alloc_string ("*"); #endif #ifdef TCB_BTREE char *db = NULL; path = tc_db_set_path (dbname, module); if (module >= 0) { db = xmalloc (snprintf (NULL, 0, "%s", path) + 1); sprintf (db, "%s", path); free (path); return db; } #endif return path; } static void init_tables (GModule module) { ht_storage[module].module = module; ht_storage[module].metrics = new_ht_metrics (); /* Initialize metrics hash tables */ ht_storage[module].metrics->keymap = tc_adb_create (get_dbname (DB_KEYMAP, module)); ht_storage[module].metrics->datamap = tc_adb_create (get_dbname (DB_DATAMAP, module)); ht_storage[module].metrics->rootmap = tc_adb_create (get_dbname (DB_ROOTMAP, module)); ht_storage[module].metrics->uniqmap = tc_adb_create (get_dbname (DB_UNIQMAP, module)); ht_storage[module].metrics->hits = tc_adb_create (get_dbname (DB_HITS, module)); ht_storage[module].metrics->visitors = tc_adb_create (get_dbname (DB_VISITORS, module)); ht_storage[module].metrics->bw = tc_adb_create (get_dbname (DB_BW, module)); ht_storage[module].metrics->cumts = tc_adb_create (get_dbname (DB_CUMTS, module)); ht_storage[module].metrics->maxts = tc_adb_create (get_dbname (DB_MAXTS, module)); ht_storage[module].metrics->methods = tc_adb_create (get_dbname (DB_METHODS, module)); ht_storage[module].metrics->protocols = tc_adb_create (get_dbname (DB_PROTOCOLS, module)); #ifdef TCB_MEMHASH ht_storage[module].metrics->agents = tc_adb_create (get_dbname (DB_AGENTS, module)); #endif #ifdef TCB_BTREE /* allow for duplicate keys */ ht_storage[module].metrics->agents = tc_bdb_create (DB_AGENTS, module); #endif } /* Initialize Tokyo Cabinet storage tables */ void init_storage (void) { GModule module; ht_agent_keys = tc_adb_create (get_dbname (DB_AGENT_KEYS, -1)); ht_agent_vals = tc_adb_create (get_dbname (DB_AGENT_VALS, -1)); ht_general_stats = tc_adb_create (get_dbname (DB_GEN_STATS, -1)); ht_hostnames = tc_adb_create (get_dbname (DB_HOSTNAMES, -1)); ht_unique_keys = tc_adb_create (get_dbname (DB_UNIQUE_KEYS, -1)); ht_storage = new_gstorage (TOTAL_MODULES); for (module = 0; module < TOTAL_MODULES; ++module) { init_tables (module); } } static void free_tables (GStorageMetrics * metrics, GModule module) { /* Initialize metrics hash tables */ tc_db_close (metrics->keymap, get_dbname (DB_KEYMAP, module)); tc_db_close (metrics->datamap, get_dbname (DB_DATAMAP, module)); tc_db_close (metrics->rootmap, get_dbname (DB_ROOTMAP, module)); tc_db_close (metrics->uniqmap, get_dbname (DB_UNIQMAP, module)); tc_db_close (metrics->hits, get_dbname (DB_HITS, module)); tc_db_close (metrics->visitors, get_dbname (DB_VISITORS, module)); tc_db_close (metrics->bw, get_dbname (DB_BW, module)); tc_db_close (metrics->cumts, get_dbname (DB_CUMTS, module)); tc_db_close (metrics->maxts, get_dbname (DB_MAXTS, module)); tc_db_close (metrics->methods, get_dbname (DB_METHODS, module)); tc_db_close (metrics->protocols, get_dbname (DB_PROTOCOLS, module)); #ifdef TCB_MEMHASH tc_db_close (metrics->agents, get_dbname (DB_AGENTS, module)); #endif #ifdef TCB_BTREE tc_bdb_close (metrics->agents, get_dbname (DB_AGENTS, module)); #endif } void free_storage (void) { GModule module; tc_db_close (ht_agent_keys, get_dbname (DB_AGENT_KEYS, -1)); tc_db_close (ht_agent_vals, get_dbname (DB_AGENT_VALS, -1)); tc_db_close (ht_general_stats, get_dbname (DB_GEN_STATS, -1)); tc_db_close (ht_hostnames, get_dbname (DB_HOSTNAMES, -1)); tc_db_close (ht_unique_keys, get_dbname (DB_UNIQUE_KEYS, -1)); for (module = 0; module < TOTAL_MODULES; ++module) { free_tables (ht_storage[module].metrics, module); } } uint32_t get_ht_size (TCADB * adb) { return tcadbrnum (adb); } uint32_t get_ht_size_by_metric (GModule module, GMetric metric) { TCADB *adb = get_storage_metric (module, metric); return get_ht_size (adb); } int ht_insert_keymap (TCADB * adb, const char *value) { void *value_ptr; int nkey = 0, size = 0, ret = 0; if ((adb == NULL) || (value == NULL)) return (EINVAL); if ((value_ptr = tcadbget2 (adb, value)) != NULL) { ret = (*(int *) value_ptr); free (value_ptr); return ret; } size = get_ht_size (adb); /* the auto increment value starts at SIZE (hash table) + 1 */ nkey = size > 0 ? size + 1 : 1; tcadbput (adb, value, strlen (value), &nkey, sizeof (int)); return nkey; } int ht_insert_uniqmap (TCADB * adb, char *uniq_key) { void *value_ptr; int nkey = 0, size = 0; if ((adb == NULL) || (uniq_key == NULL)) return (EINVAL); if ((value_ptr = tcadbget2 (adb, uniq_key)) != NULL) { free (value_ptr); return 0; } size = get_ht_size (adb); /* the auto increment value starts at SIZE (hash table) + 1 */ nkey = size > 0 ? size + 1 : 1; tcadbput (adb, uniq_key, strlen (uniq_key), &nkey, sizeof (int)); free (uniq_key); return nkey; } int ht_insert_nkey_nval (TCADB * adb, int nkey, int nval) { int sp = 0; if (adb == NULL) return (EINVAL); if (tcadbget (adb, &nkey, sizeof (int), &sp) != NULL) return 1; tcadbput (adb, &nkey, sizeof (int), &nval, sizeof (int)); return 0; } int ht_insert_hit (TCADB * adb, int data_nkey, int uniq_nkey, int root_nkey) { int sp = 0; GDataMap *map; if (adb == NULL) return (EINVAL); if ((map = tcadbget (adb, &data_nkey, sizeof (int), &sp)) != NULL) { map->data++; } else { map = xcalloc (1, sizeof (GDataMap)); map->data = 1; map->root = root_nkey; map->uniq = uniq_nkey; } tcadbput (adb, &data_nkey, sizeof (int), map, sizeof (GDataMap)); if (map) free (map); return 0; } int find_host_agent_in_list (void *data, void *needle) { return (*(int *) data) == (*(int *) needle) ? 1 : 0; } #ifdef TCB_MEMHASH int ht_insert_host_agent (TCADB * adb, int data_nkey, int agent_nkey) { GSLList *list, *match; int sp = 0; if (adb == NULL) return (EINVAL); if ((list = tcadbget (adb, &data_nkey, sizeof (int), &sp)) != NULL) { if ((match = list_find (list, find_host_agent_in_list, &agent_nkey))) goto out; list = list_insert_prepend (list, int2ptr (agent_nkey)); } else { list = list_create (int2ptr (agent_nkey)); } tcadbput (adb, &data_nkey, sizeof (int), list, sizeof (GSLList)); out: free (list); return 0; } #endif int ht_insert_str_from_int_key (TCADB * adb, int nkey, const char *value) { if (adb == NULL) return (EINVAL); tcadbput (adb, &nkey, sizeof (int), value, strlen (value)); return 0; } static int ht_inc_int_from_key (TCADB * adb, const void *key, size_t ksize, int inc) { int sp = 0; void *value_ptr; int add_value; if (adb == NULL) return (EINVAL); if ((value_ptr = tcadbget (adb, key, ksize, &sp)) != NULL) { add_value = (*(int *) value_ptr) + inc; free (value_ptr); } else { add_value = 0 + inc; } tcadbput (adb, key, ksize, &add_value, sizeof (int)); return 0; } static int ht_inc_u64_from_key (TCADB * adb, const void *key, size_t ksize, uint64_t inc) { int sp = 0; void *value_ptr; uint64_t add_value; if (adb == NULL) return (EINVAL); if ((value_ptr = tcadbget (adb, key, ksize, &sp)) != NULL) { add_value = (*(uint64_t *) value_ptr) + inc; free (value_ptr); } else { add_value = 0 + inc; } tcadbput (adb, key, ksize, &add_value, sizeof (uint64_t)); return 0; } int ht_inc_int_from_int_key (TCADB * adb, int data_nkey, int inc) { if (adb == NULL) return (EINVAL); return ht_inc_int_from_key (adb, &data_nkey, sizeof (data_nkey), inc); } int ht_max_u64_from_int_key (TCADB * adb, int data_nkey, uint64_t newval) { int sp = 0; void *value_ptr; uint64_t curval = 0; if (adb == NULL) return (EINVAL); if ((value_ptr = tcadbget (adb, &data_nkey, sizeof (data_nkey), &sp)) != NULL) { curval = (*(uint64_t *) value_ptr); free (value_ptr); } if (curval < newval) tcadbput (adb, &data_nkey, sizeof (data_nkey), &newval, sizeof (uint64_t)); return 0; } int ht_inc_u64_from_int_key (TCADB * adb, int data_nkey, uint64_t inc) { if (adb == NULL) return (EINVAL); return ht_inc_u64_from_key (adb, &data_nkey, sizeof (data_nkey), inc); } int ht_inc_int_from_str_key (TCADB * adb, const char *key, int inc) { if (adb == NULL) return (EINVAL); return ht_inc_int_from_key (adb, key, strlen (key), inc); } int ht_inc_u64_from_str_key (TCADB * adb, const char *key, uint64_t inc) { if (adb == NULL) return (EINVAL); return ht_inc_u64_from_key (adb, key, strlen (key), inc); } int ht_insert_unique_key (const char *key) { return ht_insert_keymap (ht_unique_keys, key); } int ht_insert_agent_key (const char *key) { return ht_insert_keymap (ht_agent_keys, key); } int ht_insert_agent_val (int nkey, const char *key) { return ht_insert_str_from_int_key (ht_agent_vals, nkey, key); } static int get_int_from_int_key (TCADB * adb, int nkey) { void *value_ptr; int sp = 0, ret = 0; if (adb == NULL) return (EINVAL); value_ptr = tcadbget (adb, &nkey, sizeof (int), &sp); if (value_ptr != NULL) { ret = (*(int *) value_ptr); free (value_ptr); } return ret; } int get_int_from_str_key (TCADB * adb, const char *key) { void *value_ptr; int sp = 0, ret = 0; if (adb == NULL) return (EINVAL); value_ptr = tcadbget (adb, key, strlen (key), &sp); if (value_ptr != NULL) { ret = (*(int *) value_ptr); free (value_ptr); } return ret; } unsigned int get_uint_from_str_key (TCADB * adb, const char *key) { void *value_ptr; int sp = 0, ret = 0; if (adb == NULL) return (EINVAL); value_ptr = tcadbget (adb, key, strlen (key), &sp); if (value_ptr != NULL) { ret = (*(unsigned int *) value_ptr); free (value_ptr); } return ret; } char * get_str_from_int_key (TCADB * adb, int nkey) { void *value_ptr; int sp = 0; if (adb == NULL) return NULL; value_ptr = tcadbget (adb, &nkey, sizeof (int), &sp); if (value_ptr != NULL) return (char *) value_ptr; return NULL; } char * get_root_from_key (int root_nkey, GModule module) { TCADB *adb = NULL; void *value_ptr; int sp = 0; adb = get_storage_metric (module, MTRC_ROOTMAP); if (adb == NULL) return NULL; value_ptr = tcadbget (adb, &root_nkey, sizeof (int), &sp); if (value_ptr != NULL) return (char *) value_ptr; return NULL; } char * get_node_from_key (int data_nkey, GModule module, GMetric metric) { TCADB *adb = NULL; GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); /* bandwidth modules */ switch (metric) { case MTRC_DATAMAP: adb = metrics->datamap; break; case MTRC_METHODS: adb = metrics->methods; break; case MTRC_PROTOCOLS: adb = metrics->protocols; break; default: adb = NULL; } if (adb == NULL) return NULL; return get_str_from_int_key (adb, data_nkey); } uint64_t get_cumulative_from_key (int data_nkey, GModule module, GMetric metric) { TCADB *adb = NULL; GStorageMetrics *metrics; void *value_ptr; uint64_t ret = 0; int sp = 0; metrics = get_storage_metrics_by_module (module); /* bandwidth modules */ switch (metric) { case MTRC_BW: adb = metrics->bw; break; case MTRC_CUMTS: adb = metrics->cumts; break; case MTRC_MAXTS: adb = metrics->maxts; break; default: adb = NULL; } if (adb == NULL) return 0; value_ptr = tcadbget (adb, &data_nkey, sizeof (int), &sp); if (value_ptr != NULL) { ret = (*(uint64_t *) value_ptr); free (value_ptr); } return ret; } int get_num_from_key (int data_nkey, GModule module, GMetric metric) { TCADB *adb = NULL; GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); /* bandwidth modules */ switch (metric) { case MTRC_HITS: adb = metrics->hits; break; case MTRC_VISITORS: adb = metrics->visitors; break; default: adb = NULL; } if (adb == NULL) return 0; return get_int_from_int_key (adb, data_nkey); } char * get_hostname (const char *host) { void *value_ptr; value_ptr = tcadbget2 (ht_hostnames, host); if (value_ptr) return value_ptr; return NULL; } int get_int_from_keymap (const char *key, GModule module) { TCADB *adb = get_storage_metric (module, MTRC_KEYMAP); return get_int_from_str_key (adb, key); } char * get_host_agent_val (int agent_nkey) { return get_str_from_int_key (ht_agent_vals, agent_nkey); } GSLList * tclist_to_gsllist (TCLIST * tclist) { GSLList *list = NULL; int i, sz; int *val; for (i = 0; i < tclistnum (tclist); ++i) { val = (int *) tclistval (tclist, i, &sz); if (list == NULL) list = list_create (int2ptr (*val)); else list = list_insert_prepend (list, int2ptr (*val)); } return list; } void * get_host_agent_list (int data_nkey) { #ifdef TCB_MEMHASH TCADB *db; void *list; int sp = 0; #endif #ifdef TCB_BTREE TCBDB *db; TCLIST *tclist; #endif db = get_storage_metric (HOSTS, MTRC_AGENTS); #ifdef TCB_MEMHASH if ((list = tcadbget (db, &data_nkey, sizeof (data_nkey), &sp))) return list; #endif #ifdef TCB_BTREE if ((tclist = tcbdbget4 (db, &data_nkey, sizeof (int))) != NULL) { return tclist; } #endif return NULL; } /* Calls the given function for each of the key/value pairs */ static void tc_db_foreach (void *db, void (*fp) (TCADB * m, void *k, int s, void *u), void *user_data) { TCADB *adb = db; int ksize = 0; void *key; tcadbiterinit (adb); while ((key = tcadbiternext (adb, &ksize)) != NULL) (*fp) (adb, key, ksize, user_data); } static void free_key (TCADB * adb, void *key, int ksize, GO_UNUSED void *user_data) { void *value; int sp = 0; value = tcadbget (adb, key, ksize, &sp); if (value) free (value); free (key); } static void free_agent_values (TCADB * adb, void *key, int ksize, GO_UNUSED void *user_data) { void *list; int sp = 0; list = tcadbget (adb, key, ksize, &sp); if (list) list_remove_nodes (list); free (key); } void free_db_key (TCADB * adb) { tc_db_foreach (adb, free_key, NULL); } void free_agent_list (void) { TCADB *adb = get_storage_metric (HOSTS, MTRC_AGENTS); tc_db_foreach (adb, free_agent_values, NULL); } static void set_raw_data (void *key, void *value, GRawData * raw_data) { raw_data->items[raw_data->idx].key = key; raw_data->items[raw_data->idx].value = value; raw_data->idx++; } static void data_iter_generic (TCADB * adb, void *key, int ksize, void *user_data) { GRawData *raw_data = user_data; void *value; int sp = 0; value = tcadbget (adb, key, ksize, &sp); if (value) set_raw_data (key, value, raw_data); } GRawData * parse_raw_data (void *db, int ht_size, GModule module) { GRawData *raw_data; raw_data = new_grawdata (); raw_data->size = ht_size; raw_data->module = module; raw_data->idx = 0; raw_data->items = new_grawdata_item (ht_size); tc_db_foreach (db, data_iter_generic, raw_data); sort_raw_data (raw_data, ht_size); return raw_data; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/sort.h���������������������������������������������������������������������������0000664�0000000�0000000�00000003707�12573351525�012152� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include <config.h> #endif #ifndef SORT_H_INCLUDED #define SORT_H_INCLUDED #include "commons.h" #include "parser.h" #define SORT_MAX_OPTS 10 /* See GEnum for mapping */ #define SORT_FIELD_LEN 11 + 1 /* longest metric name */ #define SORT_MODULE_LEN 15 + 1 /* longest module name */ #define SORT_ORDER_LEN 4 + 1 typedef enum GSortField_ { SORT_BY_HITS, SORT_BY_VISITORS, SORT_BY_DATA, SORT_BY_BW, SORT_BY_AVGTS, SORT_BY_CUMTS, SORT_BY_MAXTS, SORT_BY_PROT, SORT_BY_MTHD, } GSortField; typedef enum GSortOrder_ { SORT_ASC, SORT_DESC } GSortOrder; typedef struct GSort_ { GModule module; GSortField field; GSortOrder sort; } GSort; extern GSort module_sort[TOTAL_MODULES]; extern const int sort_choices[][SORT_MAX_OPTS];; GRawData *sort_raw_data (GRawData * raw_data, int ht_size); int can_sort_module (GModule module, int field); int get_sort_field_enum (const char *str); int get_sort_order_enum (const char *str); void parse_initial_sort (void); void set_initial_sort (const char *smod, const char *sfield, const char *ssort); void sort_holder_items (GHolderItem * items, int size, GSort sort); #endif ���������������������������������������������������������goaccess-0.9.4/src/util.h���������������������������������������������������������������������������0000644�0000000�0000000�00000005323�12573351525�012132� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef UTIL_H_INCLUDED #define UTIL_H_INCLUDED #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) #define BUFFMT 8 #define REGEX_ERROR 100 #define KB 1024 #define MB (KB * 1024) #define GB (MB * 1024) #define MILS 1000ULL #define SECS 1000000ULL #define MINS 60000000ULL #define HOUR 3600000000ULL #define DAY 86400000000ULL /* *INDENT-OFF* */ #include <stdint.h> #include <sys/types.h> #include <time.h> char *alloc_string (const char *str); char *char_repeat (int n, char c); char *char_replace (char *str, char o, char n); char *deblank (char *str); char *escape_str (const char *src); char *filesize_str (unsigned long long log_size); char *float2str (float d, int width); char *get_global_config (void); char *get_home (void); char *ints_to_str (int a, int b); char *int2str (int d, int width); char *left_pad_str (const char *s, int indent); char *ltrim (char *s); char *replace_str (const char *str, const char *old, const char *new); char *rtrim (char *s); char *secs_to_str (int secs); char* strtoupper(char* str); char *substring (const char *str, int begin, int len); char *trim_str (char *str); char *unescape_str (const char *src); char *usecs_to_str (unsigned long long usec); const char *verify_status_code (char *str); const char *verify_status_code_type (const char *str); int convert_date (char *res, char *data, const char *from, const char *to, int size); int count_matches (const char *s1, char c); int ignore_referer (const char *ref); int intlen (int num); int invalid_ipaddr (char *str, int *ipvx); int ip_in_range (const char *ip); int str_to_time (const char *str, const char *fmt, struct tm *tm); int wc_match(char *wc, char * str); off_t file_size (const char *filename); uint32_t ip_to_binary (const char *ip); void strip_newlines (char *str); void xstrncpy (char *dest, const char *source, const size_t dest_size); /* *INDENT-ON* */ #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/gstorage.c�����������������������������������������������������������������������0000664�0000000�0000000�00000007554�12573351525�012775� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * gstorage.c -- common storage handling * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #include <stdio.h> #if !defined __SUNPRO_C #include <stdint.h> #endif #include <stdlib.h> #include <string.h> #include "gstorage.h" #include "error.h" #include "xmalloc.h" GStorage * new_gstorage (uint32_t size) { GStorage *store = xcalloc (size, sizeof (GStorage)); return store; } GMetrics * new_gmetrics (void) { GMetrics *metrics = xcalloc (1, sizeof (GMetrics)); return metrics; } GStorageMetrics * new_ht_metrics (void) { GStorageMetrics *metrics = xmalloc (sizeof (GStorageMetrics)); memset (metrics, 0, sizeof *metrics); /* maps */ metrics->keymap = NULL; metrics->datamap = NULL; metrics->rootmap = NULL; metrics->uniqmap = NULL; /* metrics */ metrics->hits = NULL; metrics->visitors = NULL; metrics->bw = NULL; metrics->cumts = NULL; metrics->maxts = NULL; metrics->protocols = NULL; metrics->methods = NULL; metrics->agents = NULL; return metrics; } GStorageMetrics * get_storage_metrics_by_module (GModule module) { return ht_storage[module].metrics; } int * int2ptr (int val) { int *ptr = xmalloc (sizeof (int)); *ptr = val; return ptr; } uint64_t * uint642ptr (uint64_t val) { uint64_t *ptr = xmalloc (sizeof (uint64_t)); *ptr = val; return ptr; } void * get_storage_metric_by_module (GModule module, GMetric metric) { void *ht; GStorageMetrics *metrics; metrics = get_storage_metrics_by_module (module); switch (metric) { case MTRC_KEYMAP: ht = metrics->keymap; break; case MTRC_ROOTMAP: ht = metrics->rootmap; break; case MTRC_DATAMAP: ht = metrics->datamap; break; case MTRC_UNIQMAP: ht = metrics->uniqmap; break; case MTRC_HITS: ht = metrics->hits; break; case MTRC_VISITORS: ht = metrics->visitors; break; case MTRC_BW: ht = metrics->bw; break; case MTRC_CUMTS: ht = metrics->cumts; break; case MTRC_MAXTS: ht = metrics->maxts; break; case MTRC_METHODS: ht = metrics->methods; break; case MTRC_PROTOCOLS: ht = metrics->protocols; break; case MTRC_AGENTS: ht = metrics->agents; break; default: ht = NULL; } return ht; } void set_data_metrics (GMetrics * ometrics, GMetrics ** nmetrics, int valid) { GMetrics *metrics; float percent = get_percentage (valid, ometrics->hits); metrics = new_gmetrics (); metrics->bw.nbw = ometrics->bw.nbw; metrics->id = ometrics->id; metrics->data = ometrics->data; metrics->hits = ometrics->hits; metrics->percent = percent < 0 ? 0 : percent; metrics->visitors = ometrics->visitors; if (conf.serve_usecs && ometrics->hits > 0) { metrics->avgts.nts = ometrics->avgts.nts; metrics->cumts.nts = ometrics->cumts.nts; metrics->maxts.nts = ometrics->maxts.nts; } if (conf.append_method && ometrics->method) metrics->method = ometrics->method; if (conf.append_method && ometrics->protocol) metrics->protocol = ometrics->protocol; *nmetrics = metrics; } void * get_storage_metric (GModule module, GMetric metric) { return get_storage_metric_by_module (module, metric); } ����������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/goaccess.c�����������������������������������������������������������������������0000644�0000000�0000000�00000061353�12573357401�012743� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * goaccess.c -- main log analyzer * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #include <assert.h> #include <ctype.h> #include <errno.h> #include <locale.h> #if HAVE_CONFIG_H #include <config.h> #endif #include <pthread.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <signal.h> #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #else #include "glibht.h" #endif #ifdef HAVE_LIBGEOIP #include "geolocation.h" #endif #include "csv.h" #include "error.h" #include "gdashboard.h" #include "gdns.h" #include "json.h" #include "options.h" #include "output.h" #include "util.h" static WINDOW *header_win, *main_win; GConf conf = { .hl_header = 1 }; int active_gdns = 0; static GDash *dash; static GHolder *holder; static GLog *logger; GSpinner *parsing_spinner; /* *INDENT-OFF* */ static GScroll gscroll = { { {0, 0}, /* visitors {scroll, offset} */ {0, 0}, /* requests {scroll, offset} */ {0, 0}, /* req static {scroll, offset} */ {0, 0}, /* not found {scroll, offset} */ {0, 0}, /* hosts {scroll, offset} */ {0, 0}, /* os {scroll, offset} */ {0, 0}, /* browsers {scroll, offset} */ {0, 0}, /* visit times {scroll, offset} */ {0, 0}, /* referrers {scroll, offset} */ {0, 0}, /* ref sites {scroll, offset} */ {0, 0}, /* keywords {scroll, offset} */ #ifdef HAVE_LIBGEOIP {0, 0}, /* geolocation {scroll, offset} */ #endif {0, 0}, /* status {scroll, offset} */ }, 0, /* current module */ 0, /* main dashboard scroll */ 0, /* expanded flag */ }; /* *INDENT-ON* */ static void house_keeping (void) { #if defined(TCB_BTREE) || defined(TCB_MEMHASH) GModule module; #endif #ifndef TCB_BTREE if (conf.list_agents) free_agent_list (); #endif /* REVERSE DNS THREAD */ pthread_mutex_lock (&gdns_thread.mutex); /* kill dns pthread */ active_gdns = 0; free_holder (&holder); gdns_free_queue (); /* free uniqmap */ #if defined(TCB_BTREE) || defined(TCB_MEMHASH) for (module = 0; module < TOTAL_MODULES; module++) { free_db_key (get_storage_metric (module, MTRC_UNIQMAP)); } #endif free_storage (); pthread_mutex_unlock (&gdns_thread.mutex); /* DASHBOARD */ if (dash && !conf.output_html) { free_dashboard (dash); reset_find (); } /* GEOLOCATION */ #ifdef HAVE_LIBGEOIP if (geo_location_data != NULL) GeoIP_delete (geo_location_data); #endif /* LOGGER */ free (logger); /* INVALID REQUESTS */ if (conf.invalid_requests_log) { LOG_DEBUG (("Closing invalid requests log.\n")); invalid_log_close (); } /* CONFIGURATION */ if (conf.debug_log) { LOG_DEBUG (("Bye.\n")); dbg_log_close (); } /* free colors */ free_color_lists (); /*free_normal_color (); */ /* free cmd arguments */ free_cmd_args (); } /* allocate memory for an instance of holder */ static void allocate_holder_by_module (GModule module) { #if defined(TCB_BTREE) || defined(TCB_MEMHASH) TCADB *ht = NULL; #else GHashTable *ht; #endif GRawData *raw_data; unsigned int ht_size = 0; /* extract data from the corresponding hash table */ ht = get_storage_metric (module, MTRC_HITS); ht_size = get_ht_size (ht); raw_data = parse_raw_data (ht, ht_size, module); load_holder_data (raw_data, holder + module, module, module_sort[module]); } /* allocate memory for an instance of holder */ static void allocate_holder (void) { #if defined(TCB_BTREE) || defined(TCB_MEMHASH) TCADB *ht = NULL; #else GHashTable *ht; #endif GModule module; GRawData *raw_data; unsigned int ht_size = 0; holder = new_gholder (TOTAL_MODULES); for (module = 0; module < TOTAL_MODULES; module++) { /* extract data from the corresponding hits hash table */ ht = get_storage_metric (module, MTRC_HITS); ht_size = get_ht_size (ht); raw_data = parse_raw_data (ht, ht_size, module); load_holder_data (raw_data, holder + module, module, module_sort[module]); } } /* allocate memory for an instance of dashboard */ static void allocate_data (void) { GModule module; int col_data = get_num_collapsed_data_rows (); int size = 0; dash = new_gdash (); for (module = 0; module < TOTAL_MODULES; module++) { if (ignore_panel (module)) continue; switch (module) { case VISITORS: dash->module[module].head = (!conf.ignore_crawlers ? VISIT_HEAD INCLUDE_BOTS : VISIT_HEAD); dash->module[module].desc = VISIT_DESC; break; case REQUESTS: dash->module[module].head = REQUE_HEAD; dash->module[module].desc = REQUE_DESC; break; case REQUESTS_STATIC: dash->module[module].head = STATI_HEAD; dash->module[module].desc = STATI_DESC; break; case NOT_FOUND: dash->module[module].head = FOUND_HEAD; dash->module[module].desc = FOUND_DESC; break; case HOSTS: dash->module[module].head = HOSTS_HEAD; dash->module[module].desc = HOSTS_DESC; break; case OS: dash->module[module].head = OPERA_HEAD; dash->module[module].desc = OPERA_DESC; break; case BROWSERS: dash->module[module].head = BROWS_HEAD; dash->module[module].desc = BROWS_DESC; break; case VISIT_TIMES: dash->module[module].head = VTIME_HEAD; dash->module[module].desc = VTIME_DESC; break; case REFERRERS: dash->module[module].head = REFER_HEAD; dash->module[module].desc = REFER_DESC; break; case REFERRING_SITES: dash->module[module].head = SITES_HEAD; dash->module[module].desc = SITES_DESC; break; case KEYPHRASES: dash->module[module].head = KEYPH_HEAD; dash->module[module].desc = KEYPH_DESC; break; #ifdef HAVE_LIBGEOIP case GEO_LOCATION: dash->module[module].head = GEOLO_HEAD; dash->module[module].desc = GEOLO_DESC; break; #endif case STATUS_CODES: dash->module[module].head = CODES_HEAD; dash->module[module].desc = CODES_DESC; break; } size = holder[module].idx; if (gscroll.expanded && module == gscroll.current) { size = size > MAX_CHOICES ? MAX_CHOICES : holder[module].idx; } else { size = holder[module].idx > col_data ? col_data : holder[module].idx; } dash->module[module].alloc_data = size; /* data allocated */ dash->module[module].ht_size = holder[module].ht_size; /* hash table size */ dash->module[module].idx_data = 0; dash->module[module].pos_y = 0; if (gscroll.expanded && module == gscroll.current) dash->module[module].dash_size = DASH_EXPANDED; else dash->module[module].dash_size = DASH_COLLAPSED; dash->total_alloc += dash->module[module].dash_size; pthread_mutex_lock (&gdns_thread.mutex); load_data_to_dash (&holder[module], dash, module, &gscroll); pthread_mutex_unlock (&gdns_thread.mutex); } } /* render all windows */ static void render_screens (void) { GColors *color = get_color (COLOR_DEFAULT); int row, col, chg = 0; getmaxyx (stdscr, row, col); term_size (main_win); generate_time (); chg = logger->processed - logger->offset; draw_header (stdscr, "", "%s", row - 1, 0, col, color_default); wattron (stdscr, color->attr | COLOR_PAIR (color->pair->idx)); mvaddstr (row - 1, 1, "[F1]Help [Enter] Exp. Panel"); mvprintw (row - 1, 30, "%d - %s", chg, asctime (now_tm)); mvaddstr (row - 1, col - 21, "[Q]uit GoAccess"); mvprintw (row - 1, col - 5, "%s", GO_VERSION); wattroff (stdscr, color->attr | COLOR_PAIR (color->pair->idx)); refresh (); /* call general stats header */ display_general (header_win, conf.ifile, logger); wrefresh (header_win); /* display active label based on current module */ update_active_module (header_win, gscroll.current); display_content (main_win, logger, dash, &gscroll); } /* collapse the current expanded module */ static void collapse_current_module (void) { if (!gscroll.expanded) return; gscroll.expanded = 0; reset_scroll_offsets (&gscroll); free_dashboard (dash); allocate_data (); render_screens (); } static void disabled_panel_msg (GModule module) { const char *lbl = module_to_label (module); int row, col; getmaxyx (stdscr, row, col); draw_header (stdscr, lbl, "'%s' panel is disabled", row - 1, 0, col, color_error); } static void set_module_to (GScroll * scrll, GModule module) { if (ignore_panel (module)) { disabled_panel_msg (module); return; } /* reset expanded module */ collapse_current_module (); scrll->current = module; render_screens (); } static void scroll_to_first_line (void) { if (!gscroll.expanded) gscroll.dash = 0; else { gscroll.module[gscroll.current].scroll = 0; gscroll.module[gscroll.current].offset = 0; } } static void scroll_to_last_line (void) { int exp_size = get_num_expanded_data_rows (); int scrll = 0, offset = 0; if (!gscroll.expanded) gscroll.dash = dash->total_alloc - real_size_y; else { scrll = dash->module[gscroll.current].idx_data - 1; if (scrll >= exp_size && scrll >= offset + exp_size) offset = scrll < exp_size - 1 ? 0 : scrll - exp_size + 1; gscroll.module[gscroll.current].scroll = scrll; gscroll.module[gscroll.current].offset = offset; } } static void load_ip_agent_list (void) { int type_ip = 0; /* make sure we have a valid IP */ int sel = gscroll.module[gscroll.current].scroll; GDashData item = dash->module[HOSTS].data[sel]; if (!invalid_ipaddr (item.metrics->data, &type_ip)) load_agent_list (main_win, item.metrics->data); } static void expand_current_module (void) { if (gscroll.expanded && gscroll.current == HOSTS) { load_ip_agent_list (); return; } if (gscroll.expanded) return; reset_scroll_offsets (&gscroll); gscroll.expanded = 1; free_holder_by_module (&holder, gscroll.current); free_dashboard (dash); allocate_holder_by_module (gscroll.current); allocate_data (); } static void expand_on_mouse_click (void) { int ok_mouse; MEVENT event; ok_mouse = getmouse (&event); if (!conf.mouse_support || ok_mouse != OK) return; if (event.bstate & BUTTON1_CLICKED) { /* ignore header/footer clicks */ if (event.y < MAX_HEIGHT_HEADER || event.y == LINES - 1) return; if (set_module_from_mouse_event (&gscroll, dash, event.y)) return; reset_scroll_offsets (&gscroll); gscroll.expanded = 1; free_holder_by_module (&holder, gscroll.current); free_dashboard (dash); allocate_holder_by_module (gscroll.current); allocate_data (); render_screens (); } } static void scroll_down_expanded_module (void) { int exp_size = get_num_expanded_data_rows (); int *scroll_ptr, *offset_ptr; scroll_ptr = &gscroll.module[gscroll.current].scroll; offset_ptr = &gscroll.module[gscroll.current].offset; if (!gscroll.expanded) return; if (*scroll_ptr >= dash->module[gscroll.current].idx_data - 1) return; ++(*scroll_ptr); if (*scroll_ptr >= exp_size && *scroll_ptr >= *offset_ptr + exp_size) ++(*offset_ptr); } static void scroll_up_dashboard (void) { gscroll.dash--; } static void page_up_module (void) { int exp_size = get_num_expanded_data_rows (); int *scroll_ptr, *offset_ptr; scroll_ptr = &gscroll.module[gscroll.current].scroll; offset_ptr = &gscroll.module[gscroll.current].offset; if (!gscroll.expanded) return; /* decrease scroll and offset by exp_size */ *scroll_ptr -= exp_size; if (*scroll_ptr < 0) *scroll_ptr = 0; if (*scroll_ptr < *offset_ptr) *offset_ptr -= exp_size; if (*offset_ptr <= 0) *offset_ptr = 0; } static void page_down_module (void) { int exp_size = get_num_expanded_data_rows (); int *scroll_ptr, *offset_ptr; scroll_ptr = &gscroll.module[gscroll.current].scroll; offset_ptr = &gscroll.module[gscroll.current].offset; if (!gscroll.expanded) return; *scroll_ptr += exp_size; if (*scroll_ptr >= dash->module[gscroll.current].idx_data - 1) *scroll_ptr = dash->module[gscroll.current].idx_data - 1; if (*scroll_ptr >= exp_size && *scroll_ptr >= *offset_ptr + exp_size) *offset_ptr += exp_size; if (*offset_ptr + exp_size >= dash->module[gscroll.current].idx_data - 1) *offset_ptr = dash->module[gscroll.current].idx_data - exp_size; if (*scroll_ptr < exp_size - 1) *offset_ptr = 0; } static void scroll_up_expanded_module (void) { int *scroll_ptr, *offset_ptr; scroll_ptr = &gscroll.module[gscroll.current].scroll; offset_ptr = &gscroll.module[gscroll.current].offset; if (!gscroll.expanded) return; if (*scroll_ptr <= 0) return; --(*scroll_ptr); if (*scroll_ptr < *offset_ptr) --(*offset_ptr); } static void render_search_dialog (int search) { if (render_find_dialog (main_win, &gscroll)) return; pthread_mutex_lock (&gdns_thread.mutex); search = perform_next_find (holder, &gscroll); pthread_mutex_unlock (&gdns_thread.mutex); if (search != 0) return; free_dashboard (dash); allocate_data (); render_screens (); } static void search_next_match (int search) { pthread_mutex_lock (&gdns_thread.mutex); search = perform_next_find (holder, &gscroll); pthread_mutex_unlock (&gdns_thread.mutex); if (search != 0) return; free_dashboard (dash); allocate_data (); render_screens (); } static void perform_tail_follow (uint64_t * size1) { uint64_t size2 = 0; char buf[LINE_BUFFER]; FILE *fp = NULL; if (logger->piping || logger->load_from_disk_only) return; size2 = file_size (conf.ifile); /* file hasn't changed */ if (size2 == *size1) return; if (!(fp = fopen (conf.ifile, "r"))) FATAL ("Unable to read log file %s.", strerror (errno)); if (!fseeko (fp, *size1, SEEK_SET)) while (fgets (buf, LINE_BUFFER, fp) != NULL) parse_log (&logger, buf, -1); fclose (fp); *size1 = size2; pthread_mutex_lock (&gdns_thread.mutex); free_holder (&holder); pthread_cond_broadcast (&gdns_thread.not_empty); pthread_mutex_unlock (&gdns_thread.mutex); free_dashboard (dash); allocate_holder (); allocate_data (); term_size (main_win); render_screens (); usleep (200000); /* 0.2 seconds */ } static int next_module (void) { gscroll.current++; if (gscroll.current == TOTAL_MODULES) gscroll.current = 0; if (ignore_panel (gscroll.current)) { disabled_panel_msg (gscroll.current); return 1; } return 0; } static int previous_module (void) { if (gscroll.current == 0) gscroll.current = TOTAL_MODULES - 1; else gscroll.current--; if (ignore_panel (gscroll.current)) { disabled_panel_msg (gscroll.current); return 1; } return 0; } static void window_resize (void) { endwin (); refresh (); werase (header_win); werase (main_win); werase (stdscr); term_size (main_win); refresh (); render_screens (); } static void render_sort_dialog (void) { load_sort_win (main_win, gscroll.current, &module_sort[gscroll.current]); pthread_mutex_lock (&gdns_thread.mutex); free_holder (&holder); pthread_cond_broadcast (&gdns_thread.not_empty); pthread_mutex_unlock (&gdns_thread.mutex); free_dashboard (dash); allocate_holder (); allocate_data (); render_screens (); } static void get_keys (void) { int search = 0; int c, quit = 1; uint64_t size1 = 0; if (!logger->piping && !logger->load_from_disk_only) size1 = file_size (conf.ifile); while (quit) { c = wgetch (stdscr); switch (c) { case 'q': /* quit */ if (!gscroll.expanded) { quit = 0; break; } collapse_current_module (); break; case KEY_F (1): case '?': case 'h': load_help_popup (main_win); render_screens (); break; case 49: /* 1 */ /* reset expanded module */ set_module_to (&gscroll, VISITORS); break; case 50: /* 2 */ /* reset expanded module */ set_module_to (&gscroll, REQUESTS); break; case 51: /* 3 */ /* reset expanded module */ set_module_to (&gscroll, REQUESTS_STATIC); break; case 52: /* 4 */ /* reset expanded module */ set_module_to (&gscroll, NOT_FOUND); break; case 53: /* 5 */ /* reset expanded module */ set_module_to (&gscroll, HOSTS); break; case 54: /* 6 */ /* reset expanded module */ set_module_to (&gscroll, OS); break; case 55: /* 7 */ /* reset expanded module */ set_module_to (&gscroll, BROWSERS); break; case 56: /* 8 */ /* reset expanded module */ set_module_to (&gscroll, VISIT_TIMES); break; case 57: /* 9 */ /* reset expanded module */ set_module_to (&gscroll, REFERRERS); break; case 48: /* 0 */ /* reset expanded module */ set_module_to (&gscroll, REFERRING_SITES); break; case 33: /* shift + 1 */ /* reset expanded module */ set_module_to (&gscroll, KEYPHRASES); break; case 34: /* Shift + 2 */ /* reset expanded module */ #ifdef HAVE_LIBGEOIP set_module_to (&gscroll, GEO_LOCATION); #else set_module_to (&gscroll, STATUS_CODES); #endif break; #ifdef HAVE_LIBGEOIP case 35: /* Shift + 3 */ /* reset expanded module */ set_module_to (&gscroll, STATUS_CODES); break; #endif case 9: /* TAB */ /* reset expanded module */ collapse_current_module (); if (next_module () == 0) render_screens (); break; case 353: /* Shift TAB */ /* reset expanded module */ collapse_current_module (); if (previous_module () == 0) render_screens (); break; case 'g': /* g = top */ scroll_to_first_line (); display_content (main_win, logger, dash, &gscroll); break; case 'G': /* G = down */ scroll_to_last_line (); display_content (main_win, logger, dash, &gscroll); break; /* expand dashboard module */ case KEY_RIGHT: case 0x0a: case 0x0d: case 32: /* ENTER */ case 79: /* o */ case 111: /* O */ case KEY_ENTER: expand_current_module (); display_content (main_win, logger, dash, &gscroll); break; case KEY_DOWN: /* scroll main dashboard */ if ((gscroll.dash + real_size_y) < (unsigned) dash->total_alloc) { gscroll.dash++; display_content (main_win, logger, dash, &gscroll); } break; case KEY_MOUSE: /* handles mouse events */ expand_on_mouse_click (); break; case 106: /* j - DOWN expanded module */ scroll_down_expanded_module (); display_content (main_win, logger, dash, &gscroll); break; /* scroll up main_win */ case KEY_UP: if (gscroll.dash > 0) { scroll_up_dashboard (); display_content (main_win, logger, dash, &gscroll); } break; case 2: /* ^ b - page up */ case 339: /* ^ PG UP */ page_up_module (); display_content (main_win, logger, dash, &gscroll); break; case 6: /* ^ f - page down */ case 338: /* ^ PG DOWN */ page_down_module (); display_content (main_win, logger, dash, &gscroll); break; case 107: /* k - UP expanded module */ scroll_up_expanded_module (); display_content (main_win, logger, dash, &gscroll); break; case 'n': search_next_match (search); break; case '/': render_search_dialog (search); break; case 99: /* c */ if (conf.no_color) break; load_schemes_win (main_win); free_dashboard (dash); allocate_data (); render_screens (); break; case 115: /* s */ render_sort_dialog (); break; case 269: case KEY_RESIZE: window_resize (); break; default: perform_tail_follow (&size1); break; } } } static void set_general_stats (void) { verify_formats (); logger->valid = logger->processed = logger->invalid = logger->excluded_ip = 0; #ifdef TCB_BTREE logger->excluded_ip = get_uint_from_str_key (ht_general_stats, "excluded_ip"); logger->invalid = get_uint_from_str_key (ht_general_stats, "failed_requests"); logger->processed = get_uint_from_str_key (ht_general_stats, "total_requests"); logger->resp_size = get_uint_from_str_key (ht_general_stats, "bandwidth"); logger->valid = get_uint_from_str_key (ht_general_stats, "valid_requests"); if (logger->resp_size > 0) conf.bandwidth = 1; #endif } #ifdef HAVE_LIBGEOIP static void init_geoip (void) { /* open custom city GeoIP database */ if (conf.geoip_database != NULL) geo_location_data = geoip_open_db (conf.geoip_database); /* fall back to legacy GeoIP database */ else geo_location_data = GeoIP_new (conf.geo_db); } #endif static void standard_output (void) { /* CSV */ if (conf.output_format && strcmp ("csv", conf.output_format) == 0) output_csv (logger, holder); /* JSON */ else if (conf.output_format && strcmp ("json", conf.output_format) == 0) output_json (logger, holder); /* HTML */ else output_html (logger, holder); } static void curses_output (void) { allocate_data (); if (!conf.skip_term_resolver) gdns_thread_create (); render_screens (); get_keys (); /* restore tty modes and reset * terminal into non-visual mode */ endwin (); } static void set_locale (void) { char *loc_ctype; loc_ctype = getenv ("LC_CTYPE"); if (loc_ctype != NULL) setlocale (LC_CTYPE, loc_ctype); else if ((loc_ctype = getenv ("LC_ALL"))) setlocale (LC_CTYPE, loc_ctype); else setlocale (LC_CTYPE, ""); } static void parse_cmd_line (int argc, char **argv) { read_option_args (argc, argv); /* Not outputting to a terminal */ if (!isatty (STDOUT_FILENO) || conf.output_format != NULL) conf.output_html = 1; /* Log piped, and log file passed */ if (conf.ifile && !isatty (STDIN_FILENO) && !conf.output_html) cmd_help (); /* No data piped, no file was used and not loading from disk */ if (!conf.ifile && isatty (STDIN_FILENO) && !conf.load_from_disk) cmd_help (); set_default_static_files (); } #if defined(__GLIBC__) static void setup_signal_handlers (void) { struct sigaction act; sigemptyset (&act.sa_mask); act.sa_flags = 0; act.sa_handler = sigsegv_handler; sigaction (SIGSEGV, &act, NULL); } #endif int main (int argc, char **argv) { int quit = 0; #if defined(__GLIBC__) setup_signal_handlers (); #endif /* command line/config options */ verify_global_config (argc, argv); parse_conf_file (&argc, &argv); parse_cmd_line (argc, argv); /* initialize storage */ init_storage (); /* setup to use the current locale */ set_locale (); #ifdef HAVE_LIBGEOIP init_geoip (); #endif /* init logger */ logger = init_log (); set_signal_data (logger); /* init parsing spinner */ parsing_spinner = new_gspinner (); parsing_spinner->processed = &logger->processed; /* outputting to stdout */ if (conf.output_html) { ui_spinner_create (parsing_spinner); goto out; } /* init curses */ set_input_opts (); if (conf.no_color || has_colors () == FALSE) { conf.color_scheme = NO_COLOR; conf.no_color = 1; } else { start_color (); } init_colors (0); init_windows (&header_win, &main_win); set_curses_spinner (parsing_spinner); /* configuration dialog */ if (isatty (STDIN_FILENO) && (conf.log_format == NULL || conf.load_conf_dlg)) { refresh (); quit = render_confdlg (logger, parsing_spinner); } /* straight parsing */ else { ui_spinner_create (parsing_spinner); } out: /* main processing event */ time (&start_proc); if (conf.load_from_disk) set_general_stats (); if (!quit && parse_log (&logger, NULL, -1)) FATAL ("Error while processing file"); logger->offset = logger->processed; /* no valid entries to process from the log */ if (logger->valid == 0) FATAL ("Nothing valid to process."); /* init reverse lookup thread */ gdns_init (); parse_initial_sort (); allocate_holder (); end_spinner (); time (&end_proc); /* stdout */ if (conf.output_html) standard_output (); /* curses */ else curses_output (); /* clean */ house_keeping (); return EXIT_SUCCESS; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/util.c���������������������������������������������������������������������������0000644�0000000�0000000�00000037127�12573351525�012134� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * util.c -- a set of handy functions to help parsing * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #define _XOPEN_SOURCE 700 #include <arpa/inet.h> #include <ctype.h> #include <errno.h> #include <stdio.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <time.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <netdb.h> #include <unistd.h> #include "util.h" #include "error.h" #include "xmalloc.h" static const char *code_type[][2] = { {"1", "1xx Informational"}, {"2", "2xx Success"}, {"3", "3xx Redirection"}, {"4", "4xx Client Error"}, {"5", "5xx Server Error"}, }; static const char *codes[][2] = { {"100", "100 - Continue: Server received the initial part of the request"}, {"101", "101 - Switching Protocols: Client asked to switch protocols"}, {"200", "200 - OK: The request sent by the client was successful"}, {"201", "201 - Created: The request has been fulfilled and created"}, {"202", "202 - Accepted: The request has been accepted for processing"}, {"203", "203 - Non-Authoritative Information: Response from a third party"}, {"204", "204 - No Content: Request did not return any content"}, {"205", "205 - Reset Content: Server asked the client to reset the document"}, {"206", "206 - Partial Content: The partial GET has been successful"}, {"300", "300 - Multiple Choices: Multiple options for the resource"}, {"301", "301 - Moved Permanently: Resource has permanently moved"}, {"302", "302 - Moved Temporarily (redirect)"}, {"303", "303 - See Other Document: The response is at a different URI"}, {"304", "304 - Not Modified: Resource has not been modified"}, {"305", "305 - Use Proxy: Can only be accessed through the proxy"}, {"307", "307 - Temporary Redirect: Resource temporarily moved"}, {"400", "400 - Bad Request: The syntax of the request is invalid"}, {"401", "401 - Unauthorized: Request needs user authentication"}, {"402", "402 - Payment Required"}, {"403", "403 - Forbidden: Server is refusing to respond to it"}, {"404", "404 - Document Not Found: Requested resource could not be found"}, {"405", "405 - Method Not Allowed: Request method not supported"}, {"406", "406 - Not Acceptable"}, {"407", "407 - Proxy Authentication Required"}, {"408", "408 - Request Timeout: Server timed out waiting for the request"}, {"409", "409 - Conflict: Conflict in the request"}, {"410", "410 - Gone: Resource requested is no longer available"}, {"411", "411 - Length Required: Invalid Content-Length"}, {"412", "412 - Precondition Failed: Server does not meet preconditions"}, {"413", "413 - Requested Entity Too Long"}, {"414", "414 - Requested Filename Too Long"}, {"415", "415 - Unsupported Media Type: Media type is not supported"}, {"416", "416 - Requested Range Not Satisfiable: Cannot supply that portion"}, {"417", "417 - Expectation Failed"}, {"444", "444 - (Nginx) Connection closed without sending any headers"}, {"494", "494 - (Nginx) Request Header Too Large"}, {"495", "495 - (Nginx) SSL client certificate error"}, {"496", "496 - (Nginx) Client didn't provide certificate"}, {"497", "497 - (Nginx) HTTP request sent to HTTPS port"}, {"499", "499 - (Nginx) Connection closed by client while processing request"}, {"500", "500 - Internal Server Error"}, {"501", "501 - Not Implemented"}, {"502", "502 - Bad Gateway: Received an invalid response from the upstream"}, {"503", "503 - Service Unavailable: The server is currently unavailable"}, {"504", "504 - Gateway Timeout: The upstream server failed to send request"}, {"505", "505 - HTTP Version Not Supported"}, {"520", "520 - CloudFlare - Web server is returning an unknown error"}, {"521", "521 - CloudFlare - Web server is down"}, {"522", "522 - CloudFlare - Connection timed out"}, {"523", "523 - CloudFlare - Origin is unreachable"}, {"524", "524 - CloudFlare - A timeout occured"} }; /* helper functions */ char * substring (const char *str, int begin, int len) { char *buffer; if (str == NULL) return NULL; if (begin < 0) begin = strlen (str) + begin; if (begin < 0) begin = 0; if (len < 0) len = 0; if (((size_t) begin) > strlen (str)) begin = strlen (str); if (((size_t) len) > strlen (&str[begin])) len = strlen (&str[begin]); if ((buffer = xmalloc (len + 1)) == NULL) return NULL; memcpy (buffer, &(str[begin]), len); buffer[len] = '\0'; return buffer; } char * alloc_string (const char *str) { char *new = xmalloc (strlen (str) + 1); strcpy (new, str); return new; } void xstrncpy (char *dest, const char *source, const size_t dest_size) { strncpy (dest, source, dest_size); if (dest_size > 0) { dest[dest_size - 1] = '\0'; } else { dest[0] = '\0'; } } int count_matches (const char *s1, char c) { const char *ptr = s1; int n = 0; do { if (*ptr == c) n++; } while (*(ptr++)); return n; } int ignore_referer (const char *host) { char *needle = NULL; int i, ignore = 0; if (conf.ignore_referer_idx == 0) return 0; if (host == NULL || *host == '\0') return 0; needle = xstrdup (host); for (i = 0; i < conf.ignore_referer_idx; ++i) { if (conf.ignore_referers[i] == NULL || *conf.ignore_referers[i] == '\0') continue; if (wc_match (conf.ignore_referers[i], needle)) { ignore = 1; goto out; } } out: free (needle); return ignore; } static int within_range (const char *ip, const char *start, const char *end) { struct in6_addr addr6, start6, end6; struct in_addr addr4, start4, end4; if (start == NULL || *start == '\0') return 0; if (end == NULL || *end == '\0') return 0; if (ip == NULL || *ip == '\0') return 0; /* IPv4 */ if (1 == inet_pton (AF_INET, ip, &addr4)) { if (1 != inet_pton (AF_INET, start, &start4)) return 0; if (1 != inet_pton (AF_INET, end, &end4)) return 0; if (memcmp (&addr4, &start4, sizeof (addr4)) >= 0 && memcmp (&addr4, &end4, sizeof (addr4)) <= 0) return 1; } /* IPv6 */ else if (1 == inet_pton (AF_INET6, ip, &addr6)) { if (1 != inet_pton (AF_INET6, start, &start6)) return 0; if (1 != inet_pton (AF_INET6, end, &end6)) return 0; if (memcmp (&addr6, &start6, sizeof (addr6)) >= 0 && memcmp (&addr6, &end6, sizeof (addr6)) <= 0) return 1; } return 0; } int ip_in_range (const char *ip) { char *start = NULL, *end, *dash; int i; for (i = 0; i < conf.ignore_ip_idx; ++i) { end = NULL; if (conf.ignore_ips[i] == NULL || *conf.ignore_ips[i] == '\0') continue; start = xstrdup (conf.ignore_ips[i]); /* split range */ if ((dash = strchr (start, '-')) != NULL) { *dash = '\0'; end = dash + 1; } /* matches single IP */ if (end == NULL && start) { if (strcmp (ip, start) == 0) { free (start); return 1; } } /* within range */ else if (start && end) { if (within_range (ip, start, end)) { free (start); return 1; } } free (start); } return 0; } char * get_home (void) { char *user_home = NULL, *path = NULL; user_home = getenv ("HOME"); if (user_home == NULL) FATAL ("Unable to determine the HOME environment variable."); path = xmalloc (snprintf (NULL, 0, "%s/.goaccessrc", user_home) + 1); sprintf (path, "%s/.goaccessrc", user_home); return path; } char * get_global_config (void) { char *path = NULL; path = xmalloc (snprintf (NULL, 0, "%s/goaccess.conf", SYSCONFDIR) + 1); sprintf (path, "%s/goaccess.conf", SYSCONFDIR); return path; } #pragma GCC diagnostic ignored "-Wformat-nonliteral" int str_to_time (const char *str, const char *fmt, struct tm *tm) { char *end = NULL, *sEnd = NULL; unsigned long long usecs = 0; if (str == NULL || *str == '\0' || fmt == NULL || *fmt == '\0') return 1; /* check if char string needs to be convert from microseconds */ if (strcmp ("%f", fmt) == 0) { errno = 0; tm->tm_year = 1970 - 1900; tm->tm_mday = 1; usecs = strtoull (str, &sEnd, 10); if (str == sEnd || *sEnd != '\0' || errno == ERANGE) return 1; tm->tm_sec = usecs / SECS; tm->tm_isdst = -1; if (mktime (tm) == -1) return 1; return 0; } end = strptime (str, fmt, tm); if (end == NULL || *end != '\0') return 1; return 0; } int convert_date (char *res, char *data, const char *from, const char *to, int size) { struct tm tm; memset (&tm, 0, sizeof (tm)); timestamp = time (NULL); now_tm = localtime (×tamp); if (str_to_time (data, from, &tm) != 0) return 1; /* if not a timestamp, use current year if not passed */ if (!has_timestamp (from) && strpbrk (from, "Yy") == NULL) tm.tm_year = now_tm->tm_year; if (strftime (res, size, to, &tm) <= 0) return 1; return 0; } #pragma GCC diagnostic warning "-Wformat-nonliteral" int invalid_ipaddr (char *str, int *ipvx) { union { struct sockaddr addr; struct sockaddr_in6 addr6; struct sockaddr_in addr4; } a; (*ipvx) = TYPE_IPINV; if (str == NULL || *str == '\0') return 1; memset (&a, 0, sizeof (a)); if (1 == inet_pton (AF_INET, str, &a.addr4.sin_addr)) { (*ipvx) = TYPE_IPV4; return 0; } else if (1 == inet_pton (AF_INET6, str, &a.addr6.sin6_addr)) { (*ipvx) = TYPE_IPV6; return 0; } return 1; } /* off_t becomes 64 bit aware */ off_t file_size (const char *filename) { struct stat st; if (stat (filename, &st) == 0) return st.st_size; LOG_DEBUG (("Can't determine size of %s: %s\n", filename, strerror (errno))); return -1; } const char * verify_status_code_type (const char *str) { size_t i; for (i = 0; i < ARRAY_SIZE (code_type); i++) if (strchr (code_type[i][0], str[0]) != NULL) return code_type[i][1]; return "Unknown"; } const char * verify_status_code (char *str) { size_t i; for (i = 0; i < ARRAY_SIZE (codes); i++) if (strstr (str, codes[i][0]) != NULL) return codes[i][1]; return "Unknown"; } char * ltrim (char *s) { char *begin = s; while (isspace (*begin)) ++begin; memmove (s, begin, strlen (begin) + 1); return s; } char * rtrim (char *s) { char *end = s + strlen (s); while ((end != s) && isspace (*(end - 1))) --end; *end = '\0'; return s; } char * trim_str (char *str) { return rtrim (ltrim (str)); } char * filesize_str (unsigned long long log_size) { char *size = (char *) xmalloc (sizeof (char) * 12); if (log_size >= GB) snprintf (size, 12, "%.2f GiB", (double) (log_size) / GB); else if (log_size >= MB) snprintf (size, 12, "%.2f MiB", (double) (log_size) / MB); else if (log_size >= KB) snprintf (size, 12, "%.2f KiB", (double) (log_size) / KB); else snprintf (size, 12, "%.1f B", (double) (log_size)); return size; } char * usecs_to_str (unsigned long long usec) { char *size = (char *) xmalloc (sizeof (char) * 11); if (usec >= DAY) snprintf (size, 11, "%.2f d", (double) (usec) / DAY); else if (usec >= HOUR) snprintf (size, 11, "%.2f hr", (double) (usec) / HOUR); else if (usec >= MINS) snprintf (size, 11, "%.2f mn", (double) (usec) / MINS); else if (usec >= SECS) snprintf (size, 11, "%.2f s", (double) (usec) / SECS); else if (usec >= MILS) snprintf (size, 11, "%.2f ms", (double) (usec) / MILS); else snprintf (size, 11, "%.2f us", (double) (usec)); return size; } char * int2str (int d, int width) { char *s = xmalloc (snprintf (NULL, 0, "%*d", width, d) + 1); sprintf (s, "%*d", width, d); return s; } char * ints_to_str (int a, int b) { char *s = xmalloc (snprintf (NULL, 0, "%d%d", a, b) + 1); sprintf (s, "%d%d", a, b); return s; } char * float2str (float d, int width) { char *s = xmalloc (snprintf (NULL, 0, "%*.2f", width, d) + 1); sprintf (s, "%*.2f", width, d); return s; } int intlen (int num) { int l = 1; while (num > 9) { l++; num /= 10; } return l; } char * char_repeat (int n, char c) { char *dest = xmalloc (n + 1); memset (dest, c, n); dest[n] = '\0'; return dest; } /* replace old with new char */ char * char_replace (char *str, char o, char n) { char *p = str; if (str == NULL || *str == '\0') return str; while ((p = strchr (p, o)) != NULL) *p++ = n; return str; } void strip_newlines (char *str) { char *src, *dst; for (src = dst = str; *src != '\0'; src++) { *dst = *src; if (*dst != '\r' && *dst != '\n') dst++; } *dst = '\0'; } /* strip blanks from a string */ char * deblank (char *str) { char *out = str, *put = str; for (; *str != '\0'; ++str) { if (*str != ' ') *put++ = *str; } *put = '\0'; return out; } char * strtoupper (char *str) { char *p = str; if (str == NULL || *str == '\0') return str; while (*p != '\0') { *p = toupper (*p); p++; } return str; } char * left_pad_str (const char *s, int indent) { char *buf = NULL; indent = strlen (s) + indent; buf = xmalloc (snprintf (NULL, 0, "%*s", indent, s) + 1); sprintf (buf, "%*s", indent, s); return buf; } int wc_match (char *wc, char *str) { while (*wc && *str) { if (*wc == '*') { while (*wc && *wc == '*') wc++; if (!*wc) return 1; while (*str && *str != *wc) str++; } else if (*wc == '?' || *wc == *str) { wc++; str++; } else { break; } } if (!*wc && !*str) return 1; return 0; } /* returns unescaped malloc'd string */ char * unescape_str (const char *src) { char *dest, *q; const char *p = src; if (src == NULL || *src == '\0') return NULL; dest = xmalloc (strlen (src) + 1); q = dest; while (*p) { if (*p == '\\') { p++; switch (*p) { case '\0': /* warning... */ goto out; case 'n': *q++ = '\n'; break; case 'r': *q++ = '\r'; break; case 't': *q++ = '\t'; break; default: *q++ = *p; break; } } else *q++ = *p; p++; } out: *q = 0; return dest; } /* returns escaped malloc'd string */ char * escape_str (const char *src) { char *dest, *q; const unsigned char *p; if (src == NULL || *src == '\0') return NULL; p = (unsigned char *) src; q = dest = xmalloc (strlen (src) * 4 + 1); while (*p) { switch (*p) { case '\\': *q++ = '\\'; *q++ = '\\'; break; case '\n': *q++ = '\\'; *q++ = 'n'; break; case '\r': *q++ = '\\'; *q++ = 'r'; break; case '\t': *q++ = '\\'; *q++ = 't'; break; default: /* not ASCII */ if ((*p < ' ') || (*p >= 0177)) { *q++ = '\\'; *q++ = '0' + (((*p) >> 6) & 07); *q++ = '0' + (((*p) >> 3) & 07); *q++ = '0' + ((*p) & 07); } else *q++ = *p; break; } p++; } *q = 0; return dest; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/src/output.c�������������������������������������������������������������������������0000644�0000000�0000000�00000160153�12573351525�012513� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * output.c -- output to the standard output stream * Copyright (C) 2009-2014 by Gerardo Orellana <goaccess@prosoftcorp.com> * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <time.h> #include <unistd.h> #include <inttypes.h> #include <locale.h> #include "output.h" #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #else #include "glibht.h" #endif #include "settings.h" #include "ui.h" #include "util.h" #include "xmalloc.h" typedef struct GPanel_ { GModule module; void (*render) (FILE * fp, GHolder * h, int total, int max_hit, int max_vis, const struct GPanel_ *, const struct GOutput_ *); void (*metrics_callback) (GMetrics * metrics); const char *clabel; /* column label */ } GPanel; static void print_html_data (FILE * fp, GHolder * h, int total, int max_hit, int max_vis, const GPanel *, const GOutput *); static void print_html_host (FILE * fp, GHolder * h, int total, int max_hit, int max_vis, const GPanel *, const GOutput *); static void fmt_date (GMetrics * metrics); /* *INDENT-OFF* */ static GPanel paneling[] = { {VISITORS , print_html_data , fmt_date, "Date"} , {REQUESTS , print_html_data , NULL , NULL } , {REQUESTS_STATIC , print_html_data , NULL , NULL } , {NOT_FOUND , print_html_data , NULL , NULL } , {HOSTS , print_html_host , NULL , NULL } , {OS , print_html_data , NULL , NULL } , {BROWSERS , print_html_data , NULL , NULL } , {VISIT_TIMES , print_html_data , NULL , NULL } , {REFERRERS , print_html_data , NULL , NULL } , {REFERRING_SITES , print_html_data , NULL , NULL } , {KEYPHRASES , print_html_data , NULL , NULL } , #ifdef HAVE_LIBGEOIP {GEO_LOCATION , print_html_data , NULL , NULL } , #endif {STATUS_CODES , print_html_data , NULL , NULL } , }; /* base64 icons */ unsigned char icons[] = { 0x40, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x63, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x20, 0x27, 0x69, 0x63, 0x6f, 0x6d, 0x6f, 0x6f, 0x6e, 0x27, 0x3b, 0x0a, 0x09, 0x73, 0x72, 0x63, 0x3a, 0x20, 0x75, 0x72, 0x6c, 0x28, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x6f, 0x66, 0x66, 0x3b, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x3b, 0x62, 0x61, 0x73, 0x65, 0x36, 0x34, 0x2c, 0x64, 0x30, 0x39, 0x47, 0x52, 0x67, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x6a, 0x67, 0x41, 0x41, 0x73, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x4a, 0x51, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x50, 0x55, 0x79, 0x38, 0x79, 0x41, 0x41, 0x41, 0x42, 0x43, 0x41, 0x41, 0x41, 0x41, 0x47, 0x41, 0x41, 0x41, 0x41, 0x42, 0x67, 0x44, 0x78, 0x49, 0x4f, 0x63, 0x47, 0x4e, 0x74, 0x59, 0x58, 0x41, 0x41, 0x41, 0x41, 0x46, 0x6f, 0x41, 0x41, 0x41, 0x41, 0x62, 0x41, 0x41, 0x41, 0x41, 0x47, 0x7a, 0x77, 0x33, 0x73, 0x51, 0x76, 0x5a, 0x32, 0x46, 0x7a, 0x63, 0x41, 0x41, 0x41, 0x41, 0x64, 0x51, 0x41, 0x41, 0x41, 0x41, 0x49, 0x41, 0x41, 0x41, 0x41, 0x43, 0x41, 0x41, 0x41, 0x41, 0x42, 0x42, 0x6e, 0x62, 0x48, 0x6c, 0x6d, 0x41, 0x41, 0x41, 0x42, 0x33, 0x41, 0x41, 0x41, 0x42, 0x4f, 0x41, 0x41, 0x41, 0x41, 0x54, 0x67, 0x58, 0x72, 0x4c, 0x63, 0x58, 0x47, 0x68, 0x6c, 0x59, 0x57, 0x51, 0x41, 0x41, 0x41, 0x61, 0x38, 0x41, 0x41, 0x41, 0x41, 0x4e, 0x67, 0x41, 0x41, 0x41, 0x44, 0x59, 0x47, 0x42, 0x41, 0x4f, 0x54, 0x61, 0x47, 0x68, 0x6c, 0x59, 0x51, 0x41, 0x41, 0x42, 0x76, 0x51, 0x41, 0x41, 0x41, 0x41, 0x6b, 0x41, 0x41, 0x41, 0x41, 0x4a, 0x41, 0x68, 0x55, 0x42, 0x46, 0x31, 0x6f, 0x62, 0x58, 0x52, 0x34, 0x41, 0x41, 0x41, 0x48, 0x47, 0x41, 0x41, 0x41, 0x41, 0x43, 0x67, 0x41, 0x41, 0x41, 0x41, 0x6f, 0x47, 0x70, 0x49, 0x41, 0x42, 0x32, 0x78, 0x76, 0x59, 0x32, 0x45, 0x41, 0x41, 0x41, 0x64, 0x41, 0x41, 0x41, 0x41, 0x41, 0x46, 0x67, 0x41, 0x41, 0x41, 0x42, 0x59, 0x46, 0x52, 0x67, 0x50, 0x4d, 0x62, 0x57, 0x46, 0x34, 0x63, 0x41, 0x41, 0x41, 0x42, 0x31, 0x67, 0x41, 0x41, 0x41, 0x41, 0x67, 0x41, 0x41, 0x41, 0x41, 0x49, 0x41, 0x41, 0x53, 0x41, 0x49, 0x78, 0x75, 0x59, 0x57, 0x31, 0x6c, 0x41, 0x41, 0x41, 0x48, 0x65, 0x41, 0x41, 0x41, 0x41, 0x55, 0x55, 0x41, 0x41, 0x41, 0x46, 0x46, 0x56, 0x78, 0x6d, 0x6d, 0x37, 0x6e, 0x42, 0x76, 0x63, 0x33, 0x51, 0x41, 0x41, 0x41, 0x6a, 0x41, 0x41, 0x41, 0x41, 0x41, 0x49, 0x41, 0x41, 0x41, 0x41, 0x43, 0x41, 0x41, 0x41, 0x77, 0x41, 0x41, 0x41, 0x41, 0x4d, 0x45, 0x41, 0x41, 0x47, 0x51, 0x41, 0x41, 0x55, 0x41, 0x41, 0x41, 0x4b, 0x5a, 0x41, 0x73, 0x77, 0x41, 0x41, 0x41, 0x43, 0x50, 0x41, 0x70, 0x6b, 0x43, 0x7a, 0x41, 0x41, 0x41, 0x41, 0x65, 0x73, 0x41, 0x4d, 0x77, 0x45, 0x4a, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x52, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x38, 0x55, 0x59, 0x44, 0x77, 0x50, 0x2f, 0x41, 0x41, 0x45, 0x41, 0x44, 0x77, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x49, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x67, 0x41, 0x41, 0x41, 0x41, 0x4d, 0x41, 0x41, 0x41, 0x41, 0x55, 0x41, 0x41, 0x4d, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x42, 0x51, 0x41, 0x42, 0x41, 0x42, 0x59, 0x41, 0x41, 0x41, 0x41, 0x45, 0x67, 0x41, 0x51, 0x41, 0x41, 0x4d, 0x41, 0x41, 0x67, 0x41, 0x42, 0x41, 0x43, 0x44, 0x77, 0x5a, 0x76, 0x43, 0x41, 0x38, 0x4f, 0x54, 0x77, 0x2f, 0x76, 0x46, 0x47, 0x2f, 0x2f, 0x33, 0x2f, 0x2f, 0x77, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x49, 0x50, 0x42, 0x6c, 0x38, 0x49, 0x44, 0x77, 0x35, 0x50, 0x44, 0x2b, 0x38, 0x55, 0x62, 0x2f, 0x2f, 0x66, 0x2f, 0x2f, 0x41, 0x41, 0x48, 0x2f, 0x34, 0x77, 0x2b, 0x66, 0x44, 0x34, 0x59, 0x50, 0x49, 0x77, 0x38, 0x4b, 0x44, 0x73, 0x4d, 0x41, 0x41, 0x77, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x45, 0x41, 0x41, 0x66, 0x2f, 0x2f, 0x41, 0x41, 0x38, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x49, 0x41, 0x41, 0x44, 0x63, 0x35, 0x41, 0x51, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x67, 0x41, 0x41, 0x4e, 0x7a, 0x6b, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x45, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x41, 0x41, 0x41, 0x33, 0x4f, 0x51, 0x45, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x67, 0x41, 0x41, 0x41, 0x41, 0x41, 0x44, 0x62, 0x67, 0x4e, 0x75, 0x41, 0x42, 0x38, 0x41, 0x50, 0x77, 0x41, 0x41, 0x41, 0x52, 0x51, 0x50, 0x41, 0x52, 0x63, 0x57, 0x46, 0x52, 0x51, 0x48, 0x42, 0x69, 0x4d, 0x68, 0x49, 0x69, 0x63, 0x6d, 0x4e, 0x52, 0x45, 0x30, 0x4e, 0x7a, 0x59, 0x7a, 0x4d, 0x68, 0x38, 0x42, 0x4e, 0x7a, 0x59, 0x7a, 0x4d, 0x68, 0x38, 0x42, 0x46, 0x68, 0x55, 0x42, 0x45, 0x52, 0x51, 0x48, 0x42, 0x69, 0x4d, 0x69, 0x4c, 0x77, 0x45, 0x48, 0x42, 0x69, 0x4d, 0x69, 0x4c, 0x77, 0x45, 0x6d, 0x4e, 0x54, 0x51, 0x2f, 0x41, 0x53, 0x63, 0x6d, 0x4e, 0x54, 0x51, 0x33, 0x4e, 0x6a, 0x4d, 0x68, 0x4d, 0x68, 0x63, 0x57, 0x46, 0x51, 0x47, 0x76, 0x42, 0x62, 0x35, 0x53, 0x43, 0x77, 0x73, 0x4c, 0x44, 0x76, 0x38, 0x41, 0x44, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x73, 0x50, 0x44, 0x67, 0x74, 0x54, 0x76, 0x51, 0x59, 0x48, 0x43, 0x41, 0x5a, 0x42, 0x42, 0x51, 0x47, 0x2f, 0x43, 0x77, 0x73, 0x50, 0x44, 0x77, 0x74, 0x53, 0x76, 0x67, 0x55, 0x49, 0x42, 0x77, 0x5a, 0x42, 0x42, 0x67, 0x61, 0x2b, 0x55, 0x77, 0x6f, 0x4b, 0x43, 0x77, 0x38, 0x42, 0x41, 0x41, 0x38, 0x4c, 0x43, 0x77, 0x46, 0x62, 0x42, 0x77, 0x61, 0x39, 0x55, 0x77, 0x73, 0x4f, 0x44, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x73, 0x50, 0x41, 0x51, 0x41, 0x4f, 0x43, 0x77, 0x73, 0x4c, 0x55, 0x72, 0x34, 0x46, 0x42, 0x55, 0x45, 0x47, 0x43, 0x41, 0x48, 0x75, 0x2f, 0x77, 0x41, 0x50, 0x43, 0x77, 0x6f, 0x4b, 0x55, 0x37, 0x34, 0x47, 0x42, 0x6b, 0x45, 0x47, 0x42, 0x77, 0x67, 0x46, 0x76, 0x6c, 0x49, 0x4c, 0x44, 0x77, 0x38, 0x4c, 0x43, 0x77, 0x73, 0x4c, 0x44, 0x77, 0x41, 0x43, 0x41, 0x41, 0x63, 0x41, 0x42, 0x77, 0x4e, 0x6d, 0x41, 0x32, 0x59, 0x41, 0x48, 0x77, 0x41, 0x2f, 0x41, 0x41, 0x41, 0x42, 0x45, 0x52, 0x51, 0x48, 0x42, 0x69, 0x4d, 0x69, 0x4c, 0x77, 0x45, 0x48, 0x42, 0x69, 0x4d, 0x69, 0x4c, 0x77, 0x45, 0x6d, 0x4e, 0x54, 0x51, 0x2f, 0x41, 0x53, 0x63, 0x6d, 0x4e, 0x54, 0x51, 0x33, 0x4e, 0x6a, 0x4d, 0x68, 0x4d, 0x68, 0x63, 0x57, 0x46, 0x51, 0x45, 0x55, 0x44, 0x77, 0x45, 0x58, 0x46, 0x68, 0x55, 0x55, 0x42, 0x77, 0x59, 0x6a, 0x49, 0x53, 0x49, 0x6e, 0x4a, 0x6a, 0x55, 0x52, 0x4e, 0x44, 0x63, 0x32, 0x4d, 0x7a, 0x49, 0x66, 0x41, 0x54, 0x63, 0x32, 0x4d, 0x7a, 0x49, 0x66, 0x41, 0x52, 0x59, 0x56, 0x41, 0x62, 0x63, 0x4c, 0x43, 0x77, 0x38, 0x50, 0x43, 0x6c, 0x4f, 0x39, 0x42, 0x67, 0x67, 0x48, 0x42, 0x6b, 0x45, 0x47, 0x42, 0x72, 0x35, 0x53, 0x43, 0x77, 0x73, 0x4b, 0x44, 0x77, 0x45, 0x41, 0x44, 0x77, 0x73, 0x4c, 0x41, 0x61, 0x38, 0x46, 0x76, 0x6c, 0x49, 0x4c, 0x43, 0x77, 0x73, 0x50, 0x2f, 0x77, 0x41, 0x4f, 0x43, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x34, 0x50, 0x43, 0x31, 0x4b, 0x2b, 0x42, 0x67, 0x63, 0x49, 0x42, 0x55, 0x49, 0x46, 0x41, 0x5a, 0x4c, 0x2f, 0x41, 0x41, 0x38, 0x4b, 0x43, 0x77, 0x74, 0x53, 0x76, 0x67, 0x59, 0x47, 0x51, 0x51, 0x59, 0x48, 0x43, 0x41, 0x61, 0x39, 0x55, 0x77, 0x6f, 0x50, 0x44, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x73, 0x50, 0x41, 0x59, 0x41, 0x48, 0x42, 0x72, 0x35, 0x53, 0x43, 0x77, 0x38, 0x4f, 0x43, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x34, 0x42, 0x41, 0x41, 0x38, 0x4c, 0x43, 0x77, 0x74, 0x53, 0x76, 0x67, 0x55, 0x46, 0x51, 0x67, 0x55, 0x49, 0x41, 0x41, 0x55, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x4a, 0x49, 0x44, 0x62, 0x67, 0x41, 0x45, 0x41, 0x41, 0x6b, 0x41, 0x45, 0x41, 0x41, 0x56, 0x41, 0x42, 0x6f, 0x41, 0x41, 0x41, 0x45, 0x52, 0x49, 0x78, 0x45, 0x7a, 0x45, 0x78, 0x45, 0x6a, 0x45, 0x54, 0x4d, 0x42, 0x46, 0x53, 0x45, 0x52, 0x4d, 0x78, 0x45, 0x68, 0x41, 0x52, 0x45, 0x6a, 0x45, 0x54, 0x4d, 0x33, 0x45, 0x53, 0x4d, 0x52, 0x4d, 0x77, 0x46, 0x75, 0x6b, 0x35, 0x50, 0x62, 0x6b, 0x70, 0x49, 0x43, 0x53, 0x66, 0x74, 0x75, 0x53, 0x51, 0x52, 0x4a, 0x2f, 0x70, 0x4f, 0x54, 0x6b, 0x39, 0x75, 0x53, 0x6b, 0x67, 0x47, 0x33, 0x2f, 0x74, 0x73, 0x42, 0x4a, 0x51, 0x45, 0x6b, 0x2f, 0x62, 0x63, 0x43, 0x53, 0x66, 0x31, 0x75, 0x53, 0x51, 0x4e, 0x75, 0x2f, 0x4e, 0x73, 0x43, 0x41, 0x50, 0x35, 0x4a, 0x41, 0x62, 0x66, 0x63, 0x2f, 0x57, 0x30, 0x43, 0x6b, 0x77, 0x41, 0x48, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x51, 0x41, 0x41, 0x79, 0x55, 0x41, 0x45, 0x41, 0x41, 0x68, 0x41, 0x44, 0x77, 0x41, 0x54, 0x51, 0x42, 0x65, 0x41, 0x47, 0x38, 0x41, 0x69, 0x51, 0x41, 0x41, 0x45, 0x7a, 0x51, 0x6e, 0x4a, 0x69, 0x4d, 0x69, 0x42, 0x77, 0x59, 0x56, 0x46, 0x42, 0x63, 0x57, 0x4d, 0x7a, 0x49, 0x33, 0x4e, 0x6a, 0x55, 0x54, 0x4e, 0x43, 0x63, 0x6d, 0x49, 0x79, 0x49, 0x48, 0x42, 0x68, 0x55, 0x55, 0x46, 0x78, 0x59, 0x7a, 0x4d, 0x6a, 0x63, 0x32, 0x4e, 0x52, 0x4d, 0x33, 0x4e, 0x69, 0x63, 0x6d, 0x4a, 0x79, 0x59, 0x48, 0x42, 0x67, 0x38, 0x42, 0x42, 0x67, 0x63, 0x47, 0x42, 0x77, 0x59, 0x58, 0x46, 0x68, 0x63, 0x57, 0x4e, 0x7a, 0x59, 0x33, 0x4e, 0x69, 0x63, 0x6d, 0x4a, 0x79, 0x55, 0x30, 0x4a, 0x79, 0x59, 0x6a, 0x49, 0x67, 0x63, 0x47, 0x46, 0x52, 0x51, 0x58, 0x46, 0x6a, 0x4d, 0x79, 0x4e, 0x7a, 0x59, 0x31, 0x41, 0x54, 0x51, 0x6e, 0x4a, 0x69, 0x4d, 0x69, 0x42, 0x77, 0x59, 0x56, 0x46, 0x42, 0x63, 0x57, 0x4d, 0x7a, 0x49, 0x33, 0x4e, 0x6a, 0x55, 0x46, 0x4e, 0x43, 0x63, 0x6d, 0x49, 0x79, 0x49, 0x48, 0x42, 0x68, 0x55, 0x55, 0x46, 0x78, 0x59, 0x7a, 0x4d, 0x6a, 0x63, 0x32, 0x4e, 0x52, 0x4d, 0x55, 0x42, 0x77, 0x59, 0x6a, 0x49, 0x53, 0x49, 0x6e, 0x4a, 0x6a, 0x55, 0x30, 0x4e, 0x7a, 0x59, 0x33, 0x4e, 0x6a, 0x63, 0x32, 0x4d, 0x7a, 0x49, 0x58, 0x46, 0x68, 0x63, 0x57, 0x46, 0x78, 0x59, 0x56, 0x32, 0x78, 0x55, 0x56, 0x48, 0x78, 0x34, 0x56, 0x46, 0x68, 0x59, 0x56, 0x48, 0x68, 0x38, 0x56, 0x46, 0x57, 0x34, 0x56, 0x46, 0x68, 0x34, 0x65, 0x46, 0x68, 0x55, 0x56, 0x46, 0x68, 0x34, 0x65, 0x46, 0x68, 0x58, 0x31, 0x4f, 0x51, 0x51, 0x49, 0x43, 0x41, 0x34, 0x4f, 0x44, 0x51, 0x30, 0x45, 0x4f, 0x69, 0x49, 0x62, 0x47, 0x77, 0x6b, 0x4d, 0x46, 0x78, 0x63, 0x73, 0x4c, 0x43, 0x63, 0x6f, 0x43, 0x77, 0x6b, 0x4d, 0x44, 0x52, 0x77, 0x42, 0x65, 0x52, 0x59, 0x56, 0x48, 0x68, 0x38, 0x56, 0x46, 0x52, 0x55, 0x56, 0x48, 0x78, 0x34, 0x56, 0x46, 0x76, 0x36, 0x53, 0x46, 0x52, 0x59, 0x65, 0x48, 0x68, 0x59, 0x56, 0x46, 0x52, 0x59, 0x65, 0x48, 0x68, 0x59, 0x56, 0x41, 0x51, 0x41, 0x56, 0x46, 0x68, 0x34, 0x65, 0x46, 0x68, 0x55, 0x56, 0x46, 0x68, 0x34, 0x65, 0x46, 0x68, 0x57, 0x33, 0x55, 0x51, 0x6f, 0x55, 0x2f, 0x4e, 0x34, 0x55, 0x43, 0x6c, 0x45, 0x70, 0x4b, 0x45, 0x56, 0x45, 0x58, 0x31, 0x39, 0x6f, 0x61, 0x46, 0x39, 0x66, 0x52, 0x45, 0x55, 0x6f, 0x4b, 0x51, 0x45, 0x6c, 0x48, 0x68, 0x55, 0x57, 0x46, 0x68, 0x55, 0x65, 0x48, 0x78, 0x55, 0x57, 0x46, 0x68, 0x55, 0x66, 0x41, 0x51, 0x41, 0x65, 0x46, 0x52, 0x59, 0x57, 0x46, 0x52, 0x34, 0x66, 0x46, 0x52, 0x59, 0x57, 0x46, 0x52, 0x2f, 0x2b, 0x37, 0x64, 0x6f, 0x50, 0x44, 0x51, 0x30, 0x45, 0x42, 0x41, 0x67, 0x49, 0x44, 0x39, 0x6f, 0x44, 0x46, 0x68, 0x59, 0x69, 0x4c, 0x43, 0x67, 0x6e, 0x43, 0x77, 0x77, 0x58, 0x46, 0x79, 0x77, 0x69, 0x49, 0x53, 0x41, 0x55, 0x45, 0x78, 0x34, 0x56, 0x46, 0x68, 0x59, 0x56, 0x48, 0x68, 0x38, 0x56, 0x46, 0x68, 0x59, 0x56, 0x48, 0x77, 0x46, 0x74, 0x48, 0x78, 0x55, 0x56, 0x46, 0x52, 0x55, 0x66, 0x48, 0x68, 0x55, 0x57, 0x46, 0x68, 0x55, 0x65, 0x62, 0x52, 0x34, 0x56, 0x46, 0x68, 0x59, 0x56, 0x48, 0x68, 0x38, 0x56, 0x46, 0x68, 0x59, 0x56, 0x48, 0x2f, 0x38, 0x41, 0x6c, 0x6e, 0x34, 0x52, 0x45, 0x58, 0x36, 0x57, 0x61, 0x46, 0x35, 0x66, 0x52, 0x55, 0x51, 0x70, 0x4b, 0x53, 0x6b, 0x70, 0x52, 0x45, 0x56, 0x66, 0x58, 0x6d, 0x67, 0x41, 0x41, 0x67, 0x41, 0x41, 0x41, 0x41, 0x41, 0x44, 0x62, 0x67, 0x4e, 0x75, 0x41, 0x43, 0x77, 0x41, 0x51, 0x51, 0x41, 0x41, 0x41, 0x54, 0x55, 0x30, 0x4a, 0x79, 0x59, 0x72, 0x41, 0x54, 0x55, 0x30, 0x4a, 0x79, 0x59, 0x72, 0x41, 0x53, 0x49, 0x48, 0x42, 0x68, 0x30, 0x42, 0x49, 0x79, 0x49, 0x48, 0x42, 0x68, 0x30, 0x42, 0x46, 0x42, 0x63, 0x57, 0x4f, 0x77, 0x45, 0x56, 0x46, 0x42, 0x63, 0x57, 0x4f, 0x77, 0x45, 0x79, 0x4e, 0x7a, 0x59, 0x39, 0x41, 0x54, 0x4d, 0x79, 0x4e, 0x7a, 0x59, 0x31, 0x45, 0x78, 0x45, 0x55, 0x42, 0x77, 0x59, 0x6a, 0x49, 0x53, 0x49, 0x6e, 0x4a, 0x6a, 0x55, 0x52, 0x4e, 0x44, 0x63, 0x32, 0x4d, 0x79, 0x45, 0x79, 0x46, 0x78, 0x59, 0x56, 0x41, 0x74, 0x73, 0x4b, 0x43, 0x77, 0x2b, 0x33, 0x43, 0x77, 0x73, 0x50, 0x53, 0x51, 0x38, 0x4b, 0x43, 0x37, 0x63, 0x50, 0x43, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x2b, 0x33, 0x43, 0x77, 0x6f, 0x50, 0x53, 0x51, 0x38, 0x4c, 0x43, 0x37, 0x63, 0x50, 0x43, 0x77, 0x71, 0x54, 0x4d, 0x54, 0x42, 0x45, 0x2f, 0x64, 0x78, 0x45, 0x4d, 0x54, 0x41, 0x77, 0x4d, 0x55, 0x51, 0x43, 0x4a, 0x45, 0x51, 0x77, 0x4d, 0x51, 0x47, 0x53, 0x53, 0x51, 0x38, 0x4c, 0x43, 0x37, 0x63, 0x50, 0x43, 0x77, 0x6f, 0x4b, 0x43, 0x77, 0x2b, 0x33, 0x43, 0x77, 0x73, 0x50, 0x53, 0x51, 0x38, 0x4b, 0x43, 0x37, 0x63, 0x50, 0x43, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x2b, 0x33, 0x43, 0x77, 0x6f, 0x50, 0x41, 0x54, 0x66, 0x39, 0x33, 0x45, 0x51, 0x78, 0x4d, 0x44, 0x41, 0x78, 0x52, 0x41, 0x49, 0x6b, 0x52, 0x44, 0x41, 0x78, 0x4d, 0x54, 0x42, 0x45, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x49, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x32, 0x34, 0x44, 0x62, 0x67, 0x41, 0x55, 0x41, 0x43, 0x6b, 0x41, 0x41, 0x41, 0x45, 0x31, 0x4e, 0x43, 0x63, 0x6d, 0x49, 0x79, 0x45, 0x69, 0x42, 0x77, 0x59, 0x64, 0x41, 0x52, 0x51, 0x58, 0x46, 0x6a, 0x4d, 0x68, 0x4d, 0x6a, 0x63, 0x32, 0x4e, 0x52, 0x4d, 0x52, 0x46, 0x41, 0x63, 0x47, 0x49, 0x79, 0x45, 0x69, 0x4a, 0x79, 0x59, 0x31, 0x45, 0x54, 0x51, 0x33, 0x4e, 0x6a, 0x4d, 0x68, 0x4d, 0x68, 0x63, 0x57, 0x46, 0x51, 0x4c, 0x62, 0x43, 0x67, 0x73, 0x50, 0x2f, 0x67, 0x41, 0x50, 0x43, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x38, 0x43, 0x41, 0x41, 0x38, 0x4c, 0x43, 0x70, 0x4d, 0x78, 0x4d, 0x45, 0x54, 0x39, 0x33, 0x45, 0x51, 0x78, 0x4d, 0x44, 0x41, 0x78, 0x52, 0x41, 0x49, 0x6b, 0x52, 0x44, 0x41, 0x78, 0x41, 0x5a, 0x4a, 0x4a, 0x44, 0x77, 0x73, 0x4c, 0x43, 0x77, 0x73, 0x50, 0x53, 0x51, 0x38, 0x4b, 0x43, 0x77, 0x73, 0x4b, 0x44, 0x77, 0x45, 0x33, 0x2f, 0x64, 0x78, 0x45, 0x4d, 0x54, 0x41, 0x77, 0x4d, 0x55, 0x51, 0x43, 0x4a, 0x45, 0x51, 0x77, 0x4d, 0x54, 0x45, 0x77, 0x52, 0x41, 0x41, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x41, 0x45, 0x41, 0x41, 0x48, 0x59, 0x78, 0x4e, 0x74, 0x5a, 0x66, 0x44, 0x7a, 0x7a, 0x31, 0x41, 0x41, 0x73, 0x45, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x44, 0x52, 0x4b, 0x64, 0x2b, 0x55, 0x41, 0x41, 0x41, 0x41, 0x41, 0x4e, 0x45, 0x70, 0x33, 0x35, 0x51, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x4a, 0x49, 0x44, 0x62, 0x67, 0x41, 0x41, 0x41, 0x41, 0x67, 0x41, 0x41, 0x67, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x41, 0x41, 0x41, 0x44, 0x77, 0x50, 0x2f, 0x41, 0x41, 0x41, 0x41, 0x45, 0x6b, 0x67, 0x41, 0x41, 0x41, 0x41, 0x41, 0x45, 0x6b, 0x67, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x67, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x49, 0x41, 0x41, 0x41, 0x41, 0x45, 0x41, 0x41, 0x41, 0x41, 0x42, 0x41, 0x41, 0x41, 0x42, 0x77, 0x53, 0x53, 0x41, 0x41, 0x41, 0x45, 0x41, 0x41, 0x41, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x6f, 0x41, 0x46, 0x41, 0x41, 0x65, 0x41, 0x48, 0x77, 0x41, 0x32, 0x67, 0x45, 0x4d, 0x41, 0x64, 0x51, 0x43, 0x4d, 0x41, 0x4a, 0x77, 0x41, 0x41, 0x41, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x41, 0x6f, 0x41, 0x69, 0x67, 0x41, 0x48, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x34, 0x41, 0x72, 0x67, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x41, 0x41, 0x34, 0x41, 0x41, 0x41, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x41, 0x41, 0x34, 0x41, 0x52, 0x77, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x44, 0x41, 0x41, 0x34, 0x41, 0x4a, 0x41, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x45, 0x41, 0x41, 0x34, 0x41, 0x56, 0x51, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x46, 0x41, 0x42, 0x59, 0x41, 0x44, 0x67, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x47, 0x41, 0x41, 0x63, 0x41, 0x4d, 0x67, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x4b, 0x41, 0x44, 0x51, 0x41, 0x59, 0x77, 0x41, 0x44, 0x41, 0x41, 0x45, 0x45, 0x43, 0x51, 0x41, 0x42, 0x41, 0x41, 0x34, 0x41, 0x41, 0x41, 0x41, 0x44, 0x41, 0x41, 0x45, 0x45, 0x43, 0x51, 0x41, 0x43, 0x41, 0x41, 0x34, 0x41, 0x52, 0x77, 0x41, 0x44, 0x41, 0x41, 0x45, 0x45, 0x43, 0x51, 0x41, 0x44, 0x41, 0x41, 0x34, 0x41, 0x4a, 0x41, 0x41, 0x44, 0x41, 0x41, 0x45, 0x45, 0x43, 0x51, 0x41, 0x45, 0x41, 0x41, 0x34, 0x41, 0x56, 0x51, 0x41, 0x44, 0x41, 0x41, 0x45, 0x45, 0x43, 0x51, 0x41, 0x46, 0x41, 0x42, 0x59, 0x41, 0x44, 0x67, 0x41, 0x44, 0x41, 0x41, 0x45, 0x45, 0x43, 0x51, 0x41, 0x47, 0x41, 0x41, 0x34, 0x41, 0x4f, 0x51, 0x41, 0x44, 0x41, 0x41, 0x45, 0x45, 0x43, 0x51, 0x41, 0x4b, 0x41, 0x44, 0x51, 0x41, 0x59, 0x77, 0x42, 0x70, 0x41, 0x47, 0x4d, 0x41, 0x62, 0x77, 0x42, 0x74, 0x41, 0x47, 0x38, 0x41, 0x62, 0x77, 0x42, 0x75, 0x41, 0x46, 0x59, 0x41, 0x5a, 0x51, 0x42, 0x79, 0x41, 0x48, 0x4d, 0x41, 0x61, 0x51, 0x42, 0x76, 0x41, 0x47, 0x34, 0x41, 0x49, 0x41, 0x41, 0x78, 0x41, 0x43, 0x34, 0x41, 0x4d, 0x41, 0x42, 0x70, 0x41, 0x47, 0x4d, 0x41, 0x62, 0x77, 0x42, 0x74, 0x41, 0x47, 0x38, 0x41, 0x62, 0x77, 0x42, 0x75, 0x61, 0x57, 0x4e, 0x76, 0x62, 0x57, 0x39, 0x76, 0x62, 0x67, 0x42, 0x70, 0x41, 0x47, 0x4d, 0x41, 0x62, 0x77, 0x42, 0x74, 0x41, 0x47, 0x38, 0x41, 0x62, 0x77, 0x42, 0x75, 0x41, 0x46, 0x49, 0x41, 0x5a, 0x51, 0x42, 0x6e, 0x41, 0x48, 0x55, 0x41, 0x62, 0x41, 0x42, 0x68, 0x41, 0x48, 0x49, 0x41, 0x61, 0x51, 0x42, 0x6a, 0x41, 0x47, 0x38, 0x41, 0x62, 0x51, 0x42, 0x76, 0x41, 0x47, 0x38, 0x41, 0x62, 0x67, 0x42, 0x47, 0x41, 0x47, 0x38, 0x41, 0x62, 0x67, 0x42, 0x30, 0x41, 0x43, 0x41, 0x41, 0x5a, 0x77, 0x42, 0x6c, 0x41, 0x47, 0x34, 0x41, 0x5a, 0x51, 0x42, 0x79, 0x41, 0x47, 0x45, 0x41, 0x64, 0x41, 0x42, 0x6c, 0x41, 0x47, 0x51, 0x41, 0x49, 0x41, 0x42, 0x69, 0x41, 0x48, 0x6b, 0x41, 0x49, 0x41, 0x42, 0x4a, 0x41, 0x47, 0x4d, 0x41, 0x62, 0x77, 0x42, 0x4e, 0x41, 0x47, 0x38, 0x41, 0x62, 0x77, 0x42, 0x75, 0x41, 0x43, 0x34, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x77, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x3d, 0x3d, 0x29, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x28, 0x27, 0x77, 0x6f, 0x66, 0x66, 0x27, 0x29, 0x3b, 0x0a, 0x09, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x3b, 0x0a, 0x09, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3a, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x3b, 0x0a, 0x7d, 0x0a, 0x5b, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5e, 0x3d, 0x22, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x22, 0x5d, 0x2c, 0x20, 0x5b, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x2a, 0x3d, 0x22, 0x20, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x22, 0x5d, 0x20, 0x7b, 0x0a, 0x09, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x20, 0x27, 0x69, 0x63, 0x6f, 0x6d, 0x6f, 0x6f, 0x6e, 0x27, 0x3b, 0x0a, 0x09, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x3a, 0x20, 0x6e, 0x6f, 0x6e, 0x65, 0x3b, 0x0a, 0x09, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3a, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x3b, 0x0a, 0x09, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x3b, 0x0a, 0x09, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x3a, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x3b, 0x0a, 0x09, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x3a, 0x20, 0x6e, 0x6f, 0x6e, 0x65, 0x3b, 0x0a, 0x09, 0x6c, 0x69, 0x6e, 0x65, 0x2d, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a, 0x20, 0x31, 0x3b, 0x0a, 0x09, 0x2d, 0x77, 0x65, 0x62, 0x6b, 0x69, 0x74, 0x2d, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x3a, 0x20, 0x61, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x3b, 0x0a, 0x09, 0x2d, 0x6d, 0x6f, 0x7a, 0x2d, 0x6f, 0x73, 0x78, 0x2d, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x3a, 0x20, 0x67, 0x72, 0x61, 0x79, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x3b, 0x0a, 0x7d, 0x0a, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x3a, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x22, 0x5c, 0x66, 0x30, 0x36, 0x35, 0x22, 0x3b, 0x0a, 0x7d, 0x0a, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x22, 0x5c, 0x66, 0x30, 0x36, 0x36, 0x22, 0x3b, 0x0a, 0x7d, 0x0a, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x62, 0x61, 0x72, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x74, 0x3a, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x22, 0x5c, 0x66, 0x30, 0x38, 0x30, 0x22, 0x3b, 0x0a, 0x7d, 0x0a, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x64, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x3a, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x22, 0x5c, 0x66, 0x30, 0x65, 0x34, 0x22, 0x3b, 0x0a, 0x7d, 0x0a, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x70, 0x6c, 0x75, 0x73, 0x2d, 0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x3a, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x22, 0x5c, 0x66, 0x30, 0x66, 0x65, 0x22, 0x3b, 0x0a, 0x7d, 0x0a, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x6d, 0x69, 0x6e, 0x75, 0x73, 0x2d, 0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x3a, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x22, 0x5c, 0x66, 0x31, 0x34, 0x36, 0x22, 0x3b, 0x0a, 0x7d, 0x0a }; /* sanitize output with html entities for special chars */ static void clean_output (FILE * fp, char *s) { while (*s) { switch (*s) { case '\'': fprintf (fp, "'"); break; case '"': fprintf (fp, """); break; case '&': fprintf (fp, "&"); break; case '<': fprintf (fp, "<"); break; case '>': fprintf (fp, ">"); break; case ' ': fprintf (fp, " "); break; default: fputc (*s, fp); break; } s++; } } static void print_html_title (FILE *fp, char *now) { const char *title = conf.html_report_title ? conf.html_report_title : REP_TITLE; fprintf (fp, "<title>"); clean_output (fp, (char *) title); fprintf (fp, " - %s\n", now); } static void print_html_page_header(FILE *fp) { const char *header = conf.html_report_title ? conf.html_report_title : T_DASH; fprintf (fp, "

"); clean_output (fp, (char *) header); fprintf (fp, "

\n"); } static void print_html_header (FILE * fp, char *now) { fprintf (fp, "\n"); fprintf (fp, "\n"); fprintf (fp, ""); fprintf (fp, ""); fprintf (fp, ""); fprintf (fp, ""); print_html_title(fp, now); fprintf (fp, "\n"); fprintf (fp, "\n"); fprintf (fp, "\n"); fprintf (fp, "\n"); fprintf (fp, "
"); } /* *INDENT-ON* */ static GPanel * panel_lookup (GModule module) { int i, num_panels = ARRAY_SIZE (paneling); for (i = 0; i < num_panels; i++) { if (paneling[i].module == module) return &paneling[i]; } return NULL; } static int get_max_visitor (GHolder * h) { int i, max = 0; for (i = 0; i < h->idx; i++) { int cur = h->items[i].metrics->visitors; if (cur > max) max = cur; } return max; } static int get_max_hit (GHolder * h) { int i, max = 0; for (i = 0; i < h->idx; i++) { int cur = h->items[i].metrics->hits; if (cur > max) max = cur; } return max; } static void print_pure_menu (FILE * fp, char *now) { fprintf (fp, "
"); fprintf (fp, "
"); fprintf (fp, "", GO_WEBSITE); fprintf (fp, "goaccess", GO_LOGO); fprintf (fp, ""); fprintf (fp, ""); fprintf (fp, "

Generated by
GoAccess %s

%s

", GO_VERSION, now); fprintf (fp, "
"); fprintf (fp, "
"); fprintf (fp, "
"); fprintf (fp, "
"); } static void print_html_footer (FILE * fp) { fprintf (fp, "
\n"); fprintf (fp, "
\n"); fprintf (fp, "
\n"); fprintf (fp, "\n"); fprintf (fp, ""); } static void print_html_h2 (FILE * fp, const char *title, const char *id) { if (id) fprintf (fp, "

%s

", id, title); else fprintf (fp, "

%s

", title); } static void print_p (FILE * fp, const char *paragraph) { fprintf (fp, "

%s

", paragraph); } static void print_html_begin_table (FILE * fp) { fprintf (fp, "\n"); } static void print_html_end_table (FILE * fp) { fprintf (fp, "
\n"); } static void print_html_begin_thead (FILE * fp) { fprintf (fp, "\n"); } static void print_html_end_thead (FILE * fp) { fprintf (fp, "\n"); } static void print_html_begin_tbody (FILE * fp) { fprintf (fp, "\n"); } static void print_html_end_tbody (FILE * fp) { fprintf (fp, "\n"); } static void print_html_begin_agent_tr (FILE * fp) { fprintf (fp, ""); } static void print_html_begin_tr (FILE * fp, int hide, int sub) { if (hide) fprintf (fp, "", (sub ? "sub" : "root")); else fprintf (fp, "", (sub ? "sub" : "root")); } static void print_html_end_tr (FILE * fp) { fprintf (fp, ""); } static void print_html_end_div (FILE * fp) { fprintf (fp, ""); } static void print_html_begin_grid (FILE * fp) { fprintf (fp, "
"); } static void print_html_begin_grid_col (FILE * fp, int size) { fprintf (fp, "
", size); } static void print_html_begin_grid_module (FILE * fp, const char *color) { fprintf (fp, "
", color); } static void print_html_begin_col_wrap (FILE * fp, int size, const char *color) { print_html_begin_grid_col (fp, size); print_html_begin_grid_module (fp, color); } static void print_html_end_col_wrap (FILE * fp) { print_html_end_div (fp); print_html_end_div (fp); } static void print_html_col_title (FILE * fp, const char *title) { fprintf (fp, "
"); fprintf (fp, " %s
", title); } #pragma GCC diagnostic ignored "-Wformat-nonliteral" static void print_graph (FILE * fp, int max_hit, int max_vis, int hits, int visitors) { const char *s, *c = "class='bar'"; float lh = get_percentage (max_hit, hits), lv = 0; int h = 0; setlocale (LC_NUMERIC, "POSIX"); fprintf (fp, ""); h = max_vis ? 8 : 16; lh = lh < 1 ? 1 : lh; /* render hits graph */ if (max_hit) { s = "
"; fprintf (fp, s, (int) lh, c, lh, h); } /* render visitors graph */ if (max_vis) { c = "class='bar light'"; s = "
"; lv = get_percentage (max_vis, visitors); lv = lv < 1 ? 1 : lv; fprintf (fp, s, (int) lv, c, lv, h); } fprintf (fp, "\n"); setlocale (LC_NUMERIC, ""); } #pragma GCC diagnostic warning "-Wformat-nonliteral" static void print_table_head (FILE * fp, GModule module) { print_html_h2 (fp, module_to_head (module), module_to_id (module)); print_p (fp, module_to_desc (module)); } static void print_metric_hits (FILE * fp, GMetrics * nmetrics) { fprintf (fp, "%'d", nmetrics->hits); } static void print_metric_visitors (FILE * fp, GMetrics * nmetrics) { fprintf (fp, "%'d", nmetrics->visitors); } static void print_metric_percent (FILE * fp, GMetrics * nmetrics, int max_hit) { fprintf (fp, ""); fprintf (fp, "%4.2f%%", (max_hit ? "max" : ""), nmetrics->percent); fprintf (fp, ""); } static void print_metric_bw (FILE * fp, GMetrics * nmetrics) { char *bw = NULL; if (!conf.bandwidth) return; bw = filesize_str (nmetrics->bw.nbw); fprintf (fp, ""); clean_output (fp, bw); fprintf (fp, ""); free (bw); } static void print_metric_avgts (FILE * fp, GMetrics * nmetrics) { char *avgts = NULL; if (!conf.serve_usecs) return; avgts = usecs_to_str (nmetrics->avgts.nts); fprintf (fp, ""); clean_output (fp, avgts); fprintf (fp, ""); free (avgts); } static void print_metric_cumts (FILE * fp, GMetrics * nmetrics) { char *cumts = NULL; if (!conf.serve_usecs) return; cumts = usecs_to_str (nmetrics->cumts.nts); fprintf (fp, ""); clean_output (fp, cumts); fprintf (fp, ""); free (cumts); } static void print_metric_maxts (FILE * fp, GMetrics * nmetrics) { char *maxts = NULL; if (!conf.serve_usecs) return; maxts = usecs_to_str (nmetrics->maxts.nts); fprintf (fp, ""); clean_output (fp, maxts); fprintf (fp, ""); free (maxts); } static void print_metric_data (FILE * fp, GMetrics * nmetrics) { fprintf (fp, ""); clean_output (fp, nmetrics->data); fprintf (fp, ""); } static void print_metric_protocol (FILE * fp, GMetrics * nmetrics) { if (!conf.append_protocol) return; fprintf (fp, ""); clean_output (fp, nmetrics->protocol); fprintf (fp, ""); } static void print_metric_method (FILE * fp, GMetrics * nmetrics) { if (!conf.append_method) return; fprintf (fp, ""); clean_output (fp, nmetrics->method); fprintf (fp, ""); } static void print_metrics (FILE * fp, GMetrics * nmetrics, int max_hit, int max_vis, int sub, const GOutput * output) { if (output->visitors) print_metric_visitors (fp, nmetrics); if (output->hits) print_metric_hits (fp, nmetrics); if (output->percent) print_metric_percent (fp, nmetrics, max_hit == nmetrics->hits); if (output->bw) print_metric_bw (fp, nmetrics); if (output->avgts) print_metric_avgts (fp, nmetrics); if (output->cumts) print_metric_cumts (fp, nmetrics); if (output->maxts) print_metric_maxts (fp, nmetrics); if (output->protocol) print_metric_protocol (fp, nmetrics); if (output->method) print_metric_method (fp, nmetrics); if (output->data) print_metric_data (fp, nmetrics); if (output->graph && max_hit && !output->sub_graph && sub) fprintf (fp, ""); else if (output->graph && max_hit) print_graph (fp, max_hit, max_vis, nmetrics->hits, nmetrics->visitors); } static void print_subitems (FILE * fp, GHolder * h, int idx, int total, int max_hit, int max_vis, const GOutput * output) { GMetrics *nmetrics; GSubItem *iter; GSubList *sub_list = h->items[idx].sub_list; int i = 0; if (sub_list == NULL) return; for (iter = sub_list->head; iter; iter = iter->next, i++) { set_data_metrics (iter->metrics, &nmetrics, total); print_html_begin_tr (fp, 1, 1); print_metrics (fp, nmetrics, max_hit, max_vis, 1, output); print_html_end_tr (fp); free (nmetrics); } } static int fill_host_agents (void *val, void *user_data) { GAgents *agents = user_data; char *agent = get_host_agent_val ((*(int *) val)); if (agent == NULL) return 1; agents->items[agents->size].agent = agent; agents->size++; return 0; } static void load_host_agents (void *list, void *user_data, int count) { GSLList *lst = list; GAgents *agents = user_data; agents->items = xcalloc (count, sizeof (GAgentItem)); list_foreach (lst, fill_host_agents, agents); } static void print_agents (FILE * fp, GHolder * h, int idx, int cspan) { GAgents *agents = new_gagents (); const char *addr = h->items[idx].metrics->data; int i, n = 0; if (set_host_agents (addr, load_host_agents, agents) == 1) goto out; if (agents->size == 0) goto out; print_html_begin_agent_tr (fp); fprintf (fp, ""); fprintf (fp, "UA - %s", cspan, addr); print_html_end_tr (fp); n = agents->size > 10 ? 10 : agents->size; for (i = 0; i < n; ++i) { print_html_begin_agent_tr (fp); fprintf (fp, ""); fprintf (fp, "", cspan); fprintf (fp, "
"); clean_output (fp, agents->items[i].agent); fprintf (fp, "
"); fprintf (fp, ""); print_html_end_tr (fp); } out: /* clean stuff up */ for (i = 0; i < agents->size; ++i) free (agents->items[i].agent); if (agents->items) free (agents->items); free (agents); } static void print_host_sub (FILE * fp, GHolder * h, int idx, int cspan) { GSubItem *iter; GSubList *sub_list = h->items[idx].sub_list; if (sub_list == NULL) return; print_html_begin_agent_tr (fp); fprintf (fp, ""); fprintf (fp, "Location/Hostname", cspan); print_html_end_tr (fp); for (iter = sub_list->head; iter; iter = iter->next) { print_html_begin_agent_tr (fp); fprintf (fp, ""); fprintf (fp, "
", cspan); clean_output (fp, iter->metrics->data); fprintf (fp, "
"); print_html_end_tr (fp); } } static void print_html_host (FILE * fp, GHolder * h, int total, int max_hit, int max_vis, GO_UNUSED const GPanel * panel, const GOutput * output) { GMetrics *nmetrics; int i, cspan = 5; if (output->avgts && conf.serve_usecs) cspan++; if (output->cumts && conf.serve_usecs) cspan++; if (output->maxts && conf.serve_usecs) cspan++; for (i = 0; i < h->idx; i++) { set_data_metrics (h->items[i].metrics, &nmetrics, total); print_html_begin_tr (fp, (i > OUTPUT_N), 0); fprintf (fp, ""); /* do we have child rows to expand */ if ((conf.list_agents) || (h->sub_items_size)) { fprintf (fp, ""); fprintf (fp, ""); fprintf (fp, ""); } else { fprintf (fp, "-"); } fprintf (fp, ""); print_metrics (fp, nmetrics, max_hit, max_vis, 0, output); print_html_end_tr (fp); if (h->sub_items_size) print_host_sub (fp, h, i, cspan); if (conf.list_agents) print_agents (fp, h, i, cspan); free (nmetrics); } } static void fmt_date (GMetrics * metrics) { format_date_visitors (metrics); } static void print_html_data (FILE * fp, GHolder * h, int total, int max_hit, int max_vis, const GPanel * panel, const GOutput * output) { GMetrics *nmetrics; int i; for (i = 0; i < h->idx; i++) { if (panel->metrics_callback) panel->metrics_callback (h->items[i].metrics); set_data_metrics (h->items[i].metrics, &nmetrics, total); print_html_begin_tr (fp, (i > OUTPUT_N), 0); print_metrics (fp, nmetrics, max_hit, max_vis, 0, output); print_html_end_tr (fp); if (h->sub_items_size) print_subitems (fp, h, i, total, max_hit, max_vis, output); free (nmetrics); } } static void print_html_common (FILE * fp, GHolder * h, int total, const GPanel * panel, const GOutput * output) { int max_hit = 0, max_vis = 0; const char *lbl = panel->clabel; if (!panel->clabel) lbl = module_to_label (h->module); if (output->graph) { max_hit = get_max_hit (h); max_vis = get_max_visitor (h); } print_table_head (fp, h->module); print_html_begin_table (fp); print_html_begin_thead (fp); fprintf (fp, ""); if (h->module == HOSTS) fprintf (fp, "-"); fprintf (fp, "%s", MTRC_VISITORS_LBL); fprintf (fp, "%s", MTRC_HITS_LBL); fprintf (fp, "%%"); if (conf.bandwidth) fprintf (fp, "%s", MTRC_BW_LBL); if (conf.serve_usecs) { fprintf (fp, "%s", MTRC_AVGTS_LBL); fprintf (fp, "%s", MTRC_CUMTS_LBL); fprintf (fp, "%s", MTRC_MAXTS_LBL); } if (conf.append_protocol && output->protocol) fprintf (fp, "%s", MTRC_PROTOCOLS_LBL); if (conf.append_method && output->method) fprintf (fp, "%s", MTRC_METHODS_LBL); if (max_hit) fprintf (fp, "%s", lbl); fprintf (fp, "%s", max_hit ? "fr" : "", max_hit ? "" : lbl); fprintf (fp, ""); fprintf (fp, ""); fprintf (fp, ""); print_html_end_thead (fp); print_html_begin_tbody (fp); panel->render (fp, h, total, max_hit, max_vis, panel, output); print_html_end_tbody (fp); print_html_end_table (fp); } static void print_html_summary (FILE * fp, GLog * logger) { long long t = 0LL; int total = 0, valid = 0; off_t log_size = 0; char *bw, *size; print_html_page_header (fp); print_html_h2 (fp, T_HEAD, GENER_ID); print_html_begin_grid (fp); /* total requests */ total = logger->processed; valid = logger->valid; print_html_begin_col_wrap (fp, 6, "green"); print_html_col_title (fp, T_VALID " / " T_REQUESTS); fprintf (fp, "

%'d / %'d

", valid, total); print_html_end_col_wrap (fp); /* invalid requests */ total = logger->invalid; print_html_begin_col_wrap (fp, 6, "red"); print_html_col_title (fp, T_FAILED); fprintf (fp, "

%'d

", total); print_html_end_col_wrap (fp); /* generated time */ t = (long long) end_proc - start_proc; print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_GEN_TIME); fprintf (fp, "

%lld secs

", t); print_html_end_col_wrap (fp); total = get_ht_size_by_metric (VISITORS, MTRC_UNIQMAP); print_html_begin_col_wrap (fp, 6, "blue"); print_html_col_title (fp, T_UNIQUE_VIS); fprintf (fp, "

%'d

", total); print_html_end_col_wrap (fp); /* files */ total = get_ht_size_by_metric (REQUESTS, MTRC_DATAMAP); print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_UNIQUE_FIL); fprintf (fp, "

%'d

", total); print_html_end_col_wrap (fp); /* excluded hits */ total = logger->excluded_ip; print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_EXCLUDE_IP); fprintf (fp, "

%'d

", total); print_html_end_col_wrap (fp); print_html_end_div (fp); print_html_begin_grid (fp); /* referrers */ total = get_ht_size_by_metric (REFERRERS, MTRC_DATAMAP); print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_REFERRER); fprintf (fp, "

%'d

", total); print_html_end_col_wrap (fp); /* not found */ total = get_ht_size_by_metric (NOT_FOUND, MTRC_DATAMAP); print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_UNIQUE404); fprintf (fp, "

%'d

", total); print_html_end_col_wrap (fp); /* static files */ total = get_ht_size_by_metric (REQUESTS_STATIC, MTRC_DATAMAP); print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_STATIC_FIL); fprintf (fp, "

%'d

", total); print_html_end_col_wrap (fp); if (!logger->piping) { log_size = file_size (conf.ifile); size = filesize_str (log_size); } else { size = alloc_string ("N/A"); } /* log size */ print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_LOG); fprintf (fp, "

%s

", size); print_html_end_col_wrap (fp); /* bandwidth */ bw = filesize_str ((float) logger->resp_size); print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_BW); fprintf (fp, "

%s

", bw); print_html_end_col_wrap (fp); /* log path */ if (conf.ifile == NULL) conf.ifile = (char *) "STDIN"; print_html_begin_col_wrap (fp, 6, NULL); print_html_col_title (fp, T_LOG_PATH); fprintf (fp, "

%s

", conf.ifile); print_html_end_col_wrap (fp); print_html_end_div (fp); free (bw); free (size); } /* entry point to generate a report writing it to the fp */ void output_html (GLog * logger, GHolder * holder) { FILE *fp = stdout; GModule module; char now[DATE_TIME]; const GOutput *output; const GPanel *panel; generate_time (); strftime (now, DATE_TIME, "%Y-%m-%d %H:%M:%S", now_tm); setlocale (LC_NUMERIC, ""); print_html_header (fp, now); print_pure_menu (fp, now); print_html_summary (fp, logger); for (module = 0; module < TOTAL_MODULES; module++) { panel = panel_lookup (module); output = output_lookup (module); if (!panel) continue; if (ignore_panel (module)) continue; print_html_common (fp, holder + module, logger->processed, panel, output); } print_html_footer (fp); fclose (fp); } goaccess-0.9.4/src/gmenu.h0000664000000000000000000000316512573351525012274 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #ifdef HAVE_NCURSESW_NCURSES_H #include #elif HAVE_NCURSES_NCURSES_H #include #elif HAVE_NCURSES_H #include #elif HAVE_CURSES_H #include #endif #ifndef GMENU_H_INCLUDED #define GMENU_H_INCLUDED enum ACTION { REQ_DOWN, REQ_UP, REQ_SEL }; typedef struct GMenu_ GMenu; typedef struct GItem_ GItem; struct GItem_ { char *name; int checked; }; struct GMenu_ { WINDOW *win; int count; int size; int idx; int start; int h; int w; int x; int y; unsigned short multiple; unsigned short selectable; unsigned short status; GItem *items; }; GMenu *new_gmenu (WINDOW * parent, int h, int w, int y, int x); int post_gmenu (GMenu * menu); void gmenu_driver (GMenu * menu, int c); #endif goaccess-0.9.4/src/ui.c0000644000000000000000000011770412573357401011573 00000000000000/** * ui.c -- various curses interfaces * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #define STDIN_FILENO 0 #ifndef _BSD_SOURCE #define _BSD_SOURCE /* include stuff from 4.3 BSD */ #endif #ifndef _DEFAULT_SOURCE #define _DEFAULT_SOURCE #endif #if HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include "ui.h" #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #else #include "glibht.h" #endif #include "color.h" #include "error.h" #include "gmenu.h" #include "goaccess.h" #include "util.h" #include "xmalloc.h" /* *INDENT-OFF* */ static GOutput outputting[] = { {VISITORS , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 1} , {REQUESTS , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0} , {REQUESTS_STATIC , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0} , {NOT_FOUND , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0} , {HOSTS , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 0} , {OS , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 1} , {BROWSERS , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 1} , {VISIT_TIMES , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 1} , {REFERRERS , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , 0} , {REFERRING_SITES , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , 0} , {KEYPHRASES , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , 0} , #ifdef HAVE_LIBGEOIP {GEO_LOCATION , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , 0} , #endif {STATUS_CODES , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , 0} , }; /* *INDENT-ON* */ static char *date_format = NULL; static char *log_format = NULL; static char *time_format = NULL; typedef struct Field_ { const char *field; /* char due to log, bw, log_file */ char *value; GColors *(*colorlbl) (void); GColors *(*colorval) (void); short oneliner; } Field; /* Determine which metrics to output given a module */ GOutput * output_lookup (GModule module) { int i, num_panels = ARRAY_SIZE (outputting); for (i = 0; i < num_panels; i++) { if (outputting[i].module == module) return &outputting[i]; } return NULL; } /* initialize curses colors */ void init_colors (int force) { /* use default foreground/background colors */ use_default_colors (); /* first set a default normal color */ set_normal_color (); /* then parse custom colors and initialize them */ set_colors (force); } /* creation - ncurses' window handling */ void set_input_opts (void) { initscr (); clear (); noecho (); halfdelay (10); nonl (); intrflush (stdscr, FALSE); keypad (stdscr, TRUE); if (curs_set (0) == ERR) LOG_DEBUG (("Unable to change cursor: %s\n", strerror (errno))); if (conf.mouse_support) mousemask (BUTTON1_CLICKED, NULL); } /* delete ncurses window handling */ void close_win (WINDOW * w) { if (w == NULL) return; wclear (w); wrefresh (w); delwin (w); } void generate_time (void) { timestamp = time (NULL); now_tm = localtime (×tamp); } void end_spinner (void) { pthread_mutex_lock (&parsing_spinner->mutex); parsing_spinner->state = SPN_END; pthread_mutex_unlock (&parsing_spinner->mutex); } void init_windows (WINDOW ** header_win, WINDOW ** main_win) { GColors *color = get_color (COLOR_BG); int row = 0, col = 0; /* init standard screen */ getmaxyx (stdscr, row, col); if (row < MIN_HEIGHT || col < MIN_WIDTH) FATAL ("Minimum screen size - 0 columns by 7 lines"); /* init header screen */ *header_win = newwin (6, col, 0, 0); keypad (*header_win, TRUE); if (*header_win == NULL) FATAL ("Unable to allocate memory for header_win."); /* init main screen */ *main_win = newwin (row - 8, col, 7, 0); keypad (*main_win, TRUE); if (*main_win == NULL) FATAL ("Unable to allocate memory for main_win."); /* background colors */ wbkgd (*main_win, COLOR_PAIR (color->pair->idx)); wbkgd (*header_win, COLOR_PAIR (color->pair->idx)); wbkgd (stdscr, COLOR_PAIR (color->pair->idx)); } #pragma GCC diagnostic ignored "-Wformat-nonliteral" /* draw a generic header */ void draw_header (WINDOW * win, const char *s, const char *fmt, int y, int x, int w, GColors * (*func) (void)) { GColors *color = (*func) (); char *buf; buf = xmalloc (snprintf (NULL, 0, fmt, s) + 1); sprintf (buf, fmt, s); wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwhline (win, y, x, ' ', w); mvwaddnstr (win, y, x, buf, w); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); free (buf); } #pragma GCC diagnostic warning "-Wformat-nonliteral" /* determine the actual size of the main window */ void term_size (WINDOW * main_win) { getmaxyx (stdscr, term_h, term_w); real_size_y = term_h - (MAX_HEIGHT_HEADER + MAX_HEIGHT_FOOTER); wresize (main_win, real_size_y, term_w); wmove (main_win, real_size_y, 0); } const char * module_to_label (GModule module) { static const char *modules[] = { VISIT_LABEL, REQUE_LABEL, STATI_LABEL, FOUND_LABEL, HOSTS_LABEL, OPERA_LABEL, BROWS_LABEL, VTIME_LABEL, REFER_LABEL, SITES_LABEL, KEYPH_LABEL, #ifdef HAVE_LIBGEOIP GEOLO_LABEL, #endif CODES_LABEL, }; return modules[module]; } const char * module_to_id (GModule module) { static const char *modules[] = { VISIT_ID, REQUE_ID, STATI_ID, FOUND_ID, HOSTS_ID, OPERA_ID, BROWS_ID, VTIME_ID, REFER_ID, SITES_ID, KEYPH_ID, #ifdef HAVE_LIBGEOIP GEOLO_ID, #endif CODES_ID, }; return modules[module]; } const char * module_to_head (GModule module) { static const char *modules[] = { VISIT_HEAD, REQUE_HEAD, STATI_HEAD, FOUND_HEAD, HOSTS_HEAD, OPERA_HEAD, BROWS_HEAD, VTIME_HEAD, REFER_HEAD, SITES_HEAD, KEYPH_HEAD, #ifdef HAVE_LIBGEOIP GEOLO_HEAD, #endif CODES_HEAD, }; return modules[module]; } const char * module_to_desc (GModule module) { static const char *modules[] = { VISIT_DESC, REQUE_DESC, STATI_DESC, FOUND_DESC, HOSTS_DESC, OPERA_DESC, BROWS_DESC, VTIME_DESC, REFER_DESC, SITES_DESC, KEYPH_DESC, #ifdef HAVE_LIBGEOIP GEOLO_DESC, #endif CODES_DESC, }; return modules[module]; } /* rerender header window to reflect active module */ void update_active_module (WINDOW * header_win, GModule current) { GColors *color = get_color (COLOR_ACTIVE_LABEL); const char *module = module_to_label (current); int col = getmaxx (stdscr); char *lbl = xmalloc (snprintf (NULL, 0, "[Active Panel: %s]", module) + 1); sprintf (lbl, "[Active Panel: %s]", module); wmove (header_win, 0, 30); wattron (header_win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (header_win, 0, col - strlen (lbl) - 1, "%s", lbl); wattroff (header_win, color->attr | COLOR_PAIR (color->pair->idx)); wrefresh (header_win); free (lbl); } static void render_overall_field (WINDOW * win, const char *s, int y, int x, GColors * color) { wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, x, "%s", s); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } static void render_overall_value (WINDOW * win, const char *s, int y, int x, GColors * color) { wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, x, "%s", s); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } static char * get_str_excluded_ips (GLog * logger) { return int2str (logger->excluded_ip, 0); } static char * get_str_failed_reqs (GLog * logger) { return int2str (logger->invalid, 0); } static char * get_str_processed_reqs (GLog * logger) { return int2str (logger->processed, 0); } static char * get_str_valid_reqs (GLog * logger) { return int2str (logger->valid, 0); } static char * get_str_notfound_reqs (void) { return int2str (get_ht_size_by_metric (NOT_FOUND, MTRC_DATAMAP), 0); } static char * get_str_ref_reqs (void) { return int2str (get_ht_size_by_metric (REFERRERS, MTRC_DATAMAP), 0); } static char * get_str_reqs (void) { return int2str (get_ht_size_by_metric (REQUESTS, MTRC_DATAMAP), 0); } static char * get_str_static_reqs (void) { return int2str (get_ht_size_by_metric (REQUESTS_STATIC, MTRC_DATAMAP), 0); } static char * get_str_visitors (void) { return int2str (get_ht_size_by_metric (VISITORS, MTRC_UNIQMAP), 0); } static char * get_str_proctime (void) { return int2str (((long long) end_proc - start_proc), 0); } static char * get_str_filesize (GLog * logger, const char *ifile) { if (!logger->piping && ifile != NULL) return filesize_str (file_size (ifile)); else return alloc_string ("N/A"); } static char * get_str_logfile (GLog * logger, const char *ifile) { if (!logger->piping && ifile != NULL) return alloc_string (ifile); else return alloc_string ("STDIN"); } static char * get_str_bandwidth (GLog * logger) { return filesize_str ((float) logger->resp_size); } /* render overall statistics */ static void render_overall_statistics (WINDOW * win, Field fields[], size_t n) { GColors *color = NULL; int x_field = 2, x_value = 0; size_t i, j, k, max_field = 0, max_value = 0, mod_val, y; for (i = 0, k = 0, y = 2; i < n; i++) { /* new line every OVERALL_NUM_COLS */ mod_val = k % OVERALL_NUM_COLS; /* reset position & length and increment row */ if (k > 0 && mod_val == 0) { max_value = max_field = 0; x_value = x_field = 2; y++; } /* x pos = max length of field */ x_field += max_field; color = (*fields[i].colorlbl) (); render_overall_field (win, fields[i].field, y, x_field, color); /* get max length of field in the same column */ max_field = 0; for (j = 0; j < n; j++) { size_t len = strlen (fields[j].field); if (j % OVERALL_NUM_COLS == mod_val && len > max_field && !fields[j].oneliner) max_field = len; } /* get max length of value in the same column */ max_value = 0; for (j = 0; j < n; j++) { size_t len = strlen (fields[j].value); if (j % OVERALL_NUM_COLS == mod_val && len > max_value && !fields[j].oneliner) max_value = len; } /* spacers */ x_value = max_field + x_field + 1; max_field += max_value + 2; color = (*fields[i].colorval) (); render_overall_value (win, fields[i].value, y, x_value, color); k += fields[i].oneliner ? OVERALL_NUM_COLS : 1; } } void display_general (WINDOW * win, char *ifile, GLog * logger) { GColors *(*colorlbl) (void) = color_overall_lbls; GColors *(*colorpth) (void) = color_overall_path; GColors *(*colorval) (void) = color_overall_vals; int col = getmaxx (stdscr); size_t n, i; /* *INDENT-OFF* */ Field fields[] = { {T_REQUESTS , get_str_processed_reqs (logger) , colorlbl , colorval , 0}, {T_UNIQUE_VIS , get_str_visitors () , colorlbl , colorval , 0}, {T_UNIQUE_FIL , get_str_reqs () , colorlbl , colorval , 0}, {T_REFERRER , get_str_ref_reqs () , colorlbl , colorval , 0}, {T_VALID , get_str_valid_reqs (logger) , colorlbl , colorval , 0}, {T_GEN_TIME , get_str_proctime () , colorlbl , colorval , 0}, {T_STATIC_FIL , get_str_static_reqs () , colorlbl , colorval , 0}, {T_LOG , get_str_filesize (logger, ifile) , colorlbl , colorval , 0}, {T_FAILED , get_str_failed_reqs (logger) , colorlbl , colorval , 0}, {T_EXCLUDE_IP , get_str_excluded_ips (logger) , colorlbl , colorval , 0}, {T_UNIQUE404 , get_str_notfound_reqs () , colorlbl , colorval , 0}, {T_BW , get_str_bandwidth (logger) , colorlbl , colorval , 0}, {T_LOG_PATH , get_str_logfile (logger, ifile) , colorlbl , colorpth , 1} }; /* *INDENT-ON* */ werase (win); draw_header (win, T_DASH " - " T_HEAD, " %s", 0, 0, col, color_panel_header); n = ARRAY_SIZE (fields); render_overall_statistics (win, fields, n); for (i = 0; i < n; i++) { free (fields[i].value); } } /* implement basic frame work to build a field input */ char * input_string (WINDOW * win, int pos_y, int pos_x, size_t max_width, const char *str, int enable_case, int *toggle_case) { char *s = xmalloc (max_width + 1), *tmp; size_t i, c, pos = 0, x = 0, quit = 1, len = 0, size_x = 0, size_y = 0; getmaxyx (win, size_y, size_x); size_x -= 4; /* are we setting a default string */ if (str) { len = MIN (max_width, strlen (str)); memcpy (s, str, len); s[len] = '\0'; x = pos = 0; /* is the default str length greater than input field? */ if (strlen (s) > size_x) { tmp = xstrdup (&s[0]); tmp[size_x] = '\0'; mvwprintw (win, pos_y, pos_x, "%s", tmp); free (tmp); } else { mvwprintw (win, pos_y, pos_x, "%s", s); } } else { s[0] = '\0'; } if (enable_case) mvwprintw (win, size_y - 2, 1, " %s", CSENSITIVE); wmove (win, pos_y, pos_x + x); wrefresh (win); curs_set (1); while (quit) { c = wgetch (stdscr); switch (c) { case 1: /* ^a */ case 262: /* HOME */ pos = x = 0; break; case 5: case 360: /* END of line */ if (strlen (s) > size_x) { x = size_x; pos = strlen (s) - size_x; } else { pos = 0; x = strlen (s); } break; case 7: /* ^g */ case 27: /* ESC */ pos = x = 0; if (str && *str == '\0') s[0] = '\0'; quit = 0; break; case 9: /* TAB */ if (!enable_case) break; *toggle_case = *toggle_case == 0 ? 1 : 0; if (*toggle_case) mvwprintw (win, size_y - 2, 1, " %s", CISENSITIVE); else if (!*toggle_case) mvwprintw (win, size_y - 2, 1, " %s", CSENSITIVE); break; case 21: /* ^u */ s[0] = '\0'; pos = x = 0; break; case 8: /* xterm-256color */ case 127: case KEY_BACKSPACE: if (pos + x > 0) { memmove (&s[(pos + x) - 1], &s[pos + x], (max_width - (pos + x)) + 1); if (pos <= 0) x--; else pos--; } break; case KEY_LEFT: if (x > 0) x--; else if (pos > 0) pos--; break; case KEY_RIGHT: if ((x + pos) < strlen (s)) { if (x < size_x) x++; else pos++; } break; case 0x0a: case 0x0d: case KEY_ENTER: quit = 0; break; default: if (strlen (s) == max_width) break; if (!isprint (c)) break; if (strlen (s) == pos) { s[pos + x] = c; s[pos + x + 1] = '\0'; waddch (win, c); } else { memmove (&s[pos + x + 1], &s[pos + x], strlen (&s[pos + x]) + 1); s[pos + x] = c; } if ((x + pos) < max_width) { if (x < size_x) x++; else pos++; } } tmp = xstrdup (&s[pos > 0 ? pos : 0]); tmp[MIN (strlen (tmp), size_x)] = '\0'; for (i = strlen (tmp); i < size_x; i++) mvwprintw (win, pos_y, pos_x + i, "%s", " "); mvwprintw (win, pos_y, pos_x, "%s", tmp); free (tmp); wmove (win, pos_y, pos_x + x); wrefresh (win); } curs_set (0); return s; } static int fill_host_agents_gmenu (void *val, void *user_data) { GMenu *menu = user_data; char *agent = get_host_agent_val ((*(int *) val)); if (agent == NULL) return 1; menu->items[menu->size].name = agent; menu->items[menu->size].checked = 0; menu->size++; return 0; } static void load_host_agents_gmenu (void *list, void *user_data, int count) { GSLList *lst = list; GMenu *menu = user_data; menu->items = (GItem *) xcalloc (count, sizeof (GItem)); list_foreach (lst, fill_host_agents_gmenu, menu); } #ifdef TCB_BTREE int set_host_agents (const char *addr, void (*func) (void *, void *, int), void *arr) { TCLIST *tclist; GSLList *list; int data_nkey, count = 0; data_nkey = get_int_from_keymap (addr, HOSTS); if (data_nkey == 0) return 1; tclist = get_host_agent_list (data_nkey); if (!tclist) return 1; list = tclist_to_gsllist (tclist); if ((count = list_count (list)) == 0) { free (list); return 1; } func (list, arr, count); list_remove_nodes (list); tclistdel (tclist); return 0; } #endif #ifndef TCB_BTREE int set_host_agents (const char *addr, void (*func) (void *, void *, int), void *arr) { GSLList *list; int data_nkey, count = 0; data_nkey = get_int_from_keymap (addr, HOSTS); if (data_nkey == 0) return 1; list = get_host_agent_list (data_nkey); if (!list) return 1; if ((count = list_count (list)) == 0) { free (list); return 1; } func (list, arr, count); #ifdef TCB_MEMHASH /*list_remove_nodes (list); */ free (list); #endif return 0; } #endif /* render a list of agents if available */ void load_agent_list (WINDOW * main_win, char *addr) { GMenu *menu; WINDOW *win; char buf[256]; int c, quit = 1, i; int y, x, list_h, list_w, menu_w, menu_h; if (!conf.list_agents) return; getmaxyx (stdscr, y, x); list_h = y / 2; /* list window - height */ list_w = x - 4; /* list window - width */ menu_h = list_h - AGENTS_MENU_Y - 1; /* menu window - height */ menu_w = list_w - AGENTS_MENU_X - AGENTS_MENU_X; /* menu window - width */ win = newwin (list_h, list_w, (y - list_h) / 2, (x - list_w) / 2); keypad (win, TRUE); wborder (win, '|', '|', '-', '-', '+', '+', '+', '+'); /* create a new instance of GMenu and make it selectable */ menu = new_gmenu (win, menu_h, menu_w, AGENTS_MENU_Y, AGENTS_MENU_X); if (set_host_agents (addr, load_host_agents_gmenu, menu) == 1) goto out; post_gmenu (menu); snprintf (buf, sizeof buf, "User Agents for %s", addr); draw_header (win, buf, " %s", 1, 1, list_w - 2, color_panel_header); mvwprintw (win, 2, 2, "[UP/DOWN] to scroll - [q] to close window"); wrefresh (win); while (quit) { c = wgetch (stdscr); switch (c) { case KEY_DOWN: gmenu_driver (menu, REQ_DOWN); break; case KEY_UP: gmenu_driver (menu, REQ_UP); break; case KEY_RESIZE: case 'q': quit = 0; break; } wrefresh (win); } touchwin (main_win); close_win (win); wrefresh (main_win); out: /* clean stuff up */ for (i = 0; i < menu->size; ++i) free (menu->items[i].name); if (menu->items) free (menu->items); free (menu); } /* render processing spinner */ static void ui_spinner (void *ptr_data) { GSpinner *sp = (GSpinner *) ptr_data; GColors *color = NULL; static char const spin_chars[] = "/-\\|"; char buf[SPIN_LBL]; int i = 0; long long tdiff = 0, psec = 0; time_t begin; if (sp->curses) color = (*sp->color) (); time (&begin); while (1) { pthread_mutex_lock (&sp->mutex); if (sp->state == SPN_END) break; setlocale (LC_NUMERIC, ""); if (conf.no_progress) { snprintf (buf, sizeof buf, SPIN_FMT, sp->label); } else { tdiff = (long long) (time (NULL) - begin); psec = tdiff >= 1 ? *(sp->processed) / tdiff : 0; snprintf (buf, sizeof buf, SPIN_FMTM, sp->label, *(sp->processed), psec); } setlocale (LC_NUMERIC, "POSIX"); if (sp->curses) { /* CURSES */ draw_header (sp->win, buf, " %s", sp->y, sp->x, sp->w, sp->color); /* caret */ wattron (sp->win, COLOR_PAIR (color->pair->idx)); mvwaddch (sp->win, sp->y, sp->spin_x, spin_chars[i++ & 3]); wattroff (sp->win, COLOR_PAIR (color->pair->idx)); wrefresh (sp->win); } else if (!conf.no_progress) { /* STDOUT */ fprintf (stderr, "%s\r", buf); } pthread_mutex_unlock (&sp->mutex); usleep (100000); } sp = NULL; free (sp); } /* create spinner's thread */ void ui_spinner_create (GSpinner * spinner) { pthread_create (&(spinner->thread), NULL, (void *) &ui_spinner, spinner); pthread_detach (spinner->thread); } /* allocate memory and initialize data */ void set_curses_spinner (GSpinner * spinner) { int y, x; if (spinner == NULL) return; getmaxyx (stdscr, y, x); spinner->color = color_progress; spinner->curses = 1; spinner->win = stdscr; spinner->x = 0; spinner->w = x; spinner->spin_x = x - 2; spinner->y = y - 1; } /* allocate memory and initialize data */ GSpinner * new_gspinner (void) { GSpinner *spinner; spinner = xcalloc (1, sizeof (GSpinner)); spinner->label = "Parsing..."; spinner->state = SPN_RUN; spinner->curses = 0; if (conf.load_from_disk) conf.no_progress = 1; if (pthread_mutex_init (&(spinner->mutex), NULL)) FATAL ("Failed init thread mutex"); return spinner; } static void clear_confdlg_status_bar (WINDOW * win) { draw_header (win, "", "%s", 3, 2, CONF_MENU_W, color_default); } /* render config log date/format dialog */ int render_confdlg (GLog * logger, GSpinner * spinner) { GMenu *menu; WINDOW *win; char *cstm_log, *cstm_date, *cstm_time; int c, quit = 1, invalid = 1, y, x, h = CONF_WIN_H, w = CONF_WIN_W; int w2 = w - 2; size_t i, n, sel; /* conf dialog menu options */ const char *choices[] = { "NCSA Combined Log Format", "NCSA Combined Log Format with Virtual Host", "Common Log Format (CLF)", "Common Log Format (CLF) with Virtual Host", "W3C", "CloudFront (Download Distribution)", "Google Cloud Storage", "AWS Elastic Load Balancing (HTTP/S)" }; n = ARRAY_SIZE (choices); getmaxyx (stdscr, y, x); win = newwin (h, w, (y - h) / 2, (x - w) / 2); keypad (win, TRUE); wborder (win, '|', '|', '-', '-', '+', '+', '+', '+'); /* create a new instance of GMenu and make it selectable */ menu = new_gmenu (win, CONF_MENU_H, CONF_MENU_W, CONF_MENU_Y, CONF_MENU_X); menu->size = n; menu->selectable = 1; /* add items to GMenu */ menu->items = (GItem *) xcalloc (n, sizeof (GItem)); for (i = 0; i < n; ++i) { menu->items[i].name = alloc_string (choices[i]); sel = get_selected_format_idx (); menu->items[i].checked = sel == i ? 1 : 0; } post_gmenu (menu); draw_header (win, "Log Format Configuration", " %s", 1, 1, w2, color_panel_header); mvwprintw (win, 2, 2, "[SPACE] to toggle - [ENTER] to proceed"); /* set log format from goaccessrc if available */ draw_header (win, "Log Format - [c] to add/edit format", " %s", 11, 1, w2, color_panel_header); if (conf.log_format) { log_format = escape_str (conf.log_format); mvwprintw (win, 12, 2, "%.*s", CONF_MENU_W, log_format); if (conf.log_format) free (conf.log_format); } /* set date format from goaccessrc if available */ draw_header (win, "Date Format - [d] to add/edit format", " %s", 14, 1, w2, color_panel_header); if (conf.date_format) { date_format = escape_str (conf.date_format); mvwprintw (win, 15, 2, "%.*s", CONF_MENU_W, date_format); if (conf.date_format) free (conf.date_format); } /* set time format from goaccessrc if available */ draw_header (win, "Time Format - [t] to add/edit format", " %s", 17, 1, w2, color_panel_header); if (conf.time_format) { time_format = escape_str (conf.time_format); mvwprintw (win, 18, 2, "%.*s", CONF_MENU_W, time_format); if (conf.time_format) free (conf.time_format); } wrefresh (win); while (quit) { c = wgetch (stdscr); switch (c) { case KEY_DOWN: gmenu_driver (menu, REQ_DOWN); clear_confdlg_status_bar (win); break; case KEY_UP: gmenu_driver (menu, REQ_UP); clear_confdlg_status_bar (win); break; case 32: /* space */ gmenu_driver (menu, REQ_SEL); if (time_format) free (time_format); if (date_format) free (date_format); if (log_format) free (log_format); for (i = 0; i < n; ++i) { if (menu->items[i].checked != 1) continue; date_format = get_selected_date_str (i); log_format = get_selected_format_str (i); time_format = get_selected_time_str (i); mvwprintw (win, 12, 1, " %s", log_format); mvwprintw (win, 15, 1, " %s", date_format); mvwprintw (win, 18, 1, " %s", time_format); break; } break; case 99: /* c */ /* clear top status bar */ clear_confdlg_status_bar (win); wmove (win, 12, 2); /* get input string */ cstm_log = input_string (win, 12, 2, 70, log_format, 0, 0); if (cstm_log != NULL && *cstm_log != '\0') { if (log_format) free (log_format); log_format = alloc_string (cstm_log); free (cstm_log); } /* did not set an input string */ else { if (cstm_log) free (cstm_log); if (log_format) { free (log_format); log_format = NULL; } } break; case 100: /* d */ /* clear top status bar */ clear_confdlg_status_bar (win); wmove (win, 15, 0); /* get input string */ cstm_date = input_string (win, 15, 2, 14, date_format, 0, 0); if (cstm_date != NULL && *cstm_date != '\0') { if (date_format) free (date_format); date_format = alloc_string (cstm_date); free (cstm_date); } /* did not set an input string */ else { if (cstm_date) free (cstm_date); if (date_format) { free (date_format); date_format = NULL; } } break; case 116: /* t */ /* clear top status bar */ clear_confdlg_status_bar (win); wmove (win, 15, 0); /* get input string */ cstm_time = input_string (win, 18, 2, 14, time_format, 0, 0); if (cstm_time != NULL && *cstm_time != '\0') { if (time_format) free (time_format); time_format = alloc_string (cstm_time); free (cstm_time); } /* did not set an input string */ else { if (cstm_time) free (cstm_time); if (time_format) { free (time_format); time_format = NULL; } } break; case 274: /* F10 */ case 0x0a: case 0x0d: case KEY_ENTER: /* display status bar error messages */ if (time_format == NULL) draw_header (win, "Select a time format.", " %s", 3, 2, CONF_MENU_W, color_error); if (date_format == NULL) draw_header (win, "Select a date format.", " %s", 3, 2, CONF_MENU_W, color_error); if (log_format == NULL) draw_header (win, "Select a log format.", " %s", 3, 2, CONF_MENU_W, color_error); if (date_format && log_format && time_format) { conf.time_format = unescape_str (time_format); conf.date_format = unescape_str (date_format); conf.log_format = unescape_str (log_format); /* test log against selected settings */ if (test_format (logger)) { invalid = 1; draw_header (win, "No valid hits.", " %s", 3, 2, CONF_MENU_W, color_error); free (conf.log_format); free (conf.date_format); free (conf.time_format); } /* valid data, reset logger & start parsing */ else { reset_struct (logger); /* start spinner thread */ spinner->win = win; spinner->y = 3; spinner->x = 2; spinner->spin_x = CONF_MENU_W; spinner->w = CONF_MENU_W; spinner->color = color_progress; ui_spinner_create (spinner); invalid = 0; quit = 0; } } break; case KEY_RESIZE: case 'q': quit = 0; break; } pthread_mutex_lock (&spinner->mutex); wrefresh (win); pthread_mutex_unlock (&spinner->mutex); } /* clean stuff up */ for (i = 0; i < n; ++i) free (menu->items[i].name); free (menu->items); free (menu); return invalid ? 1 : 0; } /* get selected scheme */ static void scheme_chosen (const char *name) { int force = 0; free_color_lists (); if (strcmp ("Green/Original", name) == 0) { conf.color_scheme = STD_GREEN; force = 1; } else if (strcmp ("Monochrome/Default", name) == 0) { conf.color_scheme = MONOCHROME; force = 1; } else if (strcmp ("Custom Scheme", name) == 0) { force = 0; } init_colors (force); } /* render schemes dialog */ void load_schemes_win (WINDOW * main_win) { GMenu *menu; WINDOW *win; int c, quit = 1; size_t i, n; int y, x, h = SCHEME_WIN_H, w = SCHEME_WIN_W; int w2 = w - 2; /* ###NOTE: 'Custom Scheme' needs to go at the end */ const char *choices[] = { "Monochrome/Default", "Green/Original", "Custom Scheme" }; n = ARRAY_SIZE (choices); getmaxyx (stdscr, y, x); win = newwin (h, w, (y - h) / 2, (x - w) / 2); keypad (win, TRUE); wborder (win, '|', '|', '-', '-', '+', '+', '+', '+'); /* create a new instance of GMenu and make it selectable */ menu = new_gmenu (win, SCHEME_MENU_H, SCHEME_MENU_W, SCHEME_MENU_Y, SCHEME_MENU_X); /* remove custom color option if no custom scheme used */ menu->size = conf.color_idx == 0 ? n - 1 : n; /* add items to GMenu */ menu->items = (GItem *) xcalloc (n, sizeof (GItem)); for (i = 0; i < n; ++i) { menu->items[i].name = alloc_string (choices[i]); menu->items[i].checked = 0; } post_gmenu (menu); draw_header (win, "Scheme Configuration", " %s", 1, 1, w2, color_panel_header); mvwprintw (win, 2, 2, "[ENTER] to switch scheme"); wrefresh (win); while (quit) { c = wgetch (stdscr); switch (c) { case KEY_DOWN: gmenu_driver (menu, REQ_DOWN); break; case KEY_UP: gmenu_driver (menu, REQ_UP); break; case 32: case 0x0a: case 0x0d: case KEY_ENTER: gmenu_driver (menu, REQ_SEL); for (i = 0; i < n; ++i) { if (menu->items[i].checked != 1) continue; scheme_chosen (choices[i]); break; } quit = 0; break; case KEY_RESIZE: case 'q': quit = 0; break; } wrefresh (win); } /* clean stuff up */ for (i = 0; i < n; ++i) free (menu->items[i].name); free (menu->items); free (menu); touchwin (main_win); close_win (win); wrefresh (main_win); } /* render sort dialog */ void load_sort_win (WINDOW * main_win, GModule module, GSort * sort) { GMenu *menu; WINDOW *win; GSortField opts[SORT_MAX_OPTS]; int c, quit = 1; int i = 0, k, n = 0; int y, x, h = SORT_WIN_H, w = SORT_WIN_W; int w2 = w - 2; getmaxyx (stdscr, y, x); /* determine amount of sort choices */ for (i = 0, k = 0; -1 != sort_choices[module][i]; i++) { GSortField field = sort_choices[module][i]; if (SORT_BY_CUMTS == field && !conf.serve_usecs) continue; else if (SORT_BY_MAXTS == field && !conf.bandwidth) continue; else if (SORT_BY_BW == field && !conf.bandwidth) continue; else if (SORT_BY_PROT == field && !conf.append_protocol) continue; else if (SORT_BY_MTHD == field && !conf.append_method) continue; opts[k++] = field; n++; } win = newwin (h, w, (y - h) / 2, (x - w) / 2); keypad (win, TRUE); wborder (win, '|', '|', '-', '-', '+', '+', '+', '+'); /* create a new instance of GMenu and make it selectable */ menu = new_gmenu (win, SORT_MENU_H, SORT_MENU_W, SORT_MENU_Y, SORT_MENU_X); menu->size = n; menu->selectable = 1; /* add items to GMenu */ menu->items = (GItem *) xcalloc (n, sizeof (GItem)); /* set choices, checked option and index */ for (i = 0; i < n; ++i) { GSortField field = sort_choices[module][opts[i]]; if (SORT_BY_HITS == field) { menu->items[i].name = alloc_string ("Hits"); if (sort->field == SORT_BY_HITS) { menu->items[i].checked = 1; menu->idx = i; } } else if (SORT_BY_VISITORS == field) { menu->items[i].name = alloc_string ("Visitors"); if (sort->field == SORT_BY_VISITORS) { menu->items[i].checked = 1; menu->idx = i; } } else if (SORT_BY_DATA == field) { menu->items[i].name = alloc_string ("Data"); if (sort->field == SORT_BY_DATA) { menu->items[i].checked = 1; menu->idx = i; } } else if (SORT_BY_BW == field) { menu->items[i].name = alloc_string ("Bandwidth"); if (sort->field == SORT_BY_BW) { menu->items[i].checked = 1; menu->idx = i; } } else if (SORT_BY_AVGTS == field) { menu->items[i].name = alloc_string ("Avg. Time Served"); if (sort->field == SORT_BY_AVGTS) { menu->items[i].checked = 1; menu->idx = i; } } else if (SORT_BY_CUMTS == field) { menu->items[i].name = alloc_string ("Cum. Time Served"); if (sort->field == SORT_BY_CUMTS) { menu->items[i].checked = 1; menu->idx = i; } } else if (SORT_BY_MAXTS == field) { menu->items[i].name = alloc_string ("Max. Time Served"); if (sort->field == SORT_BY_MAXTS) { menu->items[i].checked = 1; menu->idx = i; } } else if (SORT_BY_PROT == field) { menu->items[i].name = alloc_string ("Protocol"); if (sort->field == SORT_BY_PROT) { menu->items[i].checked = 1; menu->idx = i; } } else if (SORT_BY_MTHD == field) { menu->items[i].name = alloc_string ("Method"); if (sort->field == SORT_BY_MTHD) { menu->items[i].checked = 1; menu->idx = i; } } } post_gmenu (menu); draw_header (win, "Sort active module by", " %s", 1, 1, w2, color_panel_header); mvwprintw (win, 2, 2, "[ENTER] to select field - [TAB] sort"); if (sort->sort == SORT_ASC) mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_ASC_SEL); else mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_DESC_SEL); wrefresh (win); while (quit) { c = wgetch (stdscr); switch (c) { case KEY_DOWN: gmenu_driver (menu, REQ_DOWN); break; case KEY_UP: gmenu_driver (menu, REQ_UP); break; case 9: /* TAB */ if (sort->sort == SORT_ASC) { /* ascending */ sort->sort = SORT_DESC; mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_DESC_SEL); } else { /* descending */ sort->sort = SORT_ASC; mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_ASC_SEL); } break; case 32: case 0x0a: case 0x0d: case KEY_ENTER: gmenu_driver (menu, REQ_SEL); for (i = 0; i < n; ++i) { if (menu->items[i].checked != 1) continue; if (strcmp ("Hits", menu->items[i].name) == 0) sort->field = SORT_BY_HITS; else if (strcmp ("Visitors", menu->items[i].name) == 0) sort->field = SORT_BY_VISITORS; else if (strcmp ("Data", menu->items[i].name) == 0) sort->field = SORT_BY_DATA; else if (strcmp ("Bandwidth", menu->items[i].name) == 0) sort->field = SORT_BY_BW; else if (strcmp ("Avg. Time Served", menu->items[i].name) == 0) sort->field = SORT_BY_AVGTS; else if (strcmp ("Cum. Time Served", menu->items[i].name) == 0) sort->field = SORT_BY_CUMTS; else if (strcmp ("Max. Time Served", menu->items[i].name) == 0) sort->field = SORT_BY_MAXTS; else if (strcmp ("Protocol", menu->items[i].name) == 0) sort->field = SORT_BY_PROT; else if (strcmp ("Method", menu->items[i].name) == 0) sort->field = SORT_BY_MTHD; quit = 0; break; } break; case KEY_RESIZE: case 'q': quit = 0; break; } wrefresh (win); } /* clean stuff up */ for (i = 0; i < n; ++i) free (menu->items[i].name); free (menu->items); free (menu); touchwin (main_win); close_win (win); wrefresh (main_win); } static const char *help_main[] = { "Copyright (C) 2009-2015", "by Gerardo Orellana ", "http://goaccess.io", "Released under the GNU GPL. See `man` page for more details", "", "GoAccess is an open source real-time web log analyzer and", "interactive viewer that runs in a terminal in *nix systems.", "It provides fast and valuable HTTP statistics for system", "administrators that require a visual server report on the", "fly.", "", "The data collected based on the parsing of the log is", "divided into different modules. Modules are automatically", "generated and presented to the user.", "", "The main dashboard displays general statistics, top", "visitors, requests, browsers, operating systems,", "hosts, etc.", "", "The user can make use of the following keys:", " ^F1^ or ^h^ Main help", " ^F5^ Redraw [main window]", " ^q^ Quit the program, current window or module", " ^o^ or ^ENTER^ Expand selected module", " ^[Shift]0-9^ Set selected module to active", " ^Up^ arrow Scroll up main dashboard", " ^Down^ arrow Scroll down main dashboard", " ^j^ Scroll down within expanded module", " ^k^ Scroll up within expanded module", " ^c^ Set or change scheme color", " ^CTRL^ + ^f^ Scroll forward one screen within", " active module", " ^CTRL^ + ^b^ Scroll backward one screen within", " active module", " ^TAB^ Iterate modules (forward)", " ^SHIFT^ + ^TAB^ Iterate modules (backward)", " ^s^ Sort options for current module", " ^/^ Search across all modules", " ^n^ Find position of the next occurrence", " ^g^ Move to the first item or top of screen", " ^G^ Move to the last item or bottom of screen", "", "Examples can be found by running `man goaccess`.", "", "If you believe you have found a bug, please drop me", "an email with details.", "", "If you have a medium or high traffic website, it", "would be interesting to hear your experience with", "GoAccess, such as generating time, visitors or hits.", "", "Feedback? Just shoot me an email to:", "hello@goaccess.io", }; /* render help dialog */ void load_help_popup (WINDOW * main_win) { int c, quit = 1; size_t i, n; int y, x, h = HELP_WIN_HEIGHT, w = HELP_WIN_WIDTH; int w2 = w - 2; WINDOW *win; GMenu *menu; n = ARRAY_SIZE (help_main); getmaxyx (stdscr, y, x); win = newwin (h, w, (y - h) / 2, (x - w) / 2); keypad (win, TRUE); wborder (win, '|', '|', '-', '-', '+', '+', '+', '+'); /* create a new instance of GMenu and make it selectable */ menu = new_gmenu (win, HELP_MENU_HEIGHT, HELP_MENU_WIDTH, HELP_MENU_Y, HELP_MENU_X); menu->size = n; /* add items to GMenu */ menu->items = (GItem *) xcalloc (n, sizeof (GItem)); for (i = 0; i < n; ++i) { menu->items[i].name = alloc_string (help_main[i]); menu->items[i].checked = 0; } post_gmenu (menu); draw_header (win, "GoAccess Quick Help", " %s", 1, 1, w2, color_panel_header); mvwprintw (win, 2, 2, "[UP/DOWN] to scroll - [q] to quit"); wrefresh (win); while (quit) { c = wgetch (stdscr); switch (c) { case KEY_DOWN: gmenu_driver (menu, REQ_DOWN); break; case KEY_UP: gmenu_driver (menu, REQ_UP); break; case KEY_RESIZE: case 'q': quit = 0; break; } wrefresh (win); } /* clean stuff up */ for (i = 0; i < n; ++i) free (menu->items[i].name); free (menu->items); free (menu); touchwin (main_win); close_win (win); wrefresh (main_win); } goaccess-0.9.4/src/tcbtdb.c0000644000000000000000000001400712573351525012411 00000000000000/** * tcbtdb.c -- Tokyo Cabinet database functions * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #include #include #include #include #include #include #include "tcbtdb.h" #include "tcabdb.h" #ifdef HAVE_LIBGEOIP #include "geolocation.h" #endif #include "error.h" #include "xmalloc.h" #ifdef TCB_BTREE char * tc_db_set_path (const char *dbname, int module) { char *path; int cx; if (conf.db_path != NULL) { cx = snprintf (NULL, 0, "%s%dm%s", conf.db_path, module, dbname) + 1; path = xmalloc (cx); sprintf (path, "%s%dm%s", conf.db_path, module, dbname); } else { cx = snprintf (NULL, 0, "%s%dm%s", TC_DBPATH, module, dbname) + 1; path = xmalloc (cx); sprintf (path, "%s%dm%s", TC_DBPATH, module, dbname); } return path; } /* set database parameters */ void tc_db_get_params (char *params, const char *path) { int len = 0; long xmmap = conf.xmmap; uint32_t lcnum, ncnum, lmemb, nmemb, bnum; /* copy path name to buffer */ len += snprintf (params + len, DB_PARAMS - len, "%s", path); /* caching parameters of a B+ tree database object */ lcnum = conf.cache_lcnum > 0 ? conf.cache_lcnum : TC_LCNUM; len += snprintf (params + len, DB_PARAMS - len, "#%s=%d", "lcnum", lcnum); ncnum = conf.cache_ncnum > 0 ? conf.cache_ncnum : TC_NCNUM; len += snprintf (params + len, DB_PARAMS - len, "#%s=%d", "ncnum", ncnum); /* set the size of the extra mapped memory */ if (xmmap > 0) len += snprintf (params + len, DB_PARAMS - len, "#%s=%ld", "xmsiz", xmmap); lmemb = conf.tune_lmemb > 0 ? conf.tune_lmemb : TC_LMEMB; len += snprintf (params + len, DB_PARAMS - len, "#%s=%d", "lmemb", lmemb); nmemb = conf.tune_nmemb > 0 ? conf.tune_nmemb : TC_NMEMB; len += snprintf (params + len, DB_PARAMS - len, "#%s=%d", "nmemb", nmemb); bnum = conf.tune_bnum > 0 ? conf.tune_bnum : TC_BNUM; len += snprintf (params + len, DB_PARAMS - len, "#%s=%d", "bnum", bnum); /* compression */ len += snprintf (params + len, DB_PARAMS - len, "#%s=%c", "opts", 'l'); if (conf.compression == TC_BZ2) { len += snprintf (params + len, DB_PARAMS - len, "%c", 'b'); } else if (conf.compression == TC_ZLIB) { len += snprintf (params + len, DB_PARAMS - len, "%c", 'd'); } /* open flags. create a new database if not exist, otherwise read it */ len += snprintf (params + len, DB_PARAMS - len, "#%s=%s", "mode", "wc"); /* if not loading from disk, truncate regardless if a db file exists */ if (!conf.load_from_disk) len += snprintf (params + len, DB_PARAMS - len, "%c", 't'); LOG_DEBUG (("%s\n", path)); LOG_DEBUG (("params: %s\n", params)); } /* Open the database handle */ TCBDB * tc_bdb_create (const char *dbname, int module) { TCBDB *bdb; char *path = NULL; int ecode; uint32_t lcnum, ncnum, lmemb, nmemb, bnum, flags; path = tc_db_set_path (dbname, module); bdb = tcbdbnew (); lcnum = conf.cache_lcnum > 0 ? conf.cache_lcnum : TC_LCNUM; ncnum = conf.cache_ncnum > 0 ? conf.cache_ncnum : TC_NCNUM; /* set the caching parameters of a B+ tree database object */ if (!tcbdbsetcache (bdb, lcnum, ncnum)) { free (path); FATAL ("Unable to set TCB cache"); } /* set the size of the extra mapped memory */ if (conf.xmmap > 0 && !tcbdbsetxmsiz (bdb, conf.xmmap)) { free (path); FATAL ("Unable to set TCB xmmap."); } lmemb = conf.tune_lmemb > 0 ? conf.tune_lmemb : TC_LMEMB; nmemb = conf.tune_nmemb > 0 ? conf.tune_nmemb : TC_NMEMB; bnum = conf.tune_bnum > 0 ? conf.tune_bnum : TC_BNUM; /* compression */ flags = BDBTLARGE; if (conf.compression == TC_BZ2) { flags |= BDBTBZIP; } else if (conf.compression == TC_ZLIB) { flags |= BDBTDEFLATE; } /* set the tuning parameters */ tcbdbtune (bdb, lmemb, nmemb, bnum, 8, 10, flags); /* open flags */ flags = BDBOWRITER | BDBOCREAT; if (!conf.load_from_disk) flags |= BDBOTRUNC; /* attempt to open the database */ if (!tcbdbopen (bdb, path, flags)) { free (path); ecode = tcbdbecode (bdb); FATAL ("%s", tcbdberrmsg (ecode)); } free (path); return bdb; } /* Close the database handle */ int tc_bdb_close (void *db, char *dbname) { TCBDB *bdb = db; int ecode; if (bdb == NULL) return 1; /* close the database */ if (!tcbdbclose (bdb)) { ecode = tcbdbecode (bdb); FATAL ("%s", tcbdberrmsg (ecode)); } /* delete the object */ tcbdbdel (bdb); /* remove database file */ if (!conf.keep_db_files && !tcremovelink (dbname)) LOG_DEBUG (("Unable to remove DB: %s\n", dbname)); free (dbname); return 0; } static int is_value_in_tclist (TCLIST * tclist, void *value) { int i, sz; int *val; if (!tclist) return 0; for (i = 0; i < tclistnum (tclist); ++i) { val = (int *) tclistval (tclist, i, &sz); if (find_host_agent_in_list (value, val)) return 1; } return 0; } int ht_insert_host_agent (TCBDB * bdb, int data_nkey, int agent_nkey) { TCLIST *list; int in_list = 0; if (bdb == NULL) return (EINVAL); if ((list = tcbdbget4 (bdb, &data_nkey, sizeof (int))) != NULL) { if (is_value_in_tclist (list, &agent_nkey)) in_list = 1; tclistdel (list); } if (!in_list && tcbdbputdup (bdb, &data_nkey, sizeof (int), &agent_nkey, sizeof (int))) return 0; return 1; } #endif goaccess-0.9.4/src/browsers.c0000664000000000000000000002231512573351525013020 00000000000000/** * browsers.c -- functions for dealing with browsers * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #include #include #include #include "browsers.h" #include "util.h" #include "error.h" #include "xmalloc.h" /* ###NOTE: The size of the list is proportional to the run time, * which makes this pretty slow */ /* {"search string", "belongs to"} */ static const char *browsers[][2] = { /* Game systems: most of them are based of major browsers, * thus they need to go before. */ {"Xbox One", "Game Systems"}, {"Xbox", "Game Systems"}, {"PlayStation", "Game Systems"}, {"NintendoBrowser", "Game Systems"}, {"Valve Steam", "Game Systems"}, {"Origin", "Game Systems"}, {"Raptr", "Game Systems"}, /* Based on Internet Explorer */ {"America Online Browser", "Others"}, {"Avant Browser", "Others"}, /* Internet Explorer */ {"IEMobile", "MSIE"}, {"MSIE", "MSIE"}, /* IE11 */ {"Trident/7.0", "MSIE"}, /* Microsoft Edge */ {"Edge", "MSIE"}, /* Opera */ {"Opera Mini", "Opera"}, {"Opera Mobi", "Opera"}, {"Opera", "Opera"}, {"OPR", "Opera"}, {"OPiOS", "Opera"}, {"Coast", "Opera"}, /* Others */ {"Homebrew", "Others"}, {"APT-HTTP", "Others"}, {"Apt-Cacher", "Others"}, {"Chef Client", "Others"}, {"Huawei", "Others"}, {"HUAWEI", "Others"}, {"BlackBerry", "Others"}, {"BrowserX", "Others"}, {"Dalvik", "Others"}, {"Dillo", "Others"}, {"ELinks", "Others"}, {"Epiphany", "Others"}, {"Firebird", "Others"}, {"Galeon", "Others"}, {"GranParadiso", "Others"}, {"IBrowse", "Others"}, {"K-Meleon", "Others"}, {"Kazehakase", "Others"}, {"Konqueror", "Others"}, {"Links", "Others"}, {"Lynx", "Others"}, {"Midori", "Others"}, {"Minefield", "Others"}, {"Mosaic", "Others"}, {"Netscape", "Others"}, {"SeaMonkey", "Others"}, {"UCBrowser", "Others"}, {"Wget", "Others"}, {"libfetch", "Others"}, {"check_http", "Others"}, {"curl", "Others"}, {"midori", "Others"}, {"w3m", "Others"}, {"Apache", "Others"}, /* Feed-reader-as-a-service */ {"Bloglines", "Feeds"}, {"Feedly", "Feeds"}, {"Flipboard", "Feeds"}, {"Netvibes", "Feeds"}, {"NewsBlur", "Feeds"}, {"YandexBlogs", "Feeds"}, /* Based on Firefox */ {"Camino", "Others"}, /* Rebranded Firefox but is really unmodified * Firefox (Debian trademark policy) */ {"Iceweasel", "Firefox"}, /* Mozilla Firefox */ {"Firefox", "Firefox"}, /* Based on Chromium */ {"YaBrowser", "Others"}, {"Flock", "Others"}, /* Chrome has to go before Safari */ {"Chrome", "Chrome"}, {"CriOS", "Chrome"}, {"Safari", "Safari"}, /* Crawlers/Bots */ {"AdsBot-Google", "Crawlers"}, {"Mediapartners-Google", "Crawlers"}, {"AppEngine-Google", "Crawlers"}, {"Google", "Crawlers"}, {"bingbot", "Crawlers"}, {"msnbot", "Crawlers"}, {"Yandex", "Crawlers"}, {"Baidu", "Crawlers"}, {"Ezooms", "Crawlers"}, {"Twitter", "Crawlers"}, {"Slurp", "Crawlers"}, {"Yahoo", "Crawlers"}, {"Slack", "Crawlers"}, {"AppleBot", "Crawlers"}, {"AhrefsBot", "Crawlers"}, {"Abonti", "Crawlers"}, {"MJ12bot", "Crawlers"}, {"SISTRIX", "Crawlers"}, {"facebook", "Crawlers"}, {"DotBot", "Crawlers"}, {"Speedy Spider", "Crawlers"}, {"Sosospider", "Crawlers"}, {"BPImageWalker", "Crawlers"}, {"Sogou", "Crawlers"}, {"Java", "Crawlers"}, {"Jakarta Commons-HttpClient", "Crawlers"}, {"WBSearchBot", "Crawlers"}, {"SeznamBot", "Crawlers"}, {"DoCoMo", "Crawlers"}, {"TurnitinBot", "Crawlers"}, {"GSLFbot", "Crawlers"}, {"YodaoBot", "Crawlers"}, {"AddThis", "Crawlers"}, {"Purebot", "Crawlers"}, {"ia_archiver", "Crawlers"}, {"Wotbox", "Crawlers"}, {"CCBot", "Crawlers"}, {"findlinks", "Crawlers"}, {"Yeti", "Crawlers"}, {"ichiro", "Crawlers"}, {"Linguee Bot", "Crawlers"}, {"Gigabot", "Crawlers"}, {"BacklinkCrawler", "Crawlers"}, {"netEstate", "Crawlers"}, {"distilator", "Crawlers"}, {"Aboundex", "Crawlers"}, {"UnwindFetchor", "Crawlers"}, {"SEOkicks-Robot", "Crawlers"}, {"psbot", "Crawlers"}, {"SBIder", "Crawlers"}, {"TestNutch", "Crawlers"}, {"DomainCrawler", "Crawlers"}, {"NextGenSearchBot", "Crawlers"}, {"SEOENGWorldBot", "Crawlers"}, {"PiplBot", "Crawlers"}, {"IstellaBot", "Crawlers"}, {"Cityreview", "Crawlers"}, {"heritrix", "Crawlers"}, {"PagePeeker", "Crawlers"}, {"JS-Kit", "Crawlers"}, {"ScreenerBot", "Crawlers"}, {"PagesInventory", "Crawlers"}, {"ShowyouBot", "Crawlers"}, {"SolomonoBot", "Crawlers"}, {"rogerbot", "Crawlers"}, {"fastbot", "Crawlers"}, {"Domnutch", "Crawlers"}, {"MaxPoint", "Crawlers"}, {"NCBot", "Crawlers"}, {"TosCrawler", "Crawlers"}, {"Updownerbot", "Crawlers"}, {"urlwatch", "Crawlers"}, {"IstellaBot", "Crawlers"}, {"OpenWebSpider", "Crawlers"}, {"WordPress", "Crawlers"}, {"yacybot", "Crawlers"}, {"PEAR", "Crawlers"}, {"ZumBot", "Crawlers"}, {"YisouSpider", "Crawlers"}, {"W3C", "Crawlers"}, {"vcheck", "Crawlers"}, {"PycURL", "Crawlers"}, {"PHP", "Crawlers"}, {"PercolateCrawler", "Crawlers"}, {"NING", "Crawlers"}, {"gvfs", "Crawlers"}, {"Crowsnest", "Crawlers"}, {"CatchBot", "Crawlers"}, {"Combine", "Crawlers"}, {"A6-Indexer", "Crawlers"}, {"Altresium", "Crawlers"}, {"AndroidDownloadManager", "Crawlers"}, {"Apache-HttpClient", "Crawlers"}, {"Comodo", "Crawlers"}, {"crawler4j", "Crawlers"}, {"Cricket", "Crawlers"}, {"EC2LinkFinder", "Crawlers"}, {"Embedly", "Crawlers"}, {"envolk", "Crawlers"}, {"libwww-perl", "Crawlers"}, {"ruby", "Crawlers"}, {"Ruby", "Crawlers"}, {"python", "Crawlers"}, {"Python", "Crawlers"}, {"LinkedIn", "Crawlers"}, {"GeoHasher", "Crawlers"}, {"HTMLParser", "Crawlers"}, {"MLBot", "Crawlers"}, {"Jaxified Bot", "Crawlers"}, {"LinkWalker", "Crawlers"}, {"Microsoft-WebDAV", "Crawlers"}, {"nutch", "Crawlers"}, {"PostRank", "Crawlers"}, {"Image", "Crawlers"}, /* Podcast fetchers */ {"Downcast", "Podcasts"}, {"gPodder", "Podcasts"}, {"Instacast", "Podcasts"}, {"iTunes", "Podcasts"}, {"Miro", "Podcasts"}, {"Pocket Casts", "Podcasts"}, {"BashPodder", "Podcasts"}, /* Feed reader clients */ {"Akregator", "Feeds"}, {"Apple-PubSub", "Feeds"}, {"FeedDemon", "Feeds"}, {"Feedy", "Feeds"}, {"Liferea", "Feeds"}, {"NetNewsWire", "Feeds"}, {"RSSOwl", "Feeds"}, {"Thunderbird", "Feeds"}, {"Vienna", "Feeds"}, {"Windows-RSS-Platform", "Feeds"}, {"newsbeuter", "Feeds"}, {"Fever", "Feeds"}, {"Pingdom.com", "Uptime"}, {"UptimeRobot", "Uptime"}, {"jetmon", "Uptime"}, {"NodeUptime", "Uptime"}, {"NewRelicPinger", "Uptime"}, {"StatusCake", "Uptime"}, {"internetVista", "Uptime"}, {"Mozilla", "Others"} }; int is_crawler (const char *agent) { char type[BROWSER_TYPE_LEN]; char *browser, *a; if (agent == NULL || *agent == '\0') return 0; if ((a = xstrdup (agent), browser = verify_browser (a, type)) != NULL) free (browser); free (a); return strcmp (type, "Crawlers") == 0 ? 1 : 0; } /* Return the Opera 15 and Beyond */ static char * parse_opera (char *token) { char *val = xmalloc (snprintf (NULL, 0, "Opera%s", token) + 1); sprintf (val, "Opera%s", token); return val; } char * verify_browser (char *str, char *type) { char *a, *b, *ptr, *slash; size_t i; if (str == NULL || *str == '\0') return NULL; for (i = 0; i < ARRAY_SIZE (browsers); i++) { if ((a = strstr (str, browsers[i][0])) == NULL) continue; /* check if there is a space char in the token string, that way strpbrk * does not stop at the first space within the token string */ if ((strchr (browsers[i][0], ' ')) != NULL && (b = strchr (a, ' ')) != NULL) b++; else b = a; xstrncpy (type, browsers[i][1], BROWSER_TYPE_LEN); /* Internet Explorer 11 */ if (strstr (a, "rv:11") && strstr (a, "Trident/7.0")) { return alloc_string ("MSIE/11.0"); } /* Opera +15 uses OPR/# */ if (strstr (a, "OPR") != NULL && (slash = strrchr (a, '/'))) { return parse_opera (slash); } /* Opera has the version number at the end */ if (strstr (a, "Opera") && (slash = strrchr (a, '/')) && a < slash) { memmove (a + 5, slash, strlen (slash) + 1); } /* IE Old */ if (strstr (a, "MSIE") != NULL) { if ((ptr = strpbrk (a, ";)-")) != NULL) *ptr = '\0'; a = char_replace (a, ' ', '/'); } /* all others */ else if ((ptr = strpbrk (b, ";) ")) != NULL) { *ptr = '\0'; } return alloc_string (a); } xstrncpy (type, "Unknown", BROWSER_TYPE_LEN); return alloc_string ("Unknown"); } goaccess-0.9.4/src/ui.h0000644000000000000000000002264312573351525011576 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef UI_H_INCLUDED #define UI_H_INCLUDED #ifdef HAVE_NCURSESW_NCURSES_H #include #elif HAVE_NCURSES_NCURSES_H #include #elif HAVE_NCURSES_H #include #elif HAVE_CURSES_H #include #endif #ifdef HAVE_LIBPTHREAD #include #endif /* Global UI defaults */ #define MAX_CHOICES 366 #define MIN_HEIGHT 8 #define MIN_WIDTH 0 #define MAX_HEIGHT_FOOTER 1 #define MAX_HEIGHT_HEADER 7 #define OVERALL_NUM_COLS 4 /* Overall Stats Labels */ #define T_DASH "Dashboard" #define T_HEAD "Overall Analyzed Requests" #define T_DATETIME "Date/Time" #define T_REQUESTS "Total Requests" #define T_GEN_TIME "Processed Time" #define T_FAILED "Failed Requests" #define T_VALID "Valid Requests" #define T_UNIQUE_VIS "Unique Visitors" #define T_UNIQUE_FIL "Unique Files" #define T_EXCLUDE_IP "Excl. IP Hits" #define T_REFERRER "Referrers" #define T_UNIQUE404 "Unique 404" #define T_STATIC_FIL "Static Files" #define T_LOG "Log Size" #define T_BW "Bandwidth" #define T_LOG_PATH "Log File" /* Spinner Label Format */ #define SPIN_FMT "%s" #define SPIN_FMTM "%s [%'d] [%'lld/s]" #define SPIN_LBL 50 #define INCLUDE_BOTS " - Including spiders" /* Module Labels and Descriptions */ #define VISIT_HEAD "Unique visitors per day" #define VISIT_DESC "Hits having the same IP, date and agent are a unique visit." #define VISIT_ID "visitors" #define VISIT_LABEL "Visitors" #define REQUE_HEAD "Top requests (URLs)" #define REQUE_DESC "Top requests sorted by hits [, avgts, cumts, maxts, mthd, proto]" #define REQUE_ID "requests" #define REQUE_LABEL "Requests" #define STATI_HEAD "Top static requests (e.g. jpg, png, js, css..)" #define STATI_DESC "Top static requests sorted by hits [, avgts, cumts, maxts, mthd, proto]" #define STATI_ID "static_requests" #define STATI_LABEL "Static Requests" #define VTIME_HEAD "Time Distribution" #define VTIME_DESC "Data sorted by hour [, avgts, cumts, maxts]" #define VTIME_ID "visit_time" #define VTIME_LABEL "Time" #define FOUND_HEAD "HTTP 404 Not Found URLs" #define FOUND_DESC "Top 404 Not Found URLs sorted by hits [, avgts, cumts, maxts, mthd, proto]" #define FOUND_ID "not_found" #define FOUND_LABEL "Not Found" #define HOSTS_HEAD "Visitor hostnames and IPs" #define HOSTS_DESC "Top visitor hosts sorted by hits [, avgts, cumts, maxts]" #define HOSTS_ID "hosts" #define HOSTS_LABEL "Hosts" #define OPERA_HEAD "Operating Systems" #define OPERA_DESC "Top Operating Systems sorted by hits [, avgts, cumts, maxts]" #define OPERA_ID "os" #define OPERA_LABEL "OS" #define BROWS_HEAD "Browsers" #define BROWS_DESC "Top Browsers sorted by hits [, avgts, cumts, maxts]" #define BROWS_ID "browsers" #define BROWS_LABEL "Browsers" #define REFER_HEAD "Referrers URLs" #define REFER_DESC "Top Requested Referrers sorted by hits [, avgts, cumts, maxts]" #define REFER_ID "referrers" #define REFER_LABEL "Referrers" #define SITES_HEAD "Referring Sites" #define SITES_DESC "Top Referring Sites sorted by hits [, avgts, cumts, maxts]" #define SITES_ID "referring_sites" #define SITES_LABEL "Referring Sites" #define KEYPH_HEAD "Keyphrases from Google's search engine" #define KEYPH_DESC "Top Keyphrases sorted by hits [, avgts, cumts, maxts]" #define KEYPH_ID "keyphrases" #define KEYPH_LABEL "Keyphrases" #define GEOLO_HEAD "Geo Location" #define GEOLO_DESC "Continent > Country sorted by unique hits [, avgts, cumts, maxts]" #define GEOLO_ID "geolocation" #define GEOLO_LABEL "Geo Location" #define CODES_HEAD "HTTP Status Codes" #define CODES_DESC "Top HTTP Status Codes sorted by hits [, avgts, cumts, maxts]" #define CODES_ID "status_codes" #define CODES_LABEL "Status Codes" #define GENER_ID "general" /* Overall Statistics CSV/JSON Keys */ #define OVERALL_DATETIME "date_time" #define OVERALL_REQ "total_requests" #define OVERALL_VALID "valid_requests" #define OVERALL_GENTIME "generation_time" #define OVERALL_FAILED "failed_requests" #define OVERALL_VISITORS "unique_visitors" #define OVERALL_FILES "unique_files" #define OVERALL_EXCL_HITS "excluded_hits" #define OVERALL_REF "unique_referrers" #define OVERALL_NOTFOUND "unique_not_found" #define OVERALL_STATIC "unique_static_files" #define OVERALL_LOGSIZE "log_size" #define OVERALL_BANDWIDTH "bandwidth" #define OVERALL_LOG "log_path" /* Metric Labels */ #define MTRC_HITS_LBL "Hits" #define MTRC_VISITORS_LBL "Visitors" #define MTRC_VISITORS_SHORT_LBL "Vis." #define MTRC_BW_LBL "Bandwidth" #define MTRC_AVGTS_LBL "Avg. T.S." #define MTRC_CUMTS_LBL "Cum. T.S." #define MTRC_MAXTS_LBL "Max. T.S." #define MTRC_METHODS_LBL "Method" #define MTRC_METHODS_SHORT_LBL "Mtd" #define MTRC_PROTOCOLS_LBL "Protocol" #define MTRC_PROTOCOLS_SHORT_LBL "Proto" #define MTRC_DATA_LBL "Data" /* Find Labels */ #define FIND_HEAD "Find pattern in all views" #define FIND_DESC "Regex allowed - ^g to cancel - TAB switch case" /* CONFIG DIALOG */ #define CONF_MENU_H 6 #define CONF_MENU_W 48 #define CONF_MENU_X 2 #define CONF_MENU_Y 4 #define CONF_WIN_H 20 #define CONF_WIN_W 52 /* FIND DIALOG */ #define FIND_DLG_HEIGHT 8 #define FIND_DLG_WIDTH 50 #define FIND_MAX_MATCHES 1 /* COLOR SCHEME DIALOG */ #define SCHEME_MENU_H 4 #define SCHEME_MENU_W 38 #define SCHEME_MENU_X 2 #define SCHEME_MENU_Y 4 #define SCHEME_WIN_H 10 #define SCHEME_WIN_W 42 /* SORT DIALOG */ #define SORT_MENU_H 6 #define SORT_MENU_W 38 #define SORT_MENU_X 2 #define SORT_MENU_Y 4 #define SORT_WIN_H 13 #define SORT_WIN_W 42 #define SORT_ASC_SEL "[x] ASC [ ] DESC" #define SORT_DESC_SEL "[ ] ASC [x] DESC" /* AGENTS DIALOG */ #define AGENTS_MENU_X 2 #define AGENTS_MENU_Y 4 /* HELP DIALOG */ #define HELP_MENU_HEIGHT 12 #define HELP_MENU_WIDTH 60 #define HELP_MENU_X 2 #define HELP_MENU_Y 4 #define HELP_WIN_HEIGHT 17 #define HELP_WIN_WIDTH 64 #define CSENSITIVE "[x] case sensitive" #define CISENSITIVE "[ ] case sensitive" /* Convenient macros */ #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #include "color.h" #include "commons.h" #include "sort.h" typedef struct GFind_ { GModule module; char *pattern; int next_idx; int next_parent_idx; int next_sub_idx; int look_in_sub; int done; int icase; } GFind; typedef struct GScrollModule_ { int scroll; int offset; } GScrollModule; typedef struct GScroll_ { GScrollModule module[TOTAL_MODULES]; GModule current; int dash; int expanded; } GScroll; typedef struct GSpinner_ { const char *label; GColors *(*color) (void); int curses; int spin_x; int w; int x; int y; pthread_mutex_t mutex; pthread_t thread; unsigned int *processed; WINDOW *win; enum { SPN_RUN, SPN_END } state; } GSpinner; /* Controls metric output. * i.e., which metrics it should display */ typedef struct GOutput_ { GModule module; int8_t visitors; int8_t hits; int8_t percent; int8_t bw; int8_t avgts; int8_t cumts; int8_t maxts; int8_t protocol; int8_t method; int8_t data; int8_t graph; int8_t sub_graph; } GOutput; /* *INDENT-OFF* */ GOutput *output_lookup (GModule module); GSpinner *new_gspinner (void); char *get_browser_type (char *line); char *input_string (WINDOW * win, int pos_y, int pos_x, size_t max_width, const char *str, int enable_case, int *toggle_case); const char *module_to_desc (GModule module); const char *module_to_head (GModule module); const char *module_to_id (GModule module); const char *module_to_label (GModule module); int render_confdlg(GLog * logger, GSpinner * spinner); int set_host_agents (const char *addr, void (*func) (void *, void *, int), void *arr); void close_win (WINDOW * w); void display_general (WINDOW * header_win, char *ifile, GLog *logger); void draw_header (WINDOW * win, const char *s, const char *fmt, int y, int x, int w, GColors * (*func) (void)); void end_spinner (void); void generate_time (void); void init_colors (int force); void init_windows (WINDOW ** header_win, WINDOW ** main_win); void load_agent_list (WINDOW * main_win, char *addr); void load_help_popup (WINDOW * main_win); void load_schemes_win (WINDOW * main_win); void load_sort_win (WINDOW * main_win, GModule module, GSort * sort); void set_curses_spinner (GSpinner *spinner); void set_input_opts (void); void term_size (WINDOW * main_win); void ui_spinner_create (GSpinner * spinner); void update_active_module (WINDOW * header_win, GModule current); void update_header (WINDOW * header_win, int current); /* *INDENT-ON* */ #endif goaccess-0.9.4/src/opesys.c0000664000000000000000000001604112573351525012473 00000000000000/** * opesys.c -- functions for dealing with operating systems * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #include #include #include #include #include #include "opesys.h" #include "settings.h" #include "util.h" #include "xmalloc.h" /* ###NOTE: The size of the list is proportional to the run time, * which makes this pretty slow */ /* {"search string", "belongs to"} */ static const char *os[][2] = { {"Android", "Android"}, {"Windows NT 10.0", "Windows"}, {"Windows NT 6.3; ARM", "Windows"}, {"Windows NT 6.3", "Windows"}, {"Windows NT 6.2; ARM", "Windows"}, {"Windows NT 6.2", "Windows"}, {"Windows NT 6.1", "Windows"}, {"Windows NT 6.0", "Windows"}, {"Windows NT 5.2", "Windows"}, {"Windows NT 5.1", "Windows"}, {"Windows NT 5.01", "Windows"}, {"Windows NT 5.0", "Windows"}, {"Windows NT 4.0", "Windows"}, {"Windows NT", "Windows"}, {"Win 9x 4.90", "Windows"}, {"Windows 98", "Windows"}, {"Windows 95", "Windows"}, {"Windows CE", "Windows"}, {"Windows Phone 8.1", "Windows"}, {"Windows Phone 8.0", "Windows"}, {"Googlebot", "Unix-like"}, {"bingbot", "Windows"}, {"iPad", "iOS"}, {"iPod", "iOS"}, {"iPhone", "iOS"}, {"AppleTV", "iOS"}, {"iTunes", "Macintosh"}, {"OS X", "Macintosh"}, {"Debian", "Linux"}, {"Ubuntu", "Linux"}, {"Fedora", "Linux"}, {"Mint", "Linux"}, {"SUSE", "Linux"}, {"Mandriva", "Linux"}, {"Red Hat", "Linux"}, {"Gentoo", "Linux"}, {"CentOS", "Linux"}, {"PCLinuxOS", "Linux"}, {"Linux", "Linux"}, {"FreeBSD", "BSD"}, {"NetBSD", "BSD"}, {"OpenBSD", "BSD"}, {"DragonFly", "BSD"}, {"PlayStation", "BSD"}, {"CrOS", "Chrome OS"}, {"SunOS", "Unix-like"}, {"QNX", "Unix-like"}, {"BB10", "Unix-like"}, {"BlackBerry", "Others"}, {"Sony", "Others"}, {"AmigaOS", "Others"}, {"SymbianOS", "Others"}, {"Nokia", "Others"}, {"Nintendo", "Others"}, {"Apache", "Others"}, {"Xbox One", "Windows"}, {"Xbox", "Windows"}, }; /* get Android Codename */ static char * get_real_android (const char *droid) { if (strstr (droid, "5.0") || strstr (droid, "5.1")) return alloc_string ("Lollipop"); else if (strstr (droid, "4.4")) return alloc_string ("KitKat"); else if (strstr (droid, "4.3") || strstr (droid, "4.2") || strstr (droid, "4.1")) return alloc_string ("Jelly Bean"); else if (strstr (droid, "4.0")) return alloc_string ("Ice Cream Sandwich"); else if (strstr (droid, "3.")) return alloc_string ("Honeycomb"); else if (strstr (droid, "2.3")) return alloc_string ("Gingerbread"); else if (strstr (droid, "2.2")) return alloc_string ("Froyo"); else if (strstr (droid, "2.0") || strstr (droid, "2.1")) return alloc_string ("Eclair"); else if (strstr (droid, "1.6")) return alloc_string ("Donut"); else if (strstr (droid, "1.5")) return alloc_string ("Cupcake"); return alloc_string (droid); } /* get Windows marketing name */ static char * get_real_win (const char *win) { if (strstr (win, "10.0")) return alloc_string ("Windows 10"); else if (strstr (win, "6.3")) return alloc_string ("Windows 8.1"); else if (strstr (win, "6.3; ARM")) return alloc_string ("Windows RT"); else if (strstr (win, "6.2; ARM")) return alloc_string ("Windows RT"); else if (strstr (win, "6.2")) return alloc_string ("Windows 8"); else if (strstr (win, "6.1")) return alloc_string ("Windows 7"); else if (strstr (win, "6.0")) return alloc_string ("Windows Vista"); else if (strstr (win, "5.2")) return alloc_string ("Windows XP x64"); else if (strstr (win, "5.1")) return alloc_string ("Windows XP"); else if (strstr (win, "5.0")) return alloc_string ("Windows 2000"); return NULL; } /* get Mac OS X Codename */ static char * get_real_mac_osx (const char *osx) { if (strstr (osx, "10.10")) return alloc_string ("OS X Yosemite"); else if (strstr (osx, "10.9")) return alloc_string ("OS X Mavericks"); else if (strstr (osx, "10.8")) return alloc_string ("OS X Mountain Lion"); else if (strstr (osx, "10.7")) return alloc_string ("OS X Lion"); else if (strstr (osx, "10.6")) return alloc_string ("OS X Snow Leopard"); else if (strstr (osx, "10.5")) return alloc_string ("OS X Leopard"); else if (strstr (osx, "10.4")) return alloc_string ("OS X Tiger"); else if (strstr (osx, "10.3")) return alloc_string ("OS X Panther"); else if (strstr (osx, "10.2")) return alloc_string ("OS X Jaguar"); else if (strstr (osx, "10.1")) return alloc_string ("OS X Puma"); else if (strstr (osx, "10.0")) return alloc_string ("OS X Cheetah"); return alloc_string (osx); } static char * parse_others (char *agent, int spaces) { char *p; int space = 0; p = agent; while (*p != ';' && *p != ')' && *p != '(' && *p != '\0') { if (*p == ' ') space++; if (space > spaces) break; p++; } *p = 0; return agent; } static char * parse_osx (char *agent) { int space = 0; char *p; p = agent; while (*p != ';' && *p != ')' && *p != '(' && *p != '\0') { if (*p == '_') *p = '.'; if (*p == ' ') space++; if (space > 3) break; p++; } *p = 0; return agent; } static char * parse_android (char *agent) { char *p; p = agent; while (*p != ';' && *p != ')' && *p != '(' && *p != '\0') p++; *p = 0; return agent; } char * verify_os (const char *str, char *os_type) { char *a, *b; int spaces = 0; size_t i; if (str == NULL || *str == '\0') return NULL; for (i = 0; i < ARRAY_SIZE (os); i++) { if ((a = strstr (str, os[i][0])) == NULL) continue; xstrncpy (os_type, os[i][1], OPESYS_TYPE_LEN); /* Windows */ if ((strstr (str, "Windows")) != NULL) { return conf.real_os && (b = get_real_win (a)) ? b : xstrdup (os[i][0]); } /* Android */ if ((strstr (a, "Android")) != NULL) { a = parse_android (a); return conf.real_os ? get_real_android (a) : xstrdup (a); } /* Mac OS X */ if ((strstr (a, "OS X")) != NULL) { a = parse_osx (a); return conf.real_os ? get_real_mac_osx (a) : xstrdup (a); } /* all others */ spaces = count_matches (os[i][0], ' '); return alloc_string (parse_others (a, spaces)); } xstrncpy (os_type, "Unknown", OPESYS_TYPE_LEN); return alloc_string ("Unknown"); } goaccess-0.9.4/src/json.c0000644000000000000000000002247312573351525012126 00000000000000/** * output.c -- output json to the standard output stream * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #include #include #include #include #include #include #include #include #include "json.h" #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #else #include "glibht.h" #endif #include "settings.h" #include "ui.h" #include "util.h" typedef struct GPanel_ { GModule module; void (*render) (FILE * fp, GHolder * h, int valid); } GPanel; static void print_json_data (FILE * fp, GHolder * h, int valid); static void print_json_host_data (FILE * fp, GHolder * h, int valid); static GPanel paneling[] = { {VISITORS, print_json_data}, {REQUESTS, print_json_data}, {REQUESTS_STATIC, print_json_data}, {NOT_FOUND, print_json_data}, {HOSTS, print_json_host_data}, {OS, print_json_data}, {BROWSERS, print_json_data}, {VISIT_TIMES, print_json_data}, {REFERRERS, print_json_data}, {REFERRING_SITES, print_json_data}, {KEYPHRASES, print_json_data}, #ifdef HAVE_LIBGEOIP {GEO_LOCATION, print_json_data}, #endif {STATUS_CODES, print_json_data}, }; static GPanel * panel_lookup (GModule module) { int i, num_panels = ARRAY_SIZE (paneling); for (i = 0; i < num_panels; i++) { if (paneling[i].module == module) return &paneling[i]; } return NULL; } static void escape_json_output (FILE * fp, char *s) { while (*s) { switch (*s) { case '"': fprintf (fp, "\\\""); break; case '\\': fprintf (fp, "\\\\"); break; case '\b': fprintf (fp, "\\\b"); break; case '\f': fprintf (fp, "\\\f"); break; case '\n': fprintf (fp, "\\\n"); break; case '\r': fprintf (fp, "\\\r"); break; case '\t': fprintf (fp, "\\\t"); break; case '/': fprintf (fp, "\\/"); break; default: if ((uint8_t) * s <= 0x1f) { /* Control characters (U+0000 through U+001F) */ char buf[8]; snprintf (buf, sizeof buf, "\\u%04x", *s); fprintf (fp, "%s", buf); } else if ((uint8_t) * s == 0xe2 && (uint8_t) * (s + 1) == 0x80 && (uint8_t) * (s + 2) == 0xa8) { /* Line separator (U+2028) */ fprintf (fp, "\\u2028"); s += 2; } else if ((uint8_t) * s == 0xe2 && (uint8_t) * (s + 1) == 0x80 && (uint8_t) * (s + 2) == 0xa9) { /* Paragraph separator (U+2019) */ fprintf (fp, "\\u2029"); s += 2; } else { fputc (*s, fp); } break; } s++; } } static void print_json_block (FILE * fp, GMetrics * nmetrics, char *sep) { fprintf (fp, "%s\t\"hits\": %d,\n", sep, nmetrics->hits); fprintf (fp, "%s\t\"visitors\": %d,\n", sep, nmetrics->visitors); fprintf (fp, "%s\t\"percent\": %4.2f,\n", sep, nmetrics->percent); if (conf.bandwidth) fprintf (fp, "%s\t\"bytes\": %lld,\n", sep, (long long) nmetrics->bw.nbw); if (conf.serve_usecs) { fprintf (fp, "%s\t\"avgts\": %lld,\n", sep, (long long) nmetrics->avgts.nts); fprintf (fp, "%s\t\"cumts\": %lld,\n", sep, (long long) nmetrics->cumts.nts); fprintf (fp, "%s\t\"maxts\": %lld,\n", sep, (long long) nmetrics->maxts.nts); } if (conf.append_method && nmetrics->method) fprintf (fp, "%s\t\"method\": \"%s\",\n", sep, nmetrics->method); if (conf.append_protocol && nmetrics->protocol) fprintf (fp, "%s\t\"protocol\": \"%s\",\n", sep, nmetrics->protocol); fprintf (fp, "%s\t\"data\": \"", sep); escape_json_output (fp, nmetrics->data); fprintf (fp, "\""); } static void print_json_host_geo (FILE * fp, GSubList * sub_list, char *sep) { GSubItem *iter; static const char *key[] = { "country", "city", "hostname", }; int i; if (sub_list == NULL) return; fprintf (fp, ",\n"); for (i = 0, iter = sub_list->head; iter; iter = iter->next, i++) { fprintf (fp, "%s\t\"%s\": \"", sep, key[iter->metrics->id]); escape_json_output (fp, iter->metrics->data); fprintf (fp, (i != sub_list->size - 1) ? "\",\n" : "\""); } } static void print_json_host_data (FILE * fp, GHolder * h, int valid) { GMetrics *nmetrics; char *sep = char_repeat (2, '\t'); int i; fprintf (fp, "\t\"%s\": [\n", module_to_id (h->module)); for (i = 0; i < h->idx; i++) { set_data_metrics (h->items[i].metrics, &nmetrics, valid); fprintf (fp, "%s{\n", sep); print_json_block (fp, nmetrics, sep); print_json_host_geo (fp, h->items[i].sub_list, sep); fprintf (fp, (i != h->idx - 1) ? "\n%s},\n" : "\n%s}\n", sep); free (nmetrics); } fprintf (fp, "\t]"); free (sep); } static void print_json_sub_items (FILE * fp, GHolder * h, int idx, int valid) { GMetrics *nmetrics; GSubItem *iter; GSubList *sub_list = h->items[idx].sub_list; char *sep = char_repeat (3, '\t'); int i = 0; if (sub_list == NULL) return; fprintf (fp, ",\n%s\"items\": [\n", sep); for (iter = sub_list->head; iter; iter = iter->next, i++) { set_data_metrics (iter->metrics, &nmetrics, valid); fprintf (fp, "%s{\n", sep); print_json_block (fp, nmetrics, sep); fprintf (fp, (i != sub_list->size - 1) ? "\n%s},\n" : "\n%s}\n", sep); free (nmetrics); } fprintf (fp, "\t\t\t]"); free (sep); } static void print_json_data (FILE * fp, GHolder * h, int valid) { GMetrics *nmetrics; char *sep = char_repeat (2, '\t'); int i; fprintf (fp, "\t\"%s\": [\n", module_to_id (h->module)); for (i = 0; i < h->idx; i++) { set_data_metrics (h->items[i].metrics, &nmetrics, valid); fprintf (fp, "%s{\n", sep); print_json_block (fp, nmetrics, sep); if (h->sub_items_size) print_json_sub_items (fp, h, i, valid); fprintf (fp, (i != h->idx - 1) ? "\n%s},\n" : "\n%s}\n", sep); free (nmetrics); } fprintf (fp, "\t]"); free (sep); } static void print_json_summary (FILE * fp, GLog * logger) { long long t = 0LL; int total = 0; off_t log_size = 0; char now[DATE_TIME]; generate_time (); strftime (now, DATE_TIME, "%Y-%m-%d %H:%M:%S", now_tm); fprintf (fp, "\t\"%s\": {\n", GENER_ID); /* generated date time */ fprintf (fp, "\t\t\"%s\": \"%s\",\n", OVERALL_DATETIME, now); /* total requests */ total = logger->processed; fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_REQ, total); /* valid requests */ total = logger->valid; fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_VALID, total); /* invalid requests */ total = logger->invalid; fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_FAILED, total); /* generated time */ t = (long long) end_proc - start_proc; fprintf (fp, "\t\t\"%s\": %lld,\n", OVERALL_GENTIME, t); /* visitors */ total = get_ht_size_by_metric (VISITORS, MTRC_UNIQMAP); fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_VISITORS, total); /* files */ total = get_ht_size_by_metric (REQUESTS, MTRC_DATAMAP); fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_FILES, total); /* excluded hits */ total = logger->excluded_ip; fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_EXCL_HITS, total); /* referrers */ total = get_ht_size_by_metric (REFERRERS, MTRC_DATAMAP); fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_REF, total); /* not found */ total = get_ht_size_by_metric (NOT_FOUND, MTRC_DATAMAP); fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_NOTFOUND, total); /* static files */ total = get_ht_size_by_metric (REQUESTS_STATIC, MTRC_DATAMAP); fprintf (fp, "\t\t\"%s\": %d,\n", OVERALL_STATIC, total); /* log size */ if (!logger->piping) log_size = file_size (conf.ifile); fprintf (fp, "\t\t\"%s\": %jd,\n", OVERALL_LOGSIZE, (intmax_t) log_size); /* bandwidth */ fprintf (fp, "\t\t\"%s\": %llu,\n", OVERALL_BANDWIDTH, logger->resp_size); /* log path */ if (conf.ifile == NULL) conf.ifile = (char *) "STDIN"; fprintf (fp, "\t\t\"%s\": \"", OVERALL_LOG); escape_json_output (fp, conf.ifile); fprintf (fp, "\"\n"); fprintf (fp, "\t},\n"); } /* entry point to generate a a json report writing it to the fp */ /* follow the JSON style similar to http://developer.github.com/v3/ */ void output_json (GLog * logger, GHolder * holder) { GModule module; FILE *fp = stdout; fprintf (fp, "{\n"); print_json_summary (fp, logger); for (module = 0; module < TOTAL_MODULES; module++) { const GPanel *panel = panel_lookup (module); if (!panel) continue; if (ignore_panel (module)) continue; panel->render (fp, holder + module, logger->valid); module != TOTAL_MODULES - 1 ? fprintf (fp, ",\n") : fprintf (fp, "\n"); } fprintf (fp, "}"); fclose (fp); } goaccess-0.9.4/src/parser.h0000644000000000000000000000712712573357401012454 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef PARSER_H_INCLUDED #define PARSER_H_INCLUDED #define LINE_BUFFER 4096 #define BW_HASHTABLES 3 #define KEY_FOUND 1 #define KEY_NOT_FOUND -1 #define REF_SITE_LEN 512 #define NUM_TESTS 20 #include "commons.h" typedef struct GLogItem_ { char *agent; char *browser; char *browser_type; char *continent; char *country; char *date; char *host; char *keyphrase; char *method; char *os; char *os_type; char *protocol; char *qstr; char *ref; char *req; char *req_key; char *status; char *time; char *uniq_key; char site[REF_SITE_LEN]; uint64_t resp_size; uint64_t serve_time; int type_ip; int is_404; int is_static; int uniq_nkey; int agent_nkey; } GLogItem; typedef struct GLog_ { unsigned int excluded_ip; unsigned int invalid; unsigned int offset; unsigned int processed; unsigned int valid; unsigned long long resp_size; unsigned short load_from_disk_only; unsigned short piping; GLogItem *items; } GLog; typedef struct GRawDataItem_ { void *key; void *value; } GRawDataItem; typedef struct GRawData_ { GRawDataItem *items; /* data */ GModule module; /* current module */ int idx; /* first level index */ int size; /* total num of items on ht */ } GRawData; /* Each record contains a data value, i.e., Windows XP, and it may contain a * root value, i.e., Windows, and a unique key which is the combination of * date, IP and user agent */ typedef struct GKeyData_ { void *data; void *data_key; int data_nkey; void *root; void *root_key; int root_nkey; void *uniq_key; int uniq_nkey; } GKeyData; typedef struct GParse_ { GModule module; int (*key_data) (GKeyData * kdata, GLogItem * glog); /* data field */ void (*datamap) (int data_nkey, const char *data, GModule module); void (*rootmap) (int root_nkey, const char *root, GModule module); /* metrics */ void (*hits) (int data_nkey, int uniq_nkey, int root_nkey, GModule module); void (*visitor) (int uniq_nkey, GModule module); void (*bw) (int data_nkey, uint64_t size, GModule module); void (*cumts) (int data_nkey, uint64_t ts, GModule module); void (*maxts) (int data_nkey, uint64_t ts, GModule module); void (*method) (int data_nkey, const char *method, GModule module); void (*protocol) (int data_nkey, const char *proto, GModule module); void (*agent) (int data_nkey, int agent_nkey, GModule module); } GParse; GLog *init_log (void); GLogItem *init_log_item (GLog * logger); GRawDataItem *new_grawdata_item (unsigned int size); GRawData *new_grawdata (void); int parse_log (GLog ** logger, char *tail, int n); int test_format (GLog * logger); void free_raw_data (GRawData * raw_data); void reset_struct (GLog * logger); void verify_formats (void); #endif goaccess-0.9.4/src/tcbtdb.h0000664000000000000000000000431012573351525012414 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #ifndef TCBTDB_H_INCLUDED #define TCBTDB_H_INCLUDED #include #include "commons.h" #include "gstorage.h" #include "parser.h" #define TC_MMAP 0 #define TC_LCNUM 1024 #define TC_NCNUM 512 #define TC_LMEMB 128 #define TC_NMEMB 256 #define TC_BNUM 32749 #define TC_DBPATH "/tmp/" #define TC_ZLIB 1 #define TC_BZ2 2 /* B+ Tree - on-disk databases */ #define DB_AGENT_KEYS "db_agent_keys.tcb" #define DB_AGENT_VALS "db_agent_vals.tcb" #define DB_GEN_STATS "db_gen_stats.tcb" #define DB_HOSTNAMES "db_hostnames.tcb" #define DB_UNIQUE_KEYS "db_unique_keys.tcb" #define DB_KEYMAP "db_keymap.tcb" #define DB_DATAMAP "db_datamap.tcb" #define DB_ROOTMAP "db_rootmap.tcb" #define DB_UNIQMAP "db_uniqmap.tcb" #define DB_VISITORS "db_visitors.tcb" #define DB_HITS "db_hits.tcb" #define DB_BW "db_bw.tcb" #define DB_CUMTS "db_cumts.tcb" #define DB_MAXTS "db_maxts.tcb" #define DB_METHODS "db_methods.tcb" #define DB_PROTOCOLS "db_protocols.tcb" #define DB_AGENTS "db_agents.tcb" /* *INDENT-OFF* */ TCBDB * tc_bdb_create (const char *dbname, int module); char * tc_db_set_path (const char *dbname, int module); int tc_bdb_close (void *db, char *dbname); void tc_db_get_params (char *params, const char *path); #ifdef TCB_BTREE int ht_insert_host_agent (TCBDB * bdb, int data_nkey, int agent_nkey); #endif /* *INDENT-ON* */ #endif goaccess-0.9.4/src/color.h0000644000000000000000000000442512573351525012275 00000000000000/** * Copyright (C) 2009-2015 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #ifndef COLOR_H_INCLUDED #define COLOR_H_INCLUDED #define COLOR_STR_LEN 9 typedef enum CSTM_COLORS { COLOR_NORMAL, COLOR_MTRC_HITS, COLOR_MTRC_VISITORS, COLOR_MTRC_DATA, COLOR_MTRC_BW, COLOR_MTRC_AVGTS, COLOR_MTRC_CUMTS, COLOR_MTRC_MAXTS, COLOR_MTRC_PROT, COLOR_MTRC_MTHD, COLOR_MTRC_PERC, COLOR_MTRC_PERC_MAX, COLOR_PANEL_COLS, COLOR_BARS, COLOR_ERROR, COLOR_SELECTED, COLOR_PANEL_ACTIVE, COLOR_PANEL_HEADER, COLOR_PANEL_DESC, COLOR_OVERALL_LBLS, COLOR_OVERALL_VALS, COLOR_OVERALL_PATH, COLOR_ACTIVE_LABEL, COLOR_BG, COLOR_DEFAULT, COLOR_PROGRESS, } GColorItem; typedef enum SCHEMES { NO_COLOR, MONOCHROME, STD_GREEN } GShemes; #include "commons.h" typedef struct GColorPair_ { short idx; short fg; short bg; } GColorPair; typedef struct GColors_ { GColorItem item; GColorPair *pair; int attr; short module; } GColors; GColors *color_default (void); GColors *color_error (void); GColors *color_overall_lbls (void); GColors *color_overall_path (void); GColors *color_overall_vals (void); GColors *color_panel_active (void); GColors *color_panel_desc (void); GColors *color_panel_header (void); GColors *color_progress (void); GColors *color_selected (void); GColors *get_color_by_item_module (GColorItem item, GModule module); GColors *get_color (GColorItem item); GColors *get_color_normal (void); void free_color_lists (void); void set_colors (int force); void set_normal_color (void); #endif // for #ifndef COLOR_H goaccess-0.9.4/src/gdashboard.c0000644000000000000000000013153212573351525013250 00000000000000/** * gmenu.c -- goaccess main dashboard * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #define _XOPEN_SOURCE 700 #include #include #include #include #include #include #include #include #include #include "gdashboard.h" #ifdef HAVE_LIBTOKYOCABINET #include "tcabdb.h" #else #include "glibht.h" #endif #ifdef HAVE_LIBGEOIP #include "geolocation.h" #endif #include "error.h" #include "color.h" #include "gdns.h" #include "settings.h" #include "util.h" #include "xmalloc.h" typedef struct GPanel_ { GModule module; void (*insert) (GRawDataItem item, GHolder * h, const struct GPanel_ *); void (*holder_callback) (GHolder * h); void (*lookup) (GRawDataItem item); } GPanel; static void add_data_to_holder (GRawDataItem item, GHolder * h, const GPanel * panel); static void add_host_to_holder (GRawDataItem item, GHolder * h, const GPanel * panel); static void add_root_to_holder (GRawDataItem item, GHolder * h, const GPanel * panel); static void add_host_child_to_holder (GHolder * h); static void data_visitors (GHolder * h); static GFind find_t; /* *INDENT-OFF* */ static GPanel paneling[] = { {VISITORS , add_data_to_holder, data_visitors} , {REQUESTS , add_data_to_holder, NULL} , {REQUESTS_STATIC , add_data_to_holder, NULL} , {NOT_FOUND , add_data_to_holder, NULL} , {HOSTS , add_host_to_holder, add_host_child_to_holder} , {OS , add_root_to_holder, NULL} , {BROWSERS , add_root_to_holder, NULL} , {VISIT_TIMES , add_data_to_holder, NULL} , {REFERRERS , add_data_to_holder, NULL} , {REFERRING_SITES , add_data_to_holder, NULL} , {KEYPHRASES , add_data_to_holder, NULL} , #ifdef HAVE_LIBGEOIP {GEO_LOCATION , add_root_to_holder, NULL} , #endif {STATUS_CODES , add_root_to_holder, NULL} , {VISIT_TIMES , add_data_to_holder, NULL} , }; /* *INDENT-ON* */ static GPanel * panel_lookup (GModule module) { int i, num_panels = ARRAY_SIZE (paneling); for (i = 0; i < num_panels; i++) { if (paneling[i].module == module) return &paneling[i]; } return NULL; } /* reset find indices */ void reset_find (void) { if (find_t.pattern != NULL && *find_t.pattern != '\0') free (find_t.pattern); find_t.look_in_sub = 0; find_t.module = 0; find_t.next_idx = 0; /* next total index */ find_t.next_parent_idx = 0; /* next parent index */ find_t.next_sub_idx = 0; /* next sub item index */ find_t.pattern = NULL; } /* allocate memory for dash */ GDash * new_gdash (void) { GDash *dash = xmalloc (sizeof (GDash)); memset (dash, 0, sizeof *dash); dash->total_alloc = 0; return dash; } /* allocate memory for dash elements */ GDashData * new_gdata (uint32_t size) { GDashData *data = xcalloc (size, sizeof (GDashData)); return data; } static void free_dashboard_data (GDashData item) { if (item.metrics == NULL) return; if (item.metrics->data) free (item.metrics->data); if (item.metrics->bw.sbw) free (item.metrics->bw.sbw); if (conf.serve_usecs && item.metrics->avgts.sts) free (item.metrics->avgts.sts); if (conf.serve_usecs && item.metrics->cumts.sts) free (item.metrics->cumts.sts); if (conf.serve_usecs && item.metrics->maxts.sts) free (item.metrics->maxts.sts); free (item.metrics); } /* free dash and its elements */ void free_dashboard (GDash * dash) { int i, j; for (i = 0; i < TOTAL_MODULES; i++) { for (j = 0; j < dash->module[i].alloc_data; j++) { free_dashboard_data (dash->module[i].data[j]); } free (dash->module[i].data); } free (dash); } /* allocate memory for holder */ GHolder * new_gholder (uint32_t size) { GHolder *holder = xmalloc (size * sizeof (GHolder)); memset (holder, 0, size * sizeof *holder); return holder; } /* allocate memory for holder items */ static GHolderItem * new_gholder_item (uint32_t size) { GHolderItem *item = xcalloc (size, sizeof (GHolderItem)); return item; } /* allocate memory for a sub list */ static GSubList * new_gsublist (void) { GSubList *sub_list = xmalloc (sizeof (GSubList)); sub_list->head = NULL; sub_list->tail = NULL; sub_list->size = 0; return sub_list; } /* allocate memory for a sub list item */ static GSubItem * new_gsubitem (GModule module, GMetrics * nmetrics) { GSubItem *sub_item = xmalloc (sizeof (GSubItem)); sub_item->metrics = nmetrics; sub_item->module = module; sub_item->prev = NULL; sub_item->next = NULL; return sub_item; } /* add an item to the end of a given sub list */ static void add_sub_item_back (GSubList * sub_list, GModule module, GMetrics * nmetrics) { GSubItem *sub_item = new_gsubitem (module, nmetrics); if (sub_list->tail) { sub_list->tail->next = sub_item; sub_item->prev = sub_list->tail; sub_list->tail = sub_item; } else { sub_list->head = sub_item; sub_list->tail = sub_item; } sub_list->size++; } /* delete entire given sub list */ static void delete_sub_list (GSubList * sub_list) { GSubItem *item = NULL; GSubItem *next = NULL; if (sub_list != NULL && sub_list->size == 0) goto clear; if (sub_list->size == 0) return; for (item = sub_list->head; item; item = next) { next = item->next; free (item->metrics->data); free (item->metrics); free (item); } clear: sub_list->head = NULL; sub_list->size = 0; free (sub_list); } /* dynamically allocated holder fields */ static void free_holder_data (GHolderItem item) { if (item.sub_list != NULL) delete_sub_list (item.sub_list); if (item.metrics->data != NULL) free (item.metrics->data); if (item.metrics->method != NULL) free (item.metrics->method); if (item.metrics->protocol != NULL) free (item.metrics->protocol); if (item.metrics != NULL) free (item.metrics); } /* free memory allocated in holder for specific module */ void free_holder_by_module (GHolder ** holder, GModule module) { int j; if ((*holder) == NULL) return; for (j = 0; j < (*holder)[module].idx; j++) { free_holder_data ((*holder)[module].items[j]); } free ((*holder)[module].items); (*holder)[module].holder_size = 0; (*holder)[module].idx = 0; (*holder)[module].sub_items_size = 0; } /* free memory allocated in holder */ void free_holder (GHolder ** holder) { GModule module; int j; if ((*holder) == NULL) return; for (module = 0; module < TOTAL_MODULES; module++) { for (j = 0; j < (*holder)[module].idx; j++) { free_holder_data ((*holder)[module].items[j]); } free ((*holder)[module].items); } free (*holder); (*holder) = NULL; } static GModule get_find_current_module (GDash * dash, int offset) { GModule module; for (module = 0; module < TOTAL_MODULES; module++) { /* set current module */ if (dash->module[module].pos_y == offset) return module; /* we went over by one module, set current - 1 */ if (dash->module[module].pos_y > offset) return module - 1; } return 0; } /* Get the number of rows that a collapsed dashboard panel contains */ int get_num_collapsed_data_rows (void) { int size = DASH_COLLAPSED - DASH_NON_DATA; return conf.no_column_names ? size + DASH_COL_ROWS : size; } /* Get the number of rows that the expanded dashboard panel contains */ int get_num_expanded_data_rows (void) { int size = DASH_EXPANDED - DASH_NON_DATA; return conf.no_column_names ? size + DASH_COL_ROWS : size; } /* Get the Y position where data rows start */ static int get_data_pos_rows (void) { return conf.no_column_names ? DASH_DATA_POS - DASH_COL_ROWS : DASH_DATA_POS; } /** * Determine which module should be expanded given the * current mouse position. */ int set_module_from_mouse_event (GScroll * gscroll, GDash * dash, int y) { int module = 0; int offset = y - MAX_HEIGHT_HEADER - MAX_HEIGHT_FOOTER + 1; if (gscroll->expanded) { module = get_find_current_module (dash, offset); } else { offset += gscroll->dash; module = offset / DASH_COLLAPSED; } if (module >= TOTAL_MODULES) module = TOTAL_MODULES - 1; else if (module < 0) module = 0; if ((int) gscroll->current == module) return 1; gscroll->current = module; return 0; } /* render child nodes */ static char * render_child_node (const char *data) { char *buf; int len = 0; #ifdef HAVE_LIBNCURSESW const char *bend = "\xe2\x94\x9c"; const char *horz = "\xe2\x94\x80"; #else const char *bend = "|"; const char *horz = "`-"; #endif if (data == NULL || *data == '\0') return NULL; len = snprintf (NULL, 0, " %s%s %s", bend, horz, data); buf = xmalloc (len + 3); sprintf (buf, " %s%s %s", bend, horz, data); return buf; } /* get a string of bars given current hits, maximum hit & xpos */ static char * get_bars (int n, int max, int x) { int w, h, len; getmaxyx (stdscr, h, w); (void) h; /* avoid lint warning */ if ((len = (n * (w - x) / max)) < 1) len = 1; return char_repeat (len, '|'); } /*get largest method's length */ static int get_max_method_len (GDashData * data, int size) { int i, max = 0, len; for (i = 0; i < size; i++) { if (data[i].metrics->method == NULL) continue; len = strlen (data[i].metrics->method); if (len > max) max = len; } return max; } /*get largest data's length */ static int get_max_data_len (GDashData * data, int size) { int i, max = 0, len; for (i = 0; i < size; i++) { if (data[i].metrics->data == NULL) continue; len = strlen (data[i].metrics->data); if (len > max) max = len; } return max; } /*get largest hit's length */ static int get_max_visitor_len (GDashData * data, int size) { int i, max = 0; for (i = 0; i < size; i++) { int len = intlen (data[i].metrics->visitors); if (len > max) max = len; } if (!conf.no_column_names && max < COLUMN_VIS_LEN) max = COLUMN_VIS_LEN; return max; } /*get largest hit's length */ static int get_max_hit_len (GDashData * data, int size) { int i, max = 0; for (i = 0; i < size; i++) { int len = intlen (data[i].metrics->hits); if (len > max) max = len; } if (!conf.no_column_names && max < COLUMN_HITS_LEN) max = COLUMN_HITS_LEN; return max; } /* get largest hit */ static int get_max_hit (GDashData * data, int size) { int i, max = 0; for (i = 0; i < size; i++) { int cur = 0; if ((cur = data[i].metrics->hits) > max) max = cur; } return max; } static int get_max_perc_len (int max_percent) { return intlen ((int) max_percent); } /* set item's percent in GDashData */ static float set_percent_data (GDashData * data, int n, int valid) { float max = 0.0; int i; for (i = 0; i < n; i++) { data[i].metrics->percent = get_percentage (valid, data[i].metrics->hits); if (data[i].metrics->percent > max) max = data[i].metrics->percent; } return max; } /* render module's total */ static void render_total_label (WINDOW * win, GDashModule * data, int y, GColors * (*func) (void)) { char *s; int win_h, win_w, total, ht_size; total = data->holder_size; ht_size = data->ht_size; s = xmalloc (snprintf (NULL, 0, "Total: %d/%d", total, ht_size) + 1); getmaxyx (win, win_h, win_w); (void) win_h; sprintf (s, "Total: %d/%d", total, ht_size); draw_header (win, s, "%s", y, win_w - strlen (s) - 2, win_w, func); free (s); } /* render dashboard bars (graph) */ static void render_bars (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color (COLOR_BARS); WINDOW *win = render.win; char *bar; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; bar = get_bars (data->data[idx].metrics->hits, data->max_hits, *x); if (sel) draw_header (win, bar, "%s", y, *x, w, color_selected); else { wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%s", bar); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } free (bar); } static void render_data_hosts (WINDOW * win, GDashRender render, char *value, int x) { char *padded_data; padded_data = left_pad_str (value, x); draw_header (win, padded_data, "%s", render.y, 0, render.w, color_selected); free (padded_data); } static void get_visitors_date (char *buf, const char *value) { /* verify we have a valid date conversion */ if (convert_date (buf, (char *) value, "%Y%m%d", "%d/%b/%Y", DATE_LEN) != 0) { LOG_DEBUG (("invalid date: %s", value)); xstrncpy (buf, "---", 4); } } /* render dashboard data */ static void render_data (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_DATA, data->module); WINDOW *win = render.win; char buf[DATE_LEN]; char *value; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; value = substring (data->data[idx].metrics->data, 0, w - *x); if (data->module == VISITORS) get_visitors_date (buf, value); if (sel && data->module == HOSTS && data->data[idx].is_subitem) { render_data_hosts (win, render, value, *x); } else if (sel) { draw_header (win, data->module == VISITORS ? buf : value, "%s", y, *x, w, color_selected); } else { wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%s", data->module == VISITORS ? buf : value); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } *x += data->module == VISITORS ? DATE_LEN - 1 : data->data_len; *x += DASH_SPACE; free (value); } /* render dashboard request method */ static void render_method (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_MTHD, data->module); WINDOW *win = render.win; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; char *method = data->data[idx].metrics->method; if (method == NULL || *method == '\0') return; if (sel) { /* selected state */ draw_header (win, method, "%s", y, *x, w, color_selected); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%s", method); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } *x += data->method_len + DASH_SPACE; } /* render dashboard request protocol */ static void render_proto (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_PROT, data->module); WINDOW *win = render.win; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; char *protocol = data->data[idx].metrics->protocol; if (protocol == NULL || *protocol == '\0') return; if (sel) { /* selected state */ draw_header (win, protocol, "%s", y, *x, w, color_selected); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%s", protocol); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } *x += REQ_PROTO_LEN - 1 + DASH_SPACE; } /* render dashboard averages time served */ static void render_avgts (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_AVGTS, data->module); WINDOW *win = render.win; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; char *avgts = data->data[idx].metrics->avgts.sts; if (data->module == HOSTS && data->data[idx].is_subitem) goto out; if (sel) { /* selected state */ draw_header (win, avgts, "%9s", y, *x, w, color_selected); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%9s", avgts); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } out: *x += DASH_SRV_TM_LEN + DASH_SPACE; } /* render dashboard averages time served */ static void render_cumts (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_CUMTS, data->module); WINDOW *win = render.win; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; char *cumts = data->data[idx].metrics->cumts.sts; if (data->module == HOSTS && data->data[idx].is_subitem) goto out; if (sel) { /* selected state */ draw_header (win, cumts, "%9s", y, *x, w, color_selected); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%9s", cumts); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } out: *x += DASH_SRV_TM_LEN + DASH_SPACE; } /* render dashboard averages time served */ static void render_maxts (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_MAXTS, data->module); WINDOW *win = render.win; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; char *maxts = data->data[idx].metrics->maxts.sts; if (data->module == HOSTS && data->data[idx].is_subitem) goto out; if (sel) { /* selected state */ draw_header (win, maxts, "%9s", y, *x, w, color_selected); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%9s", maxts); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } out: *x += DASH_SRV_TM_LEN + DASH_SPACE; } /* render dashboard bandwidth */ static void render_bw (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_BW, data->module); WINDOW *win = render.win; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; char *bw = data->data[idx].metrics->bw.sbw; if (data->module == HOSTS && data->data[idx].is_subitem) goto out; if (sel) { /* selected state */ draw_header (win, bw, "%11s", y, *x, w, color_selected); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%11s", bw); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } out: *x += DASH_BW_LEN + DASH_SPACE; } /* render dashboard percent */ static void render_percent (GDashModule * data, GDashRender render, int *x) { GColorItem item = COLOR_MTRC_PERC; GColors *color; WINDOW *win = render.win; char *percent; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; int len = data->perc_len + 3; if (data->module == HOSTS && data->data[idx].is_subitem) goto out; if (data->max_hits == data->data[idx].metrics->hits) item = COLOR_MTRC_PERC_MAX; color = get_color_by_item_module (item, data->module); if (sel) { /* selected state */ percent = float2str (data->data[idx].metrics->percent, len); draw_header (win, percent, "%s%%", y, *x, w, color_selected); free (percent); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%*.2f%%", len, data->data[idx].metrics->percent); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } out: *x += len + 1 + DASH_SPACE; } /* render dashboard hits */ static void render_hits (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_HITS, data->module); WINDOW *win = render.win; char *hits; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; int len = data->hits_len; if (data->module == HOSTS && data->data[idx].is_subitem) goto out; if (sel) { /* selected state */ hits = int2str (data->data[idx].metrics->hits, 0); draw_header (win, hits, " %s", y, 0, w, color_selected); free (hits); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%d", data->data[idx].metrics->hits); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } out: *x += len + DASH_SPACE; } /* render dashboard hits */ static void render_visitors (GDashModule * data, GDashRender render, int *x) { GColors *color = get_color_by_item_module (COLOR_MTRC_VISITORS, data->module); WINDOW *win = render.win; char *visitors; int y = render.y, w = render.w, idx = render.idx, sel = render.sel; int len = data->visitors_len; if (data->module == HOSTS && data->data[idx].is_subitem) goto out; if (sel) { /* selected state */ visitors = int2str (data->data[idx].metrics->visitors, len); draw_header (win, visitors, "%s", y, *x, w, color_selected); free (visitors); } else { /* regular state */ wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, "%*d", len, data->data[idx].metrics->visitors); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); } out: *x += len + DASH_SPACE; } static void render_header (WINDOW * win, GDashModule * data, GModule cur_module, int *y) { GColors *(*func) (void); char ind; char *hd; int k, w, h; getmaxyx (win, h, w); (void) h; k = data->module + 1; ind = cur_module == data->module ? '>' : ' '; func = cur_module == data->module && conf.hl_header ? color_panel_active : color_panel_header; hd = xmalloc (snprintf (NULL, 0, "%c %d - %s", ind, k, data->head) + 1); sprintf (hd, "%c %d - %s", ind, k, data->head); draw_header (win, hd, " %s", (*y), 0, w, func); free (hd); render_total_label (win, data, (*y), func); data->pos_y = (*y); (*y)++; } static void render_description (WINDOW * win, GDashModule * data, int *y) { int w, h; getmaxyx (win, h, w); (void) h; draw_header (win, data->desc, " %s", (*y), 0, w, color_panel_desc); data->pos_y = (*y); (*y)++; (*y)++; /* add empty line underneath description */ } static void render_metrics (GDashModule * data, GDashRender render, int expanded) { int x = DASH_INIT_X; GModule module = data->module; const GOutput *output = output_lookup (module); /* basic metrics */ if (output->hits) render_hits (data, render, &x); if (output->visitors) render_visitors (data, render, &x); if (output->percent) render_percent (data, render, &x); /* render bandwidth if available */ if (conf.bandwidth && output->bw) render_bw (data, render, &x); /* render avgts, cumts and maxts if available */ if (output->avgts && conf.serve_usecs) render_avgts (data, render, &x); if (output->cumts && conf.serve_usecs) render_cumts (data, render, &x); if (output->maxts && conf.serve_usecs) render_maxts (data, render, &x); /* render request method if available */ if (output->method && conf.append_method) render_method (data, render, &x); /* render request protocol if available */ if (output->protocol && conf.append_protocol) render_proto (data, render, &x); if (output->data) render_data (data, render, &x); /* skip graph bars if module is expanded and we have sub nodes */ if ((output->graph && !expanded) || (output->sub_graph && expanded)) render_bars (data, render, &x); } static void render_data_line (WINDOW * win, GDashModule * data, int *y, int j, GScroll * gscroll) { GDashRender render; GModule module = data->module; int expanded = 0, sel = 0; int w, h; getmaxyx (win, h, w); (void) h; if (gscroll->expanded && module == gscroll->current) expanded = 1; if (j >= data->idx_data) goto out; sel = expanded && j == gscroll->module[module].scroll ? 1 : 0; render.win = win; render.y = *y; render.w = w; render.idx = j; render.sel = sel; render_metrics (data, render, expanded); out: (*y)++; } static void print_horizontal_dash (WINDOW * win, int y, int x, int len) { mvwprintw (win, y, x, "%.*s", len, "----------------"); } static void lprint_col (WINDOW * win, int y, int *x, int len, const char *fmt, const char *str) { GColors *color = get_color (COLOR_PANEL_COLS); wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, fmt, str); print_horizontal_dash (win, y + 1, *x, len); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); *x += len + DASH_SPACE; } static void rprint_col (WINDOW * win, int y, int *x, int len, const char *fmt, const char *str) { GColors *color = get_color (COLOR_PANEL_COLS); wattron (win, color->attr | COLOR_PAIR (color->pair->idx)); mvwprintw (win, y, *x, fmt, len, str); print_horizontal_dash (win, y + 1, *x, len); wattroff (win, color->attr | COLOR_PAIR (color->pair->idx)); *x += len + DASH_SPACE; } static void render_cols (WINDOW * win, GDashModule * data, int *y) { GModule module = data->module; const GOutput *output = output_lookup (module); int x = DASH_INIT_X; if (data->idx_data == 0 || conf.no_column_names) return; if (output->hits) lprint_col (win, *y, &x, data->hits_len, "%s", MTRC_HITS_LBL); if (output->visitors) rprint_col (win, *y, &x, data->visitors_len, "%*s", MTRC_VISITORS_SHORT_LBL); if (output->percent) rprint_col (win, *y, &x, data->perc_len + 4, "%*s", "%"); if (output->bw && conf.bandwidth) rprint_col (win, *y, &x, DASH_BW_LEN, "%*s", MTRC_BW_LBL); if (output->avgts && conf.serve_usecs) rprint_col (win, *y, &x, DASH_SRV_TM_LEN, "%*s", MTRC_AVGTS_LBL); if (output->cumts && conf.serve_usecs) rprint_col (win, *y, &x, DASH_SRV_TM_LEN, "%*s", MTRC_CUMTS_LBL); if (output->maxts && conf.serve_usecs) rprint_col (win, *y, &x, DASH_SRV_TM_LEN, "%*s", MTRC_MAXTS_LBL); if (output->method && conf.append_method) lprint_col (win, *y, &x, data->method_len, "%s", MTRC_METHODS_SHORT_LBL); if (output->protocol && conf.append_protocol) lprint_col (win, *y, &x, 8, "%s", MTRC_PROTOCOLS_SHORT_LBL); if (output->data) lprint_col (win, *y, &x, 4, "%s", MTRC_DATA_LBL); } /* render dashboard content */ static void render_content (WINDOW * win, GDashModule * data, int *y, int *offset, int *total, GScroll * gscroll) { GModule module = data->module; int i, j, size, h, w, data_pos = get_data_pos_rows (); getmaxyx (win, h, w); (void) w; size = data->dash_size; for (i = *offset, j = 0; i < size; i++) { /* header */ if ((i % size) == DASH_HEAD_POS) { render_header (win, data, gscroll->current, y); } else if ((i % size) == DASH_EMPTY_POS && conf.no_column_names) { /* if no column names, print panel description */ render_description (win, data, y); } else if ((i % size) == DASH_EMPTY_POS || (i % size) == size - 1) { /* blank lines */ (*y)++; } else if ((i % size) == DASH_DASHES_POS && !conf.no_column_names) { /* account for already printed dash lines under columns */ (*y)++; } else if ((i % size) == DASH_COLS_POS && !conf.no_column_names) { /* column headers lines */ render_cols (win, data, y); (*y)++; } else if ((i % size) >= data_pos || (i % size) <= size - 2) { /* account for 2 lines at the header and 2 blank lines */ j = ((i % size) - data_pos) + gscroll->module[module].offset; /* actual data */ render_data_line (win, data, y, j, gscroll); } else { /* everything else should be empty */ (*y)++; } (*total)++; if (*y >= h) break; } } /* entry point to render dashboard */ void display_content (WINDOW * win, GLog * logger, GDash * dash, GScroll * gscroll) { GDashData *idata; GModule module; float max_percent = 0.0; int j, n = 0, valid = 0; int y = 0, offset = 0, total = 0; int dash_scroll = gscroll->dash; werase (win); for (module = 0; module < TOTAL_MODULES; module++) { n = dash->module[module].idx_data; offset = 0; for (j = 0; j < dash->module[module].dash_size; j++) { if (dash_scroll > total) { offset++; total++; } } idata = dash->module[module].data; valid = logger->valid; max_percent = set_percent_data (idata, n, valid); dash->module[module].module = module; dash->module[module].method_len = get_max_method_len (idata, n); dash->module[module].data_len = get_max_data_len (idata, n); dash->module[module].hits_len = get_max_hit_len (idata, n); dash->module[module].max_hits = get_max_hit (idata, n); dash->module[module].perc_len = get_max_perc_len (max_percent); dash->module[module].visitors_len = get_max_visitor_len (idata, n); render_content (win, &dash->module[module], &y, &offset, &total, gscroll); } wrefresh (win); } /* reset scroll and offset for each module */ void reset_scroll_offsets (GScroll * gscroll) { int i; for (i = 0; i < TOTAL_MODULES; i++) { gscroll->module[i].scroll = 0; gscroll->module[i].offset = 0; } } /* compile the regular expression and see if it's valid */ static int regexp_init (regex_t * regex, const char *pattern) { int y, x, rc; char buf[REGEX_ERROR]; getmaxyx (stdscr, y, x); rc = regcomp (regex, pattern, REG_EXTENDED | (find_t.icase ? REG_ICASE : 0)); /* something went wrong */ if (rc != 0) { regerror (rc, regex, buf, sizeof (buf)); draw_header (stdscr, buf, "%s", y - 1, 0, x, color_error); refresh (); return 1; } return 0; } /* set search gscroll */ static void perform_find_dash_scroll (GScroll * gscroll, GModule module) { int *scrll, *offset; int exp_size = get_num_expanded_data_rows (); /* reset gscroll offsets if we are changing module */ if (gscroll->current != module) reset_scroll_offsets (gscroll); scrll = &gscroll->module[module].scroll; offset = &gscroll->module[module].offset; (*scrll) = find_t.next_idx; if (*scrll >= exp_size && *scrll >= *offset + exp_size) (*offset) = (*scrll) < exp_size - 1 ? 0 : (*scrll) - exp_size + 1; gscroll->current = module; gscroll->dash = module * DASH_COLLAPSED; gscroll->expanded = 1; find_t.module = module; } /* find item within the given sub_list */ static int find_next_sub_item (GSubList * sub_list, regex_t * regex) { GSubItem *iter; int i = 0, rc; if (sub_list == NULL) goto out; for (iter = sub_list->head; iter; iter = iter->next) { if (i >= find_t.next_sub_idx) { rc = regexec (regex, iter->metrics->data, 0, NULL, 0); if (rc == 0) { find_t.next_idx++; find_t.next_sub_idx = (1 + i); return 0; } find_t.next_idx++; } i++; } out: find_t.next_parent_idx++; find_t.next_sub_idx = 0; find_t.look_in_sub = 0; return 1; } /* perform a forward search across all modules */ int perform_next_find (GHolder * h, GScroll * gscroll) { int y, x, j, n, rc; char buf[REGEX_ERROR]; char *data; regex_t regex; GModule module; GSubList *sub_list; getmaxyx (stdscr, y, x); if (find_t.pattern == NULL || *find_t.pattern == '\0') return 1; /* compile and initialize regexp */ if (regexp_init (®ex, find_t.pattern)) return 1; /* use last find_t.module and start search */ for (module = find_t.module; module < TOTAL_MODULES; module++) { n = h[module].idx; for (j = find_t.next_parent_idx; j < n; j++, find_t.next_idx++) { data = h[module].items[j].metrics->data; rc = regexec (®ex, data, 0, NULL, 0); if (rc != 0 && rc != REG_NOMATCH) { regerror (rc, ®ex, buf, sizeof (buf)); draw_header (stdscr, buf, "%s", y - 1, 0, x, color_error); refresh (); regfree (®ex); return 1; } else if (rc == 0 && !find_t.look_in_sub) { find_t.look_in_sub = 1; goto found; } else { sub_list = h[module].items[j].sub_list; if (find_next_sub_item (sub_list, ®ex) == 0) goto found; } } /* reset find */ find_t.next_idx = 0; find_t.next_parent_idx = 0; find_t.next_sub_idx = 0; if (find_t.module != module) { reset_scroll_offsets (gscroll); gscroll->expanded = 0; } if (module == TOTAL_MODULES - 1) { find_t.module = 0; goto out; } } found: perform_find_dash_scroll (gscroll, module); out: regfree (®ex); return 0; } /* render find dialog */ int render_find_dialog (WINDOW * main_win, GScroll * gscroll) { int y, x, valid = 1; int w = FIND_DLG_WIDTH; int h = FIND_DLG_HEIGHT; char *query = NULL; WINDOW *win; getmaxyx (stdscr, y, x); win = newwin (h, w, (y - h) / 2, (x - w) / 2); keypad (win, TRUE); wborder (win, '|', '|', '-', '-', '+', '+', '+', '+'); draw_header (win, FIND_HEAD, " %s", 1, 1, w - 2, color_panel_header); mvwprintw (win, 2, 1, " %s", FIND_DESC); find_t.icase = 0; query = input_string (win, 4, 2, w - 3, "", 1, &find_t.icase); if (query != NULL && *query != '\0') { reset_scroll_offsets (gscroll); reset_find (); find_t.pattern = xstrdup (query); valid = 0; } if (query != NULL) free (query); touchwin (main_win); close_win (win); wrefresh (main_win); return valid; } /* iterate over holder and get the key index. * return -1 if not found */ static int get_item_idx_in_holder (GHolder * holder, const char *k) { int i; if (holder == NULL) return KEY_NOT_FOUND; if (holder->idx == 0) return KEY_NOT_FOUND; if (k == NULL || *k == '\0') return KEY_NOT_FOUND; for (i = 0; i < holder->idx; i++) { if (strcmp (k, holder->items[i].metrics->data) == 0) return i; } return KEY_NOT_FOUND; } /* Copy linked-list items to an array, sort, and move them back * to the list. Should be faster than sorting the list */ static void sort_sub_list (GHolder * h, GSort sort) { GHolderItem *arr; GSubItem *iter; GSubList *sub_list; int i, j, k; /* iterate over root-level nodes */ for (i = 0; i < h->idx; i++) { sub_list = h->items[i].sub_list; if (sub_list == NULL) continue; arr = new_gholder_item (sub_list->size); /* copy items from the linked-list into an array */ for (j = 0, iter = sub_list->head; iter; iter = iter->next, j++) { arr[j].metrics = new_gmetrics (); arr[j].metrics->bw.nbw = iter->metrics->bw.nbw; arr[j].metrics->data = xstrdup (iter->metrics->data); arr[j].metrics->hits = iter->metrics->hits; arr[j].metrics->id = iter->metrics->id; arr[j].metrics->visitors = iter->metrics->visitors; if (conf.serve_usecs) { arr[j].metrics->avgts.nts = iter->metrics->avgts.nts; arr[j].metrics->cumts.nts = iter->metrics->cumts.nts; arr[j].metrics->maxts.nts = iter->metrics->maxts.nts; } } sort_holder_items (arr, j, sort); delete_sub_list (sub_list); sub_list = new_gsublist (); for (k = 0; k < j; k++) { if (k > 0) sub_list = h->items[i].sub_list; add_sub_item_back (sub_list, h->module, arr[k].metrics); h->items[i].sub_list = sub_list; } free (arr); } } /* add an item from a sub_list to the dashboard */ static void add_sub_item_to_dash (GDash ** dash, GHolderItem item, GModule module, int *i) { GSubList *sub_list = item.sub_list; GSubItem *iter; GDashData *idata; char *entry; int *idx; idx = &(*dash)->module[module].idx_data; if (sub_list == NULL) return; for (iter = sub_list->head; iter; iter = iter->next, (*i)++) { entry = render_child_node (iter->metrics->data); if (!entry) continue; idata = &(*dash)->module[module].data[(*idx)]; idata->metrics = new_gmetrics (); idata->metrics->visitors = iter->metrics->visitors; idata->metrics->bw.sbw = filesize_str (iter->metrics->bw.nbw); idata->metrics->data = xstrdup (entry); idata->metrics->hits = iter->metrics->hits; if (conf.serve_usecs) { idata->metrics->avgts.sts = usecs_to_str (iter->metrics->avgts.nts); idata->metrics->cumts.sts = usecs_to_str (iter->metrics->cumts.nts); idata->metrics->maxts.sts = usecs_to_str (iter->metrics->maxts.nts); } idata->is_subitem = 1; (*idx)++; free (entry); } } /* add a first level item to dashboard */ static void add_item_to_dash (GDash ** dash, GHolderItem item, GModule module) { GDashData *idata; int *idx = &(*dash)->module[module].idx_data; idata = &(*dash)->module[module].data[(*idx)]; idata->metrics = new_gmetrics (); idata->metrics->bw.sbw = filesize_str (item.metrics->bw.nbw); idata->metrics->data = xstrdup (item.metrics->data); idata->metrics->hits = item.metrics->hits; idata->metrics->visitors = item.metrics->visitors; if (conf.append_method && item.metrics->method) idata->metrics->method = item.metrics->method; if (conf.append_protocol && item.metrics->protocol) idata->metrics->protocol = item.metrics->protocol; if (conf.serve_usecs) { idata->metrics->avgts.sts = usecs_to_str (item.metrics->avgts.nts); idata->metrics->cumts.sts = usecs_to_str (item.metrics->cumts.nts); idata->metrics->maxts.sts = usecs_to_str (item.metrics->maxts.nts); } (*idx)++; } /* load holder's data into dashboard */ void load_data_to_dash (GHolder * h, GDash * dash, GModule module, GScroll * gscroll) { int alloc_size = 0; int i, j; alloc_size = dash->module[module].alloc_data; if (gscroll->expanded && module == gscroll->current) alloc_size += h->sub_items_size; dash->module[module].alloc_data = alloc_size; dash->module[module].data = new_gdata (alloc_size); dash->module[module].holder_size = h->holder_size; for (i = 0, j = 0; i < alloc_size; i++) { if (h->items[j].metrics->data == NULL) continue; add_item_to_dash (&dash, h->items[j], module); if (gscroll->expanded && module == gscroll->current && h->sub_items_size) add_sub_item_to_dash (&dash, h->items[j], module, &i); j++; } } static void data_visitors (GHolder * h) { char date[DATE_LEN] = ""; /* Ymd */ char *datum = h->items[h->idx].metrics->data; memset (date, 0, sizeof *date); /* verify we have a valid date conversion */ if (convert_date (date, datum, conf.date_format, "%Y%m%d", DATE_LEN) == 0) { free (datum); h->items[h->idx].metrics->data = xstrdup (date); return; } LOG_DEBUG (("invalid date: %s", datum)); free (datum); h->items[h->idx].metrics->data = xstrdup ("---"); } static int set_host_child_metrics (char *data, uint8_t id, GMetrics ** nmetrics) { GMetrics *metrics; metrics = new_gmetrics (); metrics->data = xstrdup (data); metrics->id = id; *nmetrics = metrics; return 0; } static void set_host_sub_list (GHolder * h, GSubList * sub_list) { GMetrics *nmetrics; #ifdef HAVE_LIBGEOIP char city[CITY_LEN] = ""; char continent[CONTINENT_LEN] = ""; char country[COUNTRY_LEN] = ""; #endif char *host = h->items[h->idx].metrics->data, *hostname = NULL; #ifdef HAVE_LIBGEOIP /* add geolocation child nodes */ set_geolocation (host, continent, country, city); /* country */ if (country[0] != '\0') { set_host_child_metrics (country, MTRC_ID_COUNTRY, &nmetrics); add_sub_item_back (sub_list, h->module, nmetrics); h->items[h->idx].sub_list = sub_list; h->sub_items_size++; } /* city */ if (city[0] != '\0') { set_host_child_metrics (city, MTRC_ID_CITY, &nmetrics); add_sub_item_back (sub_list, h->module, nmetrics); h->items[h->idx].sub_list = sub_list; h->sub_items_size++; } #endif /* hostname */ if (conf.enable_html_resolver && conf.output_html) { hostname = reverse_ip (host); set_host_child_metrics (hostname, MTRC_ID_HOSTNAME, &nmetrics); add_sub_item_back (sub_list, h->module, nmetrics); h->items[h->idx].sub_list = sub_list; h->sub_items_size++; free (hostname); } } static void add_host_child_to_holder (GHolder * h) { GMetrics *nmetrics; GSubList *sub_list = new_gsublist (); char *host = h->items[h->idx].metrics->data; char *hostname = NULL; int n = h->sub_items_size; /* add child nodes */ set_host_sub_list (h, sub_list); pthread_mutex_lock (&gdns_thread.mutex); hostname = get_hostname (host); pthread_mutex_unlock (&gdns_thread.mutex); /* hostname */ if (!hostname) { dns_resolver (host); } else if (hostname) { set_host_child_metrics (hostname, MTRC_ID_HOSTNAME, &nmetrics); add_sub_item_back (sub_list, h->module, nmetrics); h->items[h->idx].sub_list = sub_list; h->sub_items_size++; free (hostname); } /* did not add any items */ if (n == h->sub_items_size) free (sub_list); } static void add_host_to_holder (GRawDataItem item, GHolder * h, const GPanel * panel) { add_data_to_holder (item, h, panel); } static void add_data_to_holder (GRawDataItem item, GHolder * h, const GPanel * panel) { GDataMap *map; char *data = NULL, *method = NULL, *protocol = NULL; int data_nkey = 0, visitors = 0; uint64_t bw = 0, cumts = 0, maxts = 0; data_nkey = (*(int *) item.key); map = (GDataMap *) item.value; if (map == NULL) return; if (!(data = get_node_from_key (data_nkey, h->module, MTRC_DATAMAP))) return; bw = get_cumulative_from_key (data_nkey, h->module, MTRC_BW); cumts = get_cumulative_from_key (data_nkey, h->module, MTRC_CUMTS); maxts = get_cumulative_from_key (data_nkey, h->module, MTRC_MAXTS); visitors = get_num_from_key (data_nkey, h->module, MTRC_VISITORS); h->items[h->idx].metrics = new_gmetrics (); h->items[h->idx].metrics->hits = map->data; h->items[h->idx].metrics->visitors = visitors; h->items[h->idx].metrics->data = data; h->items[h->idx].metrics->bw.nbw = bw; h->items[h->idx].metrics->avgts.nts = cumts / map->data;; h->items[h->idx].metrics->cumts.nts = cumts; h->items[h->idx].metrics->maxts.nts = maxts; if (conf.append_method) { method = get_node_from_key (data_nkey, h->module, MTRC_METHODS); h->items[h->idx].metrics->method = method; } if (conf.append_protocol) { protocol = get_node_from_key (data_nkey, h->module, MTRC_PROTOCOLS); h->items[h->idx].metrics->protocol = protocol; } if (panel->holder_callback) panel->holder_callback (h); h->idx++; } static int set_root_metrics (int data_nkey, GDataMap * map, GModule module, GMetrics ** nmetrics) { GMetrics *metrics; char *data = NULL; uint64_t bw = 0, cumts = 0, maxts = 0; int visitors = 0; if (!(data = get_node_from_key (data_nkey, module, MTRC_DATAMAP))) return 1; bw = get_cumulative_from_key (data_nkey, module, MTRC_BW); cumts = get_cumulative_from_key (data_nkey, module, MTRC_CUMTS); maxts = get_cumulative_from_key (data_nkey, module, MTRC_MAXTS); visitors = get_num_from_key (data_nkey, module, MTRC_VISITORS); metrics = new_gmetrics (); metrics->avgts.nts = cumts / map->data; metrics->cumts.nts = cumts; metrics->maxts.nts = maxts; metrics->bw.nbw = bw; metrics->data = data; metrics->hits = map->data; metrics->visitors = visitors; *nmetrics = metrics; return 0; } static void add_root_to_holder (GRawDataItem item, GHolder * h, GO_UNUSED const GPanel * panel) { GDataMap *map; GSubList *sub_list; GMetrics *metrics, *nmetrics; char *root = NULL; int data_nkey = 0, root_idx = KEY_NOT_FOUND, idx = 0; data_nkey = (*(int *) item.key); map = (GDataMap *) item.value; if (map == NULL) return; if (set_root_metrics (data_nkey, map, h->module, &nmetrics) == 1) return; if (!(root = (get_root_from_key (map->root, h->module)))) return; /* add data as a child node into holder */ if (KEY_NOT_FOUND == (root_idx = get_item_idx_in_holder (h, root))) { idx = h->idx; sub_list = new_gsublist (); metrics = new_gmetrics (); h->items[idx].metrics = metrics; h->items[idx].metrics->data = root; h->idx++; } else { sub_list = h->items[root_idx].sub_list; metrics = h->items[root_idx].metrics; idx = root_idx; free (root); } add_sub_item_back (sub_list, h->module, nmetrics); h->items[idx].sub_list = sub_list; h->items[idx].metrics = metrics; h->items[idx].metrics->avgts.nts += nmetrics->avgts.nts; h->items[idx].metrics->cumts.nts += nmetrics->cumts.nts; h->items[idx].metrics->maxts.nts += nmetrics->maxts.nts; h->items[idx].metrics->bw.nbw += nmetrics->bw.nbw; h->items[idx].metrics->hits += nmetrics->hits; h->items[idx].metrics->visitors += nmetrics->visitors; h->sub_items_size++; } /* Load raw data into our holder structure */ void load_holder_data (GRawData * raw_data, GHolder * h, GModule module, GSort sort) { int i, size = 0; const GPanel *panel = panel_lookup (module); size = raw_data->size; h->holder_size = size > MAX_CHOICES ? MAX_CHOICES : size; h->ht_size = size; h->idx = 0; h->module = module; h->sub_items_size = 0; h->items = new_gholder_item (h->holder_size); for (i = 0; i < h->holder_size; i++) { panel->insert (raw_data->items[i], h, panel); } sort_holder_items (h->items, h->idx, sort); if (h->sub_items_size) sort_sub_list (h, sort); free_raw_data (raw_data); } goaccess-0.9.4/src/xmalloc.c0000664000000000000000000000343112573351525012607 00000000000000/** * xmalloc.c -- *alloc functions with error handling * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #include #if !defined __SUNPRO_C #include #endif #include #include #include "error.h" #include "xmalloc.h" /* self-checking wrapper to malloc() */ void * xmalloc (size_t size) { void *ptr; if ((ptr = malloc (size)) == NULL) FATAL ("Unable to allocate memory - failed."); return (ptr); } char * xstrdup (const char *s) { char *ptr; size_t len; len = strlen (s) + 1; ptr = xmalloc (len); strncpy (ptr, s, len); return (ptr); } /* self-checking wrapper to calloc() */ void * xcalloc (size_t nmemb, size_t size) { void *ptr; if ((ptr = calloc (nmemb, size)) == NULL) FATAL ("Unable to calloc memory - failed."); return (ptr); } /* self-checking wrapper to realloc() */ void * xrealloc (void *oldptr, size_t size) { void *newptr; if ((newptr = realloc (oldptr, size)) == NULL) FATAL ("Unable to reallocate memory - failed"); return (newptr); } goaccess-0.9.4/src/csv.h0000644000000000000000000000202112573351525011740 00000000000000/** * Copyright (C) 2009-2014 by Gerardo Orellana * GoAccess - An Ncurses apache weblog analyzer & interactive viewer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GNU General Public License is attached to this * source distribution for its full text. * * Visit http://goaccess.prosoftcorp.com for new releases. */ #if HAVE_CONFIG_H #include #endif #ifndef CSV_H_INCLUDED #define CSV_H_INCLUDED #include #include "parser.h" #include "settings.h" void output_csv (GLog * logger, GHolder * holder); #endif goaccess-0.9.4/README0000644000000000000000000000577312567211767011114 00000000000000What is it? ------------- GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly. Features ------------------------------- GoAccess parses the specified web log file and outputs the data to the X terminal. Features include: * General Statistics, bandwidth, etc. * Time taken to serve the request (useful to track pages that are slowing down your site) * Metrics for cumulative, average and slowest running requests * Top Visitors * Requested files * Requested static files, images, swf, js, etc. * 404 or Not Found * Hosts, Reverse DNS, IP Location * Operating Systems * Browsers and Spiders * Referring Sites * Referrers URLs * Keyphrases * Geo Location - Continent/Country/City * Visitors Time Distribution * HTTP Status Codes * Ability to output HTML, JSON and CSV * Tailor GoAccess to suit your own color taste/schemes * Incremental log processing * Support for large datasets and data persistence * Support for IPv6 Nearly all web log formats... GoAccess allows any custom log format string. Predefined options include, but not limited to: * Amazon CloudFront (Download Distribution). * AWS Elastic Load Balancing * Combined Log Format (XLF/ELF) Apache | Nginx * Common Log Format (CLF) Apache * Google Cloud Storage. * Apache virtual hosts * W3C format (IIS). Why GoAccess? ------------- The main idea behind GoAccess is being able to quickly analyze and view web server statistics in real time without having to generate an HTML report (great if you want to do a quick analysis of your access log via SSH). Although it is possible to generate an HTML, JSON, CSV report, by default it outputs to a terminal. You can see it more of a monitor command tool than anything else. Keys ---- The user can make use of the following keys: * ^F1^ or ^h^ Main help, * ^F5^ Redraw [main window], * ^q^ Quit the program, current window or module, * ^o^ or ^ENTER^ Expand selected module, * ^[Shift]0-9^ Set selected module to active, * ^Up^ arrow Scroll up main dashboard, * ^Down^ arrow Scroll down main dashboard, * ^j^ Scroll down within expanded module, * ^k^ Scroll up within expanded module, * ^c^ Set or change scheme color, * ^CTRL^ + ^f^ Scroll forward one screen within, * active module, * ^CTRL^ + ^b^ Scroll backward one screen within, * active module, * ^TAB^ Iterate modules (forward), * ^SHIFT^ + ^TAB^ Iterate modules (backward), * ^s^ Sort options for current module, * ^/^ Search across all modules, * ^n^ Find position of the next occurrence, * ^g^ Move to the first item or top of screen, * ^G^ Move to the last item or bottom of screen, Examples can be found by running `man goaccess`. goaccess-0.9.4/config.sub0000755000000000000000000010532712572061142012175 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-04-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: goaccess-0.9.4/Makefile.am0000644000000000000000000000376012570170542012247 00000000000000#AUTOMAKE_OPTIONS = foreign bin_PROGRAMS = goaccess AUTOMAKE_OPTIONS = subdir-objects confdir = $(sysconfdir) dist_conf_DATA = config/goaccess.conf goaccess_SOURCES = \ src/browsers.c \ src/browsers.h \ src/color.c \ src/color.h \ src/commons.c \ src/commons.h \ src/csv.c \ src/csv.h \ src/error.c \ src/error.h \ src/gdashboard.c \ src/gdashboard.h \ src/gdns.c \ src/gdns.h \ src/gmenu.c \ src/gmenu.h \ src/goaccess.c \ src/goaccess.h \ src/gstorage.c \ src/gstorage.h \ src/json.c \ src/json.h \ src/opesys.c \ src/opesys.h \ src/options.c \ src/options.h \ src/output.c \ src/output.h \ src/parser.c \ src/parser.h \ src/sort.c \ src/sort.h \ src/settings.c \ src/settings.h \ src/ui.c \ src/ui.h \ src/util.c \ src/util.h \ src/xmalloc.c \ src/xmalloc.h if TCB goaccess_SOURCES += \ src/tcabdb.c \ src/tcabdb.h \ src/tcbtdb.c \ src/tcbtdb.h else goaccess_SOURCES += \ src/glibht.c \ src/glibht.h endif if GEOLOCATION goaccess_SOURCES += \ src/geolocation.c \ src/geolocation.h endif if DEBUG AM_CFLAGS = -DDEBUG -O0 -g -DSYSCONFDIR=\"$(sysconfdir)\" else AM_CFLAGS = -O2 -DSYSCONFDIR=\"$(sysconfdir)\" endif if WITH_RDYNAMIC AM_LDFLAGS = -rdynamic endif AM_CFLAGS += @GLIB2_CFLAGS@ AM_CFLAGS += -Wno-long-long -Wall -W -Wnested-externs -Wformat=2 AM_CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations AM_CFLAGS += -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare AM_CFLAGS += -Wredundant-decls -Wbad-function-cast -Winline -Wcast-align -Wextra AM_CFLAGS += -Wdeclaration-after-statement -Wno-missing-field-initializers dist_man_MANS = goaccess.1 goaccess-0.9.4/AUTHORS0000644000000000000000000000167412573360546011275 00000000000000GoAccess was designed and developed by Gerardo Orellana Special thanks to the following individuals for their great contributions: * Andrew Minion * as0n * Chilledheart * Christopher Meng * Daniel Aleksandersen * Daniel (dmilith) Dettlaff * Florian Forster * Francisco Azevedo * Frederic Cambus * holys * Kit Westneat * Mark J. Berger * m-r-r * mynameiscfed * radoslawc * Stéphane Péchard * Viktor Szépe * Ville Skyttä * woobee goaccess-0.9.4/configure.ac0000644000000000000000000001566412573357740012521 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([goaccess], [0.9.4], [goaccess@prosoftcorp.com], [], [http://goaccess.io]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/goaccess.c]) AC_CONFIG_HEADERS([src/config.h]) # Use empty CFLAGS by default so autoconf does not add # CFLAGS="-O2 -g" : ${CFLAGS=""} # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O # pthread AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR([pthread is missing])]) CFLAGS="$CFLAGS -pthread" # DEBUG AC_ARG_ENABLE(debug, [ --enable-debug Create a debug build. Default is disabled], [debug="$enableval"], debug=no) if test "$debug" = "yes"; then AC_DEFINE([_DEBUG], 1, [Debug option]) fi AM_CONDITIONAL([DEBUG], [test "x$debug" = "xyes"]) # Handle rdynamic only on systems using GNU ld AC_CANONICAL_HOST AC_MSG_CHECKING([whether to build with rdynamic for GNU ld]) with_rdyanimc=yes case "$host_os" in *darwin*|*cygwin*|*aix*|*mingw*) with_rdyanimc=no ;; esac AC_MSG_RESULT([$with_rdyanimc]) AM_CONDITIONAL([WITH_RDYNAMIC], [test "x$with_rdyanimc" = "xyes"]) # GeoIP AC_ARG_ENABLE(geoip, [ --enable-geoip Enable GeoIP country lookup. Default is disabled], [geoip="$enableval"], geoip=no) if test "$geoip" = "yes"; then AC_CHECK_LIB([GeoIP], [GeoIP_new], [], [AC_MSG_ERROR([*** Missing development files for the GeoIP library])]) fi AM_CONDITIONAL([GEOLOCATION], [test "x$geoip" = "xyes"]) # UTF8 AC_ARG_ENABLE(utf8, [ --enable-utf8 Enable ncurses library that handles wide characters], [utf8="$enableval"], utf8=no) if test "$utf8" = "yes"; then AC_CHECK_LIB([ncursesw], [mvaddwstr], [], [AC_MSG_ERROR([*** Missing development libraries for ncursesw])]) have_ncurses="yes" AC_CHECK_HEADERS([ncursesw/ncurses.h],[have_ncurses=yes], [], [ #ifdef HAVE_NCURSESW_NCURSES_H #include #endif ]) AC_CHECK_HEADERS([ncurses.h],[have_ncurses=yes], [], [ #ifdef HAVE_NCURSES_H #include #endif ]) if test "$have_ncurses" != "yes"; then AC_MSG_ERROR([Missing ncursesw header file]) fi else AC_CHECK_LIB([ncurses], [refresh], [], [AC_MSG_ERROR([*** Missing development libraries for ncurses])]) have_ncurses="yes" AC_CHECK_HEADERS([ncurses/ncurses.h],[have_ncurses=yes], [], [ #ifdef HAVE_NCURSES_NCURSES_H #include #endif ]) AC_CHECK_HEADERS([ncurses.h],[have_ncurses=yes], [], [ #ifdef HAVE_NCURSES_H #include #endif ]) AC_CHECK_HEADERS([curses.h],[have_ncurses=yes], [], [ #ifdef HAVE_CURSES_H #include #endif ]) if test "$have_ncurses" != "yes"; then AC_MSG_ERROR([Missing ncursesw header file]) fi fi # Tokyo Cabinet AC_ARG_ENABLE(tcb, [ --enable-tcb Enable TokyoCabinet database. Default is disabled], [tcb="$enableval"], tcb=no) WITH_TC=no if test "$tcb" = "memhash"; then WITH_TC=yes AC_DEFINE([TCB_MEMHASH], [1], ["Build using on-memory hash database"]) elif test "$tcb" = "btree"; then AC_DEFINE([TCB_BTREE], [1], ["Build using on-disk B+ Tree database"]) WITH_TC=yes fi if test "$WITH_TC" = "yes"; then AC_CHECK_LIB([tokyocabinet], [tchdbnew], [], [AC_MSG_ERROR([*** Missing development libraries for Tokyo Cabinet Database])]) AC_ARG_ENABLE([zlib], [ --disable-zlib Build without ZLIB compression], [zlib="$enableval"], zlib=yes) if test "$zlib" = "yes"; then AC_CHECK_LIB(z, gzread, [Z_FLAG=-lz], AC_MSG_ERROR([ *** zlib is required. If zlib compression is not needed *** you can use --disable-zlib. *** Debian based distributions zlib1g-dev *** Red Hat based distributions zlib-devel ])) AC_DEFINE([HAVE_ZLIB], [1], ["Build using ZLIB"]) CFLAGS="$CFLAGS $Z_FLAG" fi AC_ARG_ENABLE([bzip], [ --disable-bzip Build without BZIP2 compression], [bz2="$enableval"], bz2=yes) if test "$bz2" = "yes"; then AC_CHECK_LIB(bz2, BZ2_bzopen, [BZ2_FLAG=-lbz2], AC_MSG_ERROR([ *** BZIP2 is required. If BZIP2 compression is not needed *** you can use --disable-bzip. *** Debian based distributions libbz2-dev *** Red Hat based distributions bzip2-devel ])) AC_DEFINE([HAVE_BZ2], [1], ["Build using BZ2"]) CFLAGS="$CFLAGS $BZ2_FLAG" fi CFLAGS="$CFLAGS -ltokyocabinet -lrt -lc" # GLib otherwise else # Check for pkg-config program, used for configuring some libraries. m4_define_default([PKG_PROG_PKG_CONFIG], [AC_MSG_CHECKING([pkg-config]) AC_MSG_RESULT([no])]) PKG_PROG_PKG_CONFIG # If pkg-config autoconf support isn't installed, define its autoconf macro. m4_define_default([PKG_CHECK_MODULES], [AC_MSG_CHECKING([$1]) AC_MSG_RESULT([no]) $4]) AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no]) AS_IF([test "x$PKG_CONFIG" = "xno"],[ AC_MSG_ERROR([ *** pkg-config script could not be found. Make sure it is *** in your path, or set the PKG_CONFIG environment variable *** to the full path to pkg-config. Otherwise, reinstall glib2 *** development files (libglib2.0-dev)]) ]) PKG_CHECK_MODULES(GLIB2, glib-2.0, [], AC_MSG_ERROR([*** Missing development libraries for GLib])) AC_SUBST(GLIB2_CFLAGS) AC_SUBST(GLIB2_LIBS) AC_CHECK_LIB([glib-2.0], [g_list_append], [], [AC_MSG_ERROR([*** Missing development libraries for GLib])]) fi AM_CONDITIONAL([TCB], [test "$WITH_TC" = "yes"]) if test "$tcb" = "memhash"; then storage="On-memory Hash Database (Tokyo Cabinet)" elif test "$tcb" = "btree"; then storage="On-disk B+ Tree Database (Tokyo Cabinet)" else storage="On-memory Hash Database (GLib)" fi # Solaris AC_CHECK_LIB([socket], [socket]) AC_CHECK_LIB([nsl], [gethostbyname]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([arpa/inet.h]) AC_CHECK_HEADERS([locale.h]) AC_CHECK_HEADERS([netdb.h]) AC_CHECK_HEADERS([stdint.h]) AC_CHECK_HEADERS([stdlib.h]) AC_CHECK_HEADERS([string.h]) AC_CHECK_HEADERS([unistd.h]) AC_CHECK_HEADERS([stddef.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_STRUCT_TM AC_CHECK_TYPES([ptrdiff_t]) # Checks for library functions. AC_FUNC_STRTOD AC_FUNC_FSEEKO AC_FUNC_MEMCMP AC_FUNC_STAT AC_FUNC_STRFTIME AC_CHECK_FUNCS([regcomp]) AC_CHECK_FUNCS([strtoull]) AC_CHECK_FUNCS([memmove]) AC_CHECK_FUNCS([floor]) AC_CHECK_FUNCS([gethostbyaddr]) AC_CHECK_FUNCS([gethostbyname]) AC_CHECK_FUNCS([memset]) AC_CHECK_FUNCS([setlocale]) AC_CHECK_FUNCS([strchr]) AC_CHECK_FUNCS([strdup]) AC_CHECK_FUNCS([strerror]) AC_CHECK_FUNCS([strrchr]) AC_CHECK_FUNCS([strstr]) AC_CHECK_FUNCS([strtol]) AC_CHECK_FUNCS([realpath]) AC_CHECK_FUNCS([malloc]) AC_CHECK_FUNCS([realloc]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT cat << EOF Your build configuration: Prefix: $prefix Package: $PACKAGE_NAME Version: $VERSION Storage method: $storage Compiler flags: $CFLAGS Linker flags: $LIBS $LDFLAGS Bugs: $PACKAGE_BUGREPORT EOF goaccess-0.9.4/missing0000755000000000000000000002415212572061142011605 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: goaccess-0.9.4/COPYING0000644000000000000000000004325412432301671011244 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. goaccess-0.9.4/Makefile.in0000644000000000000000000010306112573361510012253 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = goaccess$(EXEEXT) @TCB_TRUE@am__append_1 = \ @TCB_TRUE@ src/tcabdb.c \ @TCB_TRUE@ src/tcabdb.h \ @TCB_TRUE@ src/tcbtdb.c \ @TCB_TRUE@ src/tcbtdb.h @TCB_FALSE@am__append_2 = \ @TCB_FALSE@ src/glibht.c \ @TCB_FALSE@ src/glibht.h @GEOLOCATION_TRUE@am__append_3 = \ @GEOLOCATION_TRUE@ src/geolocation.c \ @GEOLOCATION_TRUE@ src/geolocation.h subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_conf_DATA) \ $(dist_man_MANS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/configure $(top_srcdir)/src/config.h.in AUTHORS \ COPYING ChangeLog INSTALL NEWS TODO compile config.guess \ config.sub depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(confdir)" PROGRAMS = $(bin_PROGRAMS) am__goaccess_SOURCES_DIST = src/browsers.c src/browsers.h src/color.c \ src/color.h src/commons.c src/commons.h src/csv.c src/csv.h \ src/error.c src/error.h src/gdashboard.c src/gdashboard.h \ src/gdns.c src/gdns.h src/gmenu.c src/gmenu.h src/goaccess.c \ src/goaccess.h src/gstorage.c src/gstorage.h src/json.c \ src/json.h src/opesys.c src/opesys.h src/options.c \ src/options.h src/output.c src/output.h src/parser.c \ src/parser.h src/sort.c src/sort.h src/settings.c \ src/settings.h src/ui.c src/ui.h src/util.c src/util.h \ src/xmalloc.c src/xmalloc.h src/tcabdb.c src/tcabdb.h \ src/tcbtdb.c src/tcbtdb.h src/glibht.c src/glibht.h \ src/geolocation.c src/geolocation.h am__dirstamp = $(am__leading_dot)dirstamp @TCB_TRUE@am__objects_1 = src/tcabdb.$(OBJEXT) src/tcbtdb.$(OBJEXT) @TCB_FALSE@am__objects_2 = src/glibht.$(OBJEXT) @GEOLOCATION_TRUE@am__objects_3 = src/geolocation.$(OBJEXT) am_goaccess_OBJECTS = src/browsers.$(OBJEXT) src/color.$(OBJEXT) \ src/commons.$(OBJEXT) src/csv.$(OBJEXT) src/error.$(OBJEXT) \ src/gdashboard.$(OBJEXT) src/gdns.$(OBJEXT) \ src/gmenu.$(OBJEXT) src/goaccess.$(OBJEXT) \ src/gstorage.$(OBJEXT) src/json.$(OBJEXT) src/opesys.$(OBJEXT) \ src/options.$(OBJEXT) src/output.$(OBJEXT) \ src/parser.$(OBJEXT) src/sort.$(OBJEXT) src/settings.$(OBJEXT) \ src/ui.$(OBJEXT) src/util.$(OBJEXT) src/xmalloc.$(OBJEXT) \ $(am__objects_1) $(am__objects_2) $(am__objects_3) goaccess_OBJECTS = $(am_goaccess_OBJECTS) goaccess_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(goaccess_SOURCES) DIST_SOURCES = $(am__goaccess_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man_MANS) DATA = $(dist_conf_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GLIB2_CFLAGS = @GLIB2_CFLAGS@ GLIB2_LIBS = @GLIB2_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POW_LIB = @POW_LIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = subdir-objects confdir = $(sysconfdir) dist_conf_DATA = config/goaccess.conf goaccess_SOURCES = src/browsers.c src/browsers.h src/color.c \ src/color.h src/commons.c src/commons.h src/csv.c src/csv.h \ src/error.c src/error.h src/gdashboard.c src/gdashboard.h \ src/gdns.c src/gdns.h src/gmenu.c src/gmenu.h src/goaccess.c \ src/goaccess.h src/gstorage.c src/gstorage.h src/json.c \ src/json.h src/opesys.c src/opesys.h src/options.c \ src/options.h src/output.c src/output.h src/parser.c \ src/parser.h src/sort.c src/sort.h src/settings.c \ src/settings.h src/ui.c src/ui.h src/util.c src/util.h \ src/xmalloc.c src/xmalloc.h $(am__append_1) $(am__append_2) \ $(am__append_3) @DEBUG_FALSE@AM_CFLAGS = -O2 -DSYSCONFDIR=\"$(sysconfdir)\" \ @DEBUG_FALSE@ @GLIB2_CFLAGS@ -Wno-long-long -Wall -W \ @DEBUG_FALSE@ -Wnested-externs -Wformat=2 -Wmissing-prototypes \ @DEBUG_FALSE@ -Wstrict-prototypes -Wmissing-declarations \ @DEBUG_FALSE@ -Wwrite-strings -Wshadow -Wpointer-arith \ @DEBUG_FALSE@ -Wsign-compare -Wredundant-decls \ @DEBUG_FALSE@ -Wbad-function-cast -Winline -Wcast-align -Wextra \ @DEBUG_FALSE@ -Wdeclaration-after-statement \ @DEBUG_FALSE@ -Wno-missing-field-initializers @DEBUG_TRUE@AM_CFLAGS = -DDEBUG -O0 -g -DSYSCONFDIR=\"$(sysconfdir)\" \ @DEBUG_TRUE@ @GLIB2_CFLAGS@ -Wno-long-long -Wall -W \ @DEBUG_TRUE@ -Wnested-externs -Wformat=2 -Wmissing-prototypes \ @DEBUG_TRUE@ -Wstrict-prototypes -Wmissing-declarations \ @DEBUG_TRUE@ -Wwrite-strings -Wshadow -Wpointer-arith \ @DEBUG_TRUE@ -Wsign-compare -Wredundant-decls \ @DEBUG_TRUE@ -Wbad-function-cast -Winline -Wcast-align -Wextra \ @DEBUG_TRUE@ -Wdeclaration-after-statement \ @DEBUG_TRUE@ -Wno-missing-field-initializers @WITH_RDYNAMIC_TRUE@AM_LDFLAGS = -rdynamic dist_man_MANS = goaccess.1 all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): src/config.h: src/stamp-h1 @if test ! -f $@; then rm -f src/stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) src/stamp-h1; else :; fi src/stamp-h1: $(top_srcdir)/src/config.h.in $(top_builddir)/config.status @rm -f src/stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(top_srcdir)/src/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f src/stamp-h1 touch $@ distclean-hdr: -rm -f src/config.h src/stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/$(DEPDIR) @: > src/$(DEPDIR)/$(am__dirstamp) src/browsers.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/color.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/commons.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/csv.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/error.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/gdashboard.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/gdns.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/gmenu.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/goaccess.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/gstorage.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/json.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/opesys.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/options.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/output.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/parser.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/sort.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/settings.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ui.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/util.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/xmalloc.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/tcabdb.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/tcbtdb.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/glibht.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/geolocation.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) goaccess$(EXEEXT): $(goaccess_OBJECTS) $(goaccess_DEPENDENCIES) $(EXTRA_goaccess_DEPENDENCIES) @rm -f goaccess$(EXEEXT) $(LINK) $(goaccess_OBJECTS) $(goaccess_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f src/browsers.$(OBJEXT) -rm -f src/color.$(OBJEXT) -rm -f src/commons.$(OBJEXT) -rm -f src/csv.$(OBJEXT) -rm -f src/error.$(OBJEXT) -rm -f src/gdashboard.$(OBJEXT) -rm -f src/gdns.$(OBJEXT) -rm -f src/geolocation.$(OBJEXT) -rm -f src/glibht.$(OBJEXT) -rm -f src/gmenu.$(OBJEXT) -rm -f src/goaccess.$(OBJEXT) -rm -f src/gstorage.$(OBJEXT) -rm -f src/json.$(OBJEXT) -rm -f src/opesys.$(OBJEXT) -rm -f src/options.$(OBJEXT) -rm -f src/output.$(OBJEXT) -rm -f src/parser.$(OBJEXT) -rm -f src/settings.$(OBJEXT) -rm -f src/sort.$(OBJEXT) -rm -f src/tcabdb.$(OBJEXT) -rm -f src/tcbtdb.$(OBJEXT) -rm -f src/ui.$(OBJEXT) -rm -f src/util.$(OBJEXT) -rm -f src/xmalloc.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/browsers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/color.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/commons.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/csv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/gdashboard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/gdns.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/geolocation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/glibht.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/gmenu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/goaccess.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/gstorage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/json.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/opesys.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/output.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/settings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/sort.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/tcabdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/tcbtdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ui.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/xmalloc.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` install-man1: $(dist_man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(dist_man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-dist_confDATA: $(dist_conf_DATA) @$(NORMAL_INSTALL) @list='$(dist_conf_DATA)'; test -n "$(confdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(confdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(confdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(confdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(confdir)" || exit $$?; \ done uninstall-dist_confDATA: @$(NORMAL_UNINSTALL) @list='$(dist_conf_DATA)'; test -n "$(confdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(confdir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(confdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf src/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_confDATA install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf src/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-dist_confDATA \ uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-binPROGRAMS install-data \ install-data-am install-dist_confDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-dist_confDATA uninstall-man uninstall-man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: goaccess-0.9.4/NEWS0000644000000000000000000000615412573357614010724 00000000000000Copyright (C) 2009-2015 Gerardo Orellana * Version history: - 0.9.4 [Tuesday, September 08 , 2015] . GoAccess 0.9.4 Released. See ChangeLog for new features/bug-fixes. - 0.9.3 [Wednesday, August 28, 2015] . GoAccess 0.9.3 Released. See ChangeLog for new features/bug-fixes. - 0.9.2 [Monday, July 06, 2015] . GoAccess 0.9.2 Released. See ChangeLog for new features/bug-fixes. - 0.9.1 [Tuesday, May 26, 2015] . GoAccess 0.9.1 Released. See ChangeLog for new features/bug-fixes. - 0.9 [Thursday, March 19, 2015] . GoAccess 0.9 Released. See ChangeLog for new features/bug-fixes. - 0.8.5 [Sunday, September 14, 2014] . GoAccess 0.8.5 Released. See ChangeLog for new features/bug-fixes. - 0.8.4 [Monday, September 08, 2014] . GoAccess 0.8.4 Released. See ChangeLog for new features/bug-fixes. - 0.8.3 [Monday, July 28, 2014] . GoAccess 0.8.3 Released. See ChangeLog for new features/bug-fixes. - 0.8.2 [Monday, July 21, 2014] . GoAccess 0.8.2 Released. See ChangeLog for new features/bug-fixes. - 0.8.1 [Monday, June 16, 2014] . GoAccess 0.8.1 Released. See ChangeLog for new features/bug-fixes. - 0.8 [Monday, May 20, 2013] . GoAccess 0.8 Released. See ChangeLog for new features/bug-fixes. - 0.7.1 [Monday, February 17, 2014] . GoAccess 0.7.1 Released. See ChangeLog for new features/bug-fixes. - 0.7 [Monday, December 16, 2013] . GoAccess 0.7 Released. See ChangeLog for new features/bug-fixes. - 0.6.1 [Monday, October 07, 2013] . GoAccess 0.6.1 Released. See ChangeLog for new features/bug-fixes. - 0.6 [Monday, July 15, 2013] . GoAccess 0.6 Released. See ChangeLog for new features/bug-fixes. - 0.5 [Monday, June 04, 2012] . GoAccess 0.5 Released. See ChangeLog for new features/bug-fixes. - 0.4.2 [Monday, January 03, 2011] . GoAccess 0.4.2 Released. See ChangeLog for new features/bug-fixes. - 0.4.1 [Monday, December 13, 2010] . GoAccess 0.4.1 Released. See ChangeLog for new features/bug-fixes. - 0.4 [Tuesday, November 30, 2010] . GoAccess 0.4 Released. See ChangeLog for new features/bug-fixes. - 0.3.3 [Monday, September 27, 2010] . GoAccess 0.3.3 Released. See ChangeLog for new features/bug-fixes. - 0.3.2 [Thursday, September 09 2010] . GoAccess 0.3.2 Released. See ChangeLog for new features/bug-fixes. - 0.3.1 [Friday, September 03, 2010] . GoAccess 0.3.1 Released. See ChangeLog for new features/bug-fixes. - 0.3 [Sunday, August 29, 2010] . GoAccess 0.3 Released. See ChangeLog for new features/bug-fixes. - 0.2 [Sunday, July 25, 2010] . GoAccess 0.2 Released. See ChangeLog for new features/bug-fixes. - 0.1.2 [Tuesday, July 13, 2010] . GoAccess 0.1.2 Released. See ChangeLog for new features/bug-fixes. - 0.1.1 [Saturday, July 10, 2010] . GoAccess 0.1.1 Released. See ChangeLog for new features/bug-fixes. - 0.1 [Wednesday, July 07, 2010] . Welcome to the GoAccess 0.1 Released. goaccess-0.9.4/TODO0000644000000000000000000000055112502146344010674 00000000000000Copyright (C) 2009-2015 Gerardo Orellana For a more comprehensive list of to-do items, please refer to the GitHub site. https://github.com/allinurl/goaccess/issues or visit http://goaccess.io/faq#todo If you are interested in working on any of the items listed in there, email goaccess@prosoftcorp.com or better, open a new issue: goaccess-0.9.4/install-sh0000755000000000000000000003325612572061142012217 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: goaccess-0.9.4/compile0000755000000000000000000001615212572061142011565 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-03-05.13; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free # Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: goaccess-0.9.4/configure0000755000000000000000000064646412573361511012141 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for goaccess 0.9.4. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: goaccess@prosoftcorp.com about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='goaccess' PACKAGE_TARNAME='goaccess' PACKAGE_VERSION='0.9.4' PACKAGE_STRING='goaccess 0.9.4' PACKAGE_BUGREPORT='goaccess@prosoftcorp.com' PACKAGE_URL='http://goaccess.io' ac_unique_file="src/goaccess.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS POW_LIB EGREP GREP CPP TCB_FALSE TCB_TRUE GLIB2_LIBS GLIB2_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG GEOLOCATION_FALSE GEOLOCATION_TRUE WITH_RDYNAMIC_FALSE WITH_RDYNAMIC_TRUE host_os host_vendor host_cpu host build_os build_vendor build_cpu build DEBUG_FALSE DEBUG_TRUE am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_debug enable_geoip enable_utf8 enable_tcb enable_zlib enable_bzip ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR GLIB2_CFLAGS GLIB2_LIBS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures goaccess 0.9.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/goaccess] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of goaccess 0.9.4:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-debug Create a debug build. Default is disabled --enable-geoip Enable GeoIP country lookup. Default is disabled --enable-utf8 Enable ncurses library that handles wide characters --enable-tcb Enable TokyoCabinet database. Default is disabled --disable-zlib Build without ZLIB compression --disable-bzip Build without BZIP2 compression Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path GLIB2_CFLAGS C compiler flags for GLIB2, overriding pkg-config GLIB2_LIBS linker flags for GLIB2, overriding pkg-config CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . goaccess home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF goaccess configure 0.9.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------------- ## ## Report this to goaccess@prosoftcorp.com ## ## --------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by goaccess $as_me 0.9.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='goaccess' VERSION='0.9.4' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' ac_config_headers="$ac_config_headers src/config.h" # Use empty CFLAGS by default so autoconf does not add # CFLAGS="-O2 -g" : ${CFLAGS=""} # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi # pthread { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" else as_fn_error $? "pthread is missing" "$LINENO" 5 fi CFLAGS="$CFLAGS -pthread" # DEBUG # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; debug="$enableval" else debug=no fi if test "$debug" = "yes"; then $as_echo "#define _DEBUG 1" >>confdefs.h fi if test "x$debug" = "xyes"; then DEBUG_TRUE= DEBUG_FALSE='#' else DEBUG_TRUE='#' DEBUG_FALSE= fi # Handle rdynamic only on systems using GNU ld # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with rdynamic for GNU ld" >&5 $as_echo_n "checking whether to build with rdynamic for GNU ld... " >&6; } with_rdyanimc=yes case "$host_os" in *darwin*|*cygwin*|*aix*|*mingw*) with_rdyanimc=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_rdyanimc" >&5 $as_echo "$with_rdyanimc" >&6; } if test "x$with_rdyanimc" = "xyes"; then WITH_RDYNAMIC_TRUE= WITH_RDYNAMIC_FALSE='#' else WITH_RDYNAMIC_TRUE='#' WITH_RDYNAMIC_FALSE= fi # GeoIP # Check whether --enable-geoip was given. if test "${enable_geoip+set}" = set; then : enableval=$enable_geoip; geoip="$enableval" else geoip=no fi if test "$geoip" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GeoIP_new in -lGeoIP" >&5 $as_echo_n "checking for GeoIP_new in -lGeoIP... " >&6; } if ${ac_cv_lib_GeoIP_GeoIP_new+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lGeoIP $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char GeoIP_new (); int main () { return GeoIP_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_GeoIP_GeoIP_new=yes else ac_cv_lib_GeoIP_GeoIP_new=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GeoIP_GeoIP_new" >&5 $as_echo "$ac_cv_lib_GeoIP_GeoIP_new" >&6; } if test "x$ac_cv_lib_GeoIP_GeoIP_new" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGEOIP 1 _ACEOF LIBS="-lGeoIP $LIBS" else as_fn_error $? "*** Missing development files for the GeoIP library" "$LINENO" 5 fi fi if test "x$geoip" = "xyes"; then GEOLOCATION_TRUE= GEOLOCATION_FALSE='#' else GEOLOCATION_TRUE='#' GEOLOCATION_FALSE= fi # UTF8 # Check whether --enable-utf8 was given. if test "${enable_utf8+set}" = set; then : enableval=$enable_utf8; utf8="$enableval" else utf8=no fi if test "$utf8" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mvaddwstr in -lncursesw" >&5 $as_echo_n "checking for mvaddwstr in -lncursesw... " >&6; } if ${ac_cv_lib_ncursesw_mvaddwstr+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncursesw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char mvaddwstr (); int main () { return mvaddwstr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ncursesw_mvaddwstr=yes else ac_cv_lib_ncursesw_mvaddwstr=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_mvaddwstr" >&5 $as_echo "$ac_cv_lib_ncursesw_mvaddwstr" >&6; } if test "x$ac_cv_lib_ncursesw_mvaddwstr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNCURSESW 1 _ACEOF LIBS="-lncursesw $LIBS" else as_fn_error $? "*** Missing development libraries for ncursesw" "$LINENO" 5 fi have_ncurses="yes" for ac_header in ncursesw/ncurses.h do : ac_fn_c_check_header_compile "$LINENO" "ncursesw/ncurses.h" "ac_cv_header_ncursesw_ncurses_h" " #ifdef HAVE_NCURSESW_NCURSES_H #include #endif " if test "x$ac_cv_header_ncursesw_ncurses_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NCURSESW_NCURSES_H 1 _ACEOF have_ncurses=yes fi done for ac_header in ncurses.h do : ac_fn_c_check_header_compile "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" " #ifdef HAVE_NCURSES_H #include #endif " if test "x$ac_cv_header_ncurses_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NCURSES_H 1 _ACEOF have_ncurses=yes fi done if test "$have_ncurses" != "yes"; then as_fn_error $? "Missing ncursesw header file" "$LINENO" 5 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for refresh in -lncurses" >&5 $as_echo_n "checking for refresh in -lncurses... " >&6; } if ${ac_cv_lib_ncurses_refresh+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char refresh (); int main () { return refresh (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ncurses_refresh=yes else ac_cv_lib_ncurses_refresh=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_refresh" >&5 $as_echo "$ac_cv_lib_ncurses_refresh" >&6; } if test "x$ac_cv_lib_ncurses_refresh" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNCURSES 1 _ACEOF LIBS="-lncurses $LIBS" else as_fn_error $? "*** Missing development libraries for ncurses" "$LINENO" 5 fi have_ncurses="yes" for ac_header in ncurses/ncurses.h do : ac_fn_c_check_header_compile "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" " #ifdef HAVE_NCURSES_NCURSES_H #include #endif " if test "x$ac_cv_header_ncurses_ncurses_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NCURSES_NCURSES_H 1 _ACEOF have_ncurses=yes fi done for ac_header in ncurses.h do : ac_fn_c_check_header_compile "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" " #ifdef HAVE_NCURSES_H #include #endif " if test "x$ac_cv_header_ncurses_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NCURSES_H 1 _ACEOF have_ncurses=yes fi done for ac_header in curses.h do : ac_fn_c_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" " #ifdef HAVE_CURSES_H #include #endif " if test "x$ac_cv_header_curses_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CURSES_H 1 _ACEOF have_ncurses=yes fi done if test "$have_ncurses" != "yes"; then as_fn_error $? "Missing ncursesw header file" "$LINENO" 5 fi fi # Tokyo Cabinet # Check whether --enable-tcb was given. if test "${enable_tcb+set}" = set; then : enableval=$enable_tcb; tcb="$enableval" else tcb=no fi WITH_TC=no if test "$tcb" = "memhash"; then WITH_TC=yes $as_echo "#define TCB_MEMHASH 1" >>confdefs.h elif test "$tcb" = "btree"; then $as_echo "#define TCB_BTREE 1" >>confdefs.h WITH_TC=yes fi if test "$WITH_TC" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tchdbnew in -ltokyocabinet" >&5 $as_echo_n "checking for tchdbnew in -ltokyocabinet... " >&6; } if ${ac_cv_lib_tokyocabinet_tchdbnew+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltokyocabinet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tchdbnew (); int main () { return tchdbnew (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_tokyocabinet_tchdbnew=yes else ac_cv_lib_tokyocabinet_tchdbnew=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tokyocabinet_tchdbnew" >&5 $as_echo "$ac_cv_lib_tokyocabinet_tchdbnew" >&6; } if test "x$ac_cv_lib_tokyocabinet_tchdbnew" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBTOKYOCABINET 1 _ACEOF LIBS="-ltokyocabinet $LIBS" else as_fn_error $? "*** Missing development libraries for Tokyo Cabinet Database" "$LINENO" 5 fi # Check whether --enable-zlib was given. if test "${enable_zlib+set}" = set; then : enableval=$enable_zlib; zlib="$enableval" else zlib=yes fi if test "$zlib" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 $as_echo_n "checking for gzread in -lz... " >&6; } if ${ac_cv_lib_z_gzread+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gzread (); int main () { return gzread (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_gzread=yes else ac_cv_lib_z_gzread=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 $as_echo "$ac_cv_lib_z_gzread" >&6; } if test "x$ac_cv_lib_z_gzread" = xyes; then : Z_FLAG=-lz else as_fn_error $? " *** zlib is required. If zlib compression is not needed *** you can use --disable-zlib. *** Debian based distributions zlib1g-dev *** Red Hat based distributions zlib-devel " "$LINENO" 5 fi $as_echo "#define HAVE_ZLIB 1" >>confdefs.h CFLAGS="$CFLAGS $Z_FLAG" fi # Check whether --enable-bzip was given. if test "${enable_bzip+set}" = set; then : enableval=$enable_bzip; bz2="$enableval" else bz2=yes fi if test "$bz2" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzopen in -lbz2" >&5 $as_echo_n "checking for BZ2_bzopen in -lbz2... " >&6; } if ${ac_cv_lib_bz2_BZ2_bzopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbz2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char BZ2_bzopen (); int main () { return BZ2_bzopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bz2_BZ2_bzopen=yes else ac_cv_lib_bz2_BZ2_bzopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzopen" >&5 $as_echo "$ac_cv_lib_bz2_BZ2_bzopen" >&6; } if test "x$ac_cv_lib_bz2_BZ2_bzopen" = xyes; then : BZ2_FLAG=-lbz2 else as_fn_error $? " *** BZIP2 is required. If BZIP2 compression is not needed *** you can use --disable-bzip. *** Debian based distributions libbz2-dev *** Red Hat based distributions bzip2-devel " "$LINENO" 5 fi $as_echo "#define HAVE_BZ2 1" >>confdefs.h CFLAGS="$CFLAGS $BZ2_FLAG" fi CFLAGS="$CFLAGS -ltokyocabinet -lrt -lc" # GLib otherwise else # Check for pkg-config program, used for configuring some libraries. if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi # If pkg-config autoconf support isn't installed, define its autoconf macro. # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$PKG_CONFIG" = "xno"; then : as_fn_error $? " *** pkg-config script could not be found. Make sure it is *** in your path, or set the PKG_CONFIG environment variable *** to the full path to pkg-config. Otherwise, reinstall glib2 *** development files (libglib2.0-dev)" "$LINENO" 5 fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB2" >&5 $as_echo_n "checking for GLIB2... " >&6; } if test -n "$GLIB2_CFLAGS"; then pkg_cv_GLIB2_CFLAGS="$GLIB2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GLIB2_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GLIB2_LIBS"; then pkg_cv_GLIB2_LIBS="$GLIB2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GLIB2_LIBS=`$PKG_CONFIG --libs "glib-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GLIB2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0" 2>&1` else GLIB2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GLIB2_PKG_ERRORS" >&5 as_fn_error $? "*** Missing development libraries for GLib" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "*** Missing development libraries for GLib" "$LINENO" 5 else GLIB2_CFLAGS=$pkg_cv_GLIB2_CFLAGS GLIB2_LIBS=$pkg_cv_GLIB2_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for g_list_append in -lglib-2.0" >&5 $as_echo_n "checking for g_list_append in -lglib-2.0... " >&6; } if ${ac_cv_lib_glib_2_0_g_list_append+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lglib-2.0 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char g_list_append (); int main () { return g_list_append (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_glib_2_0_g_list_append=yes else ac_cv_lib_glib_2_0_g_list_append=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_glib_2_0_g_list_append" >&5 $as_echo "$ac_cv_lib_glib_2_0_g_list_append" >&6; } if test "x$ac_cv_lib_glib_2_0_g_list_append" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGLIB_2_0 1 _ACEOF LIBS="-lglib-2.0 $LIBS" else as_fn_error $? "*** Missing development libraries for GLib" "$LINENO" 5 fi fi if test "$WITH_TC" = "yes"; then TCB_TRUE= TCB_FALSE='#' else TCB_TRUE='#' TCB_FALSE= fi if test "$tcb" = "memhash"; then storage="On-memory Hash Database (Tokyo Cabinet)" elif test "$tcb" = "btree"; then storage="On-disk B+ Tree Database (Tokyo Cabinet)" else storage="On-memory Hash Database (GLib)" fi # Solaris { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in netinet/in.h do : ac_fn_c_check_header_mongrel "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_in_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETINET_IN_H 1 _ACEOF fi done for ac_header in sys/socket.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" if test "x$ac_cv_header_sys_socket_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_SOCKET_H 1 _ACEOF fi done for ac_header in arpa/inet.h do : ac_fn_c_check_header_mongrel "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" if test "x$ac_cv_header_arpa_inet_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ARPA_INET_H 1 _ACEOF fi done for ac_header in locale.h do : ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" if test "x$ac_cv_header_locale_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LOCALE_H 1 _ACEOF fi done for ac_header in netdb.h do : ac_fn_c_check_header_mongrel "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" if test "x$ac_cv_header_netdb_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETDB_H 1 _ACEOF fi done for ac_header in stdint.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" if test "x$ac_cv_header_stdint_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDINT_H 1 _ACEOF fi done for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done for ac_header in string.h do : ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRING_H 1 _ACEOF fi done for ac_header in unistd.h do : ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNISTD_H 1 _ACEOF fi done for ac_header in stddef.h do : ac_fn_c_check_header_mongrel "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" if test "x$ac_cv_header_stddef_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDDEF_H 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" if test "x$ac_cv_type_ptrdiff_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTRDIFF_T 1 _ACEOF fi # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 $as_echo_n "checking for working strtod... " >&6; } if ${ac_cv_func_strtod+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_strtod=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifndef strtod double strtod (); #endif int main() { { /* Some versions of Linux strtod mis-parse strings with leading '+'. */ char *string = " +69"; char *term; double value; value = strtod (string, &term); if (value != 69 || term != (string + 4)) return 1; } { /* Under Solaris 2.4, strtod returns the wrong value for the terminating character under some conditions. */ char *string = "NaN"; char *term; strtod (string, &term); if (term != string && *(term - 1) == 0) return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strtod=yes else ac_cv_func_strtod=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 $as_echo "$ac_cv_func_strtod" >&6; } if test $ac_cv_func_strtod = no; then case " $LIBOBJS " in *" strtod.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strtod.$ac_objext" ;; esac ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" if test "x$ac_cv_func_pow" = xyes; then : fi if test $ac_cv_func_pow = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 $as_echo_n "checking for pow in -lm... " >&6; } if ${ac_cv_lib_m_pow+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pow (); int main () { return pow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_pow=yes else ac_cv_lib_m_pow=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 $as_echo "$ac_cv_lib_m_pow" >&6; } if test "x$ac_cv_lib_m_pow" = xyes; then : POW_LIB=-lm else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 $as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 $as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } if ${ac_cv_sys_largefile_source+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=no; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=1; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_cv_sys_largefile_source=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 $as_echo "$ac_cv_sys_largefile_source" >&6; } case $ac_cv_sys_largefile_source in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source _ACEOF ;; esac rm -rf conftest* # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug # in glibc 2.1.3, but that breaks too many other things. # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. if test $ac_cv_sys_largefile_source != unknown; then $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_stat_empty_string_bug=no else ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRFTIME 1 _ACEOF else # strftime is in -lintl on SCO UNIX. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 $as_echo_n "checking for strftime in -lintl... " >&6; } if ${ac_cv_lib_intl_strftime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strftime (); int main () { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_strftime=yes else ac_cv_lib_intl_strftime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 $as_echo "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = xyes; then : $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done for ac_func in regcomp do : ac_fn_c_check_func "$LINENO" "regcomp" "ac_cv_func_regcomp" if test "x$ac_cv_func_regcomp" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_REGCOMP 1 _ACEOF fi done for ac_func in strtoull do : ac_fn_c_check_func "$LINENO" "strtoull" "ac_cv_func_strtoull" if test "x$ac_cv_func_strtoull" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRTOULL 1 _ACEOF fi done for ac_func in memmove do : ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" if test "x$ac_cv_func_memmove" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMMOVE 1 _ACEOF fi done for ac_func in floor do : ac_fn_c_check_func "$LINENO" "floor" "ac_cv_func_floor" if test "x$ac_cv_func_floor" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FLOOR 1 _ACEOF fi done for ac_func in gethostbyaddr do : ac_fn_c_check_func "$LINENO" "gethostbyaddr" "ac_cv_func_gethostbyaddr" if test "x$ac_cv_func_gethostbyaddr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHOSTBYADDR 1 _ACEOF fi done for ac_func in gethostbyname do : ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHOSTBYNAME 1 _ACEOF fi done for ac_func in memset do : ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" if test "x$ac_cv_func_memset" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMSET 1 _ACEOF fi done for ac_func in setlocale do : ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale" if test "x$ac_cv_func_setlocale" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETLOCALE 1 _ACEOF fi done for ac_func in strchr do : ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" if test "x$ac_cv_func_strchr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRCHR 1 _ACEOF fi done for ac_func in strdup do : ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" if test "x$ac_cv_func_strdup" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRDUP 1 _ACEOF fi done for ac_func in strerror do : ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR 1 _ACEOF fi done for ac_func in strrchr do : ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" if test "x$ac_cv_func_strrchr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRRCHR 1 _ACEOF fi done for ac_func in strstr do : ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" if test "x$ac_cv_func_strstr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRSTR 1 _ACEOF fi done for ac_func in strtol do : ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" if test "x$ac_cv_func_strtol" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRTOL 1 _ACEOF fi done for ac_func in realpath do : ac_fn_c_check_func "$LINENO" "realpath" "ac_cv_func_realpath" if test "x$ac_cv_func_realpath" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_REALPATH 1 _ACEOF fi done for ac_func in malloc do : ac_fn_c_check_func "$LINENO" "malloc" "ac_cv_func_malloc" if test "x$ac_cv_func_malloc" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MALLOC 1 _ACEOF fi done for ac_func in realloc do : ac_fn_c_check_func "$LINENO" "realloc" "ac_cv_func_realloc" if test "x$ac_cv_func_realloc" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_REALLOC 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DEBUG_TRUE}" && test -z "${DEBUG_FALSE}"; then as_fn_error $? "conditional \"DEBUG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_RDYNAMIC_TRUE}" && test -z "${WITH_RDYNAMIC_FALSE}"; then as_fn_error $? "conditional \"WITH_RDYNAMIC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GEOLOCATION_TRUE}" && test -z "${GEOLOCATION_FALSE}"; then as_fn_error $? "conditional \"GEOLOCATION\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${TCB_TRUE}" && test -z "${TCB_FALSE}"; then as_fn_error $? "conditional \"TCB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by goaccess $as_me 0.9.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to . goaccess home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ goaccess config.status 0.9.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cat << EOF Your build configuration: Prefix: $prefix Package: $PACKAGE_NAME Version: $VERSION Storage method: $storage Compiler flags: $CFLAGS Linker flags: $LIBS $LDFLAGS Bugs: $PACKAGE_BUGREPORT EOF goaccess-0.9.4/goaccess.10000644000000000000000000005322612573222111012057 00000000000000.TH goaccess 1 "SEPTEMBER 2015" Linux "User Manuals" .SH NAME goaccess \- fast web log analyzer and interactive viewer. .SH SYNOPSIS .LP .B goaccess [-f input-file][\-c][\-r][\-d][\-m][\-q][\-o][\-h][...] .SH DESCRIPTION .B goaccess is a free (GPL) real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly. GoAccess parses the specified web log file and outputs the data to the X terminal. Features include: .IP "General Statistics:" This panel gives a summary of several metrics, some of them are: number of valid and invalid requests, time taken to analyze the data set, unique visitors, requested files, static files (CSS, ICO, JPG, etc) HTTP referrers, 404s, size of the parsed log file and bandwidth consumption. .IP "Unique visitors" This panel shows metrics such as hits, unique visitors and cumulative bandwidth per date. HTTP requests containing the same IP, the same date, and the same user agent are considered a unique visitor. By default, it includes web crawlers/spiders. .IP "Requested files" This panel displays the most highly requested files on your web server. It shows hits, unique visitors, and percentage, along with the cumulative bandwidth, protocol, and the request method used. .IP "Requested static files" Lists the most frequently static files such as: JPG, CSS, SWF, JS, GIF, and PNG file types, along with the same metrics as the last module. Additional static files can be added to the configuration file. .IP "404 or Not Found" Listed like previous panels, containing the same metrics. This panel lists the top recurrent HTTP 404s. .IP "Hosts" This panel has detailed information on the hosts themselves. It displays the same metrics as previous panels, such as number of hits, visitors, cumulative bandwidth. This is great to spot aggressive crawlers and identifying who's eating your bandwidth. Expanding the panel can display more information such as host's reverse DNS lookup result, country of origin and city. If the .I -a argument is enabled, a list of user agents can be displayed by selecting the desired IP address, and then pressing ENTER. .IP "Operating Systems" This panel will report which operating system the host used when it hit the server. It attempts to provide the most specific version of each operating system. .IP "Browsers" This panel will report which browser the host used when it hit the server. It attempts to provide the most specific version of each browser. .IP "Visit Times" This panel will display an hourly report. This option displays 24 data points, one for each hour of the day. .IP "Referrers URLs" If the host in question accessed the site via another resource, or was linked/diverted to you from another host, the URL they were referred from will be provided in this panel. See command line option to ignore specific referrers. .I disabled by default. .IP "Referring Sites" This panel will display only the host part but not the whole URL. The URL where the request came from. .IP "Keyphrases" It reports keyphrases used on Google search, Google cache, and Google translate that have lead to your web server. At present, it only supports Google search queries. By default this panel is disabled. See `--ignore-panel` in your configuration file to enable it. .I disabled by default. .IP "Geo Location" Determines where an IP address is geographically located. Statistics are broken down by continent and country. It needs to be compiled with GeoLocation support. .IP "HTTP Status Codes" The values of the numeric status code to HTTP requests. .P .I NOTE: Optionally and if configured, all panels can display the average time taken to serve the request. .SH STORAGE .P There are three storage options that can be used with GoAccess. Choosing one will depend on your environment and needs. .TP GLib Hash Tables On-memory storage provides better performance at the cost of limiting the dataset size to the amount of available physical memory. By default GoAccess uses GLib Hash Tables. If your dataset can fit in memory, then this will perform fine. It has average memory usage and pretty good performance. For better performance with memory trade-off see Tokyo Cabinet on-memory hash database. .TP Tokyo Cabinet On-Disk B+ Tree Use this storage method for large datasets where it is not possible to fit everything in memory. The B+ tree database is slower than any of the hash databases since data has to be committed to disk. However, using an SSD greatly increases the performance. You may also use this storage method if you need data persistence to quickly load statistics at a later date. .TP Tokyo Cabinet On-Memory Hash Database Although this may vary across different systems, in general the on-memory hash database should perform slightly better than GLib Hash Tables. .SH CONFIGURATION .P Multiple options can be used to configure GoAccess. For a complete up-to-date list of configure options, run .I ./configure --help .TP \fB\-\-enable-debug Compile with debugging symbols and turn off compiler optimizations. .TP \fB\-\-enable-utf8 Compile with wide character support. Ncursesw is required. .TP \fB\-\-enable-geoip Compile with GeoLocation support. MaxMind's GeoIP is required. .TP \fB\-\-enable-tcb= Compile with Tokyo Cabinet storage support. .I memhash will utilize Tokyo Cabinet's on-memory hash database. .I btree will utilize Tokyo Cabinet's on-disk B+ Tree database. .TP \fB\-\-disable-zlib Disable zlib compression on B+ Tree database. .TP \fB\-\-disable-bzip Disable bzip2 compression on B+ Tree database. .SH OPTIONS .P The following options can be supplied to the command or specified in the configuration file. If specified in the configuration file, long options need to be used without prepending --. .TP \fB\-\-time-format= The time_format variable followed by a space, specifies the log format time containing any combination of regular characters and special format specifiers. They all begin with a percentage (%) sign. See `man strftime`. .I %T or %H:%M:%S. Note that if a timestamp is given in microseconds, .I %f must be used as time-format .TP \fB\-\-date-format= The date_format variable followed by a space, specifies the log format date containing any combination of regular characters and special format specifiers. They all begin with a percentage (%) sign. See `man strftime`. .I %Y-%m-%d. Note that if a timestamp is given in microseconds, .I %f must be used as date-format .TP \fB\-\-log-format= The log_format variable followed by a space or .I \\\\t for tab-delimited, specifies the log format string. Note that if there are spaces within the format, the string needs to be enclosed in double quotes. Inner quotes need to be escaped. .TP \fB\-a \-\-agent-list Enable a list of user-agents by host. For faster parsing, do not enable this flag. .TP \fB\-c \-\-config-dialog Prompt log/date configuration window on program start. .TP \fB\-d \-\-with-output-resolver Enable IP resolver on HTML|JSON output. .TP \fB\-e \-\-exclude-ip= Exclude an IPv4 or IPv6 from being counted. Ranges can be included as well using a dash in between the IPs (start-end). .I Examples: exclude-ip 127.0.0.1 exclude-ip 192.168.0.1-192.168.0.100 exclude-ip ::1 exclude-ip 0:0:0:0:0:ffff:808:804-0:0:0:0:0:ffff:808:808 .TP \fB\-f \-\-log-file= Specify the path to the input log file. If set in the config file, it will take priority over -f from the command line. .TP \fB\-g \-\-std-geoip Standard GeoIP database for less memory usage. .TP \fB\-h \-\-help The help. .TP \fB\-H \-\-http-protocol Include HTTP request protocol if found. This will create a request key containing the request protocol + the actual request. .TP \fB\-i \-\-hl-header Color highlight active panel. .TP \fB\-M \-\-http-method Include HTTP request method if found. This will create a request key containing the request method + the actual request. .TP \fB\-m \-\-with-mouse Enable mouse support on main dashboard. .TP \fB\-o \-\-output-format= Write output to stdout given one of the following formats: .I csv : Comma-separated values (CSV) .I json : JSON (JavaScript Object Notation) .TP \fB\-p \-\-config-file= Specify a custom configuration file to use. If set, it will take priority over the global configuration file (if any). .TP \fB\-q \-\-no-query-string Ignore request's query string. i.e., www.google.com/page.htm?query => www.google.com/page.htm. .I Note: Removing the query string can greatly decrease memory consumption, especially on timestamped requests. .TP \fB\-r \-\-no-term-resolver Disable IP resolver on terminal output. .TP \fB\-s \-\-storage Display current storage method. i.e., B+ Tree, Hash. .TP \fB\-V \-\-version Display version information and exit. .TP \fB\-\-color-scheme<1|2> Choose among color schemes. .I 1 for the default grey scheme. .I 2 for the green scheme. .TP \fB\-\-no-color Turn off colored output. This is the default output on terminals that do not support colors. .TP \fB\-\-\-color= Specify custom colors for the terminal output. .I Color Syntax DEFINITION space/tab colorFG#:colorBG# [attributes,PANEL] FG# = foreground color [-1...255] (-1 = default term color) BG# = background color [-1...255] (-1 = default term color) Optionally, it is possible to apply color attributes (multiple attributes are comma separated), such as: .I bold, .I underline, .I normal, .I reverse, .I blink If desired, it is possible to apply custom colors per panel, that is, a metric in the REQUESTS panel can be of color A, while the same metric in the BROWSERS panel can be of color B. .I Available color definitions: COLOR_MTRC_HITS COLOR_MTRC_VISITORS COLOR_MTRC_DATA COLOR_MTRC_BW COLOR_MTRC_AVGTS COLOR_MTRC_CUMTS COLOR_MTRC_MAXTS COLOR_MTRC_PROT COLOR_MTRC_MTHD COLOR_MTRC_PERC COLOR_MTRC_PERC_MAX COLOR_PANEL_COLS COLOR_BARS COLOR_ERROR COLOR_SELECTED COLOR_PANEL_ACTIVE COLOR_PANEL_HEADER COLOR_PANEL_DESC COLOR_OVERALL_LBLS COLOR_OVERALL_VALS COLOR_OVERALL_PATH COLOR_ACTIVE_LABEL COLOR_BG COLOR_DEFAULT COLOR_PROGRESS See configuration file for a sample color scheme. .TP \fB\-\-no-column-names Don't write column names in the terminal output. By default, it displays column names for each available metric in every panel. .TP \fB\-\-html-report-title= Set HTML report page title and header. .TP \fB\-\-debug-file=<debugfile> Send all debug messages to the specified file. Needs to be configured with --enable-debug .TP \fB\-\-invalid-requests=<filename> Log invalid requests to the specified file. .TP \fB\-\-no-global-config Do not load the global configuration file. This directory should normally be /usr/local/etc, unless specified with .I --sysconfdir=/dir. .TP \fB\-\-real-os Display real OS names. e.g, Windows XP, Snow Leopard. .TP \fB\-\-sort-panel=<PANEL,FIELD,ORDER> Sort panel on initial load. Sort options are separated by comma. Options are in the form: PANEL,METRIC,ORDER .I Available metrics: BY_HITS BY_VISITORS BY_DATA BY_BW BY_USEC BY_PROT BY_MTHD .I Available orders: ASC DESC .TP \fB\-\-static-file=<extension> Add static file extension. e.g.: .I .mp3 Extensions are case sensitive. .TP \fB\-\-all-static-files Include static files that contain a query string. .TP \fB\-\-double-decode Decode double-encoded values. This includes, user-agent, request, and referer. .TP \fB\-\-ignore-crawlers Ignore crawlers from being counted. .TP \fB\-\-ignore-panel=PANEL Ignore parsing and displaying the given panel. .I Available panels: VISITORS, REQUESTS, REQUESTS_STATIC, NOT_FOUND, HOSTS, OS, BROWSERS, VISIT_TIMES, REFERRERS, REFERRING_SITES, KEYPHRASES, GEO_LOCATION, STATUS_CODES, .TP \fB\-\-ignore-referer=<referer> Ignore referers from being counted. Wildcards allowed. e.g., .I *.domain.com .I ww?.domain.* .TP \fB\-\-444-as-404 Treat non-standard status code 444 as 404. .TP \fB\-\-4xx-to-unique-count Add 4xx client errors to the unique visitors count. .TP \fB\-\-no-progress Disable progress metrics [total requests/requests per second]. .TP \fB\-\-geoip-database=<geofile> Specify path to GeoIP database file. i.e., GeoLiteCity.dat. File needs to be downloaded from maxmind.com. IPv4 and IPv6 files are supported as well. .I Note: `--geoip-city-data` is an alias of `--geoip-database`. .TP \fB\-\-keep-db-files Persist parsed data into disk. This should be set to the first dataset prior to use `load-from-disk`. Setting it to false will delete all database files when exiting the program. Only if configured with --enable-tcb=btree .TP \fB\-\-load-from-disk Load previously stored data from disk. Database files need to exist. See .I keep-db-files. Only if configured with --enable-tcb=btree .TP \fB\-\-db-path=<dir> Path where the on-disk database files are stored. The default value is the .I /tmp directory. Only if configured with --enable-tcb=btree .TP \fB\-\-xmmap=<num> Set the size in bytes of the extra mapped memory. The default value is 0. Only if configured with --enable-tcb=btree .TP \fB\-\-cache-lcnum=<num> Specifies the maximum number of leaf nodes to be cached. If it is not more than 0, the default value is specified. The default value is 1024. Setting a larger value will increase speed performance, however, memory consumption will increase. Lower value will decrease memory consumption. Only if configured with --enable-tcb=btree .TP \fB\-\-cache-ncnum=<num> Specifies the maximum number of non-leaf nodes to be cached. If it is not more than 0, the default value is specified. The default value is 512. Only if configured with --enable-tcb=btree .TP \fB\-\-tune-lmemb=<num> Specifies the number of members in each leaf page. If it is not more than 0, the default value is specified. The default value is 128. Only if configured with --enable-tcb=btree .TP \fB\-\-tune-nmemb=<num> Specifies the number of members in each non-leaf page. If it is not more than 0, the default value is specified. The default value is 256. Only if configured with --enable-tcb=btree .TP \fB\-\-tune-bnum=<num> Specifies the number of elements of the bucket array. If it is not more than 0, the default value is specified. The default value is 32749. Suggested size of the bucket array is about from 1 to 4 times of the number of all pages to be stored. Only if configured with --enable-tcb=btree .TP \fB\-\-compression=<zlib|bz2> Specifies that each page is compressed with ZLIB|BZ2 encoding. Only if configured with --enable-tcb=btree .TP Processing Logs Incrementally GoAccess has the ability to process logs incrementally through the on-disk B+Tree database. It works in the following way: A data set must be persisted first with --keep-db-files, then the same data set can be loaded with --load-from-disk. If new data is passed (piped or through a log file), it will append it to the original data set. To preserve the data at all times, --keep-db-files must be used. If --load-from-disk is used without --keep-db-files, database files will be deleted upon closing the program. .SH CUSTOM LOG/DATE FORMAT GoAccess can parse virtually any web log format. .P Predefined options include, Common Log Format (CLF), Combined Log Format (XLF/ELF), including virtual host, Amazon CloudFront (Download Distribution), Google Cloud Storage and W3C format (IIS). .P GoAccess allows any custom format string as well. .P There are two ways to configure the log format. The easiest is to run GoAccess with .I -c to prompt a configuration window. Otherwise, it can be configured under ~/.goaccessrc or the %sysconfdir%. .IP "time_format" The .I time_format variable followed by a space, specifies the log format time containing any combination of regular characters and special format specifiers. They all begin with a percentage (%) sign. See `man strftime`. .I %T or %H:%M:%S. .IP .I Note: If a timestamp is given in microseconds, .I %f must be used as .I time_format .IP "date_format" The .I date_format variable followed by a space, specifies the log format date containing any combination of regular characters and special format specifiers. They all begin with a percentage (%) sign. See `man strftime`. e.g., .I %Y-%m-%d. .IP .I Note: If a timestamp is given in microseconds, .I %f must be used as .I date_format .IP "log_format" The .I log_format variable followed by a space or .I \\\\t , specifies the log format string. .IP %x A date and time field matching the .I time_format and .I date_format variables. This is used when a timestamp is given instead of the date and time being in two separated variables. .IP %t time field matching the .I time_format variable. .IP %d date field matching the .I date_format variable. .IP %h host (the client IP address, either IPv4 or IPv6) .IP %r The request line from the client. This requires specific delimiters around the request (as single quotes, double quotes, or anything else) to be parsable. If not, we have to use a combination of special format specifiers as %m %U %H. .IP %q The query string. .IP %m The request method. .IP %U The URL path requested. .I Note: If the query string is in %U, there is no need to use .I %q. However, if the URL path, does not include any query string, you may use .I %q and the query string will be appended to the request. .IP %H The request protocol. .IP %s The status code that the server sends back to the client. .IP %b The size of the object returned to the client. .IP %R The "Referrer" HTTP request header. .IP %u The user-agent HTTP request header. .IP %D The time taken to serve the request, in microseconds as a decimal number. .IP %T The time taken to serve the request, in seconds with milliseconds resolution. .IP %L The time taken to serve the request, in milliseconds as a decimal number. .IP .I Note: If multiple time served specifiers are used at the same time, the first option specified in the format string will take priority over the other specifiers. .IP %^ Ignore this field. .IP %~ Move forward through the log string until a non-space (!isspace) char is found. .P GoAccess .I requires the following fields: .IP .I %h a valid IPv4/6 .IP .I %d a valid date .IP .I %r the request .SH INTERACTIVE MENU .IP "F1 or h" Main help. .IP "F5" Redraw main window. .IP "q" Quit the program, current window or collapse active module .IP "o or ENTER" Expand selected module or open window .IP "0-9 and Shift + 0" Set selected module to active .IP "j" Scroll down within expanded module .IP "k" Scroll up within expanded module .IP "c" Set or change scheme color. .IP "TAB" Forward iteration of modules. Starts from current active module. .IP "SHIFT + TAB" Backward iteration of modules. Starts from current active module. .IP "^f" Scroll forward one screen within an active module. .IP "^b" Scroll backward one screen within an active module. .IP "s" Sort options for active module .IP "/" Search across all modules (regex allowed) .IP "n" Find the position of the next occurrence across all modules. .IP "g" Move to the first item or top of screen. .IP "G" Move to the last item or bottom of screen. .SH EXAMPLES The simplest and fastest usage would be: .IP # goaccess -f access.log .P That will generate an interactive text-only output. .P To generate full statistics we can run GoAccess as: .IP # goaccess -f access.log -a .P To generate an HTML report: .IP # goaccess -f access.log -a > report.html .P To generate a JSON file: .IP # goaccess -f access.log -a -d -o json > report.json .P To generate a CSV file: .IP # goaccess -f access.log -o csv > report.csv .P The .I -a flag indicates that we want to process an agent-list for every host parsed. .P The .I -d flag indicates that we want to enable the IP resolver on the HTML | JSON output. (It will take longer time to output since it has to resolve all queries.) .P The .I -c flag will prompt the date and log format configuration window. Only when curses is initialized. .P Filtering can be done through the use of pipes. For instance, using grep to filter specific data and then pipe the output into GoAccess. This adds a great amount of flexibility to what GoAccess can display. For example: .P If we would like to process all .I access.log.*.gz we can do: .IP # zcat access.log.*.gz | goaccess .P OR .IP # zcat -f access.log* | goaccess .P (On Mac OS X, use `gunzip -c` instead of `zcat`). .P Another useful pipe would be filtering dates out of the web log .P The following will get all HTTP requests starting on 05/Dec/2010 until the end of the file. .IP # sed -n '/05\\/Dec\\/2010/,$ p' access.log | goaccess -a .P If we want to parse only a certain time-frame from DATE a to DATE b, we can do: .IP sed -n '/5\\/Nov\\/2010/,/5\\/Dec\\/2010/ p' access.log | goaccess -a .P .I Note that this could take longer time to parse depending on the speed of sed. .P To exclude a list of virtual hosts you can do the following: .IP grep -v "`cat exclude_vhost_list_file`" vhost_access.log | goaccess .P .B Also, it is worth pointing out that if we want to run GoAccess at lower priority, we can run it as: .IP # nice -n 19 goaccess -f access.log -a .P and if you don't want to install it on your server, you can still run it from your local machine: .IP # ssh root@server 'cat /var/log/apache2/access.log' | goaccess -a .P .SH NOTES For now, each active window has a total of 366 items. Eventually this will be customizable. These 366 items are all available by default in the CSV and JSON exports, and as an expandable panel in the HTML report (upper-right corner). .P Piping a log to GoAccess will disable the real-time functionality. This is due to the portability issue on determining the actual size of STDIN. However, a future release *might* include this feature. .SH BUGS If you think you have found a bug, please send me an email to .I goaccess@prosoftcorp.com or use the issue tracker in https://github.com/allinurl/goaccess/issues .SH AUTHOR Gerardo Orellana <goaccess@prosoftcorp.com> For more details about it, or new releases, please visit http://goaccess.io ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/INSTALL������������������������������������������������������������������������������0000644�0000000�0000000�00000036600�12572061142�011240� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `<wchar.h>' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. ��������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/config.guess�������������������������������������������������������������������������0000755�0000000�0000000�00000127432�12572061142�012533� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to <config-patches@gnu.org> and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include <sys/systemcfg.h> main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include <stdlib.h> #include <unistd.h> int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include <unistd.h> int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` echo ${UNAME_MACHINE}-pc-isc$UNAME_REL elif /bin/uname -X 2>/dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c <<EOF #ifdef _SEQUENT_ # include <sys/types.h> # include <sys/utsname.h> #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include <sys/param.h> printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include <sys/param.h> # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 <<EOF $0: unable to guess system type This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD and http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run ($0) is already up to date, please send the following data and any information you think might be pertinent to <config-patches@gnu.org> in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������goaccess-0.9.4/aclocal.m4���������������������������������������������������������������������������0000644�0000000�0000000�00000121563�12573361507�012063� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar <conftest.tar]) grep GrepMe conftest.dir/file >/dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������