On Tue, 01 Dec 2009, Szak�ts Viktor wrote: > > I'm also not a fun of breaking the line to 79 columns especially when > > output is redirected because it makes output parsing much harder but I can > > leave with it. It would be nice to make: > > hbmk2 -info ... | grep "^hbmk2:" > > and catch only and _full_ hbmk2 messages but in this it's not important > > enough for me to discuss about it. > If you have any suggestion how to solve that, pls tell, > maybe it's possible to detect redirection and adjust col > limit accordingly?
In *nixes we can check if output is TTY device. If not then we it's redirected to sth else, i.e. pipe, file, socket. In filesys.c hb_fsIsDevice() function can be used for it and in *nixes it will work as we want but I do not know how it will work in MS-Windows with different shells (i.e. CMD.EXE and MSys) for different redirecting types (pipe (|) or file (>)). We should make some tests. Also in OS/2 for GCC and OpenWatcom builds. This code can be used for tests: proc main() ? "0:", HB_FISDEVICE( 0 ) ? "1:", HB_FISDEVICE( 1 ) ? "2:", HB_FISDEVICE( 2 ) return #pragma begindump #include "hbapifs.h" HB_FUNC( HB_FISDEVICE ) { hb_retl( hb_fsIsDevice( hb_numToHandle( hb_parnint( 1 ) ) ) ); } #pragma enddump > > If you can also replace all hb_osNewLine() used in output with some macro > > like: > > #define OUT_EOL hb_osNewLine() > > then later we can easy switch to OS level EOL translation by adding: > > hb_osTextOutputMode( .T. ) // or any other name you may suggest > How about this: > hb_osOutputMode( FD_TEXT ) > Or: > hb_osOutputTextMode( .T. ) Oops. I've forgot that FD_* constants are in .ch file for CL53 FSETDEVMOD() functions so we already have everything in core code so please simply add: FSETDEVMOD( 1, FD_TEXT ) FSETDEVMOD( 2, FD_TEXT ) or if you want to make it in more generic way which will work also for multi GT output (i.e. with some code which allocates many different GTCGI drivers with different redirection) then make: FSETDEVMOD( hb_gtInfo( HB_GTI_OUTPUTFD ), FD_TEXT ) FSETDEVMOD( hb_gtInfo( HB_GTI_ERRORFD ), FD_TEXT ) > > and changing this macro to: > > #define OUT_EOL Chr( 10 ) > > what will resolve the stairs effect problem in output from embedded > > Harbour compiler. > That's okay, I'll change it when the core function > is in place. Thank you very much. best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour