wok-stable view busybox/stuff/busybox-1.10.1-stat.u @ rev 1508

Add doxygen
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Oct 05 17:35:38 2008 +0000 (2008-10-05)
parents
children
line source
1 --- busybox-1.10.1/coreutils/stat.c
2 +++ busybox-1.10.1/coreutils/stat.c
3 @@ -14,12 +14,14 @@
4 */
6 #include "libbb.h"
7 +#include <linux/fs.h>
9 /* vars to control behavior */
10 #define OPT_FILESYS (1 << 0)
11 #define OPT_TERSE (1 << 1)
12 #define OPT_DEREFERENCE (1 << 2)
13 -#define OPT_SELINUX (1 << 3)
14 +#define OPT_MAP (1 << 3)
15 +#define OPT_SELINUX (1 << 4)
17 #if ENABLE_FEATURE_STAT_FORMAT
18 typedef bool (*statfunc_ptr)(const char *, const char *);
19 @@ -345,6 +347,26 @@
21 /* Stat the file system and print what we find. */
22 #if !ENABLE_FEATURE_STAT_FORMAT
23 +#define do_mapfile(filename, format) do_mapfile(filename)
24 +#endif
25 +static bool do_mapfile(const char *filename, const char *format)
26 +{
27 + int i = 0;
28 + int fd = xopen(filename, O_RDONLY);
29 +
30 +#if ENABLE_FEATURE_STAT_FORMAT
31 + (void) format;
32 +#endif
33 + while (1) {
34 + int blk = i++;
35 + if (ioctl(fd,FIBMAP,&blk) < 0 || blk == 0) break;
36 + printf("%u\n",blk);
37 + }
38 + return 1;
39 +}
40 +
41 +/* Stat the file system and print what we find. */
42 +#if !ENABLE_FEATURE_STAT_FORMAT
43 #define do_statfs(filename, format) do_statfs(filename)
44 #endif
45 static bool do_statfs(const char *filename, const char *format)
46 @@ -632,13 +654,15 @@
47 int ok = 1;
48 statfunc_ptr statfunc = do_stat;
50 - getopt32(argv, "ftL"
51 + getopt32(argv, "ftLm"
52 USE_SELINUX("Z")
53 USE_FEATURE_STAT_FORMAT("c:", &format)
54 );
56 if (option_mask32 & OPT_FILESYS) /* -f */
57 statfunc = do_statfs;
58 + if (option_mask32 & OPT_MAP) /* -m */
59 + statfunc = do_mapfile;
60 if (argc == optind) /* files */
61 bb_show_usage();
64 --- busybox-1.10.1/include/usage.h
65 +++ busybox-1.10.1/include/usage.h
66 @@ -3585,6 +3585,7 @@
67 ) \
68 "\n -f Display filesystem status" \
69 "\n -L Dereference links" \
70 + "\n -m Display block list" \
71 "\n -t Display info in terse form" \
72 USE_SELINUX( \
73 "\n -Z Print security context" \