mirror of https://github.com/mkerrisk/man-pages
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:
parent
d510e7de7e
commit
51dbffc566
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue