1 After applying this patch and running configure, you MUST run this
7 --- orig/batch.c 2005-04-09 18:00:28
8 +++ batch.c 2004-07-03 20:15:41
9 @@ -208,6 +208,8 @@ void show_flist(int index, struct file_s
10 rprintf(FINFO, "flist->flags=%#x\n", fptr[i]->flags);
11 rprintf(FINFO, "flist->modtime=%#lx\n",
12 (long unsigned) fptr[i]->modtime);
13 + rprintf(FINFO, "flist->atime=%#lx\n",
14 + (long unsigned) fptr[i]->atime);
15 rprintf(FINFO, "flist->length=%.0f\n",
16 (double) fptr[i]->length);
17 rprintf(FINFO, "flist->mode=%#o\n", (int) fptr[i]->mode);
18 --- orig/flist.c 2005-07-27 23:31:12
19 +++ flist.c 2005-07-28 00:16:34
20 @@ -50,6 +50,7 @@ extern int preserve_perms;
21 extern int preserve_devices;
22 extern int preserve_uid;
23 extern int preserve_gid;
24 +extern int preserve_atimes;
25 extern int relative_paths;
26 extern int implied_dirs;
27 extern int copy_links;
28 @@ -141,16 +142,18 @@ static void list_file_entry(struct file_
31 if (preserve_links && S_ISLNK(f->mode)) {
32 - rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
33 + rprintf(FINFO, "%s %11.0f %s %s %s -> %s\n",
35 (double)f->length, timestring(f->modtime),
36 + timestring(f->atime),
37 safe_fname(f_name(f)), safe_fname(f->u.link));
41 - rprintf(FINFO, "%s %11.0f %s %s\n",
42 + rprintf(FINFO, "%s %11.0f %s %s %s\n",
44 (double)f->length, timestring(f->modtime),
45 + timestring(f->atime),
46 safe_fname(f_name(f)));
49 @@ -314,6 +317,7 @@ void send_file_entry(struct file_struct
52 static time_t modtime;
53 + static time_t atime;
57 @@ -329,7 +333,7 @@ void send_file_entry(struct file_struct
61 - modtime = 0, mode = 0;
62 + modtime = 0, atime = 0, mode = 0;
63 dev = 0, rdev = makedev(0, 0);
66 @@ -378,6 +382,12 @@ void send_file_entry(struct file_struct
67 flags |= XMIT_SAME_TIME;
69 modtime = file->modtime;
70 + if (preserve_atimes && !S_ISDIR(mode)) {
71 + if (file->atime == atime)
72 + flags |= XMIT_SAME_ATIME;
74 + atime = file->atime;
77 #ifdef SUPPORT_HARD_LINKS
78 if (file->link_u.idev) {
79 @@ -433,6 +443,8 @@ void send_file_entry(struct file_struct
80 write_int(f, modtime);
81 if (!(flags & XMIT_SAME_MODE))
82 write_int(f, to_wire_mode(mode));
83 + if (preserve_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME))
84 + write_int(f, atime);
85 if (preserve_uid && !(flags & XMIT_SAME_UID)) {
88 @@ -506,6 +518,7 @@ static struct file_struct *receive_file_
89 unsigned short flags, int f)
91 static time_t modtime;
92 + static time_t atime;
96 @@ -524,7 +537,7 @@ static struct file_struct *receive_file_
97 struct file_struct *file;
100 - modtime = 0, mode = 0;
101 + modtime = 0, atime = 0, mode = 0;
102 dev = 0, rdev = makedev(0, 0);
105 @@ -580,6 +593,8 @@ static struct file_struct *receive_file_
106 modtime = (time_t)read_int(f);
107 if (!(flags & XMIT_SAME_MODE))
108 mode = from_wire_mode(read_int(f));
109 + if (preserve_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME))
110 + atime = (time_t)read_int(f);
112 if (preserve_uid && !(flags & XMIT_SAME_UID))
113 uid = (uid_t)read_int(f);
114 @@ -630,6 +645,7 @@ static struct file_struct *receive_file_
117 file->modtime = modtime;
118 + file->atime = atime;
119 file->length = file_length;
122 @@ -882,6 +898,7 @@ skip_filters:
125 file->modtime = st.st_mtime;
126 + file->atime = st.st_atime;
127 file->length = st.st_size;
128 file->mode = st.st_mode;
129 file->uid = st.st_uid;
130 --- orig/generator.c 2005-07-27 23:31:12
131 +++ generator.c 2005-07-28 00:14:43
132 @@ -44,6 +44,7 @@ extern int preserve_uid;
133 extern int preserve_gid;
134 extern int preserve_times;
135 extern int omit_dir_times;
136 +extern int preserve_atimes;
137 extern int delete_before;
138 extern int delete_during;
139 extern int delete_after;
140 @@ -323,9 +324,21 @@ void itemize(struct file_struct *file, i
141 : S_ISDIR(file->mode) ? !omit_dir_times
142 : !S_ISLNK(file->mode);
144 + if (iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
145 + && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname)) {
146 + iflags |= ITEM_REPORT_TIME;
147 + if (!preserve_atimes && !S_ISDIR(file->mode))
148 + iflags |= ITEM_REPORT_ATIME;
150 + if (keep_time && cmp_time(file->modtime, st->st_mtime) != 0)
151 + iflags |= ITEM_REPORT_TIME;
152 + if (preserve_atimes && !S_ISDIR(file->mode)
153 + && cmp_time(file->atime, st->st_atime) != 0)
154 + iflags |= ITEM_REPORT_ATIME;
156 if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
157 && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
158 - || (keep_time && cmp_modtime(file->modtime, st->st_mtime) != 0))
159 + || (keep_time && cmp_time(file->modtime, st->st_mtime) != 0))
160 iflags |= ITEM_REPORT_TIME;
162 && (file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS))
163 @@ -377,7 +390,7 @@ static int unchanged_file(char *fn, stru
167 - return cmp_modtime(st->st_mtime, file->modtime) == 0;
168 + return cmp_time(st->st_mtime, file->modtime) == 0;
172 @@ -530,7 +543,7 @@ static int find_fuzzy(struct file_struct
175 if (fp->length == file->length
176 - && cmp_modtime(fp->modtime, file->modtime) == 0) {
177 + && cmp_time(fp->modtime, file->modtime) == 0) {
180 "fuzzy size/modtime match for %s\n",
181 @@ -851,7 +864,7 @@ static void recv_generator(char *fname,
184 if (update_only && statret == 0
185 - && cmp_modtime(st.st_mtime, file->modtime) > 0) {
186 + && cmp_time(st.st_mtime, file->modtime) > 0) {
188 rprintf(FINFO, "%s is newer\n", safe_fname(fname));
190 --- orig/log.c 2005-06-10 21:33:28
191 +++ log.c 2005-07-28 00:22:30
192 @@ -38,6 +38,7 @@ extern int module_id;
193 extern int msg_fd_out;
194 extern int protocol_version;
195 extern int preserve_times;
196 +extern int preserve_atimes;
197 extern int log_format_has_o_or_i;
198 extern int daemon_log_format_has_o_or_i;
199 extern char *auth_user;
200 @@ -501,11 +502,14 @@ static void log_formatted(enum logcode c
201 n[4] = !(iflags & ITEM_REPORT_TIME) ? '.'
202 : !preserve_times || IS_DEVICE(file->mode)
203 || S_ISLNK(file->mode) ? 'T' : 't';
204 - n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
205 - n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
206 - n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
207 - n[8] = !(iflags & ITEM_REPORT_XATTRS) ? '.' : 'a';
209 + n[5] = !(iflags & ITEM_REPORT_ATIME) ? '.'
210 + : !preserve_atimes || IS_DEVICE(file->mode)
211 + || S_ISLNK(file->mode) ? 'A' : 'a';
212 + n[6] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
213 + n[7] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
214 + n[8] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
215 + n[9] = !(iflags & ITEM_REPORT_XATTRS) ? '.' : 'a';
218 if (iflags & (ITEM_IS_NEW|ITEM_MISSING_DATA)) {
219 char ch = iflags & ITEM_IS_NEW ? '+' : '?';
220 --- orig/options.c 2005-07-27 23:31:12
221 +++ options.c 2005-07-28 01:00:24
222 @@ -49,6 +49,7 @@ int preserve_uid = 0;
223 int preserve_gid = 0;
224 int preserve_times = 0;
225 int omit_dir_times = 0;
226 +int preserve_atimes = 0;
230 @@ -285,8 +286,9 @@ void usage(enum logcode F)
231 rprintf(F," -o, --owner preserve owner (root only)\n");
232 rprintf(F," -g, --group preserve group\n");
233 rprintf(F," -D, --devices preserve devices (root only)\n");
234 - rprintf(F," -t, --times preserve times\n");
235 - rprintf(F," -O, --omit-dir-times omit directories when preserving times\n");
236 + rprintf(F," -t, --times preserve modify times\n");
237 + rprintf(F," -O, --omit-dir-times omit directories when preserving modify times\n");
238 + rprintf(F," -A, --atimes preserve access times\n");
239 rprintf(F," -S, --sparse handle sparse files efficiently\n");
240 rprintf(F," -n, --dry-run show what would have been transferred\n");
241 rprintf(F," -W, --whole-file copy files whole (without rsync algorithm)\n");
242 @@ -413,6 +415,7 @@ static struct poptOption long_options[]
243 {"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 },
244 {"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 },
245 {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 },
246 + {"atimes", 'A', POPT_ARG_NONE, &preserve_atimes, 0, 0, 0 },
247 {"checksum", 'c', POPT_ARG_NONE, &always_checksum, 0, 0, 0 },
248 {"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 },
249 {"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 },
250 @@ -1292,6 +1295,8 @@ void server_options(char **args,int *arg
254 + if (preserve_atimes)
256 if (omit_dir_times == 2 && am_sender)
259 --- orig/rsync.c 2005-07-27 23:31:12
260 +++ rsync.c 2005-07-28 00:17:37
261 @@ -27,6 +27,7 @@ extern int dry_run;
262 extern int daemon_log_format_has_i;
263 extern int preserve_times;
264 extern int omit_dir_times;
265 +extern int preserve_atimes;
267 extern int am_server;
268 extern int am_sender;
269 @@ -56,6 +57,7 @@ int set_perms(char *fname,struct file_st
272 int change_uid, change_gid;
273 + time_t atime, mtime;
277 @@ -70,16 +72,29 @@ int set_perms(char *fname,struct file_st
279 if (!preserve_times || (S_ISDIR(st->st_mode) && omit_dir_times))
280 flags |= PERMS_SKIP_MTIME;
281 + if (!preserve_atimes || S_ISDIR(st->st_mode))
282 + flags |= PERMS_SKIP_ATIME;
283 if (!(flags & PERMS_SKIP_MTIME)
284 - && cmp_modtime(st->st_mtime, file->modtime) != 0) {
285 - int ret = set_modtime(fname, file->modtime, st->st_mode);
286 + && cmp_time(st->st_mtime, file->modtime) != 0) {
287 + mtime = file->modtime;
290 + mtime = st->st_mtime;
291 + if (!(flags & PERMS_SKIP_ATIME)
292 + && cmp_time(st->st_atime, file->atime) != 0) {
293 + atime = file->atime;
296 + atime = st->st_atime;
298 + int ret = set_times(fname, mtime, atime, st->st_mode);
300 rsyserr(FERROR, errno, "failed to set times on %s",
304 - if (ret == 0) /* ret == 1 if symlink could not be set */
306 + if (ret > 0) /* ret == 1 if symlink could not be set */
310 change_uid = am_root && preserve_uid && st->st_uid != file->uid;
311 --- orig/rsync.h 2005-05-03 17:11:01
312 +++ rsync.h 2005-07-28 00:04:51
314 #define XMIT_HAS_IDEV_DATA (1<<9)
315 #define XMIT_SAME_DEV (1<<10)
316 #define XMIT_RDEV_MINOR_IS_SMALL (1<<11)
317 +#define XMIT_SAME_ATIME (1<<12)
319 /* These flags are used in the live flist data. */
323 #define PERMS_REPORT (1<<0)
324 #define PERMS_SKIP_MTIME (1<<1)
325 +#define PERMS_SKIP_ATIME (1<<2)
328 #define NORMAL_FLUSH 0
330 #define DEL_TERSE (1<<3)
332 /* For use by the itemize_changes code */
333 +#define ITEM_REPORT_ATIME (1<<0)
334 #define ITEM_REPORT_CHECKSUM (1<<1)
335 #define ITEM_REPORT_SIZE (1<<2)
336 #define ITEM_REPORT_TIME (1<<3)
337 @@ -509,6 +512,7 @@ struct file_struct {
345 --- orig/rsync.yo 2005-07-07 23:11:09
346 +++ rsync.yo 2005-07-28 01:04:09
347 @@ -309,8 +309,9 @@ to the detailed description below for a
348 -o, --owner preserve owner (root only)
349 -g, --group preserve group
350 -D, --devices preserve devices (root only)
351 - -t, --times preserve times
352 + -t, --times preserve modify times
353 -O, --omit-dir-times omit directories when preserving times
354 + -A, --atimes preserve access times
355 -S, --sparse handle sparse files efficiently
356 -n, --dry-run show what would have been transferred
357 -W, --whole-file copy files whole (without rsync algorithm)
358 @@ -648,6 +649,12 @@ it is preserving modification times (see
359 the directories on the receiving side, it is a good idea to use bf(-O).
360 This option is inferred if you use bf(--backup) without bf(--backup-dir).
362 +dit(bf(-A, --atimes)) This tells rsync to set the access times of the
363 +destination files to the same value as the source files. Note that the
364 +reading of the source file may update the atime of the source files, so
365 +repeated rsync runs with --atimes may be needed if you want to force the
366 +access-time values to be 100% identical on the two systems.
368 dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers,
369 instead it will just report the actions it would have taken.
371 @@ -1055,7 +1062,7 @@ changes that are being made to each file
372 This is exactly the same as specifying bf(--log-format='%i %n%L').
374 The "%i" escape has a cryptic output that is 9 letters long. The general
375 -format is like the string bf(UXcstpoga)), where bf(U) is replaced by the
376 +format is like the string bf(UXcstapogx)), where bf(U) is replaced by the
377 kind of update being done, bf(X) is replaced by the file-type, and the
378 other letters represent attributes that may be output if they are being
380 @@ -1094,17 +1101,22 @@ quote(itemize(
381 by the file transfer.
382 it() A bf(t) means the modification time is different and is being updated
383 to the sender's value (requires bf(--times)). An alternate value of bf(T)
384 - means that the time will be set to the transfer time, which happens
385 + means that the modify time will be set to the transfer time, which happens
386 anytime a symlink is transferred, or when a file or device is transferred
388 + it() A bf(a) means the access time is different and is being updated to
389 + the sender's value (requires bf(--atimes)). An alternate value of bf(A)
390 + means that the access time will be set to the transfer time, which happens
391 + anytime a symlink is transferred, or when a file or device is transferred
392 + without bf(--atimes).
393 it() A bf(p) means the permissions are different and are being updated to
394 the sender's value (requires bf(--perms)).
395 it() An bf(o) means the owner is different and is being updated to the
396 sender's value (requires bf(--owner) and root privileges).
397 it() A bf(g) means the group is different and is being updated to the
398 sender's value (requires bf(--group) and the authority to set the group).
399 - it() The bf(a) is reserved for a future enhanced version that supports
400 - extended file attributes, such as ACLs.
401 + it() The bf(x) is reserved for a future enhanced version that supports
402 + extended file attributes.
405 One other output is possible: when deleting files, the "%i" will output
406 --- orig/testsuite/atimes.test 2004-06-30 00:06:23
407 +++ testsuite/atimes.test 2004-06-30 00:06:23
411 +# Test rsync copying atimes
413 +. "$suitedir/rsync.fns"
419 +touch "$fromdir/foo"
420 +touch -a -t 200102031717.42 "$fromdir/foo"
424 +checkit "$RSYNC -rtAgvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
426 +# The script would have aborted on error, so getting here means we've won.
428 --- orig/testsuite/itemize.test 2005-07-07 20:35:48
429 +++ testsuite/itemize.test 2005-07-28 00:29:54
430 @@ -44,14 +44,14 @@ ln "$fromdir/foo/config1" "$fromdir/foo/
431 $RSYNC -iplr "$fromdir/" "$todir/" \
433 cat <<EOT >"$chkfile"
436 ->f+++++++ bar/baz/rsync
438 ->f+++++++ foo/config1
439 ->f+++++++ foo/config2
441 -cL+++++++ foo/sym -> ../bar/baz/rsync
444 +>f++++++++ bar/baz/rsync
446 +>f++++++++ foo/config1
447 +>f++++++++ foo/config2
448 +>f++++++++ foo/extra
449 +cL++++++++ foo/sym -> ../bar/baz/rsync
451 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
453 @@ -63,10 +63,10 @@ chmod 601 "$fromdir/foo/config2"
454 $RSYNC -iplrH "$fromdir/" "$todir/" \
456 cat <<EOT >"$chkfile"
457 ->f..T.... bar/baz/rsync
458 ->f..T.... foo/config1
459 ->f.sTp... foo/config2
460 -hf..T.... foo/extra => foo/config1
461 +>f..TA.... bar/baz/rsync
462 +>f..TA.... foo/config1
463 +>f.sTAp... foo/config2
464 +hf..TA.... foo/extra => foo/config1
466 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
468 @@ -83,11 +83,11 @@ chmod 777 "$todir/bar/baz/rsync"
469 $RSYNC -iplrtc "$fromdir/" "$todir/" \
471 cat <<EOT >"$chkfile"
472 -.f..tp... bar/baz/rsync
474 -.f..t.... foo/config1
475 ->fcstp... foo/config2
476 -cL..T.... foo/sym -> ../bar/baz/rsync
477 +.f..t.p... bar/baz/rsync
479 +.f..t..... foo/config1
480 +>fcst.p... foo/config2
481 +cL..TA.... foo/sym -> ../bar/baz/rsync
483 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
485 @@ -112,15 +112,15 @@ $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
488 cat <<EOT >"$chkfile"
492 -.f...p... bar/baz/rsync
495 ->f..t.... foo/config2
497 -.L foo/sym -> ../bar/baz/rsync
501 +.f....p... bar/baz/rsync
504 +>f..t..... foo/config2
506 +.L foo/sym -> ../bar/baz/rsync
508 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
510 @@ -139,8 +139,8 @@ touch "$todir/foo/config2"
511 $RSYNC -iplrtH "$fromdir/" "$todir/" \
513 cat <<EOT >"$chkfile"
514 -.f...p... foo/config1
515 ->f..t.... foo/config2
516 +.f....p... foo/config1
517 +>f..t..... foo/config2
519 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
521 @@ -149,15 +149,15 @@ $RSYNC -ivvplrtH --copy-dest="$lddir" "$
524 cat <<EOT >"$chkfile"
528 -cf....... bar/baz/rsync
530 -cf....... foo/config1
531 -cf....... foo/config2
532 -hf+++++++ foo/extra => foo/config1
533 -cL+++++++ foo/sym -> ../bar/baz/rsync
537 +cf........ bar/baz/rsync
539 +cf........ foo/config1
540 +cf........ foo/config2
541 +hf++++++++ foo/extra => foo/config1
542 +cL++++++++ foo/sym -> ../bar/baz/rsync
544 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
546 @@ -165,12 +165,12 @@ rm -rf "$todir"
547 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
549 cat <<EOT >"$chkfile"
554 -hf+++++++ foo/extra => foo/config1
555 -cL+++++++ foo/sym -> ../bar/baz/rsync
560 +hf++++++++ foo/extra => foo/config1
561 +cL++++++++ foo/sym -> ../bar/baz/rsync
563 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
565 --- orig/testsuite/rsync.fns 2005-06-10 21:33:28
566 +++ testsuite/rsync.fns 2005-07-28 00:41:20
567 @@ -50,7 +50,7 @@ printmsg() {
571 - find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls"
572 + find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls" $TLS_ARGS
576 @@ -158,6 +158,10 @@ checkit() {
577 # We can just write everything to stdout/stderr, because the
578 # wrapper hides it unless there is a problem.
580 + if test x$TLS_ARGS = x--atime; then
581 + ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
584 echo "Running: \"$1\""
587 @@ -165,10 +169,13 @@ checkit() {
591 + if test x$TLS_ARGS != x--atime; then
592 + ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
596 echo "check how the directory listings compare with diff:"
598 - ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
599 ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to"
600 diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES
602 --- orig/tls.c 2005-01-19 19:30:29
603 +++ tls.c 2005-03-23 17:49:48
610 #define PROGRAM "tls"
612 @@ -48,6 +49,7 @@ int read_only = 1;
614 int preserve_perms = 0;
616 +static int display_atime = 0;
618 static void failed(char const *what, char const *where)
620 @@ -56,14 +58,29 @@ static void failed(char const *what, cha
624 +static void storetime(char *dest, time_t t)
627 + struct tm *mt = gmtime(&t);
629 + sprintf(dest, "%04d-%02d-%02d %02d:%02d:%02d ",
630 + mt->tm_year + 1900,
641 static void list_file(const char *fname)
644 char permbuf[PERMSTRING_SIZE];
651 if (do_lstat(fname, &buf) < 0)
652 @@ -96,19 +113,8 @@ static void list_file(const char *fname)
654 permstring(permbuf, buf.st_mode);
656 - if (buf.st_mtime) {
657 - mt = gmtime(&buf.st_mtime);
659 - sprintf(datebuf, "%04d-%02d-%02d %02d:%02d:%02d",
660 - mt->tm_year + 1900,
667 - strcpy(datebuf, " ");
669 + storetime(mtimebuf, buf.st_mtime);
670 + storetime(atimebuf, buf.st_atime);
672 /* TODO: Perhaps escape special characters in fname? */
674 @@ -119,24 +125,55 @@ static void list_file(const char *fname)
675 (long)minor(buf.st_rdev));
676 } else /* NB: use double for size since it might not fit in a long. */
677 printf("%12.0f", (double)buf.st_size);
678 - printf(" %6ld.%-6ld %6ld %s %s%s\n",
679 + printf(" %6ld.%-6ld %6ld %s%s%s%s\n",
680 (long)buf.st_uid, (long)buf.st_gid, (long)buf.st_nlink,
681 - datebuf, fname, linkbuf);
682 + mtimebuf, display_atime && !S_ISDIR(buf.st_mode) ? atimebuf : "",
686 +static struct poptOption long_options[] = {
687 + /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
688 + {"atime", 'u', POPT_ARG_NONE, &display_atime, 0, 0, 0},
689 + {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0},
693 +static void tls_usage(int ret)
695 + fprintf(stderr, "usage: " PROGRAM " [--atime | -u] DIR ...\n"
696 + "Trivial file listing program for portably checking rsync\n");
701 main(int argc, char *argv[])
704 - fprintf(stderr, "usage: " PROGRAM " DIR ...\n"
705 - "Trivial file listing program for portably checking rsync\n");
708 + const char **extra_args;
711 + pc = poptGetContext(PROGRAM, argc, (const char **)argv,
713 + while ((opt = poptGetNextOpt(pc)) != -1) {
720 + poptBadOption(pc, POPT_BADOPTION_NOALIAS),
721 + poptStrerror(opt));
726 - for (argv++; *argv; argv++) {
729 + extra_args = poptGetArgs(pc);
730 + if (*extra_args == NULL)
733 + for (; *extra_args; extra_args++)
734 + list_file(*extra_args);
735 + poptFreeContext(pc);
739 --- orig/util.c 2005-07-27 23:31:12
740 +++ util.c 2005-07-27 23:37:27
741 @@ -128,7 +128,7 @@ void overflow_exit(char *str)
745 -int set_modtime(char *fname, time_t modtime, mode_t mode)
746 +int set_times(char *fname, time_t modtime, time_t atime, mode_t mode)
748 #if !defined HAVE_LUTIMES || !defined HAVE_UTIMES
750 @@ -136,9 +136,13 @@ int set_modtime(char *fname, time_t modt
754 - rprintf(FINFO, "set modtime of %s to (%ld) %s",
755 + char mtimebuf[200];
757 + strlcpy(mtimebuf, timestring(modtime), sizeof mtimebuf);
759 + "set modtime, atime of %s to (%ld) %s, (%ld) %s\n",
760 safe_fname(fname), (long)modtime,
761 - asctime(localtime(&modtime)));
762 + mtimebuf, (long)atime, timestring(atime));
766 @@ -147,7 +151,7 @@ int set_modtime(char *fname, time_t modt
770 - t[0].tv_sec = time(NULL);
771 + t[0].tv_sec = atime;
773 t[1].tv_sec = modtime;
775 @@ -158,12 +162,12 @@ int set_modtime(char *fname, time_t modt
776 return utimes(fname, t);
777 #elif defined HAVE_UTIMBUF
779 - tbuf.actime = time(NULL);
780 + tbuf.actime = atime;
781 tbuf.modtime = modtime;
782 return utime(fname,&tbuf);
783 #elif defined HAVE_UTIME
788 return utime(fname,t);
790 @@ -1167,8 +1171,8 @@ int msleep(int t)
794 - * Determine if two file modification times are equivalent (either
795 - * exact or in the modification timestamp window established by
796 + * Determine if two file times are equivalent (either
797 + * exact or in the timestamp window established by
800 * @retval 0 if the times should be treated as the same
801 @@ -1177,7 +1181,7 @@ int msleep(int t)
803 * @retval -1 if the 2nd is later
805 -int cmp_modtime(time_t file1, time_t file2)
806 +int cmp_time(time_t file1, time_t file2)
809 if (file2 - file1 <= modify_window)