1 /* paramvalue() - decode kernel parameter values Author: Kees J. Bot
3 * The kernel returns the results of parameter queries
4 * by the XXQUERYPARAM svrctl calls as an array of hex digits, like this:
5 * "75020000,080C0000". These are the values of two four-byte variables.
6 * Paramvalue() decodes such a string.
12 #include <sys/types.h>
13 #include <minix/queryparam.h>
15 size_t paramvalue(char **value
, void *address
, size_t size
)
16 /* Decode the string *value storing the result in the object at address with
17 * the given size. *value is left at the next parameter, *address is padded
18 * with zeros if needed, and the actual size of the value is returned.
21 unsigned char *addr
= address
;
28 while (*v
!= 0 && *v
!= ',') {
30 if (nibble
> 0x9) nibble
= nibble
+ '0' - 'A' + 0xA;
31 if (nibble
> 0xF) nibble
= nibble
+ 'A' - 'a';
42 while (size
> 0) { *addr
++= 0; size
--; }
43 while (*v
!= 0 && *v
++ != ',') {}
50 * $PchId: paramvalue.c,v 1.3 1996/02/22 09:15:56 philip Exp $