diff --git a/find.c b/find.c
index f60c45a..a4d056b 100644
--- a/find.c
+++ b/find.c
@@ -5,6 +5,8 @@
  *
  * Copyright (C) 1999,2000,2001 by Lineo, inc.
  * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ * Reworked by David Douthitt <n9ubh@callsign.net> and
+ *  Matt Kraai <kraai@alumni.carnegiemellon.edu>.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,82 +30,168 @@
 #include <dirent.h>
 #include <string.h>
 #include <stdlib.h>
+#include <fnmatch.h>
+#include <time.h>
+#include <ctype.h>
 
 
-static char *pattern = NULL;
-static char *directory = ".";
-static int dereferenceFlag = FALSE;
+static char *pattern;
+
+#ifdef BB_FEATURE_FIND_TYPE
+static int type_mask = 0;
+#endif
+
+#ifdef BB_FEATURE_FIND_PERM
+static char perm_char = 0;
+static int perm_mask = 0;
+#endif
+
+#ifdef BB_FEATURE_FIND_MTIME
+static char mtime_char;
+static int mtime_days;
+#endif
 
 static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
 {
-	if (pattern == NULL)
-		puts(fileName);
-	else {
-		char *tmp = strrchr(fileName, '/');
+	if (pattern != NULL) {
+		const char *tmp = strrchr(fileName, '/');
 
 		if (tmp == NULL)
-			tmp = (char *) fileName;
+			tmp = fileName;
 		else
 			tmp++;
-		if (check_wildcard_match(tmp, pattern) == TRUE)
-			puts(fileName);
+		if (!(fnmatch(pattern, tmp, FNM_PERIOD) == 0))
+			goto no_match;
 	}
+#ifdef BB_FEATURE_FIND_TYPE
+	if (type_mask != 0) {
+		if (!((statbuf->st_mode & S_IFMT) == type_mask))
+			goto no_match;
+	}
+#endif
+#ifdef BB_FEATURE_FIND_PERM
+	if (perm_mask != 0) {
+		if (!((isdigit(perm_char) && (statbuf->st_mode & 07777) == perm_mask) ||
+			 (perm_char == '-' && (statbuf->st_mode & perm_mask) == perm_mask) ||
+			 (perm_char == '+' && (statbuf->st_mode & perm_mask) != 0)))
+			goto no_match;
+	}
+#endif
+#ifdef BB_FEATURE_FIND_MTIME
+	if (mtime_days != 0) {
+		time_t file_age = time(NULL) - statbuf->st_mtime;
+		time_t mtime_secs = mtime_days * 24 * 60 * 60;
+		if (!((isdigit(mtime_char) && mtime_secs >= file_age &&
+						mtime_secs < file_age + 24 * 60 * 60) ||
+				(mtime_char == '+' && mtime_secs >= file_age) || 
+				(mtime_char == '-' && mtime_secs < file_age)))
+			goto no_match;
+	}
+#endif
+	puts(fileName);
+no_match:
 	return (TRUE);
 }
 
+#ifdef BB_FEATURE_FIND_TYPE
+static int find_type(char *type)
+{
+	int mask = 0;
+
+	switch (type[0]) {
+		case 'b':
+			mask = S_IFBLK;
+			break;
+		case 'c':
+			mask = S_IFCHR;
+			break;
+		case 'd':
+			mask = S_IFDIR;
+			break;
+		case 'p':
+			mask = S_IFIFO;
+			break;
+		case 'f':
+			mask = S_IFREG;
+			break;
+		case 'l':
+			mask = S_IFLNK;
+			break;
+		case 's':
+			mask = S_IFSOCK;
+			break;
+	}
+
+	if (mask == 0 || type[1] != '\0')
+		error_msg_and_die("invalid argument `%s' to `-type'", type);
+
+	return mask;
+}
+#endif
+
 int find_main(int argc, char **argv)
 {
-	/* peel off the "find" */
-	argc--;
-	argv++;
+	int dereference = FALSE;
+	int i, firstopt, status = EXIT_SUCCESS;
 
-	if (argc > 0 && **argv != '-') {
-		directory = *argv;
-		argc--;
-		argv++;
+	for (firstopt = 1; firstopt < argc; firstopt++) {
+		if (argv[firstopt][0] == '-')
+			break;
 	}
 
 	/* Parse any options */
-	while (argc > 0 && **argv == '-') {
-		int stopit = FALSE;
-
-		while (*++(*argv) && stopit == FALSE)
-			switch (**argv) {
-			case 'f':
-				if (strcmp(*argv, "follow") == 0) {
-					argc--;
-					argv++;
-					dereferenceFlag = TRUE;
-				}
-				break;
-			case 'n':
-				if (strcmp(*argv, "name") == 0) {
-					if (argc-- > 1) {
-						pattern = *(++argv);
-						stopit = TRUE;
-					} else {
-						usage(find_usage);
-					}
-				}
-				break;
-			case '-':
-				/* Ignore all long options */
-				break;
-			default:
-				usage(find_usage);
-			}
-		if (argc-- > 1)
-			argv++;
-		if (**argv != '-')
-			break;
-		else
-			break;
+	for (i = firstopt; i < argc; i++) {
+		if (strcmp(argv[i], "-follow") == 0)
+			dereference = TRUE;
+		else if (strcmp(argv[i], "-name") == 0) {
+			if (++i == argc)
+				error_msg_and_die("option `-name' requires an argument");
+			pattern = argv[i];
+#ifdef BB_FEATURE_FIND_TYPE
+		} else if (strcmp(argv[i], "-type") == 0) {
+			if (++i == argc)
+				error_msg_and_die("option `-type' requires an argument");
+			type_mask = find_type(argv[i]);
+#endif
+#ifdef BB_FEATURE_FIND_PERM
+		} else if (strcmp(argv[i], "-perm") == 0) {
+			char *end;
+			if (++i == argc)
+				error_msg_and_die("option `-perm' requires an argument");
+			perm_mask = strtol(argv[i], &end, 8);
+			if (end[0] != '\0')
+				error_msg_and_die("invalid argument `%s' to `-perm'", argv[i]);
+			if (perm_mask > 07777)
+				error_msg_and_die("invalid argument `%s' to `-perm'", argv[i]);
+			if ((perm_char = argv[i][0]) == '-')
+				perm_mask = -perm_mask;
+#endif
+#ifdef BB_FEATURE_FIND_MTIME
+		} else if (strcmp(argv[i], "-mtime") == 0) {
+			char *end;
+			if (++i == argc)
+				error_msg_and_die("option `-mtime' requires an argument");
+			mtime_days = strtol(argv[i], &end, 10);
+			if (end[0] != '\0')
+				error_msg_and_die("invalid argument `%s' to `-mtime'", argv[i]);
+			if ((mtime_char = argv[i][0]) == '-')
+				mtime_days = -mtime_days;
+#endif
+		} else
+			usage(find_usage);
 	}
 
-	if (recursive_action(directory, TRUE, FALSE, FALSE,
-						fileAction, fileAction, NULL) == FALSE) {
-		return EXIT_FAILURE;
+	if (firstopt == 1) {
+		if (recursive_action(".", TRUE, dereference, FALSE, fileAction,
+					fileAction, NULL) == FALSE)
+			status = EXIT_FAILURE;
+	} else {
+		for (i = 1; i < firstopt; i++) {
+			if (recursive_action(argv[i], TRUE, dereference, FALSE, fileAction,
+						fileAction, NULL) == FALSE)
+				status = EXIT_FAILURE;
+		}
 	}
 
-	return EXIT_SUCCESS;
+	return status;
 }
