Article View: news.software.readers
Article #33703S-Lang macro for slrn - segfault [long]
From: E.
Date: Sun, 25 May 1997 00:00
Date: Sun, 25 May 1997 00:00
84 lines
3021 bytes
3021 bytes
After seeing the incredibly cool Altavista search in the sample
.slrn.sl, I decided to try to write one like it, but to do a Dejanews
author search (if it worked, then I was going to do subject and
newsgroup ones). I made a few minor changes to the Altavista one, and
changed the menu, ending up with this:
% This function prompts for a search string and then calls dejanews, I
% hope.
define dejanews ()
{
variable browser = "lynx";
variable url = "http://www.dejanews.com/";
variable cgi =
"groups=&dates=&fromdate=&todate=&subkects=&authors=";
% That IS all on one line, but I can't post it that way.
variable str, new_str, len, ch, chlo, i;
variable cmd;
% Both of these segfault.
% str = strcat ("");
% str = strcat (" ");
str = read_mini ("Author: ", "", str);
len = strlen (str);
!if (len) return;
new_str = "";
for (i = 0; i < len; i++)
{
ch = str [i];
chlo = ch | 0x20;
if ((chlo > 'z') or (chlo < 'a'))
ch = Sprintf ("%%%02X", ch, 1);
else
ch = char (ch);
new_str = strcat (new_str, ch);
}
cmd = Sprintf ("%s '%s%s%s'", browser, url, cgi, new_str, 4);
() = system (cmd);
}
Which, as far as I can tell, looks right, except the lines I've
commented out. With both of them commented out, when I get to the menu:
define easy_search ()
{
variable rsp;
rsp = get_select_box_response ("NewsGroup Searches", % title
"AltaVista (WWW)",
"DejaNews author search",
"search articles",
3);
switch (rsp)
{ case 0: altavista_search (); }
{ case 1: dejanews (); }
{ case 2: search_newsgroup (); }
}
But when I select 1, I get "S-Lang Error: Variable uninitialized.:
Unknown Error.", as opposed to a segfault.
I've looked through what little S-Lang documentation I can find, and I'm
stumped. Any ideas on how to do this, AND where to find good docs on
S-Lang?
Thanks.
-E
--
PGP Public Key Fingerprint: BE FC C5 FB 30 47 E5 5C DC DF C3 C0 AD A5 27 17
Homepage: http://www.primenet.com/~fnargle/erisson/ PGP Key available here
"I am free of all prejudice. I hate everyone equally." -W. C. Fields
"This isn't right. This isn't even wrong." -Wolfgang Pauli
Technical Details
Message-ID:
<slrn5ogu8t.pa2.erisson@kallisti.sw-tech.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-mailShow Full Headers
Complete Article Headers
Message-ID: <slrn5ogu8t.pa2.erisson@kallisti.sw-tech.com> Subject: S-Lang macro for slrn - segfault [long] Date: Sun, 25 May 1997 00:00:00 +0000 From: erisson@sw-tech.com (E.) 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: 243875425 Organization: SW!-TECH Information Services X-Posted-By: erisson@206.165.17.236 (fnargle) Newsgroups: news.software.readers