On 31 October 2011 20:33, Nico Golde <n...@ngolde.de> wrote:
> Sorry for the late response, missed this thread. I'm still maintaining and
> using it. So do some other people who occasionally contact me.

Could you please apply the attached sanity patch? There are a few
strange bits in the source.

Thanks,
cls
diff -r 1b2227123889 ii.c
--- a/ii.c	Mon Jan 31 21:47:02 2011 +0100
+++ b/ii.c	Mon Oct 31 21:00:28 2011 +0100
@@ -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) {
@@ -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);
 	}
 }
@@ -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':
@@ -467,13 +464,13 @@
 	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);
 	snprintf(prefix, sizeof(prefix),"%s/irc", spw->pw_dir);
-	if (argc <= 1 || (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'h')) usage();
-
+	if(argc < 2)
+		usage();
 	for(i = 1; (i + 1 < argc) && (argv[i][0] == '-'); i++) {
 		switch (argv[i][1]) {
 			case 'i': snprintf(prefix,sizeof(prefix),"%s", argv[++i]); break;
@@ -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);
@@ -496,5 +493,5 @@
 	login(key, fullname);
 	run();
 
-	return 0;
+	return EXIT_SUCCESS;
 }

Reply via email to