Check-in Number:
|
942 | |
Date: |
2001-Sep-12 08:53:56 (local)
2001-Sep-12 06:53:56 (UTC) |
User: | thl |
Branch: | |
Comment: |
For the -m option any capturing brackets are rewritten to clustering syntax. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.51 -> 1.52
--- lmtp2nntp.c 2001/09/11 13:41:22 1.51
+++ lmtp2nntp.c 2001/09/12 06:53:56 1.52
@@ -164,7 +164,7 @@
static void usage(char *command)
{
/* use
- * perl <lmtp2nntp.c -e 'while (<>) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; s/.<(.*?)>/$1/g ; print "\"$_\"\n" };}'
+ * perl <lmtp2nntp.c -e 'while (<>) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; s/.<(.*?)>/$1/g ; print "\"$_ \"\n" };}'
* to pull the USAGE string out of this source
*/
fprintf(stderr,
@@ -464,6 +464,15 @@
break;
case 'm': /*POD [B<-m> I<mailfrom>] */
ctx->option_mailfrom = strdup(optarg);
+ /* protect ourselfs from the substitution of backreferences.
+ * Missing varargs would cause segfaults. Rewrite capturing
+ * brackets to clustering syntax. Use poor man's s///g
+ * simulator as current str library doesn't support global
+ * substitution */
+ while (str_parse(ctx->option_mailfrom, "s/(.*?)\\((?!\\?:)(.*)/$1(?:$2/", &cp) > 0) {
+ free(ctx->option_mailfrom);
+ ctx->option_mailfrom = cp;
+ }
if (str_parse("<>", ctx->option_mailfrom) == -1) {
fprintf(stderr, "%s:Error: illegal regex \"%s\" to option -m.\n", ctx->progname, ctx->option_mailfrom);
exit(ERR_EXECUTION);
|
|