summary refs log tree commit diff
path: root/litterbox.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-01-04 16:16:49 -0500
committerJune McEnroe <june@causal.agency>2020-01-04 16:16:49 -0500
commit61f01795fcc16e714cb7f826f944345f5d23ed9b (patch)
treeb7012986cc139d5d3118066444418be87be88df5 /litterbox.c
parentSet the default network name to the hostname (diff)
downloadlitterbox-61f01795fcc16e714cb7f826f944345f5d23ed9b.tar.gz
litterbox-61f01795fcc16e714cb7f826f944345f5d23ed9b.zip
Add -N option to litterbox
Diffstat (limited to 'litterbox.c')
-rw-r--r--litterbox.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/litterbox.c b/litterbox.c
index c6cee84..4c97794 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -618,15 +618,17 @@ int main(int argc, char *argv[]) {
 	bool insecure = false;
 	const char *host = NULL;
 	const char *port = "6697";
+	const char *defaultNetwork = NULL;
 
 	const char *nick = "litterbox";
 	const char *user = NULL;
 	const char *pass = NULL;
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "!Qd:h:ij:l:mn:p:qu:vw:"))) {
+	while (0 < (opt = getopt(argc, argv, "!N:Qd:h:ij:l:mn:p:qu:vw:"))) {
 		switch (opt) {
 			break; case '!': insecure = true;
+			break; case 'N': defaultNetwork = optarg;
 			break; case 'Q': searchQuery = Public;
 			break; case 'd': path = optarg;
 			break; case 'h': host = optarg;
@@ -665,7 +667,7 @@ int main(int argc, char *argv[]) {
 
 	if (!host) errx(EX_USAGE, "host required");
 	set(&self, "*");
-	set(&network, host);
+	set(&network, (defaultNetwork ? defaultNetwork : host));
 	set(&chanTypes, "#&");
 	set(&prefixes, "@+");