commit 0a32161ec554c85285e652e8d625031903741e31
parent e03b5a34fe761e341714bb3bb4ae293562c4bf57
Author: Claudio Alessi <smoppy@gmail.com>
Date: Sat, 21 Apr 2018 16:58:23 +0200
Style changes in cmd_server()
Diffstat:
M | circo.c | | | 24 | ++++++++++++++---------- |
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/circo.c b/circo.c
@@ -350,19 +350,24 @@ cmd_server(char *cmd, char *s) {
strncpy(host, t, sizeof host);
if(srv)
quit(NULL);
- if(!*host)
+ if(!*host) {
bprintf(status, "/%s: no host specified.\n", cmd);
- else if(!*port)
+ return;
+ }
+ if(!*port) {
bprintf(status, "/%s: no port specified.\n", cmd);
- else if((fd = dial(host, port)) < 0)
+ return;
+ }
+ bprintf(status, "Connecting to %s:%s...\n", host, port);
+ if((fd = dial(host, port)) < 0) { /* Note: dial() locks. */
bprintf(status, "Cannot connect to %s on port %s.\n", host, port);
- else {
- srv = fdopen(fd, "r+");
- printf(TTLSET, host);
- setbuf(srv, NULL);
- sout("NICK %s", nick);
- sout("USER %s localhost %s :%s", nick, host, nick);
+ return;
}
+ printf(TTLSET, host);
+ srv = fdopen(fd, "r+");
+ setbuf(srv, NULL);
+ sout("NICK %s", nick);
+ sout("USER %s localhost %s :%s", nick, host, nick);
sel->need_redraw |= REDRAW_BAR;
}
@@ -1087,7 +1092,6 @@ setup(void) {
ti.c_cc[VMIN] = 0;
ti.c_cc[VTIME] = 0;
tcsetattr(0, TCSAFLUSH, &ti);
-
ioctl(0, TIOCGWINSZ, &ws);
resize(ws.ws_row, ws.ws_col);
}