about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-18 02:54:32 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-18 02:54:32 +0000
commitbcc86889c775a0f717de272cc270e3b089aa5221 (patch)
tree163b2cdf47ef949fa9c01eb196974ad98cdd4413 /posix
parent9ba96eda70ecf6f86f74580b23fc387d8fd1cd77 (diff)
downloadglibc-bcc86889c775a0f717de272cc270e3b089aa5221.tar.gz
glibc-bcc86889c775a0f717de272cc270e3b089aa5221.tar.xz
glibc-bcc86889c775a0f717de272cc270e3b089aa5221.zip
Update.
2003-09-17  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/generic/wordexp.c (eval_expr_val): Use strtol since we
	have to recognize octal and hexadecimal numbers as well.  Simplify
	function, signs are handled in strtol.
	* posix/wordexp-test.c: Add tests for octal and hexadecimal
	numbers in arithmetic expressions.
Diffstat (limited to 'posix')
-rw-r--r--posix/wordexp-test.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index aca95777a8..db418cedeb 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2001, 2003 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
@@ -109,6 +109,11 @@ struct test_case_struct
     { 0, NULL, "$((-1))", 0, 1, { "-1", }, IFS },
     { 0, NULL, "$[50+20]", 0, 1, { "70", }, IFS },
     { 0, NULL, "$(((2+3)*(4+5)))", 0, 1, { "45", }, IFS },
+    { 0, NULL, "$((010))", 0, 1, { "8" }, IFS },
+    { 0, NULL, "$((0x10))", 0, 1, { "16" }, IFS },
+    { 0, NULL, "$((010+0x10))", 0, 1, { "24" }, IFS },
+    { 0, NULL, "$((-010+0x10))", 0, 1, { "8" }, IFS },
+    { 0, NULL, "$((-0x10+010))", 0, 1, { "-8" }, IFS },
 
     /* Advanced parameter expansion */
     { 0, NULL, "${var:-bar}", 0, 1, { "bar", }, IFS },
@@ -201,6 +206,7 @@ struct test_case_struct
     { WRDE_SYNTAX, NULL, "$(for i in)", 0, 0, { NULL, }, IFS },
     { WRDE_SYNTAX, NULL, "$((2+))", 0, 0, { NULL, }, IFS },
     { WRDE_SYNTAX, NULL, "`", 0, 0, { NULL, }, IFS },
+    { WRDE_SYNTAX, NULL, "$((010+4+))", 0, 0, { NULL }, IFS },
 
     { -1, NULL, NULL, 0, 0, { NULL, }, IFS },
   };