[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hurd translator

On Fri, Dec 07, 2001 at 12:53:26PM +0100, Alfred M. Szmidt wrote:
> * Oystein Viggen writes:
> > Can /hurd/exec perhaps be used as a passive translator in this way?
> > I don't currently have access to a Hurd, so I'm unable to check.
> > I believe this would be more generally useful than the "tr
> > translator", but perhaps general usefulness was not as much a goal
> > as just playing around with writing a translator?
> Marcus Brinkmann wrote an translator that does that, or at least something
> very similar a while ago, but as Marcus said, it's not for production use. [1]

Right, the run translator.  I will probably rework it in a couple of months
and finish it, but if someone else wants to have a go, I'd welcome that.

In general, filter like programs can either be applied to a specific file,
or they could also be applied to the input on the file port.

fd = open ("/tmp/my-tr-trans", O_RDWR);
write (fd, "hallo\n", 7);
read (f, buf, 7);
printf ("%s", buf);

would print "HALLO" on a line by itself.  The idea is that you use something
that is like a named pipe or fifo, but place a program inbetween. ;)

This is not something that can be done this way in Unix, so a program would
not expect it to work the way it is written above, so in the Unix world this
is not a useful feature to have.  But a small stand alone program "filter" that
writes stdin to a file and reads from the file and writes to stdout could make
it useful on the program line in form of a pipe:
cat /etc/passwd | filter /tmp/my-tr-trans | cat

This is not simpler than simply using a pipe and the program directly, so I
am not yet sure what would be the gain of this feature.  If anyone has a
good idea where it would be useful, let me know. ;)  Maybe some extension of
the run translator can make this useful.


`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org

Reply to: