]> granicus.if.org Git - apache/commitdiff
Add ap_set_int_slot() function
authorDoug MacEachern <dougm@apache.org>
Fri, 20 Apr 2001 16:43:39 +0000 (16:43 +0000)
committerDoug MacEachern <dougm@apache.org>
Fri, 20 Apr 2001 16:43:39 +0000 (16:43 +0000)
PR:
Obtained from:
Submitted by: John K. Sterling <sterling@covalent.net>
Reviewed by: dougm

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88902 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/http_config.h
server/config.c
support/httpd.exp

diff --git a/CHANGES b/CHANGES
index ec7454f555cc34919e46032c283b9be01813a36e..ba886eaf9ff1cadc59440eaaa11be89427175a13 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.18-dev
 
+  *) Add ap_set_int_slot() function
+     [John K. Sterling <sterling@covalent.net>]
+
   *) Under certain circumstances, Apache did not supply the
      right response headers when requiring authentication.
      [Gertjan van Wingerde <Gertjan.van.Wingerde@cmg.nl>] PR#7114
index 997a680ce1fcef0eef00278ceed3b8440c2576e1..4b7c5b2de54694a07fe9387169b2c802ed97733a 100644 (file)
@@ -482,6 +482,18 @@ AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
 AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd, void *struct_ptr,
                                                   const char *arg);
 
+/**
+ * Generic command handling function for integers
+ * @param cmd The command parameters for this directive
+ * @param struct_ptr pointer into a given type
+ * @param arg The argument to the directive
+ * @return An error string or NULL on success
+ * @deffunc const char *ap_set_int_slot(cmd_parms *cmd, void *struct_ptr, const char *arg)
+ */
+AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd, 
+                                                void *struct_ptr,
+                                                const char *arg);
+
 /**
  * Return true if the specified method is limited by being listed in
  * a <Limit> container, or by *not* being listed in a <LimiteExcept>
index 8391140f2184a149708d71bc32320ebc0ad1ab3f..52fe13ede125eb96a25a324ac2294ce17ee8526c 100644 (file)
@@ -1061,6 +1061,25 @@ AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd,
     return NULL;
 }
 
+AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
+                                                void *struct_ptr,
+                                                const char *arg)
+{
+    char *endptr;
+    char *error_str = NULL;
+    int offset = (int) (long) cmd->info;
+
+    *(int *) (struct_ptr + offset) = strtol(arg, &endptr, 10);
+
+    if ((*arg == '\0') || (*endptr != '\0')) {
+        error_str = apr_psprintf(cmd->pool, 
+                     "Invalid value for directive %s, expected integer",
+                     cmd->directive->directive);
+    }
+
+    return error_str;
+}
+
 AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
                                                         void *struct_ptr,
                                                         const char *arg_)
index 1bc4b8ae489982a887292b1d33199336a8d61366..49fa9c7a41d9b2f5b204cbea09818bad7b0342fb 100644 (file)
@@ -319,6 +319,7 @@ ap_set_content_length
 ap_set_etag
 ap_set_file_slot
 ap_set_flag_slot
+ap_set_int_slot
 ap_set_keepalive
 ap_set_last_modified
 ap_set_listenbacklog