Index: uspace/app/bdsh/compl.c
===================================================================
--- uspace/app/bdsh/compl.c	(revision f90eb7506f2edcc340cbf17caff016fd1aa7e237)
+++ uspace/app/bdsh/compl.c	(revision 5935c079a74a6943ead5c4cde2bba565dae6c08d)
@@ -90,12 +90,9 @@
 {
 	compl_t *cs = NULL;
-	size_t pref_size;
 	char *stext = NULL;
 	char *prefix = NULL;
 	char *dirname = NULL;
-	char *rpath_sep;
-	static const char *dirlist_arg[] = { ".", NULL };
 	int retval;
-	tokenizer_t tok;
+	
 	token_t *tokens = calloc(WORD_MAX, sizeof(token_t));
 	if (tokens == NULL) {
@@ -103,7 +100,12 @@
 		goto error;
 	}
-	int current_token;
+	
+	size_t pref_size;
+	char *rpath_sep;
+	static const char *dirlist_arg[] = { ".", NULL };
+	tokenizer_t tok;
+	ssize_t current_token;
 	size_t tokens_length;
-
+	
 	cs = calloc(1, sizeof(compl_t));
 	if (!cs) {
@@ -111,5 +113,5 @@
 		goto error;
 	}
-
+	
 	/* Convert text buffer to string */
 	stext = wstr_to_astr(text);
@@ -131,9 +133,11 @@
 	
 	/* Find the current token */
-	for (current_token = 0; current_token < (int) tokens_length;
+	for (current_token = 0; current_token < (ssize_t) tokens_length;
 	    current_token++) {
 		token_t *t = &tokens[current_token];
 		size_t end = t->char_start + t->char_length;
-		/* Check if the caret lies inside the token or immediately
+		
+		/*
+		 * Check if the caret lies inside the token or immediately
 		 * after it
 		 */
@@ -142,14 +146,15 @@
 		}
 	}
-	if (tokens_length == 0) current_token = -1;
-	
-	if (current_token >= 0 && tokens[current_token].type != TOKTYPE_SPACE) {
+	
+	if (tokens_length == 0)
+		current_token = -1;
+	
+	if ((current_token >= 0) && (tokens[current_token].type != TOKTYPE_SPACE))
 		*cstart = tokens[current_token].char_start;
-	}
-	else {
+	else
 		*cstart = pos;
-	}
-	
-	/* Extract the prefix being completed
+	
+	/*
+	 * Extract the prefix being completed
 	 * XXX: handle strings, etc.
 	 */
@@ -174,14 +179,13 @@
 
 	/* Skip any whitespace before current token */
-	int prev_token = current_token - 1;
-	if (prev_token >= 0 && tokens[prev_token].type == TOKTYPE_SPACE) {
+	ssize_t prev_token = current_token - 1;
+	if ((prev_token >= 0) && (tokens[prev_token].type == TOKTYPE_SPACE))
 		prev_token--;
-	}
-
+	
 	/*
 	 * It is a command if it is the first token or if it immediately
 	 * follows a pipe token.
 	 */
-	if (prev_token < 0 || tokens[prev_token].type == TOKTYPE_SPACE)
+	if ((prev_token < 0) || (tokens[prev_token].type == TOKTYPE_SPACE))
 		cs->is_command = true;
 	else
