Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx> writes: > Based-on-patch-by: Junio C Hamano <gitster@xxxxxxxxx> This is sufficiently different from what I suggested that I do not deserve the above line, I would think. > + ret = regcomp(&r, pat, flags); > + if (ret) { > + if (silent) > + return ret; > + > + regerror(ret, &r, errbuf, sizeof(errbuf)); > + die("failed regcomp() for pattern '%s' (%s)", pat, errbuf); Nice. > + } > + if (!str) > + return 0; > + > + ret = regexec(&r, str, 1, m, 0); > + if (ret) { > + if (silent || ret == REG_NOMATCH) > + return ret; > + > + regerror(ret, &r, errbuf, sizeof(errbuf)); > + die("failed regexec() for subject '%s' (%s)", str, errbuf); > + } > > return 0; > +usage: > + usage("\ttest-tool regex --bug\n" > + "\ttest-tool regex [--silent] <pattern>\n" > + "\ttest-tool regex [--silent] <pattern> <string> [<options>]"); > + return -1; > }