[hackers] [ii] a little cleanup by Connor Lane Smith, thanks! || Nico Golde

From: <hg_AT_suckless.org>
Date: Mon, 31 Oct 2011 21:37:59 +0100 (CET)

changeset: 94:d163c8917af7
tag: tip
user: Nico Golde <nion_AT_suckless.org>
date: Mon Oct 31 21:35:12 2011 +0100
files: ii.c
description:
a little cleanup by Connor Lane Smith, thanks!


diff -r 1b2227123889 -r d163c8917af7 ii.c
--- a/ii.c Mon Jan 31 21:47:02 2011 +0100
+++ b/ii.c Mon Oct 31 21:35:12 2011 +0100
_AT_@ -41,13 +41,12 @@
 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) {
_AT_@ -89,7 +88,7 @@
 
 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);
         }
 }
_AT_@ -240,12 +239,10 @@
                                 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':
_AT_@ -467,7 +464,7 @@
         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);
_AT_@ -487,7 +484,7 @@
         }
         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);
_AT_@ -496,5 +493,5 @@
         login(key, fullname);
         run();
 
- return 0;
+ return EXIT_SUCCESS;
 }
Received on Mon Oct 31 2011 - 21:37:59 CET

This archive was generated by hypermail 2.3.0 : Mon Oct 31 2011 - 21:48:06 CET