fix #K4019 - "can not"

Report suggested that "can not" should be "cannot".  Both forms are
acceptable.  This switches them to use contractions for various "You
<verb> not subject" phrases:  "You can't subject", "hadn't", and so
forth.  Not exhaustively tested; there may be some sentences where the
informal contraction makes things worse rather than better.

The goal here was compactness rather than efficiency since the code
involved doesn't execute very often.
This commit is contained in:
PatR
2023-10-21 03:40:56 -07:00
parent a2f80a611a
commit f7e5437746
2 changed files with 26 additions and 2 deletions

View File

@@ -127,12 +127,34 @@ enlght_out(const char *buf)
}
static void
enlght_line(const char *start, const char *middle, const char *end,
const char *ps)
enlght_line(
const char *start,
const char *middle,
const char *end,
const char *ps)
{
#ifndef NO_ENLGHT_CONTRACTIONS
static const struct contrctn {
const char *twowords, *contrctn;
} contra[] = {
{ " are not ", " aren't " },
{ " were not ", " weren't " },
{ " have not ", " haven't " },
{ " had not ", " hadn't " },
{ " can not ", " can't " },
{ " could not ", " couldn't " },
};
int i;
#endif
char buf[BUFSZ];
Sprintf(buf, " %s%s%s%s.", start, middle, end, ps);
#ifndef NO_ENLGHT_CONTRACTIONS
if (strstri(buf, " not ")) { /* TODO: switch to libc strstr() */
for (i = 0; i < SIZE(contra); ++i)
(void) strsubst(buf, contra[i].twowords, contra[i].contrctn);
}
#endif
enlght_out(buf);
}