🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #657

Re: YARNFR -- how to run nn in batch mode (almost)

#657
From: Kim F. Storm
Date: Fri, 29 Jun 1990 23:27
97 lines
3395 bytes
rock@warp.Eng.Sun.COM (Bill Petro) writes:

>How about an "nn batch mode"?  If it already exists, please direct me to
>the man page location.  But what I'm looking for is a way to get cron to
>call nn every day, or every couple of days, and auto-save those messages
>that my auto-select would mark, and save them to a file.

>Example 2:
>	nn -b BatchInstructionFile

You can *almost* do that with 6.4.6 if you simply use a different init
file, e.g. ~/.nn/batch, which you would invoke as

	nn -Ibatch

The tricky part is to make sure input is a tty and TERM is set!
I'm not sure how you can do that from cron.


The contents of 'batch' would be something like:

# --------- INIT FILE FOR BATCH MODE -----------

# include your normal .newsrc maintenance variables here
set keep-unsubscribed
set new-group-action 3

# no need to print large menus
set window 20

# don't ask for save file name or confirmation
set quick-save
unset confirm-create
unset confirm-append

# keep things in arrival order
set sort-mode 0

# save selected articles and continue to next group
on entry
	save-full '+'
	next-group
end

sequence 

	rec.arts.startrek +STARTREK
	news.software.nn +NN
	comp.mail.mush +MUSH
	comp.sys.sun +SUN
	etc...
# include this if you only want to save articles in the listed groups
!!

#---------------- END OF BATCH FILE ----------

The problem is that 6.4.6 will quickly complain about a MACRO STACK overflow
because the effect of the "next-group" command is to invoke the entry macro
of the next group before the current macro has completed.

The following patch (which will be included in patch 7) will fix that:

----- patch follows -----

*** LAST/macro.c	Mon Jun 25 15:46:43 1990
--- macro.c	Fri Jun 29 23:46:47 1990
***************
*** 453,458 ****
--- 453,460 ----
  
      if (m_level == 0)
  	no_advance = 0;
+     else if (m == NULL)
+ 	m_level--;
      else {
  	if (m_level > MSTACK) {
  	    msg("Macro stack overflow");

------ end of patch ------

I will think about adding a -b option to nn to disable the output, or
at least remove the requirement that the input is a tty - maybe in
patch #7 as well.


>Could some other key be used as a prefix to extend the
>number of things that could be bound to keys?  Other programs, like vi
>and mush, will allow the @ key to act as a prefix.

This is one of the things I have planned for release 7.  However,
it will be relatively trivial to do, so maybe you will not have
to wait that long....  Anyway, with patch #6, keymaps have an additional
96 entries if you run in 8 bit mode (set data-bits 8).

-- 
Kim F. Storm  <storm@texas.dk>		No news is good news,
Texas Instruments A/S, Denmark		  but nn is better!
Technical Details
Message-ID: <612@texas.dk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!unido!mcsun!sunic!dkuug!tidk!storm
References: <137828@sun.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Message-ID: <612@texas.dk>
Subject: Re: YARNFR -- how to run nn in batch mode (almost)
Date: Fri, 29 Jun 1990 23:27:54 +0000
From: storm@texas.dk (Kim F. Storm)
References: <137828@sun.Eng.Sun.COM>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!unido!mcsun!sunic!dkuug!tidk!storm
Newsgroups: news.software.nn
Keywords: batch
Distribution: news
Organization: Texas Instruments, Denmark
Lines: 97
Posted: Sat Jun 30 00:27:54 1990