🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Robert Brown Fri, 28 Aug 1992 13:29
filtering the response
#332
Author: Robert Brown
Date: Fri, 28 Aug 1992 13:29
21 lines
1297 bytes
I asked this question long ago, but I don't think it ever actually got
posted...

I'd like to be able to specify a filter of some sort that filters the
message that I'm responding to before it gets "autoinclude"d.  I would
prefer that this filter be an executeable that I can specify, perhaps
through a variable.

The reason I want to do this is to filter tabs into spaces because the
tabs get all messed up once they get the indent_str is put onto the
beginning of each line.

Does anyone know how I can do this?  Is this possible with the current
mush?  If it is not possible, has anyone implemented something like
this?
-- 
Robert Brown			   Work address: BARRA
UUCP: ...!uupsi!barra!robertb			 1995 University Ave. Suite 400
Arpa: robertb@corwin.barra.com			 Berkeley, CA 94704
						 (510) 548-5442
Re: filtering the response
#337
Author: Jesse Buckley
Date: Fri, 04 Sep 1992 18:22
71 lines
2362 bytes
In article <1992Aug28.132940.25322@corwin.barra.com> robertb@BARRA.COM (Robert Brown) writes:
>
>I asked this question long ago, but I don't think it ever actually got
>posted...
>
>I'd like to be able to specify a filter of some sort that filters the
>message that I'm responding to before it gets "autoinclude"d.  I would
>prefer that this filter be an executeable that I can specify, perhaps
>through a variable.
>
>The reason I want to do this is to filter tabs into spaces because the
>tabs get all messed up once they get the indent_str is put onto the
>beginning of each line.
>
>Does anyone know how I can do this?  Is this possible with the current
>mush?  If it is not possible, has anyone implemented something like
>this?

With perl all things are possible.  =)

Set your editor to detabed.  Don't forget this is a hack...

#! /usr/local/bin/perl
#
# Author: Jesse R. Buckley, Jr. (buck@sunyit.edu NIC:JRB69)
#
# detabed -- A quick hack to use tabs the right way...
#
# Useage: detabed file prefix
#

$TEMP	= "$ENV{'HOME'}/.mushtmp$$";
$FILE	= $ARGV[0];
$EDITOR = $ENV{'EDITOR'} || "/usr/ucb/vi";

$prefix= $ARGV[1] || '} ';	# The stuff in the 'quotes' 
				# is the default prefix.
open(IN,"$FILE");
open(OUT,">$TEMP");

$prelen = length($prefix);
while(<IN>)
{

    if (/^$prefix/o)
    {


	$_ = substr($_,$prelen);
	# This is taken verbatim from the Camel book.
        1 while s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
	print OUT "$prefix$_";

    }
    else
    {
        print OUT;
    }

}
close(OUT);
system("cp $TEMP $FILE");
system("rm -f $TEMP");
system("$EDITOR $FILE");


-- 
=) Buck (buck@sunyit.edu)
"There are some micro-organisms that exhibit characteristics of both plants
and animals.  When exposed to light they undergo photosynthesis; and when the
lights go out, they turn into animals.  But then again, don't we all?"
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