FreeCalypso > hg > freecalypso-tools
comparison uptools/atcmd/smsend_main.c @ 967:6bf473f77fc4
fcup-smsend: support backslash escapes in UCS-2 mode too
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 01 Sep 2023 16:43:35 +0000 |
| parents | ec7e23d5151f |
| children |
comparison
equal
deleted
inserted
replaced
| 966:ec7e23d5151f | 967:6bf473f77fc4 |
|---|---|
| 77 exit(ERROR_USAGE); | 77 exit(ERROR_USAGE); |
| 78 } | 78 } |
| 79 if (allow_escape && text_mode) { | 79 if (allow_escape && text_mode) { |
| 80 fprintf(stderr, | 80 fprintf(stderr, |
| 81 "%s error: escapes not supported in text mode\n", | 81 "%s error: escapes not supported in text mode\n", |
| 82 argv[0]); | |
| 83 exit(ERROR_USAGE); | |
| 84 } | |
| 85 if (ucs2_mode && allow_escape) { | |
| 86 fprintf(stderr, "%s error: UCS-2 escapes not supported yet\n", | |
| 87 argv[0]); | 82 argv[0]); |
| 88 exit(ERROR_USAGE); | 83 exit(ERROR_USAGE); |
| 89 } | 84 } |
| 90 if (argc > optind + 2) { | 85 if (argc > optind + 2) { |
| 91 fprintf(stderr, "usage: %s [options] dest-addr [message]\n", | 86 fprintf(stderr, "usage: %s [options] dest-addr [message]\n", |
| 255 int rc; | 250 int rc; |
| 256 unsigned nparts, n; | 251 unsigned nparts, n; |
| 257 u_char udh[5]; | 252 u_char udh[5]; |
| 258 unsigned pos, remain, chunk; | 253 unsigned pos, remain, chunk; |
| 259 | 254 |
| 260 rc = utf8_to_ucs2(msgtext, msgtext_uni, MAX_MSG_UNI, &msgtext_unilen); | 255 rc = utf8_to_ucs2(msgtext, msgtext_uni, MAX_MSG_UNI, &msgtext_unilen, |
| 256 allow_escape); | |
| 261 if (rc == -1) { | 257 if (rc == -1) { |
| 262 fprintf(stderr, "error: invalid UTF-8 message\n"); | 258 fprintf(stderr, "error: invalid UTF-8 message\n"); |
| 263 exit(ERROR_USAGE); | 259 exit(ERROR_USAGE); |
| 264 } | 260 } |
| 265 if (rc == -2) { | 261 if (rc == -2) { |
| 266 fprintf(stderr, "error: message too long for max concat SMS\n"); | 262 fprintf(stderr, "error: message too long for max concat SMS\n"); |
| 263 exit(ERROR_USAGE); | |
| 264 } | |
| 265 if (rc == -3) { | |
| 266 fprintf(stderr, | |
| 267 "error: message contains invalid backslash escape\n"); | |
| 267 exit(ERROR_USAGE); | 268 exit(ERROR_USAGE); |
| 268 } | 269 } |
| 269 if (msgtext_unilen <= 70) { | 270 if (msgtext_unilen <= 70) { |
| 270 common_init(); | 271 common_init(); |
| 271 prep_for_pdu_mode(); | 272 prep_for_pdu_mode(); |
