diff enc-text/ucs2.c @ 23:e56bb9f09ff1

sms-encode-text: port over -e option from fcup-smsend
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 02 Sep 2023 19:22:05 +0000
parents 265b8103530c
children
line wrap: on
line diff
--- a/enc-text/ucs2.c	Thu Aug 31 23:03:38 2023 +0000
+++ b/enc-text/ucs2.c	Sat Sep 02 19:22:05 2023 +0000
@@ -10,6 +10,7 @@
 #include <unistd.h>
 #include "defs.h"
 
+extern int allow_escape;
 extern int concat_enable, concat_refno_set;
 extern char msgtext[MAX_MSG_CHARS*2+2];
 extern u_char concat_refno;
@@ -23,7 +24,8 @@
 	u_char udh[6], ucs2_be[140];
 	unsigned pos, remain, chunk;
 
-	rc = utf8_to_ucs2(msgtext, msgtext_uni, MAX_MSG_UNI, &msgtext_unilen);
+	rc = utf8_to_ucs2(msgtext, msgtext_uni, MAX_MSG_UNI, &msgtext_unilen,
+			  allow_escape);
 	if (rc == -1) {
 		fprintf(stderr, "error: invalid UTF-8 message\n");
 		exit(1);
@@ -32,6 +34,11 @@
 		fprintf(stderr, "error: message too long for max concat SMS\n");
 		exit(1);
 	}
+	if (rc == -3) {
+		fprintf(stderr,
+			"error: message contains invalid backslash escape\n");
+		exit(1);
+	}
 	if (msgtext_unilen <= 70) {
 		fputs("dcs 8 octet\nmsg ", stdout);
 		if (msgtext_unilen) {