]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Committed email and variable changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 26 Oct 1999 22:39:49 +0000 (22:39 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 26 Oct 1999 22:39:49 +0000 (22:39 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@757 7a7537e8-13f0-0310-91df-b6672ffda945

cgi-bin/cgi.h
cgi-bin/var.c

index efe384258c9b277b6b320258076318c9feb3f70b..cd9b5ef875fc3366c33d6173f5e527d823432649 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cgi.h,v 1.6 1999/09/28 19:05:14 mike Exp $"
+ * "$Id: cgi.h,v 1.7 1999/10/26 22:39:48 mike Exp $"
  *
  *   CGI support library definitions.
  *
@@ -37,6 +37,7 @@ extern void           cgiAbort(const char *title, const char *stylesheet,
 extern int             cgiCheckVariables(const char *names);
 extern const char      *cgiGetArray(const char *name, int element);
 extern int             cgiGetSize(const char *name);
+extern void            cgiSetSize(const char *name, int size);
 extern const char      *cgiGetVariable(const char *name);
 extern void            cgiSetArray(const char *name, int element,
                                    const char *value);
@@ -64,5 +65,5 @@ extern void           cgiEMailClose(FILE *mail);
 #endif /* !_CGI_H_ */
 
 /*
- * End of "$Id: cgi.h,v 1.6 1999/09/28 19:05:14 mike Exp $".
+ * End of "$Id: cgi.h,v 1.7 1999/10/26 22:39:48 mike Exp $".
  */
index 6948fa6567758098bd38137871889e0fa8a67979..506e17a7c3ed20c124bedfdec8dc92a8767b2f12 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: var.c,v 1.11 1999/09/28 19:05:16 mike Exp $"
+ * "$Id: var.c,v 1.12 1999/10/26 22:39:49 mike Exp $"
  *
  *   CGI form variable and array functions.
  *
@@ -271,6 +271,46 @@ cgiSetArray(const char *name,      /* I - Name of variable */
 }
 
 
+/*
+ * 'cgiSetSize()' - Set the array size.
+ */
+
+void
+cgiSetSize(const char *name,   /* I - Name of variable */
+           int        size)    /* I - Number of elements (0 to N) */
+{
+  int  i;      /* Looping var */
+  var_t        *var;   /* Returned variable */
+
+
+  if (name == NULL || size < 0)
+    return;
+
+  if ((var = cgi_find_variable(name)) == NULL)
+    return;
+
+  if (size >= var->avalues)
+  {
+    var->avalues = size + 16;
+    var->values  = realloc(var->values, sizeof(char *) * var->avalues);
+  }
+
+  if (size > var->nvalues)
+  {
+    for (i = var->nvalues; i < size; i ++)
+      var->values[i] = NULL;
+  }
+  else if (size < var->nvalues)
+  {
+    for (i = size; i < var->nvalues; i ++)
+      if (var->values[i])
+        free(var->values[i]);
+  }
+
+  var->nvalues = size;
+}
+
+
 /*
  * 'cgiSetVariable()' - Set a CGI variable in the database...
  *
@@ -608,5 +648,5 @@ cgi_sort_variables(void)
 
 
 /*
- * End of "$Id: var.c,v 1.11 1999/09/28 19:05:16 mike Exp $".
+ * End of "$Id: var.c,v 1.12 1999/10/26 22:39:49 mike Exp $".
  */