summaryrefslogtreecommitdiffstats
path: root/tools/fs_get_stats
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:14 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:14 -0800
commit05806d7af62e07c6225b2e7103a1b115ecf6c9ad (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /tools/fs_get_stats
parent094268cf8cb37b9d904c8a1e3559cdd46d73cf66 (diff)
downloadbuild-05806d7af62e07c6225b2e7103a1b115ecf6c9ad.zip
build-05806d7af62e07c6225b2e7103a1b115ecf6c9ad.tar.gz
build-05806d7af62e07c6225b2e7103a1b115ecf6c9ad.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'tools/fs_get_stats')
-rw-r--r--tools/fs_get_stats/Android.mk9
-rw-r--r--tools/fs_get_stats/fs_get_stats.c64
2 files changed, 0 insertions, 73 deletions
diff --git a/tools/fs_get_stats/Android.mk b/tools/fs_get_stats/Android.mk
deleted file mode 100644
index c9b4a05..0000000
--- a/tools/fs_get_stats/Android.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := fs_get_stats.c
-
-LOCAL_MODULE := fs_get_stats
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/fs_get_stats/fs_get_stats.c b/tools/fs_get_stats/fs_get_stats.c
deleted file mode 100644
index 356f6f9..0000000
--- a/tools/fs_get_stats/fs_get_stats.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <private/android_filesystem_config.h>
-
-#define DO_DEBUG 1
-
-#define ERROR(fmt,args...) \
- do { \
- fprintf(stderr, "%s:%d: ERROR: " fmt, \
- __FILE__, __LINE__, ##args); \
- } while (0)
-
-#if DO_DEBUG
-#define DEBUG(fmt,args...) \
- do { fprintf(stderr, "DEBUG: " fmt, ##args); } while(0)
-#else
-#define DEBUG(x...) do {} while(0)
-#endif
-
-void
-print_help(void)
-{
- fprintf(stderr, "fs_get_stats: retrieve the target file stats "
- "for the specified file\n");
- fprintf(stderr, "usage: fs_get_stats cur_perms is_dir filename\n");
- fprintf(stderr, "\tcur_perms - The current permissions of "
- "the file\n");
- fprintf(stderr, "\tis_dir - Is filename is a dir, 1. Otherwise, 0.\n");
- fprintf(stderr, "\tfilename - The filename to lookup\n");
- fprintf(stderr, "\n");
-}
-
-int
-main(int argc, const char *argv[])
-{
- char *endptr;
- char is_dir = 0;
- unsigned perms = 0;
- unsigned uid = (unsigned)-1;
- unsigned gid = (unsigned)-1;
-
- if (argc < 4) {
- ERROR("Invalid arguments\n");
- print_help();
- exit(-1);
- }
-
- perms = (unsigned)strtoul(argv[1], &endptr, 0);
- if (!endptr || (endptr == argv[1]) || (*endptr != '\0')) {
- ERROR("current permissions must be a number. Got '%s'.\n", argv[1]);
- exit(-1);
- }
-
- if (!strcmp(argv[2], "1"))
- is_dir = 1;
-
- fs_config(argv[3], is_dir, &uid, &gid, &perms);
- fprintf(stdout, "%d %d 0%o\n", uid, gid, perms);
-
- return 0;
-}