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 while ((opt = getopt(ac, av, "sqi")) != -1) {
71 case 's': shellmode = 1; break;
72 case 'q': addquotes = 1; break;
73 case 'i': ident = 1; break;
88 for (i=argn;i<ac;i++) {
89 quoted = quote(av[i], ch, repl, addquotes);
90 printf("%s\n", quoted);