From c30b023a6bca204b808c22eef959a94db343c8d5 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 20 Feb 2008 23:29:46 +0000 Subject: [PATCH] Revoked inflation of file type characters to words --- libisoburn/trunk/test/compare_file.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/libisoburn/trunk/test/compare_file.c b/libisoburn/trunk/test/compare_file.c index 63a7ff5a..cd7cdbcd 100644 --- a/libisoburn/trunk/test/compare_file.c +++ b/libisoburn/trunk/test/compare_file.c @@ -25,8 +25,11 @@ #include +/* @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);