From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sat, 27 Feb 2010 20:59:39 -0500 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <2dfd9898fe7656a885285032d9727684@ladd.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] seq with hex, octal formats Topicbox-Message-UUID: dcf76484-ead5-11e9-9d60-3106f5b1d025 very nice! one problem, ifmt can crash with the argument -f %g. fomatting %g will mean that !running to be true when calling ifmt, thus ifmt will try to va_arg a double cast to vlong when formatting an integer: /sys/src/libc/fmt/fltfmt.c:136: sprint(s1+NSIGNIF, "e%d", e-NSIGNIF+1); /sys/src/libc/fmt/fltfmt.c:142: sprint(s1+NSIGNIF, "e%d", e-NSIGNIF+1); /sys/src/libc/fmt/fltfmt.c:155: sprint(s1+NSIGNIF, "e%d", e-NSIGNIF+1); (actually, on testing, this version spins rather than crashes on plan 9: ; ps -a | grep 1308769 quanstro 1308769 1:30 0:00 28K Running 8.seqrsc -f %g 1 5 ) using awk is still faster, and more fundamentally, avoids crashing on bogus formats like %g%g. (also, -w doesn't work with either version with a %x format because 'e' is a valid hex digit and not an exponent.) - erik