1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00
This commit is contained in:
QC 2015-01-10 15:31:13 +01:00
parent 7e6a24f9b6
commit f28ac717cd

View file

@ -138,7 +138,17 @@ static char ** get_ssh ( unsigned int *length )
if ( fd != NULL ) { if ( fd != NULL ) {
char buffer[1024]; char buffer[1024];
while ( fgets ( buffer, 1024, fd ) != NULL ) { while ( fgets ( buffer, 1024, fd ) != NULL ) {
if ( strncasecmp ( buffer, "Host", 4 ) == 0 && isspace ( buffer[4] ) ) { char *token = &buffer[0];
// Skip initial spaces.
while ( ( *token ) != '\n' && ( *token ) != '\0' && isspace ( *token ) ) {
token++;
}
// Skip empty lines.
if ( ( *token ) == '\n' || ( *token ) == '\0' ) {
continue;
}
// Check for "Host[::space::]"
if ( strncasecmp ( token, "Host", 4 ) == 0 && isspace ( token[4] ) ) {
int start = 0, stop = 0; int start = 0, stop = 0;
buffer[strlen ( buffer ) - 1] = '\0'; buffer[strlen ( buffer ) - 1] = '\0';