aboutsummaryrefslogtreecommitdiff
path: root/src/pies.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pies.c')
-rw-r--r--src/pies.c63
1 files changed, 35 insertions, 28 deletions
diff --git a/src/pies.c b/src/pies.c
index c583d7b..20ad9e2 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -772,22 +772,26 @@ _cb_url (enum grecs_callback_command cmd,
return 0;
}
+static struct tokendef socktype_xtab[] = {
+ { "stream", SOCK_STREAM },
+ { "dgram", SOCK_DGRAM },
+ { "seqpacket", SOCK_SEQPACKET },
+ { "raw", SOCK_RAW },
+ { "rdm", SOCK_RDM },
+ { "packet", SOCK_PACKET },
+ { NULL }
+};
+
int
-str_to_socket_type (const char *str, int *pret)
+str_to_socket_type (const char *str, int *pres)
{
- if (strcmp (str, "stream") == 0)
- *pret = SOCK_STREAM;
- else if (strcmp (str, "dgram") == 0)
- *pret = SOCK_DGRAM;
- else if (strcmp (str, "rdm") == 0)
- *pret = SOCK_RDM;
- else if (strcmp (str, "seqpacket") == 0)
- *pret = SOCK_SEQPACKET;
- else if (strcmp (str, "raw") == 0)
- *pret = SOCK_RAW;
- else
- return 1;
- return 0;
+ return strtotok (socktype_xtab, str, pres);
+}
+
+int
+socket_type_to_str (int socket_type, const char **pres)
+{
+ return toktostr (socktype_xtab, socket_type, pres);
}
static int
@@ -854,6 +858,18 @@ str_to_cf (const char *string, int *flags)
size_t len = strlen (string);
int neg = 0;
int mask;
+
+ static struct tokendef cf_tab[] = {
+ { "disable", CF_DISABLED },
+ { "precious", CF_PRECIOUS },
+ { "wait", CF_WAIT },
+ { "tcpmux", CF_TCPMUX },
+ { "tcpmuxplus", CF_TCPMUXPLUS },
+ { "internal", CF_INTERNAL },
+ { "sockenv", CF_SOCKENV },
+ { "resolve", CF_RESOLVE },
+ { NULL }
+ };
if (len > 2 && memcmp (string, "no", 2) == 0)
{
@@ -861,19 +877,7 @@ str_to_cf (const char *string, int *flags)
string += 2;
}
- if (strcmp (string, "disable") == 0)
- mask = CF_DISABLED;
- else if (strcmp (string, "precious") == 0)
- mask = CF_PRECIOUS;
- else if (strcmp (string, "wait") == 0)
- mask = CF_WAIT;
- else if (strcmp (string, "tcpmux") == 0)
- mask = CF_TCPMUX;
- else if (strcmp (string, "tcpmuxplus") == 0)
- mask = CF_TCPMUXPLUS;
- else if (strcmp (string, "internal") == 0)
- mask = CF_INTERNAL;
- else
+ if (strtotok (cf_tab, string, &mask))
return 1;
if (neg)
@@ -2215,6 +2219,9 @@ main (int argc, char **argv)
else
instance++;
}
+ else
+ log_tag = instance;
+
set_file_names (instance);
if (!DEFAULT_PREPROCESSOR)
@@ -2224,7 +2231,7 @@ main (int argc, char **argv)
grecs_preprocessor = obstack_finish (&pp_stk);
free (pp_qopt);
}
-
+
if (preprocess_only)
{
for (file = conf_head; file; file = file->next)

Return to:

Send suggestions and report system problems to the System administrator.