Index: trunk/src/obj_common.c =================================================================== --- trunk/src/obj_common.c (revision 24456) +++ trunk/src/obj_common.c (revision 24457) @@ -192,6 +192,25 @@ return NULL; } +char *pcb_obj_id_fix(char *id) +{ + char *s; + if (id == NULL) + return NULL; + + for(s = id; *s != '\0'; s++) { + if (isalnum(*s)) + continue; + switch(*s) { + case '_': case '.': case '$': case ':': continue; + default: *s = '_'; + } + } + + return id; +} + + pcb_flag_values_t pcb_obj_valid_flags(unsigned long int objtype) { pcb_flag_values_t res = 0; Index: trunk/src/obj_common.h =================================================================== --- trunk/src/obj_common.h (revision 24456) +++ trunk/src/obj_common.h (revision 24457) @@ -222,6 +222,9 @@ /* Returns the first invalid character of an ID (terminal, refdes) or NULL */ const char *pcb_obj_id_invalid(const char *id); +/* Fix an ID in place (replace anything invalid with '_'); returns id */ +char *pcb_obj_id_fix(char *id); + #define pcb_obj_id_reg(data, obj) \ do { \ pcb_any_obj_t *__obj__ = (pcb_any_obj_t *)(obj); \