Re: FVWM: Make fvwm-root read from stdin?

From: Dan Espen <dane_at_mk.telcordia.com>
Date: Fri, 03 Jun 2005 13:44:44 -0400

"Mark A. Nicolosi" <m.a.nicolosi_at_att.net> writes:
> On Fri, 2005-06-03 at 10:58 -0400, Dan Espen wrote:
> > I don't think it's a bug.
> >
> > If you use strace to follow what goes on, Fvwm first checks
> > to see if the file is an XPM file. It does that by reading
> > the first 4K of the file:
> >
> > open("/dev/stdin", O_RDONLY) = 4
> > read(4, "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\1_at_\0\0\0\360\10\2\0\0"..., 4096)
> = 4096
> > close(4) = 0
> >
> > Since the file is PNG, that fails and it then tries XPM:
> >
> > open("/dev/stdin", O_RDONLY) = 4
> > read(4, "\350\362\201\217\24W\2425_\7 \365T\316rV\267\331\f\30\274"..., 409
> 6) = 4096
> > close(4) = 0
> >
> > That fails too, since the first 4K of stdin has already been read.
> > Notice how the input data is different.
> >
> > The problem is that /dev/stdin is a FIFO, once you read it, you can't
> > close it and expect to read the same thing again.
> >
> > If you use convert to change the file to an XPM, fvwm-root HAPPENS to
> > work, but that's just because right now it tries XPM first.
>
> That makes perfect sense, thanks. Yeah, converting to an xpm does work.
> Just out of curiosity why is the file closed and reopened if it isn't an
> xpm? Couldn't that buffer be reused when testing if it's a png?

Respond to the list please.

The file is opened and closed by the respective libraries.

Fvwm just passes the filename to libxpm, then libxpm opens and reads
the file. If that fails, Fvwm then passes the file to libpng.

The only exception is when the file has an extension, then it passes
the file to the corresponding library first, if that fails, it tries the
other libraries.

In no case does Fvwm read the file and buffer it anywhere.

-- 
Dan Espen                           E-mail: dane_at_mk.telcordia.com
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Fri Jun 03 2005 - 12:45:48 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:57 BST