- va_end(args);
-}
-#endif
-
-static void set_str(char *to, const unsigned char *from, int count)
-{
- int i, j;
- int len;
-
- /* strip trailing whitespace */
- len = strnlen(from, count);
- while (isspace(from[len-1]))
- len--;
-
- /* strip leading whitespace */
- i = 0;
- while (isspace(from[i]) && (i < len))
- i++;
-
- j = 0;
- while (i < len) {
- /* substitute multiple whitespace */
- if (isspace(from[i])) {
- while (isspace(from[i]))
- i++;
- to[j++] = '_';
- }
- /* skip chars */
- if (from[i] == '/') {
- i++;
- continue;
- }
- to[j++] = from[i++];
- }
- to[j] = '\0';