summary refs log tree commit diff
path: root/chat.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-12-02 23:22:18 -0500
committerJune McEnroe <june@causal.agency>2018-12-02 23:22:18 -0500
commit452aeb5ecf8d70a7ce5c5ea0e0f59df92f53eab2 (patch)
tree0b78a60487770a6ef188d7ad76bd0cad35ce10aa /chat.c
parentAdd -r option for realname (diff)
downloadcatgirl-452aeb5ecf8d70a7ce5c5ea0e0f59df92f53eab2.tar.gz
catgirl-452aeb5ecf8d70a7ce5c5ea0e0f59df92f53eab2.zip
Move host, port, pass, webp to self
Diffstat (limited to '')
-rw-r--r--chat.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/chat.c b/chat.c
index 1de145d..ac49dcd 100644
--- a/chat.c
+++ b/chat.c
@@ -56,38 +56,33 @@ static char *prompt(const char *prompt) {
 }
 
 int main(int argc, char *argv[]) {
-	char *host = NULL;
-	char *port = "6697";
-	char *pass = NULL;
-	char *webirc = NULL;
-
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "NW:h:j:l:n:p:r:u:vw:"))) {
 		switch (opt) {
 			break; case 'N': self.notify = true;
-			break; case 'W': webirc = strdup(optarg);
-			break; case 'h': host = strdup(optarg);
+			break; case 'W': freedup(&self.webp, optarg);
+			break; case 'h': freedup(&self.host, optarg);
 			break; case 'j': freedup(&self.join, optarg);
 			break; case 'l': logOpen(optarg);
-			break; case 'n': selfNick(optarg);
-			break; case 'p': port = strdup(optarg);
+			break; case 'n': freedup(&self.nick, optarg);
+			break; case 'p': freedup(&self.port, optarg);
 			break; case 'r': freedup(&self.real, optarg);
-			break; case 'u': selfUser(optarg);
+			break; case 'u': freedup(&self.user, optarg);
 			break; case 'v': self.verbose = true;
-			break; case 'w': pass = strdup(optarg);
+			break; case 'w': freedup(&self.pass, optarg);
 			break; default:  return EX_USAGE;
 		}
 	}
-	if (!port) err(EX_OSERR, "strdup");
 
-	if (!host) host = prompt("Host: ");
+	if (!self.host) self.host = prompt("Host: ");
+	if (!self.port) freedup(&self.port, "6697");
 	if (!self.nick) self.nick = prompt("Name: ");
-	if (!self.user) selfUser(self.nick);
+	if (!self.user) freedup(&self.user, self.nick);
 	if (!self.real) freedup(&self.real, self.nick);
 
 	inputTab();
 	uiInit();
 	uiDraw();
-	ircInit(host, port, pass, webirc);
+	ircInit();
 	eventLoop();
 }
d> 2018-11-11Add inflateMark.3June McEnroe 2018-11-11Add inflatePrime.3June McEnroe 2018-11-11Add inflateReset.3June McEnroe 2018-11-11Add inflateCopy.3June McEnroe 2018-11-11Add inflateSync.3June McEnroe 2018-11-11Add inflateGetDictionary.3June McEnroe 2018-11-11Add inflateSetDictionary.3June McEnroe 2018-11-11Add inflateInit2.3June McEnroe