🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #40442

Re: slrn: saving articles

#40442
From: Jan Hlavacek
Date: Mon, 27 Apr 1998 00:00
89 lines
3577 bytes
On Mon, 27 Apr 1998 19:06:32 +0200, Bjoern Frantzen <bjoff@bgnett.no>
wrote:
> Vikas Agnihotri <vikasa@att.com> wrote:
> >How do I save articles to a mbox format file? The save-article function
> >prompts me for the file name with the value of save_directory suffixed with
> >the name of the current group. I dont want the current group name. I want
> >all articles to be saved to *ONE* file similar to the save_posts file.
> >
> >Suppose I want to save to the file ~/Usenet/Saved, I would still like to be
> >prompted with the above as the default file-name which I can change. Right
> >now, it prompts me with ~/News/news.software.readers (save_directory=News,
> >of course).
> >
> >README.macros says that the intrinsic function save_article_to_file
> >creates a new file every time, so this wont do.
> 
> Take a look at Jan Hlavacek's file.sl, posted here a week or two ago, or
> form his website at
> <URL:http://www.math.ohio-state.edu/~lahvak/software/slrn/save.sl.txt>

Note that this is an old version.  Newer,  much improved version,  can
be obtained from
http://www.math.ohio-state.edu/%7Elahvak/slang/files/slrn/filename.sl

It works with S-Lang v1+,  and have more sophisticated way of specifying
the names of folders.  However,  it is probably overkill for the thing
Vikas asked.  Something like this should be enough:


define append_article_save (file)
{
   % Saves the current article to the named file, appending if the file
   % exists.

   if (is_group_mode) return ();        % this only works in article mode

   set_input_string (file);             % put filename in the response stack
   call ("save");                       % save article (into file)
}

define filename_create_home_path ()
{
   variable path = getenv ("HOME");
   variable fn;
   _stk_reverse (_NARGS);
   loop (_NARGS)
   {
      fn = ();
      path += ("/" + fn);
   }
   path;
}

define filename_complete_filename (file)
{
   % Append the name of the file to ${HOME}/News/
   % unless it starts with ~ or /
   
   if (file[0] == '~') 
      return (filename_create_home_path (substr (file, 2, -1)));
   if (file[0] == '/') return (file);
   
   filename_create_home_path (get_variable_value("save_directory"),
                          "folders", file);
}

define my_save ()
{
   variable file = read_mini ("Append to folder", "", "~/Usenet/Saved");
   
   append_article_save (filename_complete_filename (file));
}


> 
> I think this does pretty much what you want.
> 
> -- 
>         Bjoern Frantzen      - bjoff@bgnett.no


-- 
Jan Hlav\'{a}\v{c}ek <lahvak@math.mps.ohio-state.edu>  (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/

Technical Details
Message-ID: <slrn6k9lt5.1iv.lahvak@mw152sd.mps.ohio-state.edu>
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
References: <slrn6k95e6.kf0.vikasa@8080b0da.ims.att.com> <slrn6k9eph.pt3.bjoff@bgnett.no>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6k9lt5.1iv.lahvak@mw152sd.mps.ohio-state.edu>
Subject: Re: slrn: saving articles
Date: Mon, 27 Apr 1998 00:00:00 +0000
From: lahvak@math.mps.ohio-state.edu (Jan Hlavacek)
References: <slrn6k95e6.kf0.vikasa@8080b0da.ims.att.com> <slrn6k9eph.pt3.bjoff@bgnett.no>
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: 348173321
Reply-To: lahvak@math.mps.ohio-state.edu
Organization: Department of Mathematics, The Ohio State University
Newsgroups: news.software.readers