aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-08-28 03:12:30 +0000
committerMatt Kraai <kraai@debian.org>2000-08-28 03:12:30 +0000
commitab60f6987a8283f60988c7e7806bd7fbfd86fbd3 (patch)
treef3df79cd432fd69d4d4d92833062c6b069a6194c
parent88cc3057fdb5a342bc305963cd6abc180ff6c324 (diff)
downloadbusybox-w32-ab60f6987a8283f60988c7e7806bd7fbfd86fbd3.tar.gz
busybox-w32-ab60f6987a8283f60988c7e7806bd7fbfd86fbd3.tar.bz2
busybox-w32-ab60f6987a8283f60988c7e7806bd7fbfd86fbd3.zip
Removed dead regular expression code.
-rw-r--r--busybox.def.h10
-rw-r--r--utility.c76
2 files changed, 0 insertions, 86 deletions
diff --git a/busybox.def.h b/busybox.def.h
index 63b8306f3..c85f1eeab 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -139,12 +139,6 @@
139// at the same time... 139// at the same time...
140#define BB_FEATURE_USE_PROCFS 140#define BB_FEATURE_USE_PROCFS
141// 141//
142// Enable full regular expressions. This adds about
143// 4k. When this is off, things that would normally
144// use regualr expressions (like grep) will just use
145// normal strings.
146#define BB_FEATURE_FULL_REGULAR_EXPRESSIONS
147//
148// This compiles out everything but the most 142// This compiles out everything but the most
149// trivial --help usage information (i.e. reduces binary size) 143// trivial --help usage information (i.e. reduces binary size)
150//#define BB_FEATURE_TRIVIAL_HELP 144//#define BB_FEATURE_TRIVIAL_HELP
@@ -281,10 +275,6 @@
281#define BB_MTAB 275#define BB_MTAB
282#endif 276#endif
283// 277//
284#if defined BB_FEATURE_FULL_REGULAR_EXPRESSIONS && (defined BB_SED || defined BB_GREP )
285#define BB_REGEXP
286#endif
287//
288#if defined BB_FEATURE_SH_COMMAND_EDITING && defined BB_SH 278#if defined BB_FEATURE_SH_COMMAND_EDITING && defined BB_SH
289#define BB_CMDEDIT 279#define BB_CMDEDIT
290#endif 280#endif
diff --git a/utility.c b/utility.c
index aa8bef6b3..911d84eaf 100644
--- a/utility.c
+++ b/utility.c
@@ -1033,82 +1033,6 @@ int get_console_fd(char *tty_name)
1033#endif /* BB_CHVT || BB_DEALLOCVT || BB_SETKEYCODES */ 1033#endif /* BB_CHVT || BB_DEALLOCVT || BB_SETKEYCODES */
1034 1034
1035 1035
1036#if !defined BB_REGEXP && (defined BB_GREP || defined BB_SED)
1037
1038/* Do a case insensitive strstr() */
1039char *stristr(char *haystack, const char *needle)
1040{
1041 int len = strlen(needle);
1042
1043 while (*haystack) {
1044 if (!strncasecmp(haystack, needle, len))
1045 break;
1046 haystack++;
1047 }
1048
1049 if (!(*haystack))
1050 haystack = NULL;
1051
1052 return haystack;
1053}
1054
1055/* This tries to find a needle in a haystack, but does so by
1056 * only trying to match literal strings (look 'ma, no regexps!)
1057 * This is short, sweet, and carries _very_ little baggage,
1058 * unlike its beefier cousin in regexp.c
1059 * -Erik Andersen
1060 */
1061extern int find_match(char *haystack, char *needle, int ignoreCase)
1062{
1063
1064 if (ignoreCase == FALSE)
1065 haystack = strstr(haystack, needle);
1066 else
1067 haystack = stristr(haystack, needle);
1068 if (haystack == NULL)
1069 return FALSE;
1070 return TRUE;
1071}
1072
1073
1074/* This performs substitutions after a string match has been found. */
1075extern int replace_match(char *haystack, char *needle, char *newNeedle,
1076 int ignoreCase)
1077{
1078 int foundOne = 0;
1079 char *where, *slider, *slider1, *oldhayStack;
1080
1081 if (ignoreCase == FALSE)
1082 where = strstr(haystack, needle);
1083 else
1084 where = stristr(haystack, needle);
1085
1086 if (strcmp(needle, newNeedle) == 0)
1087 return FALSE;
1088
1089 oldhayStack = (char *) xmalloc((unsigned) (strlen(haystack)));
1090 while (where != NULL) {
1091 foundOne++;
1092 strcpy(oldhayStack, haystack);
1093 for (slider = haystack, slider1 = oldhayStack; slider != where;
1094 slider++, slider1++);
1095 *slider = 0;
1096 haystack = strcat(haystack, newNeedle);
1097 slider1 += strlen(needle);
1098 haystack = strcat(haystack, slider1);
1099 where = strstr(slider, needle);
1100 }
1101 free(oldhayStack);
1102
1103 if (foundOne > 0)
1104 return TRUE;
1105 else
1106 return FALSE;
1107}
1108
1109#endif /* ! BB_REGEXP && (BB_GREP || BB_SED) */
1110
1111
1112#if defined BB_FIND || defined BB_INSMOD 1036#if defined BB_FIND || defined BB_INSMOD
1113/* 1037/*
1114 * Routine to see if a text string is matched by a wildcard pattern. 1038 * Routine to see if a text string is matched by a wildcard pattern.