🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
4 messages
4 total messages Started by Nancy McGough Thu, 30 Jun 1994 21:17
guard-double-slash and !lynx http://
#6057
Author: Nancy McGough
Date: Thu, 30 Jun 1994 21:17
14 lines
992 bytes
Often when I'm in nn I want to take a look at a web page someone 
mentions so I type:

  !lynx http://etc...

But by default nn interprets // as /, so I set guard-double-slash 
on in my init file but that doesn't help.  Anyone have a suggestion?

Thanks much,
Nancy


--
<A HREF="ftp://ftp.ii.com/pub/ii">Nancy McGough, Infinite Ink</A>
Re: guard-double-slash and !lynx http://
#6058
Author: David Lesher
Date: Fri, 01 Jul 1994 16:26
15 lines
1409 bytes
Nancy McGough <nancym@ii.com> writes:
>  !lynx http://etc...

>But by default nn interprets // as /, so I set guard-double-slash 
>on in my init file but that doesn't help.  Anyone have a suggestion?

The only one so far is to ^Z out to the shell and lynx from
there.......

guard-double-slash does not seem to work when banging out.
-- 
A host is a host from coast to coast.................wb8foz@nrk.com
& no one will talk to a host that's close...........(v)301 56 LINUX
Unless the host (that isn't close)....kibo# 777............pob 1433
is busy, hung or dead..............vr....................20915-1433
Re: guard-double-slash and !lynx http://
#6060
Author: Stephen Foy
Date: Sat, 02 Jul 1994 18:38
77 lines
3316 bytes
Nancy McGough <nancym@ii.com> writes:

>Often when I'm in nn I want to take a look at a web page someone 
>mentions so I type:

>  !lynx http://etc...

>But by default nn interprets // as /, so I set guard-double-slash 
>on in my init file but that doesn't help.  Anyone have a suggestion?

Here are some nn macros and shell scripts that let you start up
lynx from within nn. Put the macros into your .nn/init and save
the two shell scripts. Make sure the shell scripts are in your
PATH and executable.

Both macros are invoked when nn is in show mode (reading an
article).  The first, W, converts the current article to an html
document and starts lynx with it. This is the macro to use if an
article you are reading contains html. The second macro, S,
greps for the string ://, the string common to most URLs, and 
attempts to starts lynx with that URL. If there is more that one
URL in an article the last one is passed to lynx. The URL must
be surrounded by whitespace for lynx to read it properly.

I find that I can access most URLs mentioned in articles with
these macros. When I can't I do a ctrl-z and run lynx from the
shell prompt. 

In nn default configuration the show mode commands W & S duplicate
the fuctions of w & s. 

The macros for .nn/init...
----------------8<---------cut here----------8<-------------- 
# nn macros to pipe article to shell scripts that invoke lynx
map show W (
	save-short "|ReadWebPost"
	redraw
)

map show S (
	save-short "|GrepUrl"
	redraw
)
----------------8<---------cut here----------8<-------------- 

Shell script ReadWebPost...
----------------8<---------cut here----------8<-------------- 
#!/bin/sh
# ReadWebPost
echo \<PRE\> > .article.html
cat >> .article.html
echo \</PRE\> >> .article.html
lynx .article.html < /dev/tty
rm .article.html
----------------8<---------cut here----------8<--------------

Shell script GrepUrl
----------------8<---------cut here----------8<--------------  
#!/bin/sh
# GrepUrl
# If the article contains more that one URL, lynx is started with
# the last one in the file. The selected URL must be surrounded by
# whitespace for lynx to start up properly.
cat > .article
lynx `grep :// .article` < /dev/tty
rm .article
----------------8<---------cut here----------8<-------------- 


ps
My thanks to person who posted the ReadWebPost script and macro, 
(for rn), to comp.infosystems.www. And an apology to that person
too, as I've deleted the article and can't give you his name.  

-- 
Stephen Foy 
shf@access.digex.net
Re: guard-double-slash and !lynx http://
#6071
Author: Jelle van Zeijl
Date: Tue, 05 Jul 1994 10:48
168 lines
5262 bytes
Nancy McGough <nancym@ii.com> writes:
> Often when I'm in nn I want to take a look at a web page someone 
> mentions so I type:
>
>   !lynx http://etc...
>
> But by default nn interprets // as /, so I set guard-double-slash 
> on in my init file but that doesn't help.  Anyone have a suggestion?

Well, a colleague of mine, Gertjan van Oosten, has written a small script
and an nn macro to do just that. He's on a holiday, so that's why I
respond.

Here's the script (called mosaic_link), which can also be used from the
command-line, from within elm, or wherever. It looks on standard-in for any
http link in the text and lets you select one (using the select script).
Then it will use the remote control feature of xmosaic to open that page
(it will start xmosaic if not already running).

If you want to use it with lynx, you'll have to change it because lynx
doesn't have the remote control feature. Just starting lynx with the
specified link in the current window will probably work fine.

The scripts are his, the comments in the header I've just added (so
spelling flames should be directed to me :-).

