@@ -119,17 +119,17 @@ static void
119
119
message_wrap (char * line , size_t offset ) {
120
120
121
121
struct winsize window_dims ;
122
-
122
+
123
123
if (ioctl (0 , TIOCGWINSZ , & window_dims ) < 0 ) {
124
124
perror ("ioctrl" );
125
125
exit (EXIT_FAILURE );
126
126
}
127
127
128
128
unsigned short cmax = window_dims .ws_col ;
129
- char * tok ;
130
- size_t wordwidth , spaceleft = cmax - gutl - offset , spacewidth = 1 ;
129
+ char * tok ;
130
+ size_t wordwidth , spaceleft = cmax - gutl - offset , spacewidth = 1 ;
131
131
132
- for (tok = strtok (line , " " ); tok != NULL ; tok = strtok (NULL , " " )) {
132
+ for (tok = strtok (line , " " ); tok != NULL ; tok = strtok (NULL , " " )) {
133
133
wordwidth = strlen (tok );
134
134
if ((wordwidth + spacewidth ) > spaceleft ) {
135
135
printf ("\n%*.s%s " , (int ) gutl + 1 , " " , tok );
@@ -146,7 +146,7 @@ message_wrap(char *line, size_t offset) {
146
146
static void
147
147
raw_parser (char * string ) {
148
148
149
- if (verb ) printf (">> %s\n " , string );
149
+ if (verb ) printf (">> %s" , string );
150
150
151
151
if (!strncmp (string , "PING" , 4 )) {
152
152
string [1 ] = 'O' ;
@@ -235,7 +235,7 @@ handle_user_input(void) {
235
235
236
236
if (fgets (usrin , MSG_MAX , stdin ) == NULL ) {
237
237
perror ("fgets" );
238
- exit (1 );
238
+ exit (EXIT_FAILURE );
239
239
}
240
240
241
241
size_t msg_len = strlen (usrin );
@@ -276,9 +276,9 @@ keyboard_hit() {
276
276
277
277
static void
278
278
usage (void ) {
279
- fputs ("kirc [-s hostname ] [-p port] [-c channel] [-n nick] \
280
- [-r real_name] [- u username] [-k password] [-a token] [-x init_command ] \
281
- [-w columns] [-W columns] [-o path] [- e|v|V]\n" , stderr );
279
+ fputs ("kirc [-s host ] [-p port] [-c channel] [-n nick] [-r realname ] \
280
+ [-u username] [-k password] [-a token] [-x command] [-w columns] [-o path ] \
281
+ [-e|v|V]\n" , stderr );
282
282
exit (EXIT_FAILURE );
283
283
}
284
284
@@ -287,7 +287,7 @@ main(int argc, char **argv) {
287
287
288
288
int cval ;
289
289
290
- while ((cval = getopt (argc , argv , "s:p:o:n:k:c:u:r:x:w:a:hevV " )) != -1 ) {
290
+ while ((cval = getopt (argc , argv , "s:p:o:n:k:c:u:r:x:w:a:evV " )) != -1 ) {
291
291
switch (cval ) {
292
292
case 'V' : ++ verb ; break ;
293
293
case 'e' : ++ sasl ; break ;
@@ -319,9 +319,10 @@ main(int argc, char **argv) {
319
319
if (auth || sasl ) raw ("CAP REQ :sasl\r\n" );
320
320
raw ("NICK %s\r\n" , nick );
321
321
raw ("USER %s - - :%s\r\n" , (user ? user : nick ), (real ? real : nick ));
322
- if (auth || sasl ) raw ("AUTHENTICATE %s\r\n" , (sasl ? "EXTERNAL" : "PLAIN" ));
323
- if (auth || sasl ) raw ("AUTHENTICATE %s\r\n" , (sasl ? "+" : auth ));
324
- if (auth || sasl ) raw ("CAP END\r\n" );
322
+ if (auth || sasl ) {
323
+ raw ("AUTHENTICATE %s\r\n" , (sasl ? "EXTERNAL" : "PLAIN" ));
324
+ raw ("AUTHENTICATE %s\r\nCAP END\r\n" , (sasl ? "+" : auth ));
325
+ }
325
326
if (pass ) raw ("PASS %s\r\n" , pass );
326
327
if (inic ) raw ("%s\r\n" , inic );
327
328
0 commit comments