[net.wanted.sources] unix system enhancements

brad@altunv.UUCP (Brad Silva) (10/07/86)

In article <1986Oct1.180413.29885@sq.uucp>, dave@sq.UUCP writes:
> 
> In article <702@hropus.UUCP> jrw@hropus.UUCP (Jim Webb) writes:
> >> 	3.  And lastly modify the tty driver to support "advising."  This would
> >> 	allow root to watch the characters sent to a terminal and have the
> >> 	characters that he types inserted into that port's input character
> >> 	stream.
> >
> >	A hackers' delight, a simple rm -rf will remove this "advising" :-)
> >-- 
> >Jim Webb             "Out of phase--get help"          ...!ihnp4!hropus!jrw
> 
> 	A year or so ago a program called "force" was posted to
> net.sources. (Sorry but author and date elude me)
> 	This allowed for root to force characters, as if typed
> by the user, to a particular tty.
> ---------------
> David R. Seaman		!utzoo!sq!dave		SoftQuad Publishing Software

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!  
---------------

jso@edison.UUCP (John Owens) (10/14/86)

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 <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
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

kreek@rocky2.UUCP (Biochemical Endocrinology) (10/17/86)

In article <875@edison.UUCP>, jso@edison.UUCP (John Owens) writes:
> 
> 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[];
....
....
....

Question: What is this supposed to do?

Thank you.

--
UUCP:
     seismo|
    philabs|
       phri| -> cmcl2!rna!rocky2!kreek
    harvard|
      ihnp4|

ARPANET:        kreek@rockefeller.arpa
BITNET:         KREEK@ROCKVAX

mark@cogent.UUCP (Mark Steven Jeghers) (10/23/86)

In article <875@edison.UUCP> jso@edison.UUCP (John Owens) writes:
>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...)
>
I tried compiling force.c and got the following error:

"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 |
+----------------------------------------------------------------------------+

guy@sun.UUCP (10/23/86)

> I tried compiling force.c and got the following error:
> 
> "force.c", line 39: TIOCSTI undefined
> 
> Do I need to include some library or some such thing?

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
	guy@sun.com (or guy@sun.arpa)