From: Duncan L. <ice...@us...> - 2004-04-15 20:24:43
|
Update of /cvsroot/ipmitool/ipmitool/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13118/lib Modified Files: helper.c Log Message: add str2val() and min() helpers Index: helper.c =================================================================== RCS file: /cvsroot/ipmitool/ipmitool/lib/helper.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** helper.c 3 Mar 2004 21:23:20 -0000 1.4 --- helper.c 15 Apr 2004 20:24:35 -0000 1.5 *************** *** 39,46 **** #include <inttypes.h> #include <signal.h> - #include <ipmitool/helper.h> - #include <string.h> ! uint32_t buf2long(unsigned char * buf) --- 39,44 ---- #include <inttypes.h> #include <signal.h> #include <string.h> ! #include <ipmitool/helper.h> uint32_t buf2long(unsigned char * buf) *************** *** 105,108 **** --- 103,119 ---- } + unsigned short str2val(const char *str, const struct valstr *vs) + { + int i = 0; + + while (vs[i].str) { + if (!strncasecmp(vs[i].str, str, strlen(str))) + return vs[i].val; + i++; + } + + return 0; + } + void signal_handler(int sig, void * handler) { *************** *** 126,128 **** } } - --- 137,138 ---- |