diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /string/bug-envz1.c | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-zack/build-layout-experiment.tar glibc-zack/build-layout-experiment.tar.gz glibc-zack/build-layout-experiment.tar.bz2 glibc-zack/build-layout-experiment.zip |
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage
directory, REORG.TODO, except for files that will certainly still
exist in their current form at top level when we're done (COPYING,
COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which
are moved to the new directory OldChangeLogs, instead), and the
generated file INSTALL (which is just deleted; in the new order, there
will be no generated files checked into version control).
Diffstat (limited to 'string/bug-envz1.c')
-rw-r--r-- | string/bug-envz1.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/string/bug-envz1.c b/string/bug-envz1.c deleted file mode 100644 index 931a0559fe..0000000000 --- a/string/bug-envz1.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Test for bug BZ #2703. */ -#include <stdio.h> -#include <envz.h> -#include <stdlib.h> -#include <string.h> - -static const struct -{ - const char *s; - int in_result; -} strs[] = -{ - { "a=1", 1 }, - { "b=2", 1 }, - { "(*)", 0 }, - { "(*)", 0 }, - { "e=5", 1 }, - { "f=", 1 }, - { "(*)", 0 }, - { "h=8", 1 }, - { "i=9", 1 }, - { "j", 0 } -}; - -#define nstrs (sizeof (strs) / sizeof (strs[0])) - - -int -do_test (void) -{ - - size_t size = 0; - char *str = malloc (100); - if (str == NULL) - { - puts ("out of memory"); - return 1; - } - - char **argz = &str; - - for (int i = 0; i < nstrs; ++i) - argz_add_sep (argz, &size, strs[i].s, '\0'); - - printf ("calling envz_strip with size=%zu\n", size); - envz_strip (argz, &size); - - int result = 0; - printf ("new size=%zu\n", size); - for (int i = 0; i < nstrs; ++i) - if (strs[i].in_result) - { - char name[2]; - name[0] = strs[i].s[0]; - name[1] = '\0'; - - char *e = envz_entry (*argz, size, name); - if (e == NULL) - { - printf ("entry '%s' not found\n", name); - result = 1; - } - else if (strcmp (e, strs[i].s) != 0) - { - printf ("entry '%s' does not match: is '%s', expected '%s'\n", - name, e, strs[i].s); - result = 1; - } - } - - free (*argz); - return result; -} - -#include <support/test-driver.c> |