#40, fix dots in hostname when length is 113, 170, 227... Includes test.

This commit is contained in:
Erik Ekman 2009-01-16 18:51:54 +00:00 committed by Erik Ekman
parent 13497b1df6
commit dc17bc69fe
2 changed files with 4 additions and 2 deletions

View File

@ -52,12 +52,12 @@ inline_dotify(char *buf, size_t buflen)
pos = (unsigned) (reader - buf) + 1;
while (dots) {
*writer-- = *reader--;
pos--;
if (pos % 57 == 0) {
*writer-- = '.';
dots--;
}
*writer-- = *reader--;
pos--;
}
/* return new length of string */

View File

@ -31,6 +31,8 @@ struct tuple
"aaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa"},
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."},
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
{ "abc123", "abc123" },
{ NULL, NULL }
};