aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.custom16
-rw-r--r--findutils/find.c14
-rw-r--r--include/libbb.h21
-rw-r--r--include/usage.h35
4 files changed, 63 insertions, 23 deletions
diff --git a/Makefile.custom b/Makefile.custom
index d257f6de5..816bee5db 100644
--- a/Makefile.custom
+++ b/Makefile.custom
@@ -42,6 +42,22 @@ check test: busybox
bindir=$(objtree) srcdir=$(srctree)/testsuite SED="$(SED)" \
$(SHELL) $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:1=),-v)
+.PHONY: release
+release: distclean
+ cd ..; \
+ rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
+ cp -a busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && \
+ find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
+ -name .svn \
+ -print \
+ -exec rm -r -f {} \; && \
+ find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
+ -name .\#* \
+ -print \
+ -exec rm -f {} \; && \
+ tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
+ busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/;
+
.PHONY: checkhelp
checkhelp:
$(Q)$(srctree)/scripts/checkhelp.awk \
diff --git a/findutils/find.c b/findutils/find.c
index edb8482d8..bf6b71a83 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -69,6 +69,7 @@ USE_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;))
USE_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;))
USE_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; int *subst_count; int exec_argc;))
USE_DESKTOP( ACTS(paren, action ***subexpr;))
+USE_DESKTOP( ACTS(size, off_t size;))
USE_DESKTOP( ACTS(prune))
static action ***actions;
@@ -225,6 +226,7 @@ ACTF(paren)
{
return exec_actions(ap->subexpr, fileName, statbuf);
}
+
/*
* -prune: if -depth is not given, return true and do not descend
* current dir; if -depth is given, return false with no effect.
@@ -235,6 +237,11 @@ ACTF(prune)
{
return SKIP;
}
+
+ACTF(size)
+{
+ return statbuf->st_size == ap->size;
+}
#endif
@@ -487,6 +494,13 @@ action*** parse_params(char **argv)
else if (strcmp(arg, "-prune") == 0) {
(void) ALLOC_ACTION(prune);
}
+ else if (strcmp(arg, "-size") == 0) {
+ action_size *ap;
+ if (!*++argv)
+ bb_error_msg_and_die(bb_msg_requires_arg, arg);
+ ap = ALLOC_ACTION(size);
+ ap->size = XATOOFF(arg1);
+ }
#endif
else
bb_show_usage();
diff --git a/include/libbb.h b/include/libbb.h
index ef5086d6c..1d91a0a72 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -85,7 +85,7 @@
/* CONFIG_LFS is on */
# if ULONG_MAX > 0xffffffff
/* "long" is long enough on this system */
-# define XSTRTOOFF xstrtoul
+# define XATOOFF(a) xatoul_range(a, 0, LONG_MAX)
/* usage: sz = BB_STRTOOFF(s, NULL, 10); if (errno || sz < 0) die(); */
# define BB_STRTOOFF bb_strtoul
# define STRTOOFF strtoul
@@ -93,22 +93,23 @@
# define OFF_FMT "l"
# else
/* "long" is too short, need "long long" */
-# define XSTRTOOFF xstrtoull
+# define XATOOFF(a) xatoull_range(a, 0, LLONG_MAX)
# define BB_STRTOOFF bb_strtoull
# define STRTOOFF strtoull
# define OFF_FMT "ll"
# endif
#else
-# if 0 /* #if UINT_MAX == 0xffffffff */
-/* Doesn't work. off_t is a long. gcc will throw warnings on printf("%d", off_t)
- * even if long==int on this arch. Crap... */
-# define XSTRTOOFF xstrtou
-# define BB_STRTOOFF bb_strtoi
+/* CONFIG_LFS is off */
+# if UINT_MAX == 0xffffffff
+/* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway.
+ * gcc will throw warnings on printf("%d", off_t). Crap... */
+# define XATOOFF(a) xatoi_u(a)
+# define BB_STRTOOFF bb_strtou
# define STRTOOFF strtol
-# define OFF_FMT ""
+# define OFF_FMT "l"
# else
-# define XSTRTOOFF xstrtoul
-# define BB_STRTOOFF bb_strtol
+# define XATOOFF(a) xatoul_range(a, 0, LONG_MAX)
+# define BB_STRTOOFF bb_strtoul
# define STRTOOFF strtol
# define OFF_FMT "l"
# endif
diff --git a/include/usage.h b/include/usage.h
index b9310ac1f..0fba9b848 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -866,24 +866,33 @@ USE_FEATURE_DATE_ISOFMT( \
"\nEXPRESSION may consist of:\n" \
" -follow Dereference symbolic links\n" \
" -name PATTERN File name (leading directories removed) matches PATTERN\n" \
- " -print Print (default and assumed)\n" \
+ " -print Print (default and assumed)" \
USE_FEATURE_FIND_PRINT0( \
- " -print0 Delimit output with null characters rather than\n newlines" \
-) USE_FEATURE_FIND_TYPE( \
+ "\n -print0 Delimit output with null characters rather than" \
+ "\n newlines" \
+ ) USE_FEATURE_FIND_TYPE( \
"\n -type X Filetype matches X (where X is one of: f,d,l,b,c,...)" \
-) USE_FEATURE_FIND_PERM( \
- "\n -perm PERMS Permissions match any of (+NNN); all of (-NNN);\n or exactly (NNN)" \
-) USE_FEATURE_FIND_MTIME( \
- "\n -mtime DAYS Modified time is greater than (+N); less than (-N);\n or exactly (N) days" \
-) USE_FEATURE_FIND_MMIN( \
- "\n -mmin MINS Modified time is greater than (+N); less than (-N);\n or exactly (N) minutes" \
-) USE_FEATURE_FIND_NEWER( \
+ ) USE_FEATURE_FIND_PERM( \
+ "\n -perm PERMS Permissions match any of (+NNN); all of (-NNN);" \
+ "\n or exactly (NNN)" \
+ ) USE_FEATURE_FIND_MTIME( \
+ "\n -mtime DAYS Modified time is greater than (+N); less than (-N);" \
+ "\n or exactly (N) days" \
+ ) USE_FEATURE_FIND_MMIN( \
+ "\n -mmin MINS Modified time is greater than (+N); less than (-N);" \
+ "\n or exactly (N) minutes" \
+ ) USE_FEATURE_FIND_NEWER( \
"\n -newer FILE Modified time is more recent than FILE's" \
-) USE_FEATURE_FIND_INUM( \
+ ) USE_FEATURE_FIND_INUM( \
"\n -inum N File has inode number N" \
-) USE_FEATURE_FIND_EXEC( \
+ ) USE_FEATURE_FIND_EXEC( \
"\n -exec CMD Execute CMD with all instances of {} replaced by the" \
- "\n files matching EXPRESSION")
+ "\n files matching EXPRESSION" \
+ ) USE_DESKTOP( \
+ "\n -size N File size is N" \
+ "\n -prune Stop traversing current subtree" \
+ "\n (expr) Group" \
+ )
#define find_example_usage \
"$ find / -name passwd\n" \