parent
13d236a1e0
commit
91302d36dd
2 changed files with 0 additions and 30 deletions
|
@ -337,8 +337,6 @@ extern char *numstr(char buf[], int n);
|
||||||
extern char *esplur(int n);
|
extern char *esplur(int n);
|
||||||
extern char *splur(int n);
|
extern char *splur(int n);
|
||||||
extern char *iesplur(int n);
|
extern char *iesplur(int n);
|
||||||
extern char *plurize(char *buf, int max_len, int n);
|
|
||||||
/* more in misc.h */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* src/lib/global/ *.c
|
* src/lib/global/ *.c
|
||||||
|
|
|
@ -52,31 +52,3 @@ iesplur(int n)
|
||||||
{
|
{
|
||||||
return n == 1 ? "y" : "ies";
|
return n == 1 ? "y" : "ies";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Change suffix of BUF to English plural if N > 1.
|
|
||||||
* Best effort, not 100% accurate English.
|
|
||||||
* Array BUF[SIZE] contains a zero-terminated string.
|
|
||||||
* If there's not enough space for changed suffix, it is truncated.
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
plurize(char *buf, int size, int n)
|
|
||||||
{
|
|
||||||
size_t len = strlen(buf);
|
|
||||||
|
|
||||||
if (!len || n <= 1)
|
|
||||||
return buf;
|
|
||||||
|
|
||||||
switch (buf[len - 1]) {
|
|
||||||
case 'y':
|
|
||||||
buf[len - 1] = '\0';
|
|
||||||
strncat(buf, "ies", size - len);
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
strncat(buf, "es", size - len - 1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strncat(buf, "s", size - len - 1);
|
|
||||||
}
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue