Lines 73-78
Link Here
|
73 |
static int colortype(mode_t); |
73 |
static int colortype(mode_t); |
74 |
#endif |
74 |
#endif |
75 |
static void aclmode(char *, const FTSENT *); |
75 |
static void aclmode(char *, const FTSENT *); |
|
|
76 |
static void octalmode(int, char *); |
76 |
|
77 |
|
77 |
#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT) |
78 |
#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT) |
78 |
|
79 |
|
Lines 141-152
Link Here
|
141 |
#ifdef COLORLS |
142 |
#ifdef COLORLS |
142 |
int color_printed = 0; |
143 |
int color_printed = 0; |
143 |
#endif |
144 |
#endif |
|
|
145 |
void (*strmodefcn)(int, char *); |
144 |
|
146 |
|
145 |
if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) && |
147 |
if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) && |
146 |
(f_longform || f_size)) { |
148 |
(f_longform || f_size)) { |
147 |
(void)printf("total %lu\n", howmany(dp->btotal, blocksize)); |
149 |
(void)printf("total %lu\n", howmany(dp->btotal, blocksize)); |
148 |
} |
150 |
} |
149 |
|
151 |
|
|
|
152 |
strmodefcn = (f_octalperms > 0) ? octalmode : strmode; |
153 |
|
150 |
for (p = dp->list; p; p = p->fts_link) { |
154 |
for (p = dp->list; p; p = p->fts_link) { |
151 |
if (IS_NOPRINT(p)) |
155 |
if (IS_NOPRINT(p)) |
152 |
continue; |
156 |
continue; |
Lines 157-163
Link Here
|
157 |
if (f_size) |
161 |
if (f_size) |
158 |
(void)printf("%*jd ", |
162 |
(void)printf("%*jd ", |
159 |
dp->s_block, howmany(sp->st_blocks, blocksize)); |
163 |
dp->s_block, howmany(sp->st_blocks, blocksize)); |
160 |
strmode(sp->st_mode, buf); |
164 |
strmodefcn(sp->st_mode, buf); |
161 |
aclmode(buf, p); |
165 |
aclmode(buf, p); |
162 |
np = p->fts_pointer; |
166 |
np = p->fts_pointer; |
163 |
(void)printf("%s %*u %-*s %-*s ", buf, dp->s_nlink, |
167 |
(void)printf("%s %*u %-*s %-*s ", buf, dp->s_nlink, |
Lines 684-686
Link Here
|
684 |
buf[10] = '+'; |
688 |
buf[10] = '+'; |
685 |
acl_free(facl); |
689 |
acl_free(facl); |
686 |
} |
690 |
} |
|
|
691 |
|
692 |
/* |
693 |
* Print file mode and permissions in octal mode. Like the regular strmode(), |
694 |
* add a space at the end for (potential) use by aclmode(). |
695 |
*/ |
696 |
static void |
697 |
octalmode(int mode, char *bp) |
698 |
{ |
699 |
/* Print the file type symbolically, this makes no sense in octal. */ |
700 |
switch (mode & S_IFMT) { |
701 |
case S_IFDIR: |
702 |
*bp++ = 'd'; |
703 |
break; |
704 |
case S_IFCHR: |
705 |
*bp++ = 'c'; |
706 |
break; |
707 |
case S_IFBLK: |
708 |
*bp++ = 'b'; |
709 |
break; |
710 |
case S_IFREG: |
711 |
*bp++ = '-'; |
712 |
break; |
713 |
case S_IFLNK: |
714 |
*bp++ = 'l'; |
715 |
break; |
716 |
case S_IFSOCK: |
717 |
*bp++ = 's'; |
718 |
break; |
719 |
case S_IFIFO: |
720 |
*bp++ = 'p'; |
721 |
break; |
722 |
case S_IFWHT: |
723 |
*bp++ = 'w'; |
724 |
break; |
725 |
default: |
726 |
*bp++ = '?'; |
727 |
break; |
728 |
} |
729 |
(void)snprintf(bp, 6, "%o%o%o%o ", (mode & 0007000) >> 9, |
730 |
(mode & S_IRWXU) >> 6, (mode & S_IRWXG) >> 3, mode & S_IRWXO); |
731 |
} |