1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-07-31 21:59:25 -04:00

Include errno.h

This commit is contained in:
Qball Cow 2014-01-21 14:56:25 +01:00
parent 0068618573
commit 0dbd57b46f
3 changed files with 10 additions and 4 deletions

View file

@ -36,6 +36,7 @@
#include <dirent.h> #include <dirent.h>
#include <strings.h> #include <strings.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include "simpleswitcher.h" #include "simpleswitcher.h"
#include "run-dialog.h" #include "run-dialog.h"

View file

@ -38,6 +38,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <fcntl.h> #include <fcntl.h>
#include <err.h> #include <err.h>
#include <errno.h>
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>

View file

@ -37,6 +37,7 @@
#include <strings.h> #include <strings.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h>
#include "simpleswitcher.h" #include "simpleswitcher.h"
#include "ssh-dialog.h" #include "ssh-dialog.h"
@ -44,6 +45,7 @@
#include <time.h> #include <time.h>
#endif #endif
#define SSH_CACHE_FILE ".simpleswitcher.sshcache"
extern char *config_terminal_emulator; extern char *config_terminal_emulator;
static inline int execshssh( const char *host ) static inline int execshssh( const char *host )
@ -75,8 +77,8 @@ static pid_t exec_ssh( const char *cmd )
* This happens in non-critical time (After launching app) * This happens in non-critical time (After launching app)
* It is allowed to be a bit slower. * It is allowed to be a bit slower.
*/ */
char *path = allocate( strlen( hd ) + strlen( "/.simpleswitcher.sshcache" )+2 ); char *path = allocate( strlen( hd ) + strlen( "/"SSH_CACHE_FILE )+2 );
sprintf( path, "%s/%s", hd, ".simpleswitcher.sshcache" ); sprintf( path, "%s/%s", hd, SSH_CACHE_FILE );
FILE *fd = fopen ( path, "r" ); FILE *fd = fopen ( path, "r" );
char buffer[1024]; char buffer[1024];
@ -150,8 +152,8 @@ static char ** get_ssh ( )
if ( hd == NULL ) return NULL; if ( hd == NULL ) return NULL;
path = allocate( strlen( hd ) + strlen( "/.simpleswitcher.sshcache" )+2 ); path = allocate( strlen( hd ) + strlen( "/"SSH_CACHE_FILE )+2 );
sprintf( path, "%s/%s", hd, ".simpleswitcher.sshcache" ); sprintf( path, "%s/%s", hd, SSH_CACHE_FILE );
FILE *fd = fopen ( path, "r" ); FILE *fd = fopen ( path, "r" );
char buffer[1024]; char buffer[1024];
@ -185,11 +187,13 @@ static char ** get_ssh ( )
for ( stop=start; isalnum( buffer[stop] ); stop++ ); for ( stop=start; isalnum( buffer[stop] ); stop++ );
int found = 0; int found = 0;
// This is a nice little penalty, but doable? time will tell. // This is a nice little penalty, but doable? time will tell.
// given num_favorites is max 25. // given num_favorites is max 25.
for ( int j = 0; found == 0 && j < num_favorites; j++ ) { for ( int j = 0; found == 0 && j < num_favorites; j++ ) {
if ( strncasecmp( &buffer[start], retv[j],stop-start ) == 0 ) found = 1; if ( strncasecmp( &buffer[start], retv[j],stop-start ) == 0 ) found = 1;
} }
if ( found == 1 ) continue; if ( found == 1 ) continue;
retv = realloc( retv, ( index+2 )*sizeof( char* ) ); retv = realloc( retv, ( index+2 )*sizeof( char* ) );