FreeCalypso > hg > ueda-linux
diff ueda/libunet/unetrd.c @ 28:33e4c4cdf493
libunet: reading of ATTR lines implemented
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 08 Aug 2015 21:17:57 +0000 |
parents | dda8e455c863 |
children |
line wrap: on
line diff
--- a/ueda/libunet/unetrd.c Thu Aug 06 20:40:19 2015 +0000 +++ b/ueda/libunet/unetrd.c Sat Aug 08 21:17:57 2015 +0000 @@ -144,6 +144,29 @@ } } +static void +handle_attr(state, out, rest) + struct unetrd_state *state; + struct unetrd_out *out; + char *rest; +{ + char *cp; + + for (cp = rest; isspace(*cp); cp++) + ; + if (*cp == '\0' || *cp == '#') { +error: fprintf(stderr, "%s line %d: invalid syntax on ATTR line\n", + state->filename, state->lineno); + exit(1); + } + out->objname = cp; + cp = index(cp, '='); + if (!cp) + goto error; + *cp++ = '\0'; + out->attr_value = cp; +} + static struct objmap { char *keyword; int typecode; @@ -157,6 +180,7 @@ {"ALTNAME", UNETOBJ_ALTNAME, handle_name_only}, {"PIN", UNETOBJ_PIN, handle_pin_line}, {"PINMAP", UNETOBJ_PINMAP, handle_pin_line}, + {"ATTR", UNETOBJ_ATTR, handle_attr}, {0, 0, 0} };