If anybody has a copy of this program I would be greatly interested in it, or
anything similar. I occasionally have to help users through problems, or do
short training in various programs, and this would be VERY helpful.
--
----------------
Brad Silva "Seeker"
...!ptfsa!gilbbs!altunv!brad
No disclaimer
No cute joke
No nothin'
.... Yet!
---------------
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 <sgtty.h>
#include <stdio.h>
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
j...@edison.GE.COM old arpa: jso%edison...@seismo.CSS.GOV
+1 804 978 5726 old uucp: {seismo,decuac,houxm,calma}!edison!jso
Question: What is this supposed to do?
Thank you.
--
UUCP:
seismo|
philabs|
phri| -> cmcl2!rna!rocky2!kreek
harvard|
ihnp4|
ARPANET: kr...@rockefeller.arpa
BITNET: KREEK@ROCKVAX
"force.c", line 39: TIOCSTI undefined
Do I need to include some library or some such thing?
--
+----------------------------------------------------------------------------+
| Mark Steven Jeghers - the living incarnation of "Deep-Thought" |
| ("You won't like the answer ... you didn't ask it very well.") |
| |
| {ihnp4,cbosgd,lll-lcc,lll-crg}|{dual,ptsfa}!cogent!mark |
| ^^^^^^-------recommended------^^^^^ |
| |
| "A poodle-free world within a decade. We can do it...together!" |
| |
| Cogent Software Solutions can not be held responsible for anything said |
| by the above person since they have no control over him in the first place |
+----------------------------------------------------------------------------+
No, you need to give up and build "force" only on machines whose operating
system supports the operation needed for a process to be able to force
characters to be "typed" on another terminal. TIOCSTI is an "ioctl" that
takes a character and makes the terminal referred to by the file descriptor
argument act as if that character had been typed on it. If you don't have
this "ioctl", or something like it, you can't make "force" work.
--
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
g...@sun.com (or g...@sun.arpa)