diff -Nru /tmp/odkEidOf1S/cln-1.1.13/debian/changelog /tmp/f0rAR3Mz7O/cln-1.1.13/debian/changelog --- /tmp/odkEidOf1S/cln-1.1.13/debian/changelog 2007-10-04 19:00:31.000000000 -0400 +++ /tmp/f0rAR3Mz7O/cln-1.1.13/debian/changelog 2007-10-04 19:00:32.000000000 -0400 @@ -1,3 +1,12 @@ +cln (1.1.13-2ubuntu1) gutsy; urgency=low + + * Fix "pi" example program so that only the specified number of digits is + printed. (LP: #128851) + * Change Maintainer to Ubuntu MOTU Developers per DebianMaintainerField + spec. + + -- Andy Matteson Thu, 04 Oct 2007 16:08:33 -0400 + cln (1.1.13-2) unstable; urgency=low * Apply workaround for m68k build failure; closes: #388000. diff -Nru /tmp/odkEidOf1S/cln-1.1.13/debian/control /tmp/f0rAR3Mz7O/cln-1.1.13/debian/control --- /tmp/odkEidOf1S/cln-1.1.13/debian/control 2007-10-04 19:00:31.000000000 -0400 +++ /tmp/f0rAR3Mz7O/cln-1.1.13/debian/control 2007-10-04 19:00:32.000000000 -0400 @@ -1,6 +1,7 @@ Source: cln Priority: optional -Maintainer: Richard Kreckel +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Richard Kreckel Standards-Version: 3.6.2 Build-Depends: debhelper (>= 4.0.0), libgmp3-dev diff -Nru /tmp/odkEidOf1S/cln-1.1.13/examples/pi.cc /tmp/f0rAR3Mz7O/cln-1.1.13/examples/pi.cc --- /tmp/odkEidOf1S/cln-1.1.13/examples/pi.cc 2004-06-23 17:11:21.000000000 -0400 +++ /tmp/f0rAR3Mz7O/cln-1.1.13/examples/pi.cc 2007-10-04 19:00:32.000000000 -0400 @@ -6,6 +6,7 @@ #include #include #include +#include using namespace std; using namespace cln; @@ -23,7 +24,7 @@ int main (int argc, char * argv[]) { - int digits = 100; + long digits = 100; if (argc > 1) { if (argc == 2 && !strcmp(argv[1],"--help")) { usage(cout); @@ -33,7 +34,7 @@ cout << "pi (cln) " << CL_VERSION_MAJOR << "." << CL_VERSION_MINOR << endl; cout << "Written by Bruno Haible." << endl; cout << endl; - cout << "Copyright (C) 1998-2001 Bruno Haible." << endl; + cout << "Copyright (C) 1998-2007 Bruno Haible, 2000-2007 Richard B. Kreckel." << endl; cout << "This is free software; see the source for copying conditions. There is NO" << endl; cout << "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." << endl; cout << endl; @@ -46,20 +47,31 @@ return 0; } if (argc == 2 && isdigit(argv[1][0])) { - digits = atoi(argv[1]); + digits = atol(argv[1]); } else { usage(cerr); return 1; } } - - cl_F p = pi(float_format(digits)); - // make CLN believe this number has default_float_format to suppress - // exponent marker which would be quite boring for 3.1416... - cl_print_flags cpf; - cpf.default_float_format = float_format(p); - print_real(cout, cpf, p); + + if (digits) { + cl_F p = pi(float_format(digits)); + // make CLN believe this number has default_float_format to suppress + // exponent marker which would be quite boring for 3.1416... + cl_print_flags cpf; + cpf.default_float_format = float_format(p); + // We cannot print directly because people get dazed and confused + // when they see gratuitous digits (Debian Bug #286266.) And we + // must not "fix" the output routine because print-read consistency + // is at stake. As a workaround, print into a buffer so we can chop + // off characters from its end. + stringstream buf; + print_real(buf, cpf, p); + istreambuf_iterator i = buf.rdbuf(); + while (--digits+2>0) + cout << *(i++); + } cout << endl; - + return 0; }