X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcommon.c;h=3ec4c6e1442947422eff75e5a3ed3f6d24dc7224;hb=f453199292b45007e5078f568f3bce2e8c8b4067;hp=28f16da0190ada6346806335f8f0ba484afc7f72;hpb=6597f3a6584704f92f824f3cf7bac3369102e8a0;p=collectd.git diff --git a/src/common.c b/src/common.c index 28f16da0..3ec4c6e1 100644 --- a/src/common.c +++ b/src/common.c @@ -347,6 +347,19 @@ int escape_slashes (char *buf, int buf_len) return (0); } /* int escape_slashes */ +void replace_special (char *buffer, size_t buffer_size) +{ + size_t i; + + for (i = 0; i < buffer_size; i++) + { + if (buffer[i] == 0) + return; + if ((!isalnum ((int) buffer[i])) && (buffer[i] != '-')) + buffer[i] = '_'; + } +} /* void replace_special */ + int timeval_cmp (struct timeval tv0, struct timeval tv1, struct timeval *delta) { struct timeval *larger;