Revert r352953: Convert pnmatch to single element array in regexec calls

Requested by: cem
This commit is contained in:
Alexander Kabaev 2019-10-02 16:08:01 +00:00
parent 4a7b33ecf4
commit bcd34af473
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353011
2 changed files with 11 additions and 11 deletions

View file

@ -98,7 +98,7 @@ main(int ac, char **av)
struct stat sb;
struct passwd *pw;
regex_t rgx;
regmatch_t pmatch[1];
regmatch_t pmatch;
int i, j, ch;
char buf[256];
char first;
@ -361,9 +361,9 @@ main(int ac, char **av)
}
}
if (mflag) {
pmatch[0].rm_so = 0;
pmatch[0].rm_eo = strlen(thiscmd);
if (regexec(&rgx, thiscmd, 0, pmatch,
pmatch.rm_so = 0;
pmatch.rm_eo = strlen(thiscmd);
if (regexec(&rgx, thiscmd, 0, &pmatch,
REG_STARTEND) != 0)
matched = 0;
regfree(&rgx);
@ -387,9 +387,9 @@ main(int ac, char **av)
}
}
if (mflag) {
pmatch[0].rm_so = 0;
pmatch[0].rm_eo = strlen(thiscmd);
if (regexec(&rgx, thiscmd, 0, pmatch,
pmatch.rm_so = 0;
pmatch.rm_eo = strlen(thiscmd);
if (regexec(&rgx, thiscmd, 0, &pmatch,
REG_STARTEND) == 0)
matched = 1;
regfree(&rgx);

View file

@ -281,11 +281,11 @@ split2(void)
/* Check if we need to start a new file */
if (pflag) {
regmatch_t pmatch[1];
regmatch_t pmatch;
pmatch[0].rm_so = 0;
pmatch[0].rm_eo = len - 1;
if (regexec(&rgx, bfr, 0, pmatch, REG_STARTEND) == 0)
pmatch.rm_so = 0;
pmatch.rm_eo = len - 1;
if (regexec(&rgx, bfr, 0, &pmatch, REG_STARTEND) == 0)
newfile();
} else if (lcnt++ == numlines) {
newfile();