| 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 |
#include "nfotiser.h" |
| 13 |
|
| 14 |
static int category_cmp(const void *, const void *); |
| 15 |
|
| 16 |
const struct categories categories[] = { |
| 17 |
/* this list MUST be sorted all the time */ |
| 18 |
{ "base", "Base system" }, |
| 19 |
{ "comms", "Serial communications & terminal emulation" }, |
| 20 |
{ "crypto", "Crypto" }, |
| 21 |
{ "fsutils", "FileSystem related" }, |
| 22 |
{ "ipv6", "IPv6" }, |
| 23 |
{ "libs", "Libraries" }, |
| 24 |
{ "misc", "Applications" }, |
| 25 |
{ "multimedia", "Multimedia" }, |
| 26 |
{ "net", "Networking" }, |
| 27 |
{ "netbt", "Bluetooth" }, |
| 28 |
{ "shells", "Shells" }, |
| 29 |
{ "sysutils", "Utilities" }, |
| 30 |
{ "voip", "Telephony" }, |
| 31 |
{ NULL, NULL } |
| 32 |
}; |
| 33 |
|
| 34 |
const char * |
| 35 |
category(const char *name) |
| 36 |
{ |
| 37 |
return (name == NULL ? NULL : ((struct categories *)bsearch(name, |
| 38 |
categories, (sizeof (categories) / sizeof (categories[0])), |
| 39 |
sizeof (struct categories), category_cmp))->catdesc); |
| 40 |
} |
| 41 |
|
| 42 |
static int |
| 43 |
category_cmp(const void *key, const void *item) |
| 44 |
{ |
| 45 |
return (strcmp((const char *)key, |
| 46 |
((const struct categories *)item)->catname)); |
| 47 |
} |