diff options
Diffstat (limited to 'src/set.c')
-rw-r--r-- | src/set.c | 33 |
1 files changed, 28 insertions, 5 deletions
@@ -93,7 +93,10 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val) } //apply limit count here, needs to be defined as a tag,multi and have a value set - if ((defp->tag || defp->multi) && (defp->def_tag > 0 || defp->def_multi > 0)) { + + //NOTE: changed behavior for def_tag==1. Needs signed 32 support in parser where -1 + //represents embedded tag node... TODO + if ((defp->tag || defp->multi) && (defp->def_tag != 0 || defp->def_multi != 0)) { //get count of siblings char path[2048]; @@ -124,7 +127,7 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val) } closedir(dirp); - if (defp->tag && file_count == 1 && defp->def_tag == 1) { + if (defp->tag && file_count == 1 && defp->def_tag < 0) { //this is the special case, where the previous value should be deleted here... char command[8192]; //let unionfs handle the diff @@ -133,14 +136,34 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val) } if (defp->tag) { - if (defp->def_tag > 1 && file_count >= defp->def_tag) { - fprintf(out_stream,"Number of values exceeded for %s, allowed: %d, actual: %d\n",val,defp->def_tag,file_count); + if (defp->def_tag > 0 && file_count >= defp->def_tag) { + char *p = rindex(path,'/'); + char tmp[2048]; + if (p != NULL) { + int off = p - path; + strncpy(tmp,path + off + 1, strlen(path) - off - 1); + tmp[strlen(path) - off - 1] = '\0'; + fprintf(out_stream,"Number of values exceeded for '%s', allowed: %d, actual: %d\n",tmp,defp->def_tag,file_count); + } + else { + fprintf(out_stream,"Number of values exceeded, allowed: %d, actual: %d\n",defp->def_tag,file_count); + } return FALSE; } } else { if (defp->def_multi > 1 && file_count >= defp->def_multi) { - fprintf(out_stream,"Number of values exceeded for %s, allowed: %d, actual: %d\n",val,defp->def_multi,file_count); + char *p = rindex(path,'/'); + char tmp[2048]; + if (p != NULL) { + int off = p - path; + strncpy(tmp,path + off + 1, strlen(path) - off - 1); + tmp[strlen(path) - off - 1] = '\0'; + fprintf(out_stream,"Number of values exceeded for '%s', allowed: %d, actual: %d\n",tmp,defp->def_tag,file_count); + } + else { + fprintf(out_stream,"Number of values exceeded, allowed: %d, actual: %d\n",defp->def_tag,file_count); + } return FALSE; } } |