From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2095 Path: news.gmane.org!not-for-mail From: Lloyd Zusman Newsgroups: gmane.comp.sysutils.supervision.general Subject: [skalibs] =?utf-8?b?bG9uZ19mbXQ=?= fails with =?utf-8?b?Rk1UX0xFTg==?= (was: Why no negative numbers in the =?utf-8?b?Kl9mbXQ=?= routines?) Date: Tue, 7 Jun 2011 12:08:17 +0000 (UTC) Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1307448519 12593 80.91.229.12 (7 Jun 2011 12:08:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Jun 2011 12:08:39 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-2329-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Jun 07 14:08:32 2011 Return-path: Envelope-to: gcsg-supervision@lo.gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1QTv5D-00032d-5n for gcsg-supervision@lo.gmane.org; Tue, 07 Jun 2011 14:08:31 +0200 Original-Received: (qmail 12016 invoked by uid 76); 7 Jun 2011 12:11:09 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 12007 invoked from network); 7 Jun 2011 12:11:09 -0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 207.58.141.216 (Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1) Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2095 Archived-At: Lloyd Zusman asfast.com> writes: > Lloyd Zusman asfast.com> writes: > > > [ ... ] > > the integer-based *_fmt routines do not format negative numbers. > > I'm sorry. I missed long_fmt.c and I misread fmtscan.h. I was getting > errors with negative numbers, and I mistakenly thought that this was > due to int_fmt failing with values < 0. Actually, this problem is due to a bug in long_fmt. It doesn't properly handle the FMT_LEN argument when the value to be formatted is negative. This is evident in the source code: unsigned int long_fmt (char *fmt, long n) { if (n >= 0) return ulong_fmt(fmt, n) ; *fmt++ = '-' ; return 1 + ulong_fmt(fmt, -n) ; } This should be changed as follows: unsigned int long_fmt (char *fmt, long n) { if (n >= 0) return ulong_fmt(fmt, n) ; if (fmt != 0) *fmt++ = '-' ; return 1 + ulong_fmt(fmt, -n) ; } -- Lloyd Zusman ljz@asfast.com God bless you.