1 #define _POSIX_C_SOURCE 2
8 /* for quoting against the shell replace ' with '\'' and surround with
12 char *quote(char *s, int chi, char *repl, int addquotes) {
13 size_t size = 0, rsize = 0;
18 if (!repl) return NULL;
22 for (d = s; *d; d++) {
33 d = q = malloc(size+1);
62 int main(int ac, char **av) {
66 int opt, shellmode = 0, addquotes = 0, ident = 0;
69 char *separator = "\n";
71 while ((opt = getopt(ac, av, "sqid:")) != -1) {
73 case 's': shellmode = 1; break;
74 case 'q': addquotes = 1; break;
75 case 'i': ident = 1; break;
76 case 'd': separator = optarg; break;
92 for (i=argn;i<ac;i++) {
93 quoted = quote(av[i], ch, repl, addquotes);
94 printf("%s%s", count > 0 ? separator : "", quoted);