| 1 | After applying this patch and running configure, you MUST run this |
| 2 | command before "make": |
| 3 | |
| 4 | make proto |
| 5 | |
| 6 | |
| 7 | --- orig/batch.c 2005-02-07 20:41:56 |
| 8 | +++ batch.c 2004-07-03 20:15:41 |
| 9 | @@ -206,6 +206,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-02-07 20:41:56 |
| 19 | +++ flist.c 2005-02-07 21:06:04 |
| 20 | @@ -63,6 +63,7 @@ extern int make_backups; |
| 21 | extern int backup_suffix_len; |
| 22 | extern int copy_links; |
| 23 | extern int copy_unsafe_links; |
| 24 | +extern int copy_atimes; |
| 25 | extern int protocol_version; |
| 26 | extern int sanitize_paths; |
| 27 | extern int delete_excluded; |
| 28 | @@ -150,16 +151,18 @@ static void list_file_entry(struct file_ |
| 29 | |
| 30 | #if SUPPORT_LINKS |
| 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", |
| 34 | perms, |
| 35 | (double)f->length, timestring(f->modtime), |
| 36 | + timestring(f->atime), |
| 37 | safe_fname(f_name(f)), safe_fname(f->u.link)); |
| 38 | } else |
| 39 | #endif |
| 40 | { |
| 41 | - rprintf(FINFO, "%s %11.0f %s %s\n", |
| 42 | + rprintf(FINFO, "%s %11.0f %s %s %s\n", |
| 43 | perms, |
| 44 | (double)f->length, timestring(f->modtime), |
| 45 | + timestring(f->atime), |
| 46 | safe_fname(f_name(f))); |
| 47 | } |
| 48 | } |
| 49 | @@ -323,6 +326,7 @@ void send_file_entry(struct file_struct |
| 50 | { |
| 51 | unsigned short flags; |
| 52 | static time_t modtime; |
| 53 | + static time_t atime; |
| 54 | static mode_t mode; |
| 55 | static int64 dev; |
| 56 | static dev_t rdev; |
| 57 | @@ -338,7 +342,7 @@ void send_file_entry(struct file_struct |
| 58 | |
| 59 | if (!file) { |
| 60 | write_byte(f, 0); |
| 61 | - modtime = 0, mode = 0; |
| 62 | + modtime = 0, atime = 0, mode = 0; |
| 63 | dev = 0, rdev = makedev(0, 0); |
| 64 | rdev_major = 0; |
| 65 | uid = 0, gid = 0; |
| 66 | @@ -387,6 +391,12 @@ void send_file_entry(struct file_struct |
| 67 | flags |= XMIT_SAME_TIME; |
| 68 | else |
| 69 | modtime = file->modtime; |
| 70 | + if (copy_atimes && !S_ISDIR(mode)) { |
| 71 | + if (file->atime == atime) |
| 72 | + flags |= XMIT_SAME_ATIME; |
| 73 | + else |
| 74 | + atime = file->atime; |
| 75 | + } |
| 76 | |
| 77 | #if SUPPORT_HARD_LINKS |
| 78 | if (file->link_u.idev) { |
| 79 | @@ -442,6 +452,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 (copy_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME)) |
| 84 | + write_int(f, atime); |
| 85 | if (preserve_uid && !(flags & XMIT_SAME_UID)) { |
| 86 | if (!numeric_ids) |
| 87 | add_uid(uid); |
| 88 | @@ -515,6 +527,7 @@ static void receive_file_entry(struct fi |
| 89 | unsigned short flags, int f) |
| 90 | { |
| 91 | static time_t modtime; |
| 92 | + static time_t atime; |
| 93 | static mode_t mode; |
| 94 | static int64 dev; |
| 95 | static dev_t rdev; |
| 96 | @@ -533,7 +546,7 @@ static void receive_file_entry(struct fi |
| 97 | struct file_struct *file; |
| 98 | |
| 99 | if (!flist) { |
| 100 | - modtime = 0, mode = 0; |
| 101 | + modtime = 0, atime = 0, mode = 0; |
| 102 | dev = 0, rdev = makedev(0, 0); |
| 103 | rdev_major = 0; |
| 104 | uid = 0, gid = 0; |
| 105 | @@ -589,6 +602,8 @@ static void receive_file_entry(struct fi |
| 106 | modtime = (time_t)read_int(f); |
| 107 | if (!(flags & XMIT_SAME_MODE)) |
| 108 | mode = from_wire_mode(read_int(f)); |
| 109 | + if (copy_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME)) |
| 110 | + atime = (time_t)read_int(f); |
| 111 | |
| 112 | if (preserve_uid && !(flags & XMIT_SAME_UID)) |
| 113 | uid = (uid_t)read_int(f); |
| 114 | @@ -639,6 +654,7 @@ static void receive_file_entry(struct fi |
| 115 | |
| 116 | file->flags = 0; |
| 117 | file->modtime = modtime; |
| 118 | + file->atime = atime; |
| 119 | file->length = file_length; |
| 120 | file->mode = mode; |
| 121 | file->uid = uid; |
| 122 | @@ -886,6 +902,7 @@ skip_filters: |
| 123 | |
| 124 | file->flags = flags; |
| 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-02-07 20:41:56 |
| 131 | +++ generator.c 2004-11-03 23:02:12 |
| 132 | @@ -99,7 +99,7 @@ static int unchanged_file(char *fn, stru |
| 133 | if (ignore_times) |
| 134 | return 0; |
| 135 | |
| 136 | - return cmp_modtime(st->st_mtime, file->modtime) == 0; |
| 137 | + return cmp_time(st->st_mtime, file->modtime) == 0; |
| 138 | } |
| 139 | |
| 140 | |
| 141 | @@ -503,7 +503,7 @@ static void recv_generator(char *fname, |
| 142 | } |
| 143 | |
| 144 | if (update_only && fnamecmp_type == FNAMECMP_FNAME |
| 145 | - && cmp_modtime(st.st_mtime, file->modtime) > 0) { |
| 146 | + && cmp_time(st.st_mtime, file->modtime) > 0) { |
| 147 | if (verbose > 1) |
| 148 | rprintf(FINFO, "%s is newer\n", safe_fname(fname)); |
| 149 | return; |
| 150 | --- orig/options.c 2005-02-07 20:41:56 |
| 151 | +++ options.c 2005-01-24 01:51:48 |
| 152 | @@ -50,6 +50,7 @@ int preserve_uid = 0; |
| 153 | int preserve_gid = 0; |
| 154 | int preserve_times = 0; |
| 155 | int omit_dir_times = 0; |
| 156 | +int copy_atimes = 0; |
| 157 | int update_only = 0; |
| 158 | int cvs_exclude = 0; |
| 159 | int dry_run = 0; |
| 160 | @@ -269,6 +270,7 @@ void usage(enum logcode F) |
| 161 | rprintf(F," -g, --group preserve group\n"); |
| 162 | rprintf(F," -D, --devices preserve devices (root only)\n"); |
| 163 | rprintf(F," -t, --times preserve times\n"); |
| 164 | + rprintf(F," -A, --copy-atimes copy access times\n"); |
| 165 | rprintf(F," -O, --omit-dir-times omit directories when preserving times\n"); |
| 166 | rprintf(F," -S, --sparse handle sparse files efficiently\n"); |
| 167 | rprintf(F," -n, --dry-run show what would have been transferred\n"); |
| 168 | @@ -388,6 +390,7 @@ static struct poptOption long_options[] |
| 169 | {"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 }, |
| 170 | {"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 }, |
| 171 | {"omit-dir-times", 'O', POPT_ARG_NONE, &omit_dir_times, 0, 0, 0 }, |
| 172 | + {"copy-atimes", 'A', POPT_ARG_NONE, ©_atimes, 0, 0, 0 }, |
| 173 | {"checksum", 'c', POPT_ARG_NONE, &always_checksum, 0, 0, 0 }, |
| 174 | {"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 }, |
| 175 | {"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 }, |
| 176 | @@ -1151,6 +1154,8 @@ void server_options(char **args,int *arg |
| 177 | argstr[x++] = 'D'; |
| 178 | if (preserve_times) |
| 179 | argstr[x++] = 't'; |
| 180 | + if (copy_atimes) |
| 181 | + argstr[x++] = 'A'; |
| 182 | if (omit_dir_times && am_sender) |
| 183 | argstr[x++] = 'O'; |
| 184 | if (preserve_perms) |
| 185 | --- orig/rsync.c 2005-02-07 20:41:57 |
| 186 | +++ rsync.c 2005-01-24 01:59:12 |
| 187 | @@ -26,6 +26,7 @@ extern int verbose; |
| 188 | extern int dry_run; |
| 189 | extern int preserve_times; |
| 190 | extern int omit_dir_times; |
| 191 | +extern int copy_atimes; |
| 192 | extern int am_root; |
| 193 | extern int am_server; |
| 194 | extern int am_sender; |
| 195 | @@ -156,6 +157,7 @@ int set_perms(char *fname,struct file_st |
| 196 | int updated = 0; |
| 197 | STRUCT_STAT st2; |
| 198 | int change_uid, change_gid; |
| 199 | + time_t atime, mtime; |
| 200 | |
| 201 | if (!st) { |
| 202 | if (dry_run) |
| 203 | @@ -168,18 +170,28 @@ int set_perms(char *fname,struct file_st |
| 204 | st = &st2; |
| 205 | } |
| 206 | |
| 207 | + if (!copy_atimes || S_ISLNK(st->st_mode) || S_ISDIR(st->st_mode)) |
| 208 | + flags |= PERMS_SKIP_ATIME; |
| 209 | if (!preserve_times || S_ISLNK(st->st_mode) |
| 210 | || (S_ISDIR(st->st_mode) |
| 211 | && (omit_dir_times || (make_backups && !backup_dir)))) |
| 212 | flags |= PERMS_SKIP_MTIME; |
| 213 | + if (!(flags & PERMS_SKIP_ATIME) |
| 214 | + && cmp_time(st->st_atime, file->atime) != 0) { |
| 215 | + atime = file->atime; |
| 216 | + updated = 1; |
| 217 | + } else |
| 218 | + atime = st->st_atime; |
| 219 | if (!(flags & PERMS_SKIP_MTIME) |
| 220 | - && cmp_modtime(st->st_mtime, file->modtime) != 0) { |
| 221 | - if (set_modtime(fname,file->modtime) != 0) { |
| 222 | - rsyserr(FERROR, errno, "failed to set times on %s", |
| 223 | - full_fname(fname)); |
| 224 | - return 0; |
| 225 | - } |
| 226 | + && cmp_time(st->st_mtime, file->modtime) != 0) { |
| 227 | + mtime = file->modtime; |
| 228 | updated = 1; |
| 229 | + } else |
| 230 | + mtime = st->st_mtime; |
| 231 | + if (updated && set_times(fname, mtime, atime) != 0) { |
| 232 | + rsyserr(FERROR, errno, "failed to set times on %s", |
| 233 | + full_fname(fname)); |
| 234 | + return 0; |
| 235 | } |
| 236 | |
| 237 | change_uid = am_root && preserve_uid && st->st_uid != file->uid; |
| 238 | --- orig/rsync.h 2005-02-07 20:41:57 |
| 239 | +++ rsync.h 2004-07-03 20:15:41 |
| 240 | @@ -54,6 +54,7 @@ |
| 241 | #define XMIT_HAS_IDEV_DATA (1<<9) |
| 242 | #define XMIT_SAME_DEV (1<<10) |
| 243 | #define XMIT_RDEV_MINOR_IS_SMALL (1<<11) |
| 244 | +#define XMIT_SAME_ATIME (1<<12) |
| 245 | |
| 246 | /* These flags are used in the live flist data. */ |
| 247 | |
| 248 | @@ -114,6 +115,7 @@ |
| 249 | |
| 250 | #define PERMS_REPORT (1<<0) |
| 251 | #define PERMS_SKIP_MTIME (1<<1) |
| 252 | +#define PERMS_SKIP_ATIME (1<<2) |
| 253 | |
| 254 | #define FULL_FLUSH 1 |
| 255 | #define NORMAL_FLUSH 0 |
| 256 | @@ -481,6 +483,7 @@ struct file_struct { |
| 257 | struct hlink *links; |
| 258 | } link_u; |
| 259 | time_t modtime; |
| 260 | + time_t atime; |
| 261 | uid_t uid; |
| 262 | gid_t gid; |
| 263 | mode_t mode; |
| 264 | --- orig/rsync.yo 2005-02-06 07:24:23 |
| 265 | +++ rsync.yo 2005-01-24 01:57:18 |
| 266 | @@ -322,6 +322,7 @@ to the detailed description below for a |
| 267 | -D, --devices preserve devices (root only) |
| 268 | -t, --times preserve times |
| 269 | -O, --omit-dir-times omit directories when preserving times |
| 270 | + -A, --copy-atimes copy access times |
| 271 | -S, --sparse handle sparse files efficiently |
| 272 | -n, --dry-run show what would have been transferred |
| 273 | -W, --whole-file copy files whole |
| 274 | @@ -641,6 +642,11 @@ dit(bf(-O, --omit-dir-times)) This tells |
| 275 | it is preserving modification times (see bf(--times)). If NFS is sharing |
| 276 | the directories on the receiving side, it is a good idea to use bf(-O). |
| 277 | |
| 278 | +dit(bf(-A, --copy-atimes)) This tells rsync to transfer access times |
| 279 | +along with the files and update them on the remote system. Note that |
| 280 | +reading the source file may update the atime and hence repeated rsync |
| 281 | +copies with --copy-atimes may copy files unnecessarily. |
| 282 | + |
| 283 | dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers, |
| 284 | instead it will just report the actions it would have taken. |
| 285 | |
| 286 | --- orig/testsuite/copy-atimes.test 2004-06-30 00:06:23 |
| 287 | +++ testsuite/copy-atimes.test 2004-06-30 00:06:23 |
| 288 | @@ -0,0 +1,19 @@ |
| 289 | +#! /bin/sh |
| 290 | + |
| 291 | +# Test rsync copying atimes |
| 292 | + |
| 293 | +. "$suitedir/rsync.fns" |
| 294 | + |
| 295 | +set -x |
| 296 | + |
| 297 | +mkdir "$fromdir" |
| 298 | + |
| 299 | +touch "$fromdir/foo" |
| 300 | +touch -a -t 200102031717.42 "$fromdir/foo" |
| 301 | + |
| 302 | +TLS_ARGS=--atime |
| 303 | + |
| 304 | +checkit "$RSYNC -rtAgvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 305 | + |
| 306 | +# The script would have aborted on error, so getting here means we've won. |
| 307 | +exit 0 |
| 308 | --- orig/testsuite/rsync.fns 2004-09-18 01:49:34 |
| 309 | +++ testsuite/rsync.fns 2004-07-03 20:15:41 |
| 310 | @@ -50,7 +50,7 @@ printmsg() { |
| 311 | |
| 312 | |
| 313 | rsync_ls_lR() { |
| 314 | - find "$@" -print | sort | xargs "$TOOLDIR/tls" |
| 315 | + find "$@" -print | sort | xargs "$TOOLDIR/tls" $TLS_ARGS |
| 316 | } |
| 317 | |
| 318 | rsync_getgroups() { |
| 319 | @@ -158,6 +158,8 @@ checkit() { |
| 320 | # We can just write everything to stdout/stderr, because the |
| 321 | # wrapper hides it unless there is a problem. |
| 322 | |
| 323 | + ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from" |
| 324 | + |
| 325 | echo "Running: \"$1\"" |
| 326 | eval "$1" |
| 327 | status=$? |
| 328 | @@ -166,6 +168,12 @@ checkit() { |
| 329 | fi |
| 330 | |
| 331 | echo "-------------" |
| 332 | + echo "check how the directory listings compare with diff:" |
| 333 | + echo "" |
| 334 | + ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to" |
| 335 | + diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES |
| 336 | + |
| 337 | + echo "-------------" |
| 338 | echo "check how the files compare with diff:" |
| 339 | echo "" |
| 340 | for f in `cd "$2"; find . -type f -print ` |
| 341 | @@ -173,12 +181,6 @@ checkit() { |
| 342 | diff $diffopt "$2"/"$f" "$3"/"$f" || failed=YES |
| 343 | done |
| 344 | |
| 345 | - echo "-------------" |
| 346 | - echo "check how the directory listings compare with diff:" |
| 347 | - echo "" |
| 348 | - ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from" |
| 349 | - ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to" |
| 350 | - diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES |
| 351 | if [ -z "$failed" ] ; then |
| 352 | return 0 |
| 353 | else |
| 354 | --- orig/tls.c 2005-01-19 20:11:10 |
| 355 | +++ tls.c 2004-07-03 20:15:41 |
| 356 | @@ -39,6 +39,7 @@ |
| 357 | |
| 358 | |
| 359 | #include "rsync.h" |
| 360 | +#include "popt.h" |
| 361 | |
| 362 | #define PROGRAM "tls" |
| 363 | |
| 364 | @@ -48,6 +49,7 @@ int read_only = 1; |
| 365 | int list_only = 0; |
| 366 | int preserve_perms = 0; |
| 367 | |
| 368 | +static int display_atime = 0; |
| 369 | |
| 370 | static void failed(char const *what, char const *where) |
| 371 | { |
| 372 | @@ -56,14 +58,29 @@ static void failed(char const *what, cha |
| 373 | exit(1); |
| 374 | } |
| 375 | |
| 376 | +static void storetime(char *dest, time_t t) |
| 377 | +{ |
| 378 | + if (t) { |
| 379 | + struct tm *mt = gmtime(&t); |
| 380 | |
| 381 | + sprintf(dest, "%04d-%02d-%02d %02d:%02d:%02d ", |
| 382 | + mt->tm_year + 1900, |
| 383 | + mt->tm_mon + 1, |
| 384 | + mt->tm_mday, |
| 385 | + mt->tm_hour, |
| 386 | + mt->tm_min, |
| 387 | + mt->tm_sec); |
| 388 | + } else { |
| 389 | + strcpy(dest, " "); |
| 390 | + } |
| 391 | +} |
| 392 | |
| 393 | static void list_file(const char *fname) |
| 394 | { |
| 395 | STRUCT_STAT buf; |
| 396 | char permbuf[PERMSTRING_SIZE]; |
| 397 | - struct tm *mt; |
| 398 | - char datebuf[50]; |
| 399 | + char mtimebuf[50]; |
| 400 | + char atimebuf[50]; |
| 401 | char linkbuf[4096]; |
| 402 | |
| 403 | if (do_lstat(fname, &buf) < 0) |
| 404 | @@ -96,19 +113,8 @@ static void list_file(const char *fname) |
| 405 | |
| 406 | permstring(permbuf, buf.st_mode); |
| 407 | |
| 408 | - if (buf.st_mtime) { |
| 409 | - mt = gmtime(&buf.st_mtime); |
| 410 | - |
| 411 | - sprintf(datebuf, "%04d-%02d-%02d %02d:%02d:%02d", |
| 412 | - mt->tm_year + 1900, |
| 413 | - mt->tm_mon + 1, |
| 414 | - mt->tm_mday, |
| 415 | - mt->tm_hour, |
| 416 | - mt->tm_min, |
| 417 | - mt->tm_sec); |
| 418 | - } else { |
| 419 | - strcpy(datebuf, " "); |
| 420 | - } |
| 421 | + storetime(mtimebuf, buf.st_mtime); |
| 422 | + storetime(atimebuf, buf.st_atime); |
| 423 | |
| 424 | /* TODO: Perhaps escape special characters in fname? */ |
| 425 | |
| 426 | @@ -119,24 +125,55 @@ static void list_file(const char *fname) |
| 427 | (long)minor(buf.st_rdev)); |
| 428 | } else /* NB: use double for size since it might not fit in a long. */ |
| 429 | printf("%12.0f", (double)buf.st_size); |
| 430 | - printf(" %6ld.%-6ld %6ld %s %s%s\n", |
| 431 | + printf(" %6ld.%-6ld %6ld %s%s%s%s\n", |
| 432 | (long)buf.st_uid, (long)buf.st_gid, (long)buf.st_nlink, |
| 433 | - datebuf, fname, linkbuf); |
| 434 | + mtimebuf, display_atime ? atimebuf : "", |
| 435 | + fname, linkbuf); |
| 436 | } |
| 437 | |
| 438 | +static struct poptOption long_options[] = { |
| 439 | + /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ |
| 440 | + {"atime", 'u', POPT_ARG_NONE, &display_atime, 0, 0, 0}, |
| 441 | + {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0}, |
| 442 | + {0,0,0,0,0,0,0} |
| 443 | +}; |
| 444 | + |
| 445 | +static void tls_usage(int ret) |
| 446 | +{ |
| 447 | + fprintf(stderr, "usage: " PROGRAM " [--atime | -u] DIR ...\n" |
| 448 | + "Trivial file listing program for portably checking rsync\n"); |
| 449 | + exit(ret); |
| 450 | +} |
| 451 | |
| 452 | int |
| 453 | main(int argc, char *argv[]) |
| 454 | { |
| 455 | - if (argc < 2) { |
| 456 | - fprintf(stderr, "usage: " PROGRAM " DIR ...\n" |
| 457 | - "Trivial file listing program for portably checking rsync\n"); |
| 458 | - return 1; |
| 459 | + poptContext pc; |
| 460 | + const char **extra_args; |
| 461 | + int opt; |
| 462 | + |
| 463 | + pc = poptGetContext(PROGRAM, argc, (const char **)argv, |
| 464 | + long_options, 0); |
| 465 | + while ((opt = poptGetNextOpt(pc)) != -1) { |
| 466 | + switch (opt) { |
| 467 | + case 'h': |
| 468 | + tls_usage(0); |
| 469 | + default: |
| 470 | + fprintf(stderr, |
| 471 | + "%s: %s\n", |
| 472 | + poptBadOption(pc, POPT_BADOPTION_NOALIAS), |
| 473 | + poptStrerror(opt)); |
| 474 | + tls_usage(1); |
| 475 | + } |
| 476 | } |
| 477 | |
| 478 | - for (argv++; *argv; argv++) { |
| 479 | - list_file(*argv); |
| 480 | - } |
| 481 | + extra_args = poptGetArgs(pc); |
| 482 | + if (*extra_args == NULL) |
| 483 | + tls_usage(1); |
| 484 | + |
| 485 | + for (; *extra_args; extra_args++) |
| 486 | + list_file(*extra_args); |
| 487 | + poptFreeContext(pc); |
| 488 | |
| 489 | return 0; |
| 490 | } |
| 491 | --- orig/util.c 2005-02-07 20:41:57 |
| 492 | +++ util.c 2005-02-07 21:09:12 |
| 493 | @@ -128,12 +128,17 @@ void overflow(char *str) |
| 494 | |
| 495 | |
| 496 | |
| 497 | -int set_modtime(char *fname, time_t modtime) |
| 498 | +int set_times(char *fname, time_t modtime, time_t atime) |
| 499 | { |
| 500 | if (verbose > 2) { |
| 501 | - rprintf(FINFO, "set modtime of %s to (%ld) %s", |
| 502 | + char mtimebuf[200]; |
| 503 | + |
| 504 | + strlcpy(mtimebuf, timestring(modtime), sizeof mtimebuf); |
| 505 | + rprintf(FINFO, |
| 506 | + "set modtime, atime of %s to (%ld) %s, (%ld) %s\n", |
| 507 | safe_fname(fname), (long)modtime, |
| 508 | - asctime(localtime(&modtime))); |
| 509 | + mtimebuf, |
| 510 | + (long)atime, timestring(atime)); |
| 511 | } |
| 512 | |
| 513 | if (dry_run) |
| 514 | @@ -142,17 +147,17 @@ int set_modtime(char *fname, time_t modt |
| 515 | { |
| 516 | #if HAVE_UTIMBUF |
| 517 | struct utimbuf tbuf; |
| 518 | - tbuf.actime = time(NULL); |
| 519 | + tbuf.actime = atime; |
| 520 | tbuf.modtime = modtime; |
| 521 | return utime(fname,&tbuf); |
| 522 | #elif HAVE_UTIME |
| 523 | time_t t[2]; |
| 524 | - t[0] = time(NULL); |
| 525 | + t[0] = atime; |
| 526 | t[1] = modtime; |
| 527 | return utime(fname,t); |
| 528 | #else |
| 529 | struct timeval t[2]; |
| 530 | - t[0].tv_sec = time(NULL); |
| 531 | + t[0].tv_sec = atime; |
| 532 | t[0].tv_usec = 0; |
| 533 | t[1].tv_sec = modtime; |
| 534 | t[1].tv_usec = 0; |
| 535 | @@ -1141,8 +1146,8 @@ int msleep(int t) |
| 536 | |
| 537 | |
| 538 | /** |
| 539 | - * Determine if two file modification times are equivalent (either |
| 540 | - * exact or in the modification timestamp window established by |
| 541 | + * Determine if two file times are equivalent (either |
| 542 | + * exact or in the timestamp window established by |
| 543 | * --modify-window). |
| 544 | * |
| 545 | * @retval 0 if the times should be treated as the same |
| 546 | @@ -1151,7 +1156,7 @@ int msleep(int t) |
| 547 | * |
| 548 | * @retval -1 if the 2nd is later |
| 549 | **/ |
| 550 | -int cmp_modtime(time_t file1, time_t file2) |
| 551 | +int cmp_time(time_t file1, time_t file2) |
| 552 | { |
| 553 | if (file2 > file1) { |
| 554 | if (file2 - file1 <= modify_window) |