please dont rip this site

UK AC York CS Www-users Http ~fisher Software Voicemail Phoneman Current Connect.c

/ * 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 12:10, local time: 2024/7/2 13:24,
TOP NEW HELP FIND: 
18.188.241.120:LOG IN

 ©2024 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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://piclist.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?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .