Rework string_quote API

string_quote() has proven to be too hard to use, replace it with
print_quoted_string() that does memory allocation and prints the result.

* defs.h (string_quote): Remove.
(QUOTE_0_TERMINATED, QUOTE_OMIT_LEADING_TRAILING_QUOTES): New macros.
(print_quoted_string): New prototype.
* util.c (string_quote): Make static; take "style" flags instead
of "len", treat QUOTE_0_TERMINATED style flag as former (len == -1);
add QUOTE_OMIT_LEADING_TRAILING_QUOTES style flag support.
(ALLOCA_CUTOFF, use_alloca): New macros.
(print_quoted_string): New function.
(printpathn, printstr): Update to new API.
* loop.c (loop_ioctl): Likewise.
* mtd.c (ubi_ioctl): Likewise.
* net.c (print_scm_security): Likewise.
* socketutils.c (unix_parse_response): Likewise.
diff --git a/loop.c b/loop.c
index 6ce6545..bb622fd 100644
--- a/loop.c
+++ b/loop.c
@@ -39,7 +39,6 @@
 {
 	struct loop_info info;
 	struct loop_info64 info64;
-	char *s = alloca((LO_NAME_SIZE + LO_KEY_SIZE) * 4);
 
 	if (entering(tcp))
 		return 0;
@@ -72,12 +71,14 @@
 		tprints(", flags=");
 		printflags(loop_flags_options, info.lo_flags, "LO_FLAGS_???");
 
-		string_quote(info.lo_name, s, -1, LO_NAME_SIZE);
-		tprintf(", name=%s", s);
+		tprints(", name=");
+		print_quoted_string(info.lo_name, LO_NAME_SIZE,
+				    QUOTE_0_TERMINATED);
 
 		if (!abbrev(tcp) || info.lo_encrypt_type != LO_CRYPT_NONE) {
-			string_quote((void *) info.lo_encrypt_key, s, 0, LO_KEY_SIZE);
-			tprintf(", encrypt_key=%s", s);
+			tprints(", encrypt_key=");
+			print_quoted_string((void *) info.lo_encrypt_key,
+					    LO_KEY_SIZE, 0);
 		}
 
 		if (!abbrev(tcp))
@@ -125,14 +126,17 @@
 		tprints(", flags=");
 		printflags(loop_flags_options, info64.lo_flags, "LO_FLAGS_???");
 
-		string_quote((void *) info64.lo_file_name, s, -1, LO_NAME_SIZE);
-		tprintf(", file_name=%s", s);
+		tprints(", file_name=");
+		print_quoted_string((void *) info64.lo_file_name,
+				    LO_NAME_SIZE, QUOTE_0_TERMINATED);
 
 		if (!abbrev(tcp) || info64.lo_encrypt_type != LO_CRYPT_NONE) {
-			string_quote((void *) info64.lo_crypt_name, s, -1, LO_NAME_SIZE);
-			tprintf(", crypt_name=%s", s);
-			string_quote((void *) info64.lo_encrypt_key, s, 0, LO_KEY_SIZE);
-			tprintf(", encrypt_key=%s", s);
+			tprints(", crypt_name=");
+			print_quoted_string((void *) info64.lo_crypt_name,
+					    LO_NAME_SIZE, QUOTE_0_TERMINATED);
+			tprints(", encrypt_key=");
+			print_quoted_string((void *) info64.lo_encrypt_key,
+					    LO_KEY_SIZE, 0);
 		}
 
 		if (!abbrev(tcp))