summaryrefslogtreecommitdiff
path: root/src/ar.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2011-11-05 21:08:07 -0700
committerRoland McGrath <roland@hack.frob.com>2011-11-05 21:08:07 -0700
commite5ba2a160bea234b1f38d6e4e7a09ef898017c51 (patch)
treee906a628062ca023550d2212b6c934e74ef225bd /src/ar.c
parent4fa988e13d09465b8ae4f605333fabf39d50fd30 (diff)
downloadelfutils-e5ba2a160bea234b1f38d6e4e7a09ef898017c51.tar.gz
ar: Implement -D.
Diffstat (limited to 'src/ar.c')
-rw-r--r--src/ar.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ar.c b/src/ar.c
index 37d56b64..ce5078e4 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -95,6 +95,8 @@ static const struct argp_option options[] =
{ NULL, 'a', NULL, 0, N_("Insert file after [MEMBER]."), 0 },
{ NULL, 'b', NULL, 0, N_("Insert file before [MEMBER]."), 0 },
{ NULL, 'i', NULL, 0, N_("Same as -b."), 0 },
+ { NULL, 'D', NULL, 0,
+ N_("Use zero for uid, gid, and date in archive members."), 0 },
{ NULL, 'c', NULL, 0, N_("Suppress message when library has to be created."),
0 },
{ NULL, 'P', NULL, 0, N_("Use full path for file matching."), 0 },
@@ -141,6 +143,7 @@ static bool allow_truncate_fname;
static bool force_symtab;
static bool suppress_create_msg;
static bool full_path;
+static bool deterministic_output;
static bool update_newer;
static enum { ipos_none, ipos_before, ipos_after } ipos;
@@ -380,6 +383,10 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
allow_truncate_fname = true;
break;
+ case 'D':
+ deterministic_output = true;
+ break;
+
case 'u':
update_newer = true;
break;
@@ -1295,9 +1302,9 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
found[cnt]->old_off == -1l ? 'a' : 'r', argv[cnt]);
found[cnt]->elf = newelf;
- found[cnt]->sec = newst.st_mtime;
- found[cnt]->uid = newst.st_uid;
- found[cnt]->gid = newst.st_gid;
+ found[cnt]->sec = deterministic_output ? 0 : newst.st_mtime;
+ found[cnt]->uid = deterministic_output ? 0 : newst.st_uid;
+ found[cnt]->gid = deterministic_output ? 0 : newst.st_gid;
found[cnt]->mode = newst.st_mode;
found[cnt]->name = bname;