diff options
Diffstat (limited to 'stdio-common/tstscanf.c')
-rw-r--r-- | stdio-common/tstscanf.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/stdio-common/tstscanf.c b/stdio-common/tstscanf.c index 52473cdd8f..85ea70f135 100644 --- a/stdio-common/tstscanf.c +++ b/stdio-common/tstscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 96, 97, 98, 99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -235,5 +235,20 @@ main (int argc, char **argv) } } + fputs ("Test 7:\n", stdout); + { + short a[2] = { -1, -1 }; + int res; + + res = sscanf ("32767 1234", "%hd %hd", &a[0], &a[1]); + printf ("res = %d, a[0] = %d, a[1] = %d\n", res, a[0], a[1]); + + if (res != 2 || a[0] != 32767 || a[1] != 1234) + { + fputs ("test failed!\n", stdout); + result = 1; + } + } + exit (result); } |