stat.2: EXAMPLE: extend program to also show ID of the containing device

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-12-23 09:36:49 +01:00
parent d510e7de7e
commit 51dbffc566
1 changed files with 4 additions and 0 deletions

View File

@ -956,6 +956,7 @@ structure.
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysmacros.h>
int
main(int argc, char *argv[])
@ -972,6 +973,9 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
printf("ID of containing device: [%lx,%lx]\\n",
(long) major(sb.st_dev), (long) minor(sb.st_dev));
printf("File type: ");
switch (sb.st_mode & S_IFMT) {