Index: trunk/src/obj_common.c =================================================================== --- trunk/src/obj_common.c (revision 10903) +++ trunk/src/obj_common.c (revision 10904) @@ -154,3 +154,17 @@ if (strcmp(name, "term") == 0) obj->term = value; } + +const char *pcb_obj_id_invalid(const char *id) +{ + const char *s; + for(s = id; *s != '\0'; s++) { + if (isalnum(*s)) + continue; + switch(*s) { + case '_': case '.': case '$': case ':': continue; + } + return s; + } + return NULL; +} Index: trunk/src/obj_common.h =================================================================== --- trunk/src/obj_common.h (revision 10903) +++ trunk/src/obj_common.h (revision 10904) @@ -161,6 +161,9 @@ /* Update cached attributes (->term) */ void pcb_obj_attrib_post_change(pcb_attribute_list_t *list, const char *name, const char *value); +/* Returns the first invalid character of an ID (terminal, refdes) or NULL */ +const char *pcb_obj_id_invalid(const char *id); + /* compare two fields and return 0 if they are equal */ #define pcb_field_neq(s1, s2, f) ((s1)->f != (s2)->f)