Joerg Arndt on Sat, 11 Jun 2016 17:08:02 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: annoying symbols in logfiles |
I suggest to use isatty() in the pari code to detect whether the output is actually a terminal. If not a terminal, then the escape sequences should be dropped. This is the behavior of many programs offering colorized output, e.g., non-ancient versions of grep. Best regards, Joerg Arndt * Karim Belabas <Karim.Belabas@math.u-bordeaux.fr> [Jun 11. 2016 08:38]: > * Vasily Golyshev [2016-06-10 18:50]: > > here's how Pari logs the session in a log file > > on my fresh install from .deb: > > > > GP/PARI CALCULATOR Version 2.5.5 (released) > > amd64 running linux (x86-64/GMP-5.1.2 kernel) 64-bit version > > compiled: Sep 30 2013, gcc-4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu4) > > (readline v6.3 enabled [was v6.2 in Configure], extended help enabled) > > > > > > [0;33m ? [0;34m fi=zetakinit(y^2+3); > > These are ANSI escape sequences used to change font colour in gp's > terminal (and which some editors or plain 'cat' are able to render when > viewing the logfile). Color 3, then ?, then color 4 [ by default, this > should print a yellowish question mark, then the rest of the line in > blue ]. > > > [0;33m ? [0;34m ze=zetak(fi,3)/zeta(3) > > %77 = 0.88402381175007985674305791687101180775 > > > > How can one get rid of the extra symbols? Should I recompile using > > Configure/Make? > > 1) This was fixed in release 2.7.0 (04/2013), any later version should be fine > (current stable version is 2.7.5). > > 2) Something that will work in all versions is to set the 'colors' > default so that it leaves "prompt" and "input line" alone, see ??colors > [ I use black for these two ] > > My advice is to upgrade :-) > > Cheers, > > K.B. > -- > Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 > Universite de Bordeaux Fax: (+33) (0)5 40 00 69 50 > 351, cours de la Liberation http://www.math.u-bordeaux.fr/~kbelabas/ > F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP] > `