From owner-freebsd-bugs Tue May 23 09:50:01 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id JAA07417 for bugs-outgoing; Tue, 23 May 1995 09:50:01 -0700 Received: (from gnats@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id JAA07410 ; Tue, 23 May 1995 09:50:00 -0700 Date: Tue, 23 May 1995 09:50:00 -0700 Message-Id: <199505231650.JAA07410@freefall.cdrom.com> From: Bill Fenner Reply-To: Bill Fenner To: freebsd-bugs Subject: bin/436: "file" doesn't print longs right with %d format In-Reply-To: Your message of Tue, 23 May 1995 09:46:17 PDT <199505231646.JAA01278@fenestro.parc.xerox.com> Sender: bugs-owner@FreeBSD.org Precedence: bulk >Number: 436 >Category: bin >Synopsis: "file" doesn't print longs right with %d format >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs (FreeBSD bugs mailing list) >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 23 09:50:00 1995 >Originator: Bill Fenner >Organization: Xerox PARC >Release: FreeBSD 2.1.0-Development i386 >Environment: FreeBSD-2.0 SNAP950412 >Description: The "file" command displays only the least significant byte of a "belong" with the /etc/magic entry >16 belong x %d Hz Example: % hexdump -e '"%07.7_ax " 4/4 "%08X " "\n"' foo.snd | head 0000000 646E732E 80000000 00C0EA03 03000000 0000010 44AC0000 02000000 00000000 00000000 0000020 00000000 00000000 00000000 00000000 Note that the big-endian long at offset 16 is 0xac44, or 44100 Hz. % file foo.snd foo.snd: audio data: 16-bit linear PCM, stereo, 68 Hz Note that 0x44 is 68 Hz. >How-To-Repeat: Run "file" on a sound file and note the sampling rate. 44.1Khz comes out as 68Hz 11Khz comes out as 119Hz 8Khz comes out as 64Hz >Fix: Remove "(unsigned char)" cast from mprint() in softmagic.c. This fixes the long printing and doesn't appear to affect byte/char printing. *** ../file/softmagic.c Sat Sep 3 12:16:22 1994 --- softmagic.c Tue May 23 09:38:13 1995 *************** *** 216,222 **** } v = signextend(m, v) & m->mask; ! (void) printf(m->desc, (unsigned char) v); } /* --- 216,222 ---- } v = signextend(m, v) & m->mask; ! (void) printf(m->desc, v); } /* >Audit-Trail: >Unformatted: