Diff for /embedaddon/sudo/common/atobool.c between versions 1.1.1.1 and 1.1.1.4

version 1.1.1.1, 2012/02/21 16:23:02 version 1.1.1.4, 2014/06/15 16:12:54
Line 1 Line 1
 /*  /*
 * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 2010-2014 Todd C. Miller <Todd.Miller@courtesan.com>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 17 Line 17
 #include <config.h>  #include <config.h>
   
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/param.h>  
   
 #include <stdio.h>  #include <stdio.h>
 #ifdef STDC_HEADERS  #ifdef STDC_HEADERS
Line 39 Line 38
 #endif /* HAVE_STRINGS_H */  #endif /* HAVE_STRINGS_H */
   
 #include "missing.h"  #include "missing.h"
   #include "sudo_debug.h"
   #include "sudo_util.h"
   
 int  int
 atobool(const char *str)  atobool(const char *str)
 {  {
       debug_decl(atobool, SUDO_DEBUG_UTIL)
   
     switch (*str) {      switch (*str) {
         case '0':          case '0':
         case '1':          case '1':
             if (str[1] == '\0')              if (str[1] == '\0')
                return *str - '0';                debug_return_int(*str - '0');
             break;              break;
         case 'y':          case 'y':
         case 'Y':          case 'Y':
             if (strcasecmp(str, "yes") == 0)              if (strcasecmp(str, "yes") == 0)
                return 1;                debug_return_int(1);
             break;              break;
         case 't':          case 't':
         case 'T':          case 'T':
             if (strcasecmp(str, "true") == 0)              if (strcasecmp(str, "true") == 0)
                return 1;                debug_return_int(1);
             break;              break;
         case 'o':          case 'o':
         case 'O':          case 'O':
             if (strcasecmp(str, "on") == 0)              if (strcasecmp(str, "on") == 0)
                return 1;                debug_return_int(1);
             if (strcasecmp(str, "off") == 0)              if (strcasecmp(str, "off") == 0)
                return 0;                debug_return_int(0);
             break;              break;
         case 'n':          case 'n':
         case 'N':          case 'N':
             if (strcasecmp(str, "no") == 0)              if (strcasecmp(str, "no") == 0)
                return 0;                debug_return_int(0);
             break;              break;
         case 'f':          case 'f':
         case 'F':          case 'F':
             if (strcasecmp(str, "false") == 0)              if (strcasecmp(str, "false") == 0)
                return 0;                debug_return_int(0);
             break;              break;
     }      }
    return -1;    debug_return_int(-1);
 }  }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>