🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #12154

Re: TRN: Running it NON-interactively

#12154
From: Wayne Davison
Date: Thu, 27 Oct 1994 02:13
34 lines
1677 bytes
According to Peter J. Kappesser <pjkappes@mailbox.syr.edu>:
> But [trnkill] refuses to run as a cron job [...] complaining it
> 'Can't open /dev/tty'.

This only happens on certain systems, and depends on your termio setup.
I've made a change for trn 3.6 that checks if the input is a terminal
and skips this code if it is not:

Index:term.c
@@ -149,10 +149,13 @@
     /* do no delay reads on something that always gets closed on exit */
 
-    devtty = open("/dev/tty",0);
-    if (devtty < 0) {
-	printf(cantopen,"/dev/tty") FLUSH;
-	finalize(1);
+    devtty = fileno(stdin);
+    if (isatty(devtty)) {
+	devtty = open("/dev/tty",0);
+	if (devtty < 0) {
+	    printf(cantopen,"/dev/tty") FLUSH;
+	    finalize(1);
+	}
+	fcntl(devtty,F_SETFL,O_NDELAY);
     }
-    fcntl(devtty,F_SETFL,O_NDELAY);
 #endif
 #endif

My system doesn't use this code, however, so if you'd try it out and
let me know how it goes I'd appreciate it.
-- 
Wayne Davison
davison@borland.com
Technical Details
Message-ID: <CyB7II.H94@borland.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!gatech!concert!decwrl!borland.com!davison
References: <37fhvf$4cb@oedipa.waste.com> <CxKIy3.5u4@borland.com> <38l41u$dr4@newstand.syr.edu>

Show Full Headers
Complete Article Headers
Message-ID: <CyB7II.H94@borland.com>
Subject: Re: TRN: Running it NON-interactively
Date: Thu, 27 Oct 1994 02:13:29 GMT
From: davison@borland.com (Wayne Davison)
References: <37fhvf$4cb@oedipa.waste.com> <CxKIy3.5u4@borland.com> <38l41u$dr4@newstand.syr.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!gatech!concert!decwrl!borland.com!davison
Newsgroups: news.software.readers
Organization: Borland International
Lines: 34