Article View: news.software.readers
Article #35205Re: [SLRN] Help w/macro please
From: Pardoz
Date: Wed, 16 Jul 1997 00:00
Date: Wed, 16 Jul 1997 00:00
82 lines
4445 bytes
4445 bytes
On 16 Jul 97 02:11:20 GMT, J.B. Nicholson-Owens
<jbn@pop-a-wheelie.midwest.net> wrote:
>Pardoz <pardoz@io.com> wrote:
>> if ((rsp = "Lynx")) browservbl = "lynx2.cmd %s";
>> if ((rsp = "Bookmark")) browservbl = "echo %s | geturl.cmd > nul";
>> if ((rsp = "Download")) browservbl = "echo %s | downurl.cmd > nul";
>
>Here are some thoughts that came to my mind when I saw this code:
>
>1. I don't think you want to use double parentheses. Out of curiosity, what
> programming language uses double parentheses in the way you're using them
> here?
S-Lang apparently - at least it stopped giving me syntax errors
when I switched from a single to a double parenthesis.
>2. In S-Lang, you can't compare strings using an assignment equals sign
> ("="). You also can't use the comparative equals ("==") for strings.
> case() works on all types or you can use some string compare like
> strcmp() or string_match(). In this instance, I prefer switch()-case().
I hit on that myself when I finally dug up a recent copy of TFM to
R.
>3. You don't need to test three times since 'rsp' is not changing between
> comparisons. Once one test succeeds, make the assignment to 'rsp' and
> move on. Also, if it's not "Lynx" or "Bookmark", there's no need to test
> for "Download" since that is the only remaining choice.
At the moment, yes. It's designed to be easily extended,
particularly by people who don't necessarily know what they're doing.
>4. 'browservbl' is obviously a variable ("vbl"). You could call it
> 'browser' and it would retain all self-documenting functionality.
True. I hit on 'browservbl' to avoid potential variable name
conflicts.
>There are other ways of doing this, of course, but this jumps to my mind
>right now. By the way, are you sure you have to pipe the URL to the geturl
>and downurl commands; do they take arguments?
They do, indeed - they're a pair of REXX scripts that take an
argument from stdin and write the result to a file (geturl tarts it up
with a bit of HTML and appends it to a Lynx bookmark file, downurl just
writes to a plain text file to be fed into an offline Web page
retriever). Invoking them with 'script %s' doesn't work - you have to
pipe in the URL (based on experience with the way slrn passes mail
filenames to sendmail_command, I suspect that the culprit is slrn
appending a leading space to the URL, which confuses the REXX
'linein()' function; one of these days I'll get around to testing this
by stripping the first character of the input argument and seeing if it
works that way.)
>Also, on Unix, you are taking
>the geturl and downurl stdout output and redirecting it to a file called
>"nul" (overwriting that file each time), *not* sending unwanted output to
>the null device.
In OS/2 too. In this case both scripts use the REXX lineout
function to append the stream to a file instead of stdout, so the only
output going to stdout is result codes from the scripts.
>I highly recommend using Jed (the editor) for S-Lang programming. The most
>updated S-Lang API documentation is found there and the S-Lang mode will
>give you nice formatting (aka "pretty printing"). Finally, I suggest
>checking out the S-Lang docs in the S-Lang distribution.
Thanks for the tip - I'll grab a copy of Jed. I've also dropped a
note to the person maintaining the OS/2 binary slrn distribution
suggesting adding a copy of the latest S-Lang docs to the distribution
file.
--
RIOT, n. A popular entertainment given to the military by innocent
bystanders. (A. Bierce, _The Devil's Dictionary_)
http://www.io.com/~pardoz (Liaden Universe mailing list home page)
http://www.io.com/~pardoz/mythos.html (Mythos Adventure Archive)
Technical Details
Message-ID:
<slrn5spep7.26.pardoz@io.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<slrn5sn34c.8o.pardoz@io.com> <slrn5sobak.36l.jbn@pop-a-wheelie.midwest.net>Show Full Headers
Complete Article Headers
Message-ID: <slrn5spep7.26.pardoz@io.com> Subject: Re: [SLRN] Help w/macro please Date: Wed, 16 Jul 1997 00:00:00 +0000 From: pardoz@io.com (Pardoz) References: <slrn5sn34c.8o.pardoz@io.com> <slrn5sobak.36l.jbn@pop-a-wheelie.midwest.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 257257971 Sender: pardoz@free1-slip216.tele.queensu.ca Organization: Illuminati Online Reply-To: pardoz@io.com Newsgroups: news.software.readers