summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Golde <nion@suckless.org>2011-10-31 21:35:12 +0100
committerNico Golde <nion@suckless.org>2011-10-31 21:35:12 +0100
commit2bcd27c9e8bd1e4ce4da5af9218024736c1976e4 (patch)
treeeeffcb714c6b5a18751f37d36c6ac537d1c578b5
parent6e0a38ee6c7d9589f4eda684ac46a9e017e7dc63 (diff)
downloadii-2bcd27c9e8bd1e4ce4da5af9218024736c1976e4.zip
ii-2bcd27c9e8bd1e4ce4da5af9218024736c1976e4.tar.gz
ii-2bcd27c9e8bd1e4ce4da5af9218024736c1976e4.tar.bz2
a little cleanup by Connor Lane Smith, thanks!
-rw-r--r--ii.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/ii.c b/ii.c
index e9ebfc9..056bfbc 100644
--- a/ii.c
+++ b/ii.c
@@ -41,13 +41,12 @@ static char path[_POSIX_PATH_MAX];
static char message[PIPE_BUF]; /* message buf used for communication */
static void usage() {
- fprintf(stderr, "%s",
- "ii - irc it - " VERSION "\n"
- "(C)opyright MMV-MMVI Anselm R. Garbe\n"
- "(C)opyright MMV-MMXI Nico Golde\n"
- "usage: ii [-i <irc dir>] [-s <host>] [-p <port>]\n"
- " [-n <nick>] [-k <password>] [-f <fullname>]\n");
- exit(EXIT_SUCCESS);
+ fputs("ii - irc it - " VERSION "\n"
+ "(C)opyright MMV-MMVI Anselm R. Garbe\n"
+ "(C)opyright MMV-MMXI Nico Golde\n"
+ "usage: ii [-i <irc dir>] [-s <host>] [-p <port>]\n"
+ " [-n <nick>] [-k <password>] [-f <fullname>]\n", stderr);
+ exit(EXIT_FAILURE);
}
static char *striplower(char *s) {
@@ -89,7 +88,7 @@ static int get_filepath(char *filepath, size_t len, char *channel, char *file) {
static void create_filepath(char *filepath, size_t len, char *channel, char *suffix) {
if(!get_filepath(filepath, len, striplower(channel), suffix)) {
- fprintf(stderr, "%s", "ii: path to irc directory too long\n");
+ fputs("ii: path to irc directory too long\n", stderr);
exit(EXIT_FAILURE);
}
}
@@ -240,12 +239,10 @@ static void proc_channels_input(Channel *c, char *buf) {
else snprintf(message, PIPE_BUF, "JOIN %s\r\n", &buf[3]);
add_channel(&buf[3]);
}
- else {
- if(p){
- add_channel(&buf[3]);
- proc_channels_privmsg(&buf[3], p + 1);
- return;
- }
+ else if(p){
+ add_channel(&buf[3]);
+ proc_channels_privmsg(&buf[3], p + 1);
+ return;
}
break;
case 't':
@@ -467,7 +464,7 @@ int main(int argc, char *argv[]) {
char prefix[_POSIX_PATH_MAX];
if(!spw) {
- fprintf(stderr,"ii: getpwuid() failed\n");
+ fputs("ii: getpwuid() failed\n", stderr);
exit(EXIT_FAILURE);
}
snprintf(nick, sizeof(nick), "%s", spw->pw_name);
@@ -487,7 +484,7 @@ int main(int argc, char *argv[]) {
}
irc = tcpopen(port);
if(!snprintf(path, sizeof(path), "%s/%s", prefix, host)) {
- fprintf(stderr, "%s", "ii: path to irc directory too long\n");
+ fputs("ii: path to irc directory too long\n", stderr);
exit(EXIT_FAILURE);
}
create_dirtree(path);
@@ -496,5 +493,5 @@ int main(int argc, char *argv[]) {
login(key, fullname);
run();
- return 0;
+ return EXIT_SUCCESS;
}