LTP GCOV extension - code coverage report
Current view: directory - and-httpd/src - opt.c
Test: And-httpd coverage
Date: 2006-09-11 Instrumented lines: 25
Code covered: 72.0 % Executed lines: 18

       1                 : #include "opt.h"
       2                 : 
       3                 : int opt_toggle(int val, const char *opt)
       4              38 : {
       5              38 :   if (!opt)
       6               0 :   { val = !val; }
       7              38 :   else if (!strcasecmp("on", optarg))    val = 1;
       8              38 :   else if (!strcasecmp("true", optarg))  val = 1;
       9              18 :   else if (!strcasecmp("yes", optarg))   val = 1;
      10              18 :   else if (!strcmp("1", optarg))         val = 1;
      11              18 :   else if (!strcasecmp("false", optarg)) val = 0;
      12               0 :   else if (!strcasecmp("off", optarg))   val = 0;
      13               0 :   else if (!strcasecmp("no", optarg))    val = 0;
      14               0 :   else if (!strcmp("0", optarg))         val = 0;
      15                 :   else
      16               0 :   { val = !val; } /* error ? */
      17                 : 
      18              38 :   return (val);
      19                 : }
      20                 : 
      21                 : /* get program name ... but ignore "lt-" libtool prefix */
      22                 : const char *opt_program_name(const char *argv0, const char *def)
      23             296 : {
      24             296 :   if (argv0)
      25                 :   {
      26             296 :     if ((def = strrchr(argv0, '/')))
      27             296 :       ++def;
      28                 :     else
      29               0 :       def = argv0;
      30                 : 
      31                 :     /* hack for libtool */
      32             296 :     if ((strlen(def) > strlen("lt-")) && !memcmp("lt-", def, strlen("lt-")))
      33               0 :       def += 3;
      34                 :   }
      35                 :   
      36             296 :   return (def);
      37                 : }
      38                 : 
      39                 : const char *opt_def_toggle(int val)
      40              64 : {
      41              64 :   if (val)
      42              36 :     return (" (default: on)");
      43                 :   else
      44              28 :     return (" (default: off)");
      45                 : }
      46                 : 
      47                 : 

Generated by: LTP GCOV extension version 1.4