Article View: pb.unix.3b1
Article #1Need help on automate the input process via /dev/tty
From: Jerry Lau (baer)
Date: Wed, 06 Oct 1993 23:40
Date: Wed, 06 Oct 1993 23:40
31 lines
1491 bytes
1491 bytes
I'm trying to automate the input process at the command line
for the program, x.c, below. This program is an example of a system
command (/etc/volcopy in a System V) that I can't modify.
Utimately, I would like to stick this program into cron so it can be
run automatically. Of course first I need your help to figure out
how to go around the /dev/tty input process.
/* Program: x.c */
#include <stdio.h>
main()
{
FILE *Dstty;
char ans[11];
Dstty=fopen("/dev/tty", "r"));
fputs("input y/n", Dstty);
fgets(ans, 1, Dstty);
/* if it's 'y', do some serious damage!! */
}
P.S. It doesn't work by using the "Here Document"
x<<!
y
!
Thanks in advance.
Jerry
Technical Details
Message-ID:
<1993Oct6.234027.22784@PacBell.COM>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.unix.admin.mbox.zip!gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!pacbell.com!jklauShow Full Headers
Complete Article Headers
Message-ID: <1993Oct6.234027.22784@PacBell.COM> Subject: Need help on automate the input process via /dev/tty Date: Wed, 6 Oct 1993 23:40:27 GMT From: jklau@srv.PacBell.COM (Jerry Lau (baer)) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.unix.admin.mbox.zip!gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!pacbell.com!jklau Newsgroups: comp.unix.programmer,comp.unix.admin,comp.unix.wizards,comp.unix.questions,unix.comp.shell,pb.unix.3b1 Sender: news@PacBell.COM (Pacific Bell Netnews) Organization: Pacific * Bell Lines: 30