]> git.puffer.fish Git - matthieu/frr.git/commitdiff
2004-10-31 Paul Jakma <paul@dishone.st>
authorpaul <paul>
Sun, 31 Oct 2004 16:15:33 +0000 (16:15 +0000)
committerpaul <paul>
Sun, 31 Oct 2004 16:15:33 +0000 (16:15 +0000)
* keychain.c: Convert some more strtoul users to VTY_GET_INTEGER.

lib/ChangeLog
lib/keychain.c

index 292f850066ba166ecb72c733cfb9b34fc6736633..4d64e2129a9ba1addc32a96a6124a444d2950518 100644 (file)
@@ -3,6 +3,7 @@
        * vty.c: As per Andrew's suggestions..
          (vty_serv_un) remove flags.
          (vtysh_accept) close socket if we cant set NONBLOCK. Add flags.
+       * keychain.c: Convert some more strtoul users to VTY_GET_INTEGER.
 
 2004-10-29 Paul Jakma <paul@dishone.st>
 
index 1d3816778fb2ef9d76e450b162bd833f8b0ca642..a3219ef410ec524a093846e76111871ff341f60c 100644 (file)
@@ -278,16 +278,10 @@ DEFUN (key,
   struct keychain *keychain;
   struct key *key;
   u_int32_t index;
-  char *endptr = NULL;
 
   keychain = vty->index;
 
-  index = strtoul (argv[0], &endptr, 10);
-  if (index == ULONG_MAX || *endptr != '\0')
-    {
-      vty_out (vty, "Key identifier number error%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
+  VTY_GET_INTEGER ("key identifier", index, argv[0]);
   key = key_get (keychain, index);
   vty->index_sub = key;
   vty->node = KEYCHAIN_KEY_NODE;
@@ -305,17 +299,10 @@ DEFUN (no_key,
   struct keychain *keychain;
   struct key *key;
   u_int32_t index;
-  char *endptr = NULL;
   
   keychain = vty->index;
 
-  index = strtoul (argv[0], &endptr, 10);
-  if (index == ULONG_MAX || *endptr != '\0')
-    {
-      vty_out (vty, "Key identifier number error%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
+  VTY_GET_INTEGER ("key identifier", index, argv[0]);
   key = key_lookup (keychain, index);
   if (! key)
     {
@@ -462,7 +449,7 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
   tm.tm_year = year - 1900;
     
   time = mktime (&tm);
-
+  
   return time;
 }
 
@@ -475,7 +462,7 @@ key_lifetime_set (struct vty *vty, struct key_range *krange,
 {
   time_t time_start;
   time_t time_end;
-    
+  
   time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str);
   if (time_start < 0)
     {
@@ -510,7 +497,6 @@ key_lifetime_duration_set (struct vty *vty, struct key_range *krange,
 {
   time_t time_start;
   u_int32_t duration;
-  char *endptr = NULL;
     
   time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str);
   if (time_start < 0)
@@ -520,12 +506,7 @@ key_lifetime_duration_set (struct vty *vty, struct key_range *krange,
     }
   krange->start = time_start;
 
-  duration = strtoul (duration_str, &endptr, 10);
-  if (duration == ULONG_MAX || *endptr != '\0')
-    {
-      vty_out (vty, "Malformed duration%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
+  VTY_GET_INTEGER ("duration", duration, duration_str);
   krange->duration = 1;
   krange->end = time_start + duration;