| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | hot prices |
On Jun 03, 1996 at 22:58, Bill Grimsley of 3:640/305.9 wrote:
BL>> Poor Rod. Not only can't he write his AWK quoter, but he can't
BL>> even set up a reader properly.
Did someone mention an Awk quoter?!?!
#! /usr/bin/gawk -f
#
# $Id: quoter.awk,v 1.1 1996/06/05 13:01:14 david Exp $
#
# Name: Rod's Midnight Fido Quoter (on the cheap)
# Auth: David J. N. Begley
# Lang: GNU Awk (Slackware Linux)
# Desc: Using a simple automaton, act as a filter to process an input
# Fidonet message and "quote" it, stripping out control lines,
# the first tear line/origin line combination we find, plus
# everything following it. If someone has screwed up their
# tear/origin line combo, we make no attempt to fix it because
# Paul has far superior code running on his system to handle this.
#
# State 0: Looking for tear line.
# State 1: Found tear line, origin line must immediately follow.
#
# Environment variables:
#
# QSEND Sender's full name (default, script author's name).
# QRECV Receiver's full name (default, "(unknown)" string).
# QINIT Sender's initials (default, "db" - no more than 5 chars).
# QRLIM Right-hand limit for wrapping (no less than 50 chars).
#
# Didn't I mention that we also do right margin wrapping? Oh dear...
#
# ASSUMPTION: Calling application must convert leading ^A characters
# (ASCII 0x01) to the at-sign (viz., "{at}") - no line should begin
# with an at-sign in that case. You have lines that begin with
# at-signs? Tough!
#
# $Log: quoter.awk,v $
# Revision 1.1 1996/06/05 13:01:14 david
# Initial revision
#
# Ptrn: BEGIN (Initialisation)
# Desc: Setup variables and write out attribution.
BEGIN {
Qscan = 0
Qsend = ENVIRON["QSEND"]
Qrecv = ENVIRON["QRECV"]
Qinit = ENVIRON["QINIT"]
Qrlim = ENVIRON["QRLIM"]
if( Qsend == "" )
Qsend = "david begley"
if( Qrecv == "" )
Qrecv = "(unknown)"
if( Qinit == "" )
Qinit = "db"
if( length(Qinit) > 5 )
Qinit = substr( Qinit, 1, 5 )
if( Qrlim < 50 )
Qrlim = 50
printf( "%s wrote:\n\n", Qrecv )
}
# Ptrn: Kludge Lines
# Desc: Strip 'em.
/^{at}/ {
next
}
# Ptrn: Tear Lines
# Desc: Record 'em, move on to the next automaton state.
(/^\-\-\-$/ || /^\-\-\- /) && (Qscan == 0) {
Qscan = 1
Qtear = $0
next
}
# Ptrn: Origin Lines
# Desc: If it immediately follows a tear line, end processing here; if
# something else appears, then write out the tear line and whatever
# has appeared, reset to the previous automaton state and start
# looking for the tear line all over again.
(/^ \* Origin:/) && (Qscan == 1) {
exit
}
(! /^ \* Origin:/) && (Qscan == 1) {
Qscan = 0
Qline(Qtear)
}
# Ptrn: All Normal Lines
# Desc: Process (write out) line, complete with wrapping and quoting.
Qscan == 0 {
Qline($0)
}
# Ptrn: Magic Marker Function
# Desc: Quote/wrap/write lines.
function Qline(LINE) {
if( (length(LINE) + length(Qinit) + 3) > Qrlim )
{
Qsize = Qrlim - (length(Qinit) + 3)
while( length(LINE) > Qsize )
{
printf( " %s> %s\n", Qinit, substr( LINE, 1, Qsize ) )
LINE = substr( LINE, Qsize + 1 )
}
if( length(LINE) )
printf( " %s> %s\n", Qinit, LINE )
}
else
printf( " %s> %s\n", Qinit, LINE )
}
# $Id: quoter.awk,v 1.1 1996/06/05 13:01:14 david Exp $
BG> Which is presumably the reason that, like you, he owns a dog...
Hey, I resemble that remark! (And my Awk quoter works.)
- dave
d.begley{at}ieee.org
---
* Origin: [ epicentre of the universe -- sydney australia ] (3:711/934.4)SEEN-BY: 711/934 @PATH: 711/934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.