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

SCM Repository

ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3439 by tg, Wed Jul 18 13:23:19 2007 UTC revision 3440 by tg, Wed Aug 8 12:23:25 2007 UTC
# Line 7  Line 7 
7   */   */
8    
9  #include <stdlib.h>  #include <stdlib.h>
10    #include <string.h>
11    
12  struct categories {  static int category_cmp(const void *, const void *);
13    
14    const struct categories {
15          const char *catname;          const char *catname;
16          const char *catdesc;          const char *catdesc;
17  } categories[] = {  } categories[] = {
18            /* this list MUST be sorted all the time */
19          { "base",       "Base system" },          { "base",       "Base system" },
20          { "shells",     "Shells" },          { "comms",      "Serial communications & terminal emulation" },
         { "misc",       "Applications" },  
         { "net",        "Networking" },  
21          { "crypto",     "Crypto" },          { "crypto",     "Crypto" },
22            { "fsutils",    "FileSystem related" },
23          { "ipv6",       "IPv6" },          { "ipv6",       "IPv6" },
24          { "libs",       "Libraries" },          { "libs",       "Libraries" },
25            { "misc",       "Applications" },
26          { "multimedia", "Multimedia" },          { "multimedia", "Multimedia" },
27          { "comms",      "Serial communications & terminal emulation" },          { "net",        "Networking" },
         { "voip",       "Telephony" },  
         { "sysutils",   "Utilities" },  
         { "fsutils",    "FileSystem related" },  
28          { "netbt",      "Bluetooth" },          { "netbt",      "Bluetooth" },
29            { "shells",     "Shells" },
30            { "sysutils",   "Utilities" },
31            { "voip",       "Telephony" },
32          { NULL,         NULL }          { 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    }

Legend:
Removed from v.3439  
changed lines
  Added in v.3440

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