-/*
- * Strip leading and trailing spaces from a string; with premeasured and adjusted length.
- * buf - the string to modify
- * len - length of the string.
- */
-void string_trimlen(char *buf, int *len) {
- int delta = 0;
- if (*len == 0) return;
- while ((*len > delta) && (isspace(buf[delta]))){
- delta ++;
- }
- memmove (buf, &buf[delta], *len - delta + 1);
- (*len) -=delta;
-
- if (*len == 0) return;
- while (isspace(buf[(*len) - 1])){
- buf[--(*len)] = '\0';
- }
-}
-
-