summaryrefslogtreecommitdiff
path: root/sqesc.c
diff options
context:
space:
mode:
authorepoch <epoch@hack.thebackupbox.net>2021-10-30 00:27:43 +0000
committerepoch <epoch@hack.thebackupbox.net>2021-10-30 00:27:43 +0000
commit3c5cd5e68278f82cc071623419e1a205c6fee38b (patch)
tree72d8dc4493e399d7ea6cc094826e527ef9e4c564 /sqesc.c
parent62817acef7618bd5d6e77ffabb39aabe33f5a37c (diff)
parentc38649558142ee7a02c176f373120f417633b022 (diff)
downloaduritools-3c5cd5e68278f82cc071623419e1a205c6fee38b.tar.gz
uritools-3c5cd5e68278f82cc071623419e1a205c6fee38b.zip
Merge branch 'master' of ssh://git.thebackupbox.net/uritools
Diffstat (limited to 'sqesc.c')
-rw-r--r--sqesc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sqesc.c b/sqesc.c
new file mode 100644
index 0000000..6d7ba23
--- /dev/null
+++ b/sqesc.c
@@ -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]);
+}