about summary refs log tree commit diff
path: root/support/support_quote_string.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-11-27 21:35:56 +0100
committerFlorian Weimer <fweimer@redhat.com>2018-11-27 21:35:56 +0100
commitc74a91deaa5de416237c02bbb3e41bda76ca4c7b (patch)
tree33f46f86274a8c4286ba6ddb46370e8c8cfd0e32 /support/support_quote_string.c
parentd527c860f5a3f0ed687bd03f0cb464612dc23408 (diff)
downloadglibc-c74a91deaa5de416237c02bbb3e41bda76ca4c7b.tar.gz
glibc-c74a91deaa5de416237c02bbb3e41bda76ca4c7b.tar.xz
glibc-c74a91deaa5de416237c02bbb3e41bda76ca4c7b.zip
support: Implement support_quote_string
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 'support/support_quote_string.c')
-rw-r--r--support/support_quote_string.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/support/support_quote_string.c b/support/support_quote_string.c
new file mode 100644
index 0000000000..d324371b13
--- /dev/null
+++ b/support/support_quote_string.c
@@ -0,0 +1,26 @@
+/* Quote a string so that it can be used in C literals.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <string.h>
+#include <support/support.h>
+
+char *
+support_quote_string (const char *str)
+{
+  return support_quote_blob (str, strlen (str));
+}