Date: Tue, 23 May 1995 09:50:00 -0700 From: Bill Fenner <fenner@parc.xerox.com> To: freebsd-bugs Subject: bin/436: "file" doesn't print longs right with %d format Message-ID: <199505231650.JAA07410@freefall.cdrom.com> In-Reply-To: Your message of Tue, 23 May 1995 09:46:17 PDT <199505231646.JAA01278@fenestro.parc.xerox.com>
index | next in thread | previous in thread | raw e-mail
>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:
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505231650.JAA07410>