The mosaic_link script:
----------------------------------------------------------------------
#!/bin/sh
# NAME
#	mosaic_link - select one http link and show page with Mosaic
#
# SYNOPSIS
#	mosaic_link < file
#
# DESCRIPTION
#	Get list of http links from stdin, let the user select one and
#	show corresponding page with Mosaic via remote control feature.
#	Start up Mosaic if not yet running.
#
# AUTHOR:
#	Gertjan van Oosten
#	West Consulting BV
#	gvoosten@iso.estec.esa.nl, gertjan@west.nl
#

MOSAIC=xmosaic
TMPFILE=/tmp/Mosaic.
export MOSAIC

# Get Mosaic pid
PID=`ps x | grep "$MOSAIC" | grep -v grep | head -1 | awk '{print $1}'`

echo "\nProcessing..."
# If no pid then start Mosaic
if [ -z "$PID" ]
then
  echo "Starting Mosaic, please wait 15 seconds."
  ( exec "$MOSAIC" >> $HOME/.xsessionlog 2>&1 ) &
  PID=$!
  sleep 15
  echo "Mosaic started."
fi

# Get link
LINKS=`sed -n 's,^.*\(http://[^ 	>")]*\).*$,\1,p'`

umask 077
echo "newwin" > "$TMPFILE$PID"
echo "Select one of the following links:"
select $LINKS < /dev/tty 2>> "$TMPFILE$PID"

if [ $? -ne 255 ]
then
  kill -USR1 "$PID"	# Tell Mosaic to read remote control file
  sleep 2
fi

exit 0
----------------------------------------------------------------------

The select script:
----------------------------------------------------------------------
#!/bin/sh5
# NAME
#	select - show list and let user select one or timeout
#
# SYNOPSIS
#	select choice ...
#
# DESCRIPTION
#	A list of choices will be shown and the user can select one of them.
#	The choice will be put on stderr and the exit code will indicate which
#	choice is taken. The default is the last choice, which can be selected
#	by entering 0.
#	If the user waits too long, the script will timeout and exit with exit
#	code 255.
#	The script will return immediately if only one choice is given which
#	will then be the selected one.
#
# AUTHOR:
#	Gertjan van Oosten
#	West Consulting BV
#	gvoosten@iso.estec.esa.nl, gertjan@west.nl
#

SIGNAL=2 # INTR
DELAY=5
ERROR=255

n=0
for p
do
  n=`expr $n + 1`
  echo $n: $p
done

trap 'exit $ERROR' $SIGNAL
(sleep $DELAY && kill -$SIGNAL $$ > /dev/null 2>&1) &

if [ $n -eq 1 ]
then
  a=1
else
  echo "Select 1 to $n (0 for last one): \c"
  read a

  a=`expr 0 + 0$a 2> /dev/null`
  if [ "$a" -gt $n -o "$a" -eq 0 ]
  then
    a=$n
  fi
fi

n=0
for p
do
  n=`expr $n + 1`
  if [ $a -eq $n ]
  then
    echo "Selected $p"
    echo $p 1>&2
    break
  fi
done

exit $a
----------------------------------------------------------------------

And here is the macro which you must add to you ~/.nn/init file:
----------------------------------------------------------------------
# show WWW links via Mosaic
define 0
  save-full "/tmp/nn.mosaic.$(USER)" yes
  :!mosaic_link < /tmp/nn.mosaic.$USER ; rm -f /tmp/nn.mosaic.$USER
  redraw
end
map show ^X macro 0
----------------------------------------------------------------------

It's not fool proof but it works fine and without much hassle. All praise
(and flames) to Gertjan.

Hope you'll enjoy it,

--
-- Jelle van Zeijl:  Estec, +31-1719-85668, jvzeijl@iso.estec.esa.nl
-- 		     West Consulting, +31-15-123190, jelle@west.nl
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