FreeCalypso > hg > sms-coding-utils
comparison enc-text/gsm7.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 |
comparison
equal
deleted
inserted
replaced
22:8a2038c6a156 | 23:e56bb9f09ff1 |
---|---|
8 #include <string.h> | 8 #include <string.h> |
9 #include <strings.h> | 9 #include <strings.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 #include "defs.h" | 11 #include "defs.h" |
12 | 12 |
13 extern int utf8_input; | 13 extern int utf8_input, allow_escape; |
14 extern int concat_enable, concat_refno_set; | 14 extern int concat_enable, concat_refno_set; |
15 extern char msgtext[MAX_MSG_CHARS*2+2]; | 15 extern char msgtext[MAX_MSG_CHARS*2+2]; |
16 extern u_char concat_refno; | 16 extern u_char concat_refno; |
17 | 17 |
18 gsm7_mode_main() | 18 gsm7_mode_main() |
27 if (utf8_input && utf8_to_latin1(msgtext) < 0) { | 27 if (utf8_input && utf8_to_latin1(msgtext) < 0) { |
28 fprintf(stderr, "error: invalid UTF-8 message\n"); | 28 fprintf(stderr, "error: invalid UTF-8 message\n"); |
29 exit(1); | 29 exit(1); |
30 } | 30 } |
31 rc = latin1_to_gsm7(msgtext, msgtext_gsm7, MAX_MSG_CHARS, | 31 rc = latin1_to_gsm7(msgtext, msgtext_gsm7, MAX_MSG_CHARS, |
32 &msgtext_gsmlen); | 32 &msgtext_gsmlen, allow_escape); |
33 if (rc == -1) { | 33 if (rc == -1) { |
34 fprintf(stderr, "error: message not valid for GSM7 charset\n"); | 34 fprintf(stderr, "error: message not valid for GSM7 charset\n"); |
35 exit(1); | 35 exit(1); |
36 } | 36 } |
37 if (rc == -2) { | 37 if (rc == -2) { |
38 fprintf(stderr, "error: message too long for max concat SMS\n"); | 38 fprintf(stderr, "error: message too long for max concat SMS\n"); |
39 exit(1); | |
40 } | |
41 if (rc == -3) { | |
42 fprintf(stderr, | |
43 "error: message contains invalid backslash escape\n"); | |
39 exit(1); | 44 exit(1); |
40 } | 45 } |
41 if (msgtext_gsmlen <= 160) { | 46 if (msgtext_gsmlen <= 160) { |
42 fputs("dcs 0 septet\nmsg ", stdout); | 47 fputs("dcs 0 septet\nmsg ", stdout); |
43 if (msgtext_gsmlen) | 48 if (msgtext_gsmlen) |