Lines Matching +full:out +full:- +full:file
1 /* stat.c : display file or file system status
11 usage: stat [-tfL] [-c FORMAT] FILE...
15 -c Output specified FORMAT string instead of default
16 -f Display filesystem status instead of file status
17 -L Follow symlinks
18 -t terse (-c "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o")
19 (with -f = -c "%n %i %l %t %s %S %b %f %a %c %d")
24 %D Device ID (hex) |%f All mode bits (hex)|%F File type
35 %d Free inodes |%f Free blocks |%i File system ID
36 %l Max filename length |%n File name |%s Best transfer size
50 char *file, *pattern;
56 static void out(char c, long long val) in out() function
71 strout(format_iso_time(toybuf+128, sizeof(toybuf)-128, ts)); in date_stat_format()
78 if (type == 'a') out('o', stat->st_mode&~S_IFMT); in print_stat()
82 mode_to_string(stat->st_mode, str); in print_stat()
84 } else if (type == 'b') out('u', stat->st_blocks); in print_stat()
85 else if (type == 'B') out('d', 512); in print_stat()
89 strout(lsm_get_context(TT.file, &context) != -1 ? context : "?"); in print_stat()
91 } else if (type == 'd') out('d', stat->st_dev); in print_stat()
92 else if (type == 'D') out('x', stat->st_dev); in print_stat()
93 else if (type == 'f') out('x', stat->st_mode); in print_stat()
96 "regular file\0symbolic link\0socket\0FIFO (named pipe)"; in print_stat()
97 int i, filetype = stat->st_mode & S_IFMT; in print_stat()
100 if (!stat->st_size && filetype == S_IFREG) t = "regular empty file"; in print_stat()
102 } else if (type == 'g') out('u', stat->st_gid); in print_stat()
103 else if (type == 'G') strout(getgroupname(stat->st_gid)); in print_stat()
104 else if (type == 'h') out('u', stat->st_nlink); in print_stat()
105 else if (type == 'i') out('u', stat->st_ino); in print_stat()
108 dev_t dev = stat->st_rdev ? stat->st_rdev : stat->st_dev; in print_stat()
111 for (dlist_terminate(mt); mt; mt = mt->next) if (mt->stat.st_dev == dev) { in print_stat()
112 strout(mt->dir); in print_stat()
117 printf("%s", TT.file); in print_stat()
118 if (S_ISLNK(stat->st_mode)) in print_stat()
119 if (readlink0(TT.file, toybuf, sizeof(toybuf))) in print_stat()
120 printf(" -> '%s'", toybuf); in print_stat()
121 } else if (type == 'o') out('u', stat->st_blksize); in print_stat()
122 else if (type == 's') out('u', stat->st_size); in print_stat()
123 else if (type == 't') out('x', dev_major(stat->st_rdev)); in print_stat()
124 else if (type == 'T') out('x', dev_minor(stat->st_rdev)); in print_stat()
125 else if (type == 'u') out('u', stat->st_uid); in print_stat()
126 else if (type == 'U') strout(getusername(stat->st_uid)); in print_stat()
127 else if (type == 'x') date_stat_format(&stat->st_atim); in print_stat()
128 else if (type == 'X') out('u', stat->st_atime); in print_stat()
129 else if (type == 'y') date_stat_format(&stat->st_mtim); in print_stat()
130 else if (type == 'Y') out('u', stat->st_mtime); in print_stat()
131 else if (type == 'z') date_stat_format(&stat->st_ctim); in print_stat()
132 else if (type == 'Z') out('u', stat->st_ctime); in print_stat()
139 if (type == 'a') out('u', statfs->f_bavail); in print_statfs()
140 else if (type == 'b') out('u', statfs->f_blocks); in print_statfs()
141 else if (type == 'c') out('u', statfs->f_files); in print_statfs()
142 else if (type == 'd') out('u', statfs->f_ffree); in print_statfs()
143 else if (type == 'f') out('u', statfs->f_bfree); in print_statfs()
144 else if (type == 'l') out('d', pathconf(TT.file, _PC_NAME_MAX)); in print_statfs()
145 else if (type == 't') out('x', statfs->f_type); in print_statfs()
148 int *val = (int *) &statfs->f_fsid; in print_statfs()
153 } else if (type == 's') out('d', statfs_bsize(statfs)); in print_statfs()
154 else if (type == 'S') out('d', statfs_frsize(statfs)); in print_statfs()
167 ? " File: \"%n\"\n ID: %i Namelen: %l Type: %T\n" in stat_main()
171 : " File: %N\n Size: %s\t Blocks: %b\t IO Blocks: %B\t %F\n" in stat_main()
181 // stat the file or filesystem in stat_main()
182 TT.file = toys.optargs[i]; in stat_main()
183 if (flagf && !statfs(TT.file, (void *)&TT.stat)); in stat_main()
184 else if (flagf || (FLAG(L) ? stat : lstat)(TT.file, (void *)&TT.stat)) { in stat_main()
185 perror_msg("'%s'", TT.file); in stat_main()
195 TT.patlen = f-TT.pattern; in stat_main()
197 if (*f == 'n') strout(TT.file); in stat_main()