🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Filip Gieszczykiewicz Thu, 04 Nov 1993 08:21
rn macros - pushing limits?
#6368
Author: Filip Gieszczykiewicz
Date: Thu, 04 Nov 1993 08:21
195 lines
9275 bytes
	Greetings. I have an .rnmac file with a bunch of macros which
	I would like to automate. I keep archives of "useful" articles
	in files with short names, sci.electronics -> ele, comp.robotics
	-> rob, etc. I have macros for each that determine current
	group and save to the appropriate file.

	However, I have to remember each "hot-key" for each group - some
	of which I read only occasionally. So, I am trying to use the form:

	%(test_text=pattern?then_text:else_text)

	to do a number of steps to find the proper file for current group.

	As in:

	if comp.robotics save to rob else try next macro
	if sci.electronics save to ele else try next macro
	...

	This DOES NOT work... it seems to use the un-macro "letter" that
	my .rnmac file redefines. I include the test .rnmac in the hope
	that someone has done something like this before.

	I also include a snip of the rn manpage in the format it should
	come in (there should be a ".rnmac" file in the distribution...)

	All comments welcome.

	Take care.

-----------------chop-with-axe----------------chop-with-axe---------------------
# Macros in form:
#
# 	  %(test_text=pattern?then_text:else_text)
#
# .rnmac 	V.001		[testing... and failing...]
#
# Hoping to use "S" as the saving hot-key.
#
S	%(%d=\/tmp\/comp\/unix\/aix?saix\012:C)
#
C	%(%d=\/tmp\/rec\/climbing?sCLIMB\012:E)
#
E	%(%d=\/tmp\/sci\/electronics?sele\012:H)
#
H	%(%d=\/tmp\/rec\/humor?shum\012:T)
#
T	%(%d=\/comp\/robotics?srob\012)
#
#---------------------------------------------------------------------
#
# 	  All interpreted strings go through backslash,	uparrow	and
# 	  percent interpretation.  The backslash escapes are the
# 	  normal ones (such as \n, \t, \nnn, etc.).  The uparrow
# 	  escapes indicate control codes in the	normal fashion.
# 	  Backslashes or uparrows to be	passed through should be
# 	  escaped with backslash.  The special percent escapes are
# 	  similar to printf percent escapes.  These cause the
# 	  substitution of various run|time values into the string.
# 	  The following	are currently recognized:
# 
# 	  %a	  Current article number.
# 	  %A	  Full name of current article (%P/%c/%a).
# 	  %b	  Destination of last save command, often a mailbox.
# 	  %B	  The byte offset to the beginning of the part of the
# 		  article to be	saved, set by the save command.	 The
# 		  's' and 'S' commands set it to 0, and	the 'w'	and
# 		  'W' commands set it to the byte offset of the	body
# 		  of the article.
# 	  %c	  Current newsgroup, directory form.
# 	  %C	  Current newsgroup, dot form.
# 	  %d	  Full name of newsgroup directory (%P/%c).
# 	  %D	  "Distribution:" line from the	current	article.
# 	  %e	  The last command executed to extract an article.
# 	  %E	  The last directory where an extracted	file went.
# 	  %f	  "From:" line from the	current	article, or the
# 		  "Reply|To:"  line if there is	one.  This differs
# 		  from %t in that comments (such as the	full name) are
# 		  not stripped out with	%f.
# 	  %F	  "Newsgroups:"	line for a new article,	constructed
# 		  from "Newsgroups:" and "Followup|To:"	lines of
# 		  current article.
# 	  %h	  Name of the header file to pass to the mail or news
# 		  poster, containing all the information that the
# 		  poster program needs in the form of a	message
# 		  header.  It may also contain a copy of the current
# 		  article.  The	format of the header file is
# 		  controlled by	the MAILHEADER and NEWSHEADER
# 		  environment variables.
# 	  %H	  Host name (your machine's name).
# 	  %i	  "Message|I.D.:" line from the	current	article, with
# 		  <> guaranteed.
# 	  %I	  The reference	indication mark	(see the -FFFF switch.)
# 	  %l	  The news administrator's login name, if any.
# 	  %L	  Login	name (yours).
# 	  %m	  The current mode of rn, for use in conditional
# 		  macros.
# 		       i    Initializing.
# 		       n    Newsgroup selection	level.
# 		       a    Article selection level (What next?).
# 		       p    Pager level	(MORE prompt).
# 		       A    Add	this newsgroup?
# 		       C    Catchup confirmation.
# 		       D    Delete bogus newsgroups?
# 		       F    Is followup	a new topic?
# 		       M    Use	mailbox	format?
# 		       R    Resubscribe	to this	newsgroup?
# 		  Note that yes/no questions are all upper|case	modes.
# 		  If, for example, you wanted to disallow defaults on
# 		  all yes/no questions,	you could define the following
# 		  macro:
# 		  \040 %(%m=[A|Z]?h: )
# 	  %M	  The number of	articles marked	to return via the 'M'
# 		  command.  If the same	article	is Marked multiple
# 		  times, "%M" counts it	multiple times in the current
# 		  implementation.
# 	  %n	  "Newsgroups:"	line from the current article.
# 	  %N	  Full name (yours).
# 	  %o	  Organization (yours).
# 	  %O	  Original working directory (where you	ran rn from).
# 	  %p	  Your private news directory, normally	~/News.
# 	  %P	  Public news spool directory, normally
# 		  /usr/spool/news on systems that don't	use NNTP.
# 	  %r	  Last reference on references line of current article
# 		  (parent article id).
# 	  %R	  References list for a	new article, constructed from
# 		  the references and article ID	of the current
# 		  article.
# 	  %s	  Subject, with	all Re's and (nf)'s stripped off.
# 	  %S	  Subject, with	one "Re:" stripped off.
# 	  %t	  "To:"	line derived from the "From:" and "Reply|To:"
# 		  lines	of the current article.	 This always returns
# 		  an Internet format address.
# 	  %T	  "To:"	line derived from the "Path:" line of the
# 		  current article to produce a uucp path.
# 	  %u	  The number of	unread articles	in the current
# 		  newsgroup.
# 	  %U	  The number of	unread articles	in the current
# 		  newsgroup, not counting the current article.
# 	  %x	  The news library directory.
# 	  %X	  The rn library directory.
# 	  %z	  The length of	the current article in bytes.
# 	  %~	  Your home directory.
# 	  %.	  The directory	containing your	dot files, which is
# 		  your home directory unless the environment variable
# 		  DOTDIR is defined when rn is invoked.
# 	  %$	  Current process number.
# 	  %/	  Last search string.
# 	  %#	  The current count for	a multi|file save. This	value
# 		  is incremented by one	for each file saved or
# 		  extracted during a session.
# 	  %%	  A percent sign.
# 	  %{name} or %{name-default}
# 		  The environment variable "name".
# 	  %[name] The value of header line "Name:" from	the current
# 		  article.  The	"Name: " is not	included.  For example
# 		  "%D" and "%[distribution]" are equivalent.  The name
# 		  must be spelled out in full.
# 	  %`command`
# 		  Inserts the output of	the command, with any embedded
# 		  newlines translated to space.
# 	  %"prompt"
# 		  Prints prompt	on the terminal, then inputs one
# 		  string, and inserts it.
# 	  %(test_text=pattern?then_text:else_text)
# 		  If test_text matches pattern,	has the	value
# 		  then_text, otherwise else_text.  The ":else_text" is
# 		  optional, and	if absent, interpolates	the null
# 		  string.  The = may be	replaced with != to negate the
# 		  test.	 To quote any of the metacharacters ('=', '?',
# 		  ':', or ')'),	precede	with a backslash.
# 	  %digit  The digits 1 through 9 interpolate the string
# 		  matched by the nth bracket in	the last pattern match
# 		  that had brackets.  If the last pattern had
# 		  alternatives,	you may	not know the number of the
# 		  bracket you want|%0 will give	you the	last bracket
# 		  matched.
# 
# 	  Modifiers: to	capitalize the first letter, insert '^':
# 	  "%^C"	produces something like	"Net.jokes".  Inserting	'_'
# 	  causes the first letter following the	last '/' to be
# 	  capitalized: "%_c" produces "net/Jokes".
# 
# 	  Inserting '\'	will insert a backslash	before any characters
# 	  that would be	magic in a regular expression:	"%\C" produces
# 	  "net\.jokes".	 This is called	regexp quoting.
#
#--- The End
-----------------chop-with-axe----------------chop-with-axe---------------------
-- 
+--> Filip "I'll buy a vowel" Gieszczykiewicz. |  Best e-mail "fmgst+@pitt.edu"
| If you would like to receive the latest version of the SCI.ELECTRONICS FAQ,
| E-mail me and I will send you the INDEX to confirm address. Feedback Welcome!
| I live for my EE major, Windsurfing, SCA, programming, and assorted dreams.
Re: rn macros - pushing limits?
#6376
Author: Sridhar Venkataraman
Date: Thu, 04 Nov 1993 23:53
27 lines
1588 bytes
fmg@beta.smi.med.pitt.edu (Filip Gieszczykiewicz) writes:

| 	Greetings. I have an .rnmac file with a bunch of macros which
| 	I would like to automate. I keep archives of "useful" articles
| 	in files with short names, sci.electronics -> ele, comp.robotics
| 	-> rob, etc. I have macros for each that determine current
| 	group and save to the appropriate file.

[rest of the posting deleted]

Your solution seems an overkill to me when you could just use

&-ESAVENAME=ele

in the KILL file of sci.electronics (and similarly for other groups) and

X&-ESAVENAME=%C 

in the global KILL file.

You might want to try trn which is a tremendous improvement over rn 4.4.1
you are presently using.

Sridhar.
-- 
Sridhar Venkataraman   ASU, Tempe, Arizona USA   sridhar@asuvax.eas.asu.edu
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