From: Nathan Wagner Date: Wed, 5 Dec 2018 16:42:30 +0000 (+0000) Subject: add option to quote multiple values at once X-Git-Tag: v0.3.6~3 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=884d3cefd3b5d5ba5c6f5af0f0c87168005af3f3 add option to quote multiple values at once --- diff --git a/zpm-quote.c b/zpm-quote.c index 1aea24b..d0006e3 100644 --- a/zpm-quote.c +++ b/zpm-quote.c @@ -65,12 +65,15 @@ int main(int ac, char **av) { int ch = '\''; int opt, shellmode = 0, addquotes = 0, ident = 0; char *repl = "''"; + int count = 0; + char *separator = "\n"; - while ((opt = getopt(ac, av, "sqi")) != -1) { + while ((opt = getopt(ac, av, "sqid:")) != -1) { switch (opt) { case 's': shellmode = 1; break; case 'q': addquotes = 1; break; case 'i': ident = 1; break; + case 'd': separator = optarg; break; default: exit(EXIT_FAILURE); break; @@ -85,10 +88,13 @@ int main(int ac, char **av) { repl = "\"\""; } + count = 0; for (i=argn;i 0 ? separator : "", quoted); free(quoted); + count++; } + printf("\n"); return 0; }