diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-15 18:39:31 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-15 18:39:31 +0000 |
commit | b1ac98abf9e700f03d5aa5f97c06dab605d6da06 (patch) | |
tree | c08a9624b4a539b85c5650bcf09528d13eb2d039 /sbin/isakmpd/constants.c | |
parent | aeca45bc7d867b71e9600c7108674fae5db8ff9c (diff) |
partial move to KNF. More to come. This has happened because there
are a raft of source code auditors who are willing to help improve this
code only if this is done, and hey, isakmpd does need our standard
auditing process. ok ho hshoexer
Diffstat (limited to 'sbin/isakmpd/constants.c')
-rw-r--r-- | sbin/isakmpd/constants.c | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/sbin/isakmpd/constants.c b/sbin/isakmpd/constants.c index 0a2883e1831..ec0d0f4b7bd 100644 --- a/sbin/isakmpd/constants.c +++ b/sbin/isakmpd/constants.c @@ -1,5 +1,5 @@ -/* $OpenBSD: constants.c,v 1.8 2003/06/03 14:28:16 ho Exp $ */ -/* $EOM: constants.c,v 1.7 1999/04/02 00:57:31 niklas Exp $ */ +/* $OpenBSD: constants.c,v 1.9 2004/04/15 18:39:25 deraadt Exp $ */ +/* $EOM: constants.c,v 1.7 1999/04/02 00:57:31 niklas Exp $ */ /* * Copyright (c) 1998, 1999 Niklas Hallqvist. All rights reserved. @@ -37,65 +37,63 @@ #include "constants.h" int -constant_value (struct constant_map *map, char *name) +constant_value(struct constant_map *map, char *name) { - struct constant_map *entry = map; + struct constant_map *entry = map; - for (entry = map; entry->name; entry++) - if (strcasecmp (entry->name, name) == 0) - return entry->value; - return 0; + for (entry = map; entry->name; entry++) + if (strcasecmp(entry->name, name) == 0) + return entry->value; + return 0; } char * -constant_lookup (struct constant_map *map, int value) +constant_lookup(struct constant_map *map, int value) { - struct constant_map *entry = map; + struct constant_map *entry = map; - for (entry = map; entry->name; entry++) - if (entry->value == value) - return entry->name; - return 0; + for (entry = map; entry->name; entry++) + if (entry->value == value) + return entry->name; + return 0; } struct constant_map * -constant_link_lookup (struct constant_map *map, int value) +constant_link_lookup(struct constant_map *map, int value) { - struct constant_map *entry = map; + struct constant_map *entry = map; - for (entry = map; entry->name; entry++) - if (entry->value == value) - return entry->link; - return 0; + for (entry = map; entry->name; entry++) + if (entry->value == value) + return entry->link; + return 0; } char * -constant_name (struct constant_map *map, int value) +constant_name(struct constant_map *map, int value) { - static char tmp[32]; /* XXX Ugly, I know. */ - char *retval = constant_lookup (map, value); + static char tmp[32];/* XXX Ugly, I know. */ + char *retval = constant_lookup(map, value); - if (!retval) - { - snprintf (tmp, sizeof tmp, "<Unknown %d>", value); - return tmp; - } - return retval; + if (!retval) { + snprintf(tmp, sizeof tmp, "<Unknown %d>", value); + return tmp; + } + return retval; } char * -constant_name_maps (struct constant_map **maps, int value) +constant_name_maps(struct constant_map **maps, int value) { - static char tmp[32]; /* XXX Ugly, I know. */ - char *retval; - struct constant_map **map; + static char tmp[32];/* XXX Ugly, I know. */ + char *retval; + struct constant_map **map; - for (map = maps; *map; map++) - { - retval = constant_lookup (*map, value); - if (retval) - return retval; - } - snprintf (tmp, sizeof tmp, "<Unknown %d>", value); - return tmp; + for (map = maps; *map; map++) { + retval = constant_lookup(*map, value); + if (retval) + return retval; + } + snprintf(tmp, sizeof tmp, "<Unknown %d>", value); + return tmp; } |