diff options
Diffstat (limited to 'sqesc.c')
-rw-r--r-- | sqesc.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -0,0 +1,18 @@ +#include <stdio.h> +#include <string.h> + +int print_escaped(char *s) { + char *p=0; + for(p=strchr(s,'\'');p && s && *p && *s;p=strchr(s,'\'')) { + *p=0;//null out this single-quote + printf("%s",s); + printf("'\\''"); + s=p+1; + } + printf("%s",s); + return 0; +} + +int main(int argc,char *argv[]) { + return print_escaped(argv[1]); +} |