Introduction
Introduction Statistics Contact Development Disclaimer Help
Update kris/util.c strlcpy - sic - simple irc client
git clone git://git.suckless.org/sic
Log
Files
Refs
README
LICENSE
---
commit 2b853804113a01672790aed67cb372d35554b61e
parent 14e430ac5b398e0c47f1d80f3c4f4b6386f545c2
Author: Kris Maglione <[email protected]>
Date: Wed, 23 Sep 2009 11:26:48 -0400
Update kris/util.c strlcpy
Diffstat:
A kris/Makefile | 2 ++
A kris/config.mk | 2 ++
M kris/sic.c | 10 +---------
M kris/util.c | 9 ++++++++-
4 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/kris/Makefile b/kris/Makefile
@@ -0,0 +1 @@
+../Makefile
+\ No newline at end of file
diff --git a/kris/config.mk b/kris/config.mk
@@ -0,0 +1 @@
+../config.mk
+\ No newline at end of file
diff --git a/kris/sic.c b/kris/sic.c
@@ -28,14 +28,6 @@ static char channel[256];
static time_t trespond;
static FILE *srv;
-#define va_buf(buf, fmt) {\
- va_list ap; \
- \
- va_start(ap, fmt); \
- vsnprintf(buf, sizeof buf, fmt, ap); \
- va_end(ap); \
-}
-
#include "util.c"
static void
@@ -167,7 +159,7 @@ main(int argc, char *argv[]) {
if(++i < argc) password = argv[i];
break;
case 'v':
- eprint("sic-"VERSION", ? 2005-2007 Anselm R. Garbe, Ni…
+ eprint("sic-"VERSION", ©2005-2009 Kris Maglione, Anse…
default:
eprint("usage: sic [-h host] [-p port] [-n nick] [-k k…
}
diff --git a/kris/util.c b/kris/util.c
@@ -2,6 +2,13 @@
#include <netinet/in.h>
#include <sys/socket.h>
+#define va_buf(buf, fmt) {\
+ va_list ap; \
+ va_start(ap, fmt); \
+ vsnprintf(buf, sizeof buf, fmt, ap); \
+ va_end(ap); \
+}
+
static void
eprint(const char *fmt, ...) {
@@ -34,7 +41,7 @@ dial(char *host, int port) {
#define strlcpy _strlcpy
static void
strlcpy(char *to, const char *from, int l) {
- strncpy(to, from, l-1);
+ memccpy(to, from, '\0', l);
to[l-1] = '\0';
}
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.