From b5de2d7bd1e08d27f7780434e601d6d3a0750583 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Wed, 10 Nov 2021 20:12:45 -0800 Subject: chore: libunicode -> libutf --- sys/cmd/ic/ic.c | 40 ++++++++++++++++++++-------------------- sys/cmd/ic/rules.mk | 2 +- sys/cmd/ic/strlcpy.c | 14 +++++++------- 3 files changed, 28 insertions(+), 28 deletions(-) (limited to 'sys/cmd/ic') diff --git a/sys/cmd/ic/ic.c b/sys/cmd/ic/ic.c index 19b868d..7fc37d8 100644 --- a/sys/cmd/ic/ic.c +++ b/sys/cmd/ic/ic.c @@ -1,6 +1,6 @@ /* See LICENSE file for license details. */ #include -#include +#include #include #include @@ -308,7 +308,7 @@ channel_rm(Channel *c) free(c); } -static +static void channel_leave(Channel *c) { @@ -321,7 +321,7 @@ channel_leave(Channel *c) channel_rm(c); } -static +static void loginkey(int ircfd, const char *key) { @@ -347,13 +347,13 @@ udsopen(const char *uds) size_t len; int fd; - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { + if((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { fprintf(stderr, "%s: socket: %s\n", argv0, strerror(errno)); exit(1); } sun.sun_family = AF_UNIX; - if (strlcpy(sun.sun_path, uds, sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) { + if(strlcpy(sun.sun_path, uds, sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) { fprintf(stderr, "%s: UNIX domain socket path truncation\n", argv0); exit(1); } @@ -403,7 +403,7 @@ tcpopen(const char *host, const char *service) return fd; } -static +static int isnumeric(const char *s) { @@ -464,7 +464,7 @@ proc_channels_privmsg(int ircfd, Channel *c, char *buf) ewritestr(ircfd, msg); } -static +static void proc_channels_input(int ircfd, Channel *c, char *buf) { @@ -700,8 +700,8 @@ handle_channels_input(int ircfd, Channel *c) { char buf[IRC_MSG_MAX]; - if (read_line(c->fdin, buf, sizeof(buf)) == -1) { - if (channel_reopen(c) == -1) + if(read_line(c->fdin, buf, sizeof(buf)) == -1) { + if(channel_reopen(c) == -1) channel_rm(c); return; } @@ -755,7 +755,7 @@ run(int ircfd, const char *host) int r, maxfd; snprintf(ping_msg, sizeof(ping_msg), "PING %s\r\n", host); - while (isrunning) { + while(isrunning) { maxfd = ircfd; FD_ZERO(&rdset); FD_SET(ircfd, &rdset); @@ -767,12 +767,12 @@ run(int ircfd, const char *host) memset(&tv, 0, sizeof(tv)); tv.tv_sec = 120; r = select(maxfd + 1, &rdset, 0, 0, &tv); - if (r < 0) { + if(r < 0){ if (errno == EINTR) continue; fprintf(stderr, "%s: select: %s\n", argv0, strerror(errno)); exit(1); - } else if (r == 0) { + }else if(r == 0){ if (time(nil) - last_response >= PING_TIMEOUT) { channel_print(channelmaster, "-!- ii shutting down: ping timeout"); exit(2); /* status code 2 for timeout */ @@ -780,11 +780,11 @@ run(int ircfd, const char *host) ewritestr(ircfd, ping_msg); continue; } - if (FD_ISSET(ircfd, &rdset)) { + if(FD_ISSET(ircfd, &rdset)) { handle_server_output(ircfd); last_response = time(nil); } - for (c = channels; c; c = tmp) { + for(c = channels; c; c = tmp) { tmp = c->next; if (FD_ISSET(c->fdin, &rdset)) handle_channels_input(ircfd, c); @@ -803,7 +803,7 @@ main(int argc, char *argv[]) int ircfd, r; /* use nickname and home dir of user by default */ - if (!(spw = getpwuid(getuid()))) { + if(!(spw = getpwuid(getuid()))) { fprintf(stderr, "%s: getpwuid: %s\n", argv0, strerror(errno)); exit(1); } @@ -837,10 +837,10 @@ main(int argc, char *argv[]) break; } ARGEND - if (!*host) + if(!*host) usage(); - if (uds) + if(uds) ircfd = udsopen(uds); else ircfd = tcpopen(host, service); @@ -861,15 +861,15 @@ main(int argc, char *argv[]) create_dirtree(ircpath); channelmaster = channel_add(""); /* master channel */ - if (key) + if(key) loginkey(ircfd, key); loginuser(ircfd, host, fullname && *fullname ? fullname : nick); setup(); run(ircfd, host); - if (channelmaster) + if(channelmaster) channel_leave(channelmaster); - for (c = channels; c; c = tmp) { + for(c = channels; c; c = tmp) { tmp = c->next; channel_leave(c); } diff --git a/sys/cmd/ic/rules.mk b/sys/cmd/ic/rules.mk index c373dfb..649c9ac 100644 --- a/sys/cmd/ic/rules.mk +++ b/sys/cmd/ic/rules.mk @@ -8,7 +8,7 @@ BINS_$(d) := $(d)/ic include share/paths.mk # Local rules -$(BINS_$(d)): $(OBJS_$(d)) $(OBJ_DIR)/libn/libn.a +$(BINS_$(d)): $(OBJS_$(d)) $(OBJ_DIR)/sys/base/base.a $(COMPLINK) include share/pop.mk diff --git a/sys/cmd/ic/strlcpy.c b/sys/cmd/ic/strlcpy.c index db0e6f0..5af7906 100644 --- a/sys/cmd/ic/strlcpy.c +++ b/sys/cmd/ic/strlcpy.c @@ -15,18 +15,18 @@ strlcpy(char *dst, const char *src, size_t siz) size_t n = siz; /* Copy as many bytes as will fit */ - if (n != 0) { - while (--n != 0) { - if ((*d++ = *s++) == '\0') + if(n != 0) { + while(--n != 0) { + if((*d++ = *s++) == '\0') break; } } /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) + if(n == 0) { + if(siz != 0) *d = '\0'; /* NUL-terminate dst */ - while (*s++) + while(*s++) ; } - return(s - src - 1); /* count does not include NUL */ + return s - src - 1; /* count does not include NUL */ } -- cgit v1.2.1