Index: animator/hid_anim.c =================================================================== --- animator/hid_anim.c (revision 4737) +++ animator/hid_anim.c (revision 4738) @@ -48,6 +48,7 @@ typedef struct { unsigned in_use:1; + char cap; char color[16]; } gc_t; @@ -88,6 +89,14 @@ } } +#define get_gc(idx, idx_str) \ +do { \ + char *__end__; \ + idx = strtol(gs, &__end__, 10); \ + if ((*__end__ != '\0') || (idx < 0) || (idx >= NUM_GC) || !gc[idx].in_use) \ + return; \ +} while(0) + static void cmd_clr(proto_node_t *args) { int idx; @@ -96,14 +105,25 @@ if ((cs == NULL) || (gs == NULL)) return; - idx = atoi(gs); - if ((idx < 0) || (idx >= NUM_GC) || !gc[idx].in_use) - return; + get_gc(idx, gs); if ((strlen(cs) > 7) || (*cs != '#')) return; strcpy(gc[idx].color, cs); } +static void cmd_cap(proto_node_t *args) +{ + int idx; + proto_node_t *ch1 = child1(args); + char *gs = str(ch1), *cs = str(next(ch1)); + + if ((cs == NULL) || (gs == NULL)) + return; + get_gc(idx, gs); + if ((*cs == 'r') || (*cs == 'b') || (*cs == 's')) + gc[idx].cap = *cs; +} + static void read_netin(void) { P_size_t len, n; @@ -125,6 +145,7 @@ case cmds_makeGC: cmd_makeGC(pctx.targ); break; case cmds_delGC: cmd_delGC(pctx.targ); break; case cmds_clr: cmd_clr(pctx.targ); break; + case cmds_cap: cmd_cap(pctx.targ); break; /* ignore */ case cmds_inval: