Equipped output of lsl with '+' perm if ACL is present

This commit is contained in:
Thomas Schmitt 2009-01-31 10:11:37 +00:00
parent 002ba5d6d2
commit 4ceee394f7
3 changed files with 24 additions and 7 deletions

View File

@ -8116,9 +8116,11 @@ ex:;
}
int Xorriso__mode_to_perms(mode_t st_mode, char perms[10], int flag)
/* @param flag bit1= add '+' to perms
*/
int Xorriso__mode_to_perms(mode_t st_mode, char perms[11], int flag)
{
strcpy(perms,"---------");
strcpy(perms,"--------- ");
if(st_mode&S_IRUSR) perms[0]= 'r';
if(st_mode&S_IWUSR) perms[1]= 'w';
if(st_mode&S_IXUSR) perms[2]= 'x';
@ -8146,16 +8148,19 @@ int Xorriso__mode_to_perms(mode_t st_mode, char perms[10], int flag)
else
perms[8]= 'T';
}
if(flag & 2)
perms[9]= '+';
return(1);
}
/* @param flag bit0= recognize Xorriso_IFBOOT as file type
bit1= add '+' to perms
*/
int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag)
{
int show_major_minor= 0, high_shift= 0, high_mask= 0;
char *rpt, perms[10], mm_text[80];
char *rpt, perms[11], mm_text[80];
mode_t st_mode;
dev_t dev, major, minor;
@ -8184,10 +8189,10 @@ int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag)
else
strcat(rpt, "?");
Xorriso__mode_to_perms(st_mode, perms, 0);
Xorriso__mode_to_perms(st_mode, perms, flag & 2);
strcat(rpt, perms);
sprintf(rpt+strlen(rpt),"%4u ",(unsigned int) stbuf->st_nlink);
sprintf(rpt+strlen(rpt)," %3u ",(unsigned int) stbuf->st_nlink);
sprintf(rpt+strlen(rpt), "%-8lu ", (unsigned long) stbuf->st_uid);
sprintf(rpt+strlen(rpt), "%-8lu ", (unsigned long) stbuf->st_gid);

View File

@ -386,7 +386,7 @@ int Xorriso_regexec(struct XorrisO *xorriso, char *to_match, int *failed_at,
int Xorriso_prepare_expansion_pattern(struct XorrisO *xorriso, char *pattern,
int flag);
int Xorriso__mode_to_perms(mode_t st_mode, char perms[10], int flag);
int Xorriso__mode_to_perms(mode_t st_mode, char perms[11], int flag);
int Xorriso_much_too_long(struct XorrisO *xorriso, int len, int flag);

View File

@ -5521,6 +5521,7 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
IsoImage *volume;
char sfe[5*SfileadrL], sfe2[5*SfileadrL], path[SfileadrL];
char link_target[SfileadrL], *rpt, **dfilev= NULL;
char *a_text= NULL, *d_text= NULL;
off_t size;
struct stat stbuf;
@ -5597,7 +5598,18 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
continue;
link_target[0]= 0;
if((flag&5)==1) { /* -ls_l */
ret= Xorriso_format_ls_l(xorriso, &stbuf, 1);
#ifdef Xorriso_with_aaiP
iso_node_get_acl_text(node, &a_text, &d_text, 16);
#endif
ret= Xorriso_format_ls_l(xorriso, &stbuf,
1 | ((a_text != NULL || d_text != NULL) << 1));
#ifdef Xorriso_with_aaiP
iso_node_get_acl_text(node, &a_text, &d_text, 1 << 15);
#endif
if(ret<=0)
continue;
if(LIBISO_ISLNK(node)) {