Thanks. I think the fix below can be improved further, because strdup(3)
is unneeded here and can be omitted. We don't have either constant
argument nor want to preserve it.

On 05.01.2013 18:52, Gabor Kovesdan wrote:
>               case 'e':
> -                     add_pattern(optarg, strlen(optarg));
> +                     {
> +                             char *token;
> +                             char *string = strdup(optarg);
> +
> +                             while ((token = strsep(&string, "\n")) != NULL)
> +                                     add_pattern(token, strlen(token));
> +                     }
>                       needpattern = 0;
>                       break;
>               case 'F':
> @@ -668,7 +674,11 @@ main(int argc, char *argv[])
>  
>       /* Process patterns from command line */
>       if (aargc != 0 && needpattern) {
> -             add_pattern(*aargv, strlen(*aargv));
> +             char *token;
> +             char *string = strdup(*aargv);
> +
> +             while ((token = strsep(&string, "\n")) != NULL)
> +                     add_pattern(token, strlen(token));
>               --aargc;
>               ++aargv;
>       }
> 

_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to