Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!sri-spam!nike!ll-xn!mit-amt!mit-eddie!genrad!decvax!mcnc!ece-csc!uvacs!edison!jso From: jso@edison.UUCP (John Owens) Newsgroups: net.unix,net.wanted.sources Subject: Re: unix system enhancements Message-ID: <875@edison.UUCP> Date: Tue, 14-Oct-86 16:28:27 EDT Article-I.D.: edison.875 Posted: Tue Oct 14 16:28:27 1986 Date-Received: Thu, 16-Oct-86 22:07:32 EDT References: <4119@brl-smoke.ARPA> <702@hropus.UUCP> <19@altunv.UUCP> Organization: General Electric Company, Charlottesville, VA Lines: 60 Summary: Here it is - force! Xref: mnetor net.unix:5879 net.wanted.sources:2431 In article <19@altunv.UUCP>, brad@altunv.UUCP (Brad Silva) writes: > In article <1986Oct1.180413.29885@sq.uucp>, dave@sq.UUCP writes: > > A year or so ago a program called "force" was posted to > > net.sources. (Sorry but author and date elude me) Well, I'm the original author, and here it is. (Of course it is possible that I never bothered to post it, and that someone else posted a similar program with the same name. Naahhh...) #include #include main(argc,argv) char *argv[]; { char ch, *tty; static char ttyn[32] = "tty"; static char devn[32] = "/dev/"; int fd; struct sgttyb ttyb; char *strcat(); if (argc != 2) { fprintf(stderr,"Usage: force ttyname\n"); exit(1); } tty = argv[1]; if (*tty >= '0' && *tty <= '9') tty=strcat(ttyn,tty); if (*tty != '/') tty=strcat(devn,tty); fprintf(stderr,"force to %s:\n",tty); if ((fd=open(tty,2)) == -1) { fprintf(stderr,"force: Can't open %s\n",tty); exit(1); } gtty(0,&ttyb); ttyb.sg_flags |= RAW; stty(0,&ttyb); for (;;) { if (read(0,&ch,1) != 1) { fprintf(stderr,"read error\r\n"); break; } if (ch == 'P' - 0100) break; if (ioctl(fd,TIOCSTI,&ch)) { fprintf(stderr,"ioctl error\r\n"); break; } } ttyb.sg_flags &= ~RAW; stty(0,&ttyb); exit(0); } -- John Owens General Electric Company - Charlottesville, VA jso@edison.GE.COM old arpa: jso%edison.GE.COM@seismo.CSS.GOV +1 804 978 5726 old uucp: {seismo,decuac,houxm,calma}!edison!jso