/*
* make_punctation.c
*
* SFUN: End a sentece with a .
*
* (C) Frank Schmidt, Jesus@NorseMUD
*
*/
/* get rid of "blablabla. ." */
#define STRIP_TRAILING_WHITESPACE
/* end a sentence with a puntuation */
static varargs string make_punctation(string str, string end) {
int t;
string strorig;
strorig = str;
t = str[strlen(str)-1];
#ifdef STRIP_TRAILING_WHITESPACE
while (t == ' ') {
str = str[0..strlen(str)-2];
t = str[strlen(str)-1];
}
#endif
/* default <end> is "." */
if (!end) end = ".";
/* return original string? */
switch (t) {
case '!':
case '?':
case '.':
return strorig;
}
if (t == end[strlen(end)-1]) return strorig;
/* make punctation at end */
return str+end;
}