groff
[Top][All Lists]
Advanced

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

Re: [Groff] Displaying man pages on Win32


From: Keith Marshall
Subject: Re: [Groff] Displaying man pages on Win32
Date: Mon, 26 Jul 2004 19:59:38 +0100

On Friday 04 June 2004 6:38 pm, Werner LEMBERG wrote:
> > It works a treat, except for one minor niggle -- when reading any
> > comparatively large man page (groff.1 is big enough), and I quit
> > from less without reading to the end, then grotty complains ...
> > [...]
> >
> > What do you think of the idea of adding an option to grotty, perhaps
> > specific to the Win32 build, which would cause it to silently clean
> > up and exit, when this specific I/O error is encountered?
>
> Fine with me.  Please go the usual route: Define a macro in
> nonposix.h which expands to something only for the Win32 build.

My first thought was to add a command line option, which would permit 
selectively disabling the error message.  Having investigated further, I now 
belive a more transparent solution may be possible.

The error message emanates from the destructor for the printer object, in 
libdriver/printer.cpp, when any previous error has been detected on stdout, 
or a fflush of stdout fails.  In the specific instance of a fflush into a 
broken pipe, the MSVCRT implementation of fflush sets errno to EINVAL -- a 
value which should not normally occur in this situation;  (it should be 
EPIPE, but Microsoft don't seem to ever use that particular code).

I have developed a trial patch, (attached), which seems to achieve the 
desired effect.  I have not used nonposix.h, since a) libdriver/printer.cpp 
doesn't actually include it at present, and b) my proposed solution adds a 
locally defined static function to printer.cpp, in a single conditionally 
compiled block, for the Win32 case; this would be difficult to implement as a 
nonposix.h macro.

IMO, this is the neatest way to implement this.  However, if you still 
prefer the nonposix.h route, then I could add the new function, defined in 
its own file, as an additional public symbol in libdriver.a, with appropriate 
definitions in nonposix.h, to cause it to be linked only for the Win32 case,
or alternatively, define the conditional code block in a different (new) 
include file, to be included by printer.cpp alone.

Best regards,
Keith.

Attachment: printer.patch.bz2
Description: BZip2 compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]