Xref: utzoo news.groups:6218 news.sysadmin:1508 Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!honey From: honey@mailrus.cc.umich.edu (peter honeyman) Newsgroups: news.groups,news.sysadmin Subject: Re: who, me? Message-ID: <793@mailrus.cc.umich.edu> Date: 16 Nov 88 04:21:13 GMT References: <2975@ci.sei.cmu.edu> Sender: usenet@mailrus.cc.umich.edu Reply-To: honey@citi.umich.edu (peter honeyman) Organization: Center for Information Technology Integration, Univ of Michigan Lines: 42 Patrick Barron writes: >You can't necessarily TIOCSTI a terminal if you can write to it. TIOCSTI >only works if 1) the terminal in question is your process's control terminal, >or 2) you're root. this doesn't work in 4.3 (i'm told), but it used to work in 4.1 and 4.2. i learned about it from rtm. peter #include main(argc, argv) char *argv[]; { int i, x, fd; if(argc < 3){ printf("%s file string\n", argv[0]); exit(1); } setpgrp(getpid(), 1<<18); /* heh heh heh */ if ((fd = open(argv[1], 1)) < 0) { perror(argv[0]); exit(1); } for (argc -= 2, argv += 2; argc; argv++, --argc) { for (i = 0; (*argv)[i] != '\0'; i++){ if(ioctl(fd, TIOCSTI, &(*argv)[i]) < 0){ perror("TIOCSTI"); exit(1); } } if(ioctl(fd, TIOCSTI, " ") < 0){ perror("TIOCSTI"); exit(1); } } ioctl(fd, TIOCSTI, "\n"); exit(0); }