static int master(void) { modem_t modem[10]; char buf[1024]; int len; int i; for (i = 0; i < 10; i++) { if (psuedo_terminal_create(&modem[i])) { printf("Failure\n"); exit(2); } printf("%s %s\n", modem[i].devlink, modem[i].stty); } for (;;) { for (i = 0; i < 10; i++) { len = read(modem[i].master, buf, 4); if (len >= 0) { buf[len] = '\0'; printf("%d %d '%s' %s\n", i, len, buf, strerror(errno)); } } } for (i = 0; i < 10; i++) { if (psuedo_terminal_close(&modem[i])) { printf("Failure\n"); exit(2); } } return 0; }
int main(int argc, char *argv[]) { int log_audio; int t38_mode; int test_sending; int use_ecm; int use_gui; int g1050_model_no; int g1050_speed_pattern_no; int opt; #if !defined(WIN32) int tioflags; #endif decode_test_file = NULL; log_audio = FALSE; test_sending = FALSE; t38_mode = FALSE; use_ecm = FALSE; use_gui = FALSE; g1050_model_no = 0; g1050_speed_pattern_no = 1; while ((opt = getopt(argc, argv, "d:eglM:rS:st")) != -1) { switch (opt) { case 'd': decode_test_file = optarg; break; case 'e': use_ecm = TRUE; break; case 'g': #if defined(ENABLE_GUI) use_gui = TRUE; #else fprintf(stderr, "Graphical monitoring not available\n"); exit(2); #endif break; case 'l': log_audio = TRUE; break; case 'M': g1050_model_no = optarg[0] - 'A' + 1; break; case 'r': test_sending = FALSE; break; case 'S': g1050_speed_pattern_no = atoi(optarg); break; case 's': test_sending = TRUE; break; case 't': t38_mode = TRUE; break; default: //usage(); exit(2); break; } } if (psuedo_terminal_create(&modem[0])) printf("Failure\n"); #if !defined(WIN32) ioctl(modem[0].slave, TIOCMGET, &tioflags); tioflags |= TIOCM_RI; ioctl(modem[0].slave, TIOCMSET, &tioflags); #endif t30_tests(t38_mode, use_ecm, use_gui, log_audio, test_sending, g1050_model_no, g1050_speed_pattern_no); if (psuedo_terminal_close(&modem[0])) printf("Failure\n"); printf("Tests passed\n"); return 0; }