/ * phoneman -- telephone manager Connect program A.J. Fisher April 1998 */ #include <stdio.h> #include <sgtty.h> #include <signal.h> #define global #define unless(x) if(!(x)) #define until(x) while(!(x)) #define CASEMAP false extern "C" { int write(int, void*, int), putenv(char*); void alarm(int), close(int); void execl(char*, ...); }; static void sighandler(); global void main(int argc, char **argv) { signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); signal(SIGALRM, (SIG_PF) sighandler); alarm(60); /* 1 min timeout */ termios tmode; tcgetattr(0, &tmode); /* get pty attrs for "standard" mode */ tmode.c_lflag = 05073; /* "sane" values */ termios rmode = tmode; rmode.c_iflag = rmode.c_oflag = rmode.c_lflag = 0; /* modify for raw mode */ rmode.c_cc[VMIN] = rmode.c_cc[VTIME] = 1; /* set timeout params */ tcsetattr(0, TCSADRAIN, &rmode); /* set raw mode */ bool ok = true; write(1, &ok, sizeof(bool)); /* send "ok" to parent */ int ch1, ch2 = 0; do { ch1 = ch2; ch2 = getchar(); } until ((ch1 == '\r' && ch2 == '\r') || (ch2 < 0)); /* wait for 2 cr's from modem, or alarm */ if (ch2 < 0) { /* alarm went off */ tcsetattr(0, TCSADRAIN, &tmode); /* reset sane mode */ exit(1); } printf("Tony Fisher's Indy\r\n"); printf("casemap: %s\r\n", CASEMAP ? "yes" : "no"); if (CASEMAP) { /* map uc/lc : serviceable but not perfect */ tmode.c_lflag |= XCASE; tmode.c_iflag |= IUCLC; tmode.c_oflag |= OLCUC; } fprintf(stderr, "??? lflag was %06o ", tmode.c_lflag); tmode.c_lflag &= ~ISIG; /* disable signals */ fprintf(stderr, "is %06o\r\n", tmode.c_lflag); tcsetattr(0, TCSADRAIN, &tmode); /* set modified mode */ alarm(0); /* reset alarm timer */ putenv("SHELL=/dev/null"); /* anti-hacking precaution */ execl("/usr/bsd/telnet", "telnet", "-e", "\020", NULL); printf("Can't exec telnet!\r\n"); exit(1); } static void sighandler() { close(0); /* sneaky trick to make getchar() return -1 from now on */ }
file: /Techref/uk/ac/york/cs/www-users/http/~fisher/software/voicemail/phoneman/current/connect.C, 2KB, , updated: 2000/4/4 11:10, local time: 2025/2/11 03:17,
18.216.100.123:LOG IN
|
©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/Techref/uk/ac/york/cs/www-users/http/~fisher/software/voicemail/phoneman/current/connect.C"> uk ac york cs www-users http ~fisher software voicemail phoneman current connect</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.