summaryrefslogtreecommitdiffstats
path: root/src/arlib-argp.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2012-01-20 11:40:59 -0800
committerRoland McGrath <[email protected]>2012-01-20 11:40:59 -0800
commit8592478d3bd1a021c0b51ace768b8ef944b13cf1 (patch)
treedd51295226734916ae5e3fd295130442b29d62c3 /src/arlib-argp.c
parentb8ff18e0e8b8631fcc449cbd5a1ceba3f4a73e0d (diff)
Support -D in ranlib as in ar.
Diffstat (limited to 'src/arlib-argp.c')
-rw-r--r--src/arlib-argp.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/arlib-argp.c b/src/arlib-argp.c
new file mode 100644
index 00000000..af19a255
--- /dev/null
+++ b/src/arlib-argp.c
@@ -0,0 +1,67 @@
+/* Options common to ar and ranlib.
+ Copyright (C) 2012 Red Hat, Inc.
+
+ Red Hat elfutils is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by the
+ Free Software Foundation; version 2 of the License.
+
+ Red Hat elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <argp.h>
+#include "arlib.h"
+
+bool arlib_deterministic_output;
+
+static const struct argp_option options[] =
+ {
+ { NULL, 'D', NULL, 0,
+ N_("Use zero for uid, gid, and date in archive members."), 0 },
+
+ { NULL, 0, NULL, 0, NULL, 0 }
+ };
+
+static error_t
+parse_opt (int key, char *arg __attribute__ ((unused)),
+ struct argp_state *state __attribute__ ((unused)))
+{
+ switch (key)
+ {
+ case 'D':
+ arlib_deterministic_output = true;
+ break;
+
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+ return 0;
+}
+
+static const struct argp argp =
+ {
+ options, parse_opt, NULL, NULL, NULL, NULL, NULL
+ };
+
+const struct argp_child arlib_argp_children[] =
+ {
+ { &argp, 0, "", 2 },
+ { NULL, }
+ };