X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcutil.c;h=f665344eee27d456d5e019a8044e12fe92704213;hp=032a4eab1b81d0373bf46bdd5b394b6f8ea1107b;hb=413da0f8686910f5e627393157566ae729ca99c4;hpb=050bd9d9e5d843220f3f393a18ab5011622237b9 diff --git a/lib/silcutil/silcutil.c b/lib/silcutil/silcutil.c index 032a4eab..f665344e 100644 --- a/lib/silcutil/silcutil.c +++ b/lib/silcutil/silcutil.c @@ -28,23 +28,22 @@ This doesn't remove the newline sign from the destination buffer. The argument begin is returned and should be passed again for the function. */ -int silc_gets(char *dest, int destlen, const char *src, int srclen, - int *begin) +int silc_gets(char *dest, int destlen, const char *src, int srclen, int begin) { - int off = *begin; + static int start = 0; int i; memset(dest, 0, destlen); - if (off + 1 >= srclen) - return EOF; + if (begin != start) + start = 0; i = 0; - for ( ; off <= srclen; i++) { + for ( ; start <= srclen; i++, start++) { if (i > destlen) return -1; - dest[i] = src[off++]; + dest[i] = src[start]; if (dest[i] == EOF) return EOF; @@ -52,9 +51,9 @@ int silc_gets(char *dest, int destlen, const char *src, int srclen, if (dest[i] == '\n') break; } - *begin = off; + start++; - return off; + return start; } /* Checks line for illegal characters. Return -1 when illegal character @@ -653,6 +652,9 @@ char *silc_client_chmode(SilcUInt32 mode, const char *cipher, const char *hmac) if (mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) strncat(string, "f", 1); + if (mode & SILC_CHANNEL_MODE_CHANNEL_AUTH) + strncat(string, "C", 1); + if (mode & SILC_CHANNEL_MODE_SILENCE_USERS) strncat(string, "m", 1);