FreeCalypso > hg > sms-coding-utils
comparison gen-pdu/main.c @ 9:003660a57f99
new program sms-gen-tpdu
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sat, 05 Aug 2023 07:43:45 +0000 |
| parents | |
| children | d9d722033ff1 |
comparison
equal
deleted
inserted
replaced
| 8:265b8103530c | 9:003660a57f99 |
|---|---|
| 1 /* | |
| 2 * This C file is the main module for sms-gen-tpdu utility. | |
| 3 */ | |
| 4 | |
| 5 #include <sys/types.h> | |
| 6 #include <stdio.h> | |
| 7 #include <stdlib.h> | |
| 8 #include <string.h> | |
| 9 #include <strings.h> | |
| 10 | |
| 11 int dir_mo, include_sca; | |
| 12 u_char sc_addr[12], user_addr[12]; | |
| 13 u_char mr_byte, pid_byte, dcs_byte; | |
| 14 u_char scts_buf[7]; | |
| 15 int is_septet, scts_is_set; | |
| 16 | |
| 17 char input_line[512]; | |
| 18 int input_lineno; | |
| 19 | |
| 20 static void | |
| 21 init_defaults() | |
| 22 { | |
| 23 sc_addr[0] = 0; | |
| 24 user_addr[0] = 0; | |
| 25 user_addr[1] = 0x80; | |
| 26 mr_byte = 0xFF; | |
| 27 pid_byte = 0; | |
| 28 dcs_byte = 0; | |
| 29 is_septet = 1; | |
| 30 } | |
| 31 | |
| 32 main(argc, argv) | |
| 33 char **argv; | |
| 34 { | |
| 35 if (argc != 2) { | |
| 36 usage: fprintf(stderr, "usage: %s mo|mt|sc-mo|sc-mt\n", argv[0]); | |
| 37 exit(1); | |
| 38 } | |
| 39 if (!strcmp(argv[1], "mo")) { | |
| 40 dir_mo = 1; | |
| 41 include_sca = 0; | |
| 42 } else if (!strcmp(argv[1], "mt")) { | |
| 43 dir_mo = 0; | |
| 44 include_sca = 0; | |
| 45 } else if (!strcmp(argv[1], "sc-mo")) { | |
| 46 dir_mo = 1; | |
| 47 include_sca = 1; | |
| 48 } else if (!strcmp(argv[1], "sc-mt")) { | |
| 49 dir_mo = 0; | |
| 50 include_sca = 1; | |
| 51 } else | |
| 52 goto usage; | |
| 53 init_defaults(); | |
| 54 for (input_lineno = 1; fgets(input_line, sizeof input_line, stdin); | |
| 55 input_lineno++) | |
| 56 process_input_line(); | |
| 57 exit(0); | |
| 58 } |
