* Kenneth Almquist.
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
- *
- * Original BSD copyright notice is retained at the end of this file.
*/
-
#ifdef STANDALONE
# include <stdbool.h>
# include <stdio.h>
# include <string.h>
# include <unistd.h>
#else
-# include "busybox.h"
+# include "libbb.h"
#endif
#include <fnmatch.h>
#include "match.h"
#define pmatch(a, b) !fnmatch((a), (b), 0)
-char *scanleft(char *string, char *pattern, bool zero)
+char *scanleft(char *string, char *pattern, bool match_at_left)
{
char c;
char *loc = string;
const char *s;
c = *loc;
- if (zero) {
+ if (match_at_left) {
*loc = '\0';
s = string;
} else
return NULL;
}
-char *scanright(char *string, char *pattern, bool zero)
+char *scanright(char *string, char *pattern, bool match_at_left)
{
char c;
char *loc = string + strlen(string);
const char *s;
c = *loc;
- if (zero) {
+ if (match_at_left) {
*loc = '\0';
s = string;
} else
char *string;
char *op;
char *pattern;
- bool zero;
+ bool match_at_left;
char *loc;
int i;
continue;
}
op = string + off;
- scan = pick_scan(op[0], op[1], &zero);
+ scan = pick_scan(op[0], op[1], &match_at_left);
pattern = op + 1;
if (op[0] == op[1])
op[1] = '\0', ++pattern;
op[0] = '\0';
- loc = scan(string, pattern, zero);
+ loc = scan(string, pattern, match_at_left);
- if (zero) {
+ if (match_at_left) {
printf("'%s'\n", loc);
} else {
*loc = '\0';