mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 02:03:35 +08:00
Handle -- on getconf command line.
This commit is contained in:
parent
0549ce8ec1
commit
02bf610ca8
@ -1,3 +1,7 @@
|
||||
2009-09-09 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* posix/getconf.c (main): Handle -- on command line.
|
||||
|
||||
2009-09-05 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* configure.in: Support binutils 2.100 and 3.0.
|
||||
|
@ -1239,13 +1239,17 @@ environment SPEC.\n\n"));
|
||||
usage ();
|
||||
}
|
||||
|
||||
if (argc < 2 || argc > 3)
|
||||
int ai = 1;
|
||||
if (argc > ai && strcmp (argv[ai], "--") == 0)
|
||||
++ai;
|
||||
|
||||
if (argc - ai < 1 || argc - ai > 2)
|
||||
usage ();
|
||||
|
||||
for (c = vars; c->name != NULL; ++c)
|
||||
if (strcmp (c->name, argv[1]) == 0
|
||||
if (strcmp (c->name, argv[ai]) == 0
|
||||
|| (strncmp (c->name, "_POSIX_", 7) == 0
|
||||
&& strcmp (c->name + 7, argv[1]) == 0))
|
||||
&& strcmp (c->name + 7, argv[ai]) == 0))
|
||||
{
|
||||
long int value;
|
||||
size_t clen;
|
||||
@ -1253,14 +1257,14 @@ environment SPEC.\n\n"));
|
||||
switch (c->call)
|
||||
{
|
||||
case PATHCONF:
|
||||
if (argc < 3)
|
||||
if (argc - ai < 2)
|
||||
usage ();
|
||||
errno = 0;
|
||||
value = pathconf (argv[2], c->call_name);
|
||||
value = pathconf (argv[ai + 1], c->call_name);
|
||||
if (value == -1)
|
||||
{
|
||||
if (errno)
|
||||
error (3, errno, "pathconf: %s", argv[2]);
|
||||
error (3, errno, "pathconf: %s", argv[ai + 1]);
|
||||
else
|
||||
puts (_("undefined"));
|
||||
}
|
||||
@ -1269,7 +1273,7 @@ environment SPEC.\n\n"));
|
||||
exit (0);
|
||||
|
||||
case SYSCONF:
|
||||
if (argc > 2)
|
||||
if (argc - ai > 1)
|
||||
usage ();
|
||||
value = sysconf (c->call_name);
|
||||
if (value == -1l)
|
||||
@ -1285,7 +1289,7 @@ environment SPEC.\n\n"));
|
||||
exit (0);
|
||||
|
||||
case CONFSTR:
|
||||
if (argc > 2)
|
||||
if (argc - ai > 1)
|
||||
usage ();
|
||||
clen = confstr (c->call_name, (char *) NULL, 0);
|
||||
cvalue = (char *) malloc (clen);
|
||||
@ -1300,7 +1304,7 @@ environment SPEC.\n\n"));
|
||||
}
|
||||
}
|
||||
|
||||
error (2, 0, _("Unrecognized variable `%s'"), argv[1]);
|
||||
error (2, 0, _("Unrecognized variable `%s'"), argv[ai]);
|
||||
/* NOTREACHED */
|
||||
return 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user