🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
4 messages
4 total messages Started by E. Sun, 25 May 1997 00:00
S-Lang macro for slrn - segfault [long]
#33703
Author: E.
Date: Sun, 25 May 1997 00:00
84 lines
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

Re: S-Lang macro for slrn - segfault [long]
#33715
Author: E.
Date: Mon, 26 May 1997 00:00
17 lines
1132 bytes
> S-Lang comes with some docs in the doc/ dir of the S-Lang distribution.

This will teach me to keep the source around a little longer, I guess.
<sigh>

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
"The Internet is a good tool to use to get on the Net." -Bob Dole
"A witty saying proves nothing." -Voltaire

Re: S-Lang macro for slrn - segfault [long]
#33745
Author: John E. Davis
Date: Tue, 27 May 1997 00:00
19 lines
1420 bytes
On Sun, 25 May 1997 20:13:22 -0500, J.B. Nicholson-Owens 
<jbn@pop-a-wheelie.midwest.net> wrote:
>S-Lang comes with some docs in the doc/ dir of the S-Lang distribution.  The
>documentation built into JED, the editor, is the definitive reference for
>individual S-Lang and the JED S-Lang API.  It's where I got the above
>documentation quote (I reformatted it slightly).

It is true that most of the slang function documentation is available
online when using jed.  This is convenient for me because it is the
only environment that I use for writing macros but that does not help
those who use other editors.  I hope to distribute separate
documentation in the future; however, until slrn, jed was the only
widely used program that embedded the interpreter.

--John


Re: S-Lang macro for slrn - segfault [long]
#33773
Author: John E. Davis
Date: Wed, 28 May 1997 00:00
38 lines
1654 bytes
On 25 May 1997 10:39:00 -0700, E. <erisson@sw-tech.com>
wrote:
>   variable cgi =
>"groups=&amp;dates=&amp;fromdate=&amp;todate=&amp;subkects=&amp;authors=";
>
>% That IS all on one line, but I can't post it that way.

   I should allow text like this to extend beyond the 80 column limit.
Perhaps, by allowing a ``magic-cookie'' header that slrn would check
to disable the 80 column limit, e.g.,

.slrn: long_lines_ok

where the `.' would indicate that this header contains special
processing instructions for slrn and it would be stripped.

>% Both of these segfault.
>
>%   str = strcat ("");
>%   str = strcat (" ");

  When you say segfault, do you really mean it causes slrn to dump
core?  In any case, the syntax is wrong and even if you use:

    str = strcat (str, "");
    
it will not work because `str' is still unitialized.  You really want
to use:

    str = "";
    
Nevertheless, the interpreter is not supposed to crash so there must
be a bug somewhere.  What version of the slang library are you using?

--John

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