wok-stable diff busybox/stuff/busybox-1.10.1-stat.u @ rev 868

Up: curl (7.18.2)
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jun 06 11:49:55 2008 +0200 (2008-06-06)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.10.1-stat.u	Fri Jun 06 11:49:55 2008 +0200
     1.3 @@ -0,0 +1,73 @@
     1.4 +--- busybox-1.10.1/coreutils/stat.c
     1.5 ++++ busybox-1.10.1/coreutils/stat.c
     1.6 +@@ -14,12 +14,14 @@
     1.7 +  */
     1.8 + 
     1.9 + #include "libbb.h"
    1.10 ++#include <linux/fs.h>
    1.11 + 
    1.12 + /* vars to control behavior */
    1.13 + #define OPT_FILESYS     (1 << 0)
    1.14 + #define OPT_TERSE       (1 << 1)
    1.15 + #define OPT_DEREFERENCE (1 << 2)
    1.16 +-#define OPT_SELINUX     (1 << 3)
    1.17 ++#define OPT_MAP         (1 << 3)
    1.18 ++#define OPT_SELINUX     (1 << 4)
    1.19 + 
    1.20 + #if ENABLE_FEATURE_STAT_FORMAT
    1.21 + typedef bool (*statfunc_ptr)(const char *, const char *);
    1.22 +@@ -345,6 +347,26 @@
    1.23 + 
    1.24 + /* Stat the file system and print what we find.  */
    1.25 + #if !ENABLE_FEATURE_STAT_FORMAT
    1.26 ++#define do_mapfile(filename, format) do_mapfile(filename)
    1.27 ++#endif
    1.28 ++static bool do_mapfile(const char *filename, const char *format)
    1.29 ++{
    1.30 ++	int i = 0;
    1.31 ++	int fd = xopen(filename, O_RDONLY);
    1.32 ++
    1.33 ++#if ENABLE_FEATURE_STAT_FORMAT
    1.34 ++	(void) format;
    1.35 ++#endif
    1.36 ++	while (1) {
    1.37 ++		int blk = i++;
    1.38 ++		if (ioctl(fd,FIBMAP,&blk) < 0 || blk == 0) break;
    1.39 ++		printf("%u\n",blk);
    1.40 ++	}	
    1.41 ++	return 1;
    1.42 ++}
    1.43 ++
    1.44 ++/* Stat the file system and print what we find.  */
    1.45 ++#if !ENABLE_FEATURE_STAT_FORMAT
    1.46 + #define do_statfs(filename, format) do_statfs(filename)
    1.47 + #endif
    1.48 + static bool do_statfs(const char *filename, const char *format)
    1.49 +@@ -632,13 +654,15 @@
    1.50 + 	int ok = 1;
    1.51 + 	statfunc_ptr statfunc = do_stat;
    1.52 + 
    1.53 +-	getopt32(argv, "ftL"
    1.54 ++	getopt32(argv, "ftLm"
    1.55 + 		USE_SELINUX("Z")
    1.56 + 		USE_FEATURE_STAT_FORMAT("c:", &format)
    1.57 + 	);
    1.58 + 
    1.59 + 	if (option_mask32 & OPT_FILESYS) /* -f */
    1.60 + 		statfunc = do_statfs;
    1.61 ++	if (option_mask32 & OPT_MAP) /* -m */
    1.62 ++		statfunc = do_mapfile;
    1.63 + 	if (argc == optind)           /* files */
    1.64 + 		bb_show_usage();
    1.65 + 
    1.66 +
    1.67 +--- busybox-1.10.1/include/usage.h
    1.68 ++++ busybox-1.10.1/include/usage.h
    1.69 +@@ -3585,6 +3585,7 @@
    1.70 + 	) \
    1.71 +      "\n	-f	Display filesystem status" \
    1.72 +      "\n	-L	Dereference links" \
    1.73 ++     "\n	-m	Display block list" \
    1.74 +      "\n	-t	Display info in terse form" \
    1.75 + 	USE_SELINUX( \
    1.76 +      "\n	-Z	Print security context" \