handle other file type
This commit is contained in:
parent
a4161aff04
commit
4dcfda0167
1 changed files with 10 additions and 1 deletions
11
ccc.c
11
ccc.c
|
@ -340,7 +340,16 @@ long add_file_stat(char *filepath)
|
||||||
strcpy(type, "REG"); /* regular file */
|
strcpy(type, "REG"); /* regular file */
|
||||||
} else if (S_ISLNK(file_stat.st_mode)) {
|
} else if (S_ISLNK(file_stat.st_mode)) {
|
||||||
strcpy(type, "LNK"); /* symbolic link */
|
strcpy(type, "LNK"); /* symbolic link */
|
||||||
} // socket, block device, character device and FIFO not yet implemented
|
} else if (S_ISCHR(file_stat.st_mode)) {
|
||||||
|
strcpy(type, "CHR"); /* character device */
|
||||||
|
} else if (S_ISSOCK(file_stat.st_mode)) {
|
||||||
|
strcpy(type, "SOC"); /* socket */
|
||||||
|
} else if (S_ISBLK(file_stat.st_mode)) {
|
||||||
|
strcpy(type, "BLK"); /* block device */
|
||||||
|
} else if (S_ISFIFO(file_stat.st_mode)) {
|
||||||
|
strcpy(type, "FIF"); /* FIFO */
|
||||||
|
}
|
||||||
|
/* don't know how to handle socket, block device, character device and FIFO */
|
||||||
|
|
||||||
char *total_stat = memalloc(45 * sizeof(char));
|
char *total_stat = memalloc(45 * sizeof(char));
|
||||||
snprintf(total_stat, 45, "%-18s %-10s", time, size);
|
snprintf(total_stat, 45, "%-18s %-10s", time, size);
|
||||||
|
|
Loading…
Reference in a new issue