Using "%x" on negative hex numbers has the same problem as "%i" mentioned

in lib/21691.  Add a test for that too.
This commit is contained in:
simonb 2003-06-02 01:45:01 +00:00
parent 158e4448b0
commit 8e2ea41dff

View File

@ -1,4 +1,4 @@
/* $NetBSD: scanf.c,v 1.1 2003/05/30 12:46:06 simonb Exp $ */
/* $NetBSD: scanf.c,v 1.2 2003/06/02 01:45:01 simonb Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -56,5 +56,14 @@ main(int argc, char **argv)
errx(1, "want %d, got %d", NUM, i);
assert(i == NUM);
/*
* "%x" has the same problem as "%i" in lib/21691.
*/
sscanf(STRNUM, "%x", &i);
if (i != NUM)
errx(1, "want %d, got %d", NUM, i);
assert(i == NUM);
return (0);
}