kreed@telesys.cts.com (Kevin W. Reed) (05/30/90)
The following is how I fixed my posting problems using nn 6.4.3 and Cnews. History: SCO Xenix 386 2.3.2 Could not post, mail or forward using nn 6.4.3 on a Cnews system. Actually the article could be posted but the users name would be missing. Mail and forwarding did not work at all. Cnews 'postnews' work without any problems. Solution: It seems that for some reason, when inews is called from nn it is no longer attached to a terminal (?) and since this is so, who am i fails. When called from postnews it works ok. What I did (with the help of Geoff Collyer as he pointed out what was wanted), I removed the section that didn't work with a simple USER=`/usr/bin/logname' and Wala.... it works... I still don't know what the ypmatch is, but it evidently doesn't get that far... Below is a diff file for the change. BTW: I liked the comment in anne.jones :-) # dig up user's name (a simple task, you'd think, but you'd be wrong) Thanks for the help guys... <<this message was posted with nnpost>> *** anne.jones Tue May 29 14:10:40 1990 --- anne.jones.new Tue May 29 14:10:18 1990 *************** *** 28,58 # badsites="pucc.bitnet!" # tailor, syntax is "host1!host2!...host3!" host="$mailname" ! # dig up user's name (a simple task, you'd think, but you'd be wrong) ! case "$LOGNAME" in ! "") ! # "who am i" on many Unixes does "ttyname(0)" and "getpwuid(getuid())" ! # if that fails - it can be confused by empty utmp entries (per jerqs); ! # "who am i </dev/null" yields your userid, not your login name. ! # "tty" does "ttyname(0)"; also fallible. ! # So, emulate a slightly-modified V7 getlogin(3) (actually ttyslot(3)): ! # look for tty on /dev/tty, stdin, stdout, stderr (actually via ttyname(3)). ! for fd in 3 0 1 2 # 3 is /dev/tty on V8 ! do ! if test -t $fd; then ! case "$USER" in ! "") USER="`who am i <&$fd | ! sed -e 's/[ ].*//' -e '/!/s/^.*!//' `" ;; ! esac ! fi ! done ! case "$USER" in ! "") USER="`who am i </dev/null | # last resort: use userid ! sed -e 's/[ ].*//' -e '/!/s/^.*!//' `" ;; ! esac ! ;; ! *) USER="$LOGNAME" ;; ! esac case "$NAME" in "") if test -s $HOME/.name; then --- 28,35 ----- # badsites="pucc.bitnet!" # tailor, syntax is "host1!host2!...host3!" host="$mailname" ! USER=`/usr/bin/logname` ! case "$NAME" in "") if test -s $HOME/.name; then -- Kevin W. Reed - TeleSys Development Systems - San Diego - Voice (619) 270-1338 {nosc,ucsd,hplabs!hp-sdd}!crash!telesys!kreed --- XBBS & telesys.UUCP 483-3890 kreed@telesys.cts.com --------- Development Site for ARC Business Systems, Inc
storm@login.dkuug.dk (Kim F. Storm) (06/05/90)
kreed@telesys.cts.com (Kevin W. Reed) writes: >The following is how I fixed my posting problems using nn 6.4.3 and Cnews. >It seems that for some reason, when inews is called from nn it is no longer >attached to a terminal (?) and since this is so, who am i fails. When called >from postnews it works ok. The easy solution for this is to make fd 3 be a tty, since the anne.jones script checks that. But it has yet to be tested... This can be accomplished using dup2(2,3) early in nn's main program (in nn.c). However, I will probably use close(3); dup(2); since dup2 isn't portable - or is it? ++Kim
storm@texas.dk (Kim F. Storm) (06/06/90)
kreed@telesys.cts.com (Kevin W. Reed) writes: >The following is how I fixed my posting problems using nn 6.4.3 and Cnews. >It seems that for some reason, when inews is called from nn it is no longer >attached to a terminal (?) and since this is so, who am i fails. When called >from postnews it works ok. I would propose the following fix which I would like somebody to try out: Add this line at the beginning of aux.sh: exec 3<&0 This will open fd #3 as the tty, and Cnews' anne.jones script will use this before 0 1 2 (which are not ttys when inews is called by the aux script). Please try it out and tell me whether it works. it works. -- Kim F. Storm <storm@texas.dk> No news is good news, Texas Instruments A/S, Denmark but nn is better!