Minor cleanups.

This commit is contained in:
Tiiffi
2016-11-15 21:59:30 +02:00
parent 93e3e54357
commit 57d0cdbf95

View File

@ -221,13 +221,12 @@ int main(int argc, char *argv[])
else else
ret = run_commands(argc, argv); ret = run_commands(argc, argv);
} }
else /* auth failed */ else // auth failed
{ {
ret = -1; ret = -1;
fprintf(stdout, "Authentication failed!\n"); fprintf(stdout, "Authentication failed!\n");
} }
/* cleanup */
net_close(rsock); net_close(rsock);
rsock = -1; rsock = -1;
@ -743,7 +742,7 @@ int run_terminal_mode(int rsock)
return ret; return ret;
} }
/* gets line from stdin and deals with rubbish left in input buffer */ // gets line from stdin and deals with rubbish left in the input buffer
int get_line(char *buffer, int bsize) int get_line(char *buffer, int bsize)
{ {
int ch, len; int ch, len;
@ -754,12 +753,12 @@ int get_line(char *buffer, int bsize)
if (buffer[0] == 0) if (buffer[0] == 0)
connection_alive = 0; connection_alive = 0;
/* remove unwanted characters from the buffer */ // remove unwanted characters from the buffer
buffer[strcspn(buffer, "\r\n")] = '\0'; buffer[strcspn(buffer, "\r\n")] = '\0';
len = strlen(buffer); len = strlen(buffer);
/* clean input buffer if needed */ // clean input buffer if needed
if (len == bsize - 1) if (len == bsize - 1)
while ((ch = getchar()) != '\n' && ch != EOF); while ((ch = getchar()) != '\n' && ch != EOF);