Revoked inflation of file type characters to words
This commit is contained in:
parent
be272a685b
commit
df83afc55b
@ -25,8 +25,11 @@
|
||||
#include <time.h>
|
||||
|
||||
|
||||
/* @param flag bit0= single letters */
|
||||
char *Ftypetxt(mode_t st_mode, int flag)
|
||||
{
|
||||
if(flag&1)
|
||||
goto single_letters;
|
||||
if(S_ISDIR(st_mode))
|
||||
return("directory");
|
||||
else if(S_ISREG(st_mode))
|
||||
@ -42,6 +45,22 @@ char *Ftypetxt(mode_t st_mode, int flag)
|
||||
else if(S_ISSOCK(st_mode))
|
||||
return("unix_socket");
|
||||
return("unknown");
|
||||
single_letters:;
|
||||
if(S_ISDIR(st_mode))
|
||||
return("d");
|
||||
else if(S_ISREG(st_mode))
|
||||
return("-");
|
||||
else if(S_ISLNK(st_mode))
|
||||
return("l");
|
||||
else if(S_ISBLK(st_mode))
|
||||
return("b");
|
||||
else if(S_ISCHR(st_mode))
|
||||
return("c");
|
||||
else if(S_ISFIFO(st_mode))
|
||||
return("p");
|
||||
else if(S_ISSOCK(st_mode))
|
||||
return("s");
|
||||
return("?");
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +101,7 @@ int Compare_2_files(char *adr1, char *adr2, char *adrc, int flag)
|
||||
printf("? %s : cannot lstat() : %s\n", adr1, strerror(errno));
|
||||
return(0);
|
||||
}
|
||||
strcpy(a, Ftypetxt(s1.st_mode, 0));
|
||||
strcpy(a, Ftypetxt(s1.st_mode, 1));
|
||||
strcat(a, " ");
|
||||
if(adrc[0])
|
||||
strcat(a, adrc);
|
||||
|
Loading…
Reference in New Issue
Block a user