1 /* Options common to ar and ranlib.
2 Copyright (C) 2012 Red Hat, Inc.
3 This file is part of elfutils.
5 This file is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 elfutils is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 bool arlib_deterministic_output = DEFAULT_AR_DETERMINISTIC;
29 static const struct argp_option options[] =
32 N_("Use zero for uid, gid, and date in archive members."), 0 },
34 N_("Use actual uid, gid, and date in archive members."), 0 },
36 { NULL, 0, NULL, 0, NULL, 0 }
40 parse_opt (int key, char *arg __attribute__ ((unused)),
41 struct argp_state *state __attribute__ ((unused)))
46 arlib_deterministic_output = true;
50 arlib_deterministic_output = false;
54 return ARGP_ERR_UNKNOWN;
60 help_filter (int key, const char *text, void *input __attribute__ ((unused)))
62 inline char *text_for_default (void)
65 if (unlikely (asprintf (&new_text, gettext ("%s (default)"), text) < 0))
73 if (DEFAULT_AR_DETERMINISTIC)
74 return text_for_default ();
77 if (! DEFAULT_AR_DETERMINISTIC)
78 return text_for_default ();
85 static const struct argp argp =
87 options, parse_opt, NULL, NULL, NULL, help_filter, NULL
90 const struct argp_child arlib_argp_children[] =