🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jerry Lau (baer) Wed, 06 Oct 1993 23:40
Need help on automate the input process via /dev/tty
#1
Author: Jerry Lau (baer)
Date: Wed, 06 Oct 1993 23:40
31 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads