/*====================================================================*
*
* const char * reword (code_t code, const struct _code_ list [], size_t size);
*
* symbol.h
*
* search a _code_ list by code and return the associated name; return the
* corresponding name on success or NULL on failure;
*
*. Atheros Powerline Toolkit for HomePlug AV;
*: Published 2006-2009 by Intellon Corp. ALL RIGHTS RESERVED;
*; For demonstration; Not for production use;
*
* Contributor(s):
* Nathan Houghton <nathaniel.houghton@atheros.com>
*
*--------------------------------------------------------------------*/
#ifndef REWORD_SOURCE
#define REWORD_SOURCE
#include <unistd.h>
#include <string.h>
#include "../tools/symbol.h"
const char * reword (code_t code, const struct _code_ list [], size_t size)
{
const struct _code_ * item = list;
while ((unsigned)(item - list) < size)
{
if (item->code == code)
{
return (item->name);
}
item++;
}
return (NULL);
}
#endif