summaryrefslogtreecommitdiffstats
path: root/cpukit/httpd/value.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-10-27 12:50:33 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-10-27 12:50:33 +0000
commitc1cdaa0ce8017b075487e6670f89eb4e715258ea (patch)
treed4571a02595d6cf6a24d40d6968d83ece3b7a574 /cpukit/httpd/value.c
parentNew files created by split of old imfs_handlers.c. (diff)
downloadrtems-c1cdaa0ce8017b075487e6670f89eb4e715258ea.tar.bz2
Patch from Emmanuel Raguet <raguet@crf.canon.fr> and Eric Valette
<valette@crf.canon.fr> to add a port of the GoAhead web server (httpd) to the RTEMS build tree. They have successfully used this BSP on i386/pc386 and PowerPC/mcp750. Mark and Joel spoke with Nick Berliner <nickb@goahead.com> on 26 Oct 1999 about this port and got verbal approval to include it in RTEMS distributions.
Diffstat (limited to 'cpukit/httpd/value.c')
-rw-r--r--cpukit/httpd/value.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/cpukit/httpd/value.c b/cpukit/httpd/value.c
new file mode 100644
index 0000000000..5872382556
--- /dev/null
+++ b/cpukit/httpd/value.c
@@ -0,0 +1,74 @@
+/*
+ * value.c -- Generic type (holds all types)
+ *
+ * Copyright (c) Go Ahead Software, Inc., 1995-1999
+ *
+ * See the file "license.txt" for usage and redistribution license requirements
+ */
+
+/******************************** Description *********************************/
+
+/*
+ * This module provides a generic type that can hold all possible types.
+ * It is designed to provide maximum effeciency.
+ */
+
+/********************************* Includes ***********************************/
+
+#include "uemf.h"
+
+/*********************************** Locals ***********************************/
+
+
+/*********************************** Code *************************************/
+/*
+ * Initialize a integer value.
+ */
+
+value_t valueInteger(long value)
+{
+ value_t v = VALUE_VALID;
+
+ v.value.integer = value;
+ return v;
+}
+
+/******************************************************************************/
+/*
+ * Initialize a string value. Note: not allocation
+ */
+
+value_t valueString(char_t *value, int flags)
+{
+ value_t v = VALUE_VALID;
+
+ v.type = string;
+ if (flags & VALUE_ALLOCATE) {
+ v.allocated = 1;
+ v.value.string = gstrdup(B_L, value);
+ } else {
+ v.allocated = 0;
+ v.value.string = value;
+ }
+ return v;
+}
+
+/******************************************************************************/
+/*
+ * Free any storage allocated for a value.
+ */
+
+void valueFree(value_t *v)
+{
+ a_assert(v);
+
+ if (v->valid && v->allocated && v->type == string &&
+ v->value.string != NULL) {
+ bfree(B_L, v->value.string);
+ }
+ v->type = undefined;
+ v->valid = 0;
+ v->allocated = 0;
+}
+
+/******************************************************************************/