Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/coreutils/ls.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/coreutils/ls.c
r3232 r3621 94 94 95 95 #include "libbb.h" 96 #include "common_bufsiz.h" 96 97 #include "unicode.h" 97 98 … … 366 367 #endif 367 368 } FIX_ALIASING; 368 #define G (*(struct globals*) &bb_common_bufsiz1)369 #define G (*(struct globals*)bb_common_bufsiz1) 369 370 #define INIT_G() do { \ 371 setup_common_bufsiz(); \ 370 372 /* we have to zero it out because of NOEXEC */ \ 371 373 memset(&G, 0, sizeof(G)); \ … … 567 569 if (G.all_fmt & (LIST_FULLTIME|LIST_DATE_TIME)) { 568 570 char *filetime; 569 time_t ttime =dn->dn_mtime;571 const time_t *ttime = &dn->dn_mtime; 570 572 if (G.all_fmt & TIME_ACCESS) 571 ttime = dn->dn_atime;573 ttime = &dn->dn_atime; 572 574 if (G.all_fmt & TIME_CHANGE) 573 ttime = dn->dn_ctime;574 filetime = ctime( &ttime);575 ttime = &dn->dn_ctime; 576 filetime = ctime(ttime); 575 577 /* filetime's format: "Wed Jun 30 21:49:08 1993\n" */ 576 578 if (G.all_fmt & LIST_FULLTIME) { /* -e */ … … 581 583 } else { /* LIST_DATE_TIME */ 582 584 /* G.current_time_t ~== time(NULL) */ 583 time_t age = G.current_time_t - ttime; 584 printf("%.6s ", filetime + 4); /* "Jun 30" */ 585 time_t age = G.current_time_t - *ttime; 585 586 if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) { 586 /* hh:mm if less than 6 months old */ 587 printf("%.5s ", filetime + 11); 588 } else { /* year. buggy if year > 9999 ;) */ 589 printf(" %.4s ", filetime + 20); 587 /* less than 6 months old */ 588 /* "mmm dd hh:mm " */ 589 printf("%.12s ", filetime + 4); 590 } else { 591 /* "mmm dd yyyy " */ 592 /* "mmm dd yyyyy " after year 9999 :) */ 593 strchr(filetime + 20, '\n')[0] = ' '; 594 printf("%.7s%6s", filetime + 4, filetime + 20); 590 595 } 591 596 column += 13; … … 666 671 column_width = len; 667 672 } 668 column_width += 1+673 column_width += 2 + 669 674 IF_SELINUX( ((G.all_fmt & LIST_CONTEXT) ? 33 : 0) + ) 670 675 ((G.all_fmt & LIST_INO) ? 8 : 0) + … … 694 699 if (column > 0) { 695 700 nexttab -= column; 696 printf("%*s 697 column += nexttab + 1;701 printf("%*s", nexttab, ""); 702 column += nexttab; 698 703 } 699 704 nexttab = column + column_width; … … 1033 1038 subdnp = scan_one_dir((*dn)->fullname, &nfiles); 1034 1039 #if ENABLE_DESKTOP 1035 if ((G.all_fmt & STYLE_MASK) == STYLE_LONG )1040 if ((G.all_fmt & STYLE_MASK) == STYLE_LONG || (G.all_fmt & LIST_BLOCKS)) 1036 1041 printf("total %"OFF_FMT"u\n", calculate_blocks(subdnp)); 1037 1042 #endif … … 1103 1108 #if ENABLE_FEATURE_AUTOWIDTH 1104 1109 /* obtain the terminal width */ 1105 get_terminal_width_height(STDIN_FILENO, &G_terminal_width, NULL);1110 G_terminal_width = get_terminal_width(STDIN_FILENO); 1106 1111 /* go one less... */ 1107 1112 G_terminal_width--;
Note:
See TracChangeset
for help on using the changeset viewer.