English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Contents of /branches/common-nfo/tools/nfotiser/categories.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3440 - (show annotations) (download)
Wed Aug 8 12:23:25 2007 UTC (6 years, 6 months ago) by tg
File MIME type: text/plain
File size: 1244 byte(s)
support querying the category database
bsearch idea/syntax taken from MirBSD libc's I18N routines

1 /*-
2 * $FreeWRT$
3 *-
4 * This file is part of the FreeWRT project. FreeWRT is copyrighted
5 * material, please see the LICENCE file in the top-level directory
6 * or at http://www.freewrt.org/licence for details.
7 */
8
9 #include <stdlib.h>
10 #include <string.h>
11
12 static int category_cmp(const void *, const void *);
13
14 const struct categories {
15 const char *catname;
16 const char *catdesc;
17 } categories[] = {
18 /* this list MUST be sorted all the time */
19 { "base", "Base system" },
20 { "comms", "Serial communications & terminal emulation" },
21 { "crypto", "Crypto" },
22 { "fsutils", "FileSystem related" },
23 { "ipv6", "IPv6" },
24 { "libs", "Libraries" },
25 { "misc", "Applications" },
26 { "multimedia", "Multimedia" },
27 { "net", "Networking" },
28 { "netbt", "Bluetooth" },
29 { "shells", "Shells" },
30 { "sysutils", "Utilities" },
31 { "voip", "Telephony" },
32 { NULL, NULL }
33 };
34
35 const char *
36 category(const char *name)
37 {
38 return (name == NULL ? NULL : ((struct categories *)bsearch(name,
39 categories, (sizeof (categories) / sizeof (categories[0])),
40 sizeof (struct categories), category_cmp))->catdesc);
41 }
42
43 static int
44 category_cmp(const void *key, const void *item)
45 {
46 return (strcmp((const char *)key,
47 ((const struct categories *)item)->catname));
48 }

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20