CVS code -
- General:
- More minor comment cleanups. (DLR)
- - Convert more ints used as boolean values to use TRUE and
- FALSE. (David Benbennick and DLR)
+ - Convert more ints using 0 and 1 to bools using TRUE and FALSE.
+ (David Benbennick and DLR)
- Change more instances of ints that have large enough upper
bounds and which can never be negative to size_t's, and
convert nano to handle them properly. (DLR)
/* Tack a slash onto the string we're completing if it's a directory. We
* assume there is room for one more character on the end of buf. The
* return value says whether buf is a directory. */
-int append_slash_if_dir(char *buf, int *lastwastab, int *place)
+int append_slash_if_dir(char *buf, bool *lastwastab, int *place)
{
char *dirptr = real_dir_from_tilde(buf);
struct stat fileinfo;
strncat(buf, "/", 1);
(*place)++;
/* now we start over again with # of tabs so far */
- *lastwastab = 0;
+ *lastwastab = FALSE;
ret = 1;
}
while ((userdata = getpwent()) != NULL) {
- if (check_wildcard_match(userdata->pw_name, &buf[1]) == TRUE) {
+ if (check_wildcard_match(userdata->pw_name, &buf[1])) {
/* Cool, found a match. Add it to the list
* This makes a lot more sense to me (Chris) this way...
fprintf(stderr, "Comparing \'%s\'\n", next->d_name);
#endif
/* See if this matches */
- if (check_wildcard_match(next->d_name, tmp) == TRUE) {
+ if (check_wildcard_match(next->d_name, tmp)) {
/* Cool, found a match. Add it to the list
* This makes a lot more sense to me (Chris) this way...
/* This function now has an arg which refers to how much the statusbar
* (place) should be advanced, i.e. the new cursor pos. */
-char *input_tab(char *buf, int place, int *lastwastab, int *newplace,
- int *list)
+char *input_tab(char *buf, int place, bool *lastwastab, int *newplace,
+ bool *list)
{
/* Do TAB completion */
static int num_matches = 0, match_matches = 0;
int longestname = 0, is_dir = 0;
char *foo;
- *list = 0;
+ *list = FALSE;
if (*lastwastab == FALSE) {
char *tmp, *copyto, *matchbuf;
- *lastwastab = 1;
+ *lastwastab = TRUE;
/* Make a local copy of the string -- up to the position of the
cursor */
}
free(foo);
wrefresh(edit);
- *list = 1;
+ *list = TRUE;
} else
beep();
}
/* Only refresh the edit window if we don't have a list of filename
matches on it */
- if (*list == 0)
+ if (*list == FALSE)
edit_refresh();
curs_set(1);
return buf;
{
int mouse_x, mouse_y;
- if (get_mouseinput(&mouse_x, &mouse_y, TRUE) == FALSE) {
+ if (!get_mouseinput(&mouse_x, &mouse_y, TRUE)) {
/* Click in the edit window to move the cursor, but only when
we're not in a subfunction. */
if (wenclose(edit, mouse_y, mouse_x) && currshortcut == main_list) {
#ifdef DEBUG
fprintf(stderr, "AHA! %c (%d)\n", kbinput, kbinput);
#endif
- if (meta_key == TRUE) {
+ if (meta_key) {
/* Check for the metaval and miscval defs... */
for (s =
#if !defined(DISABLE_BROWSER) || !defined (DISABLE_HELP) || !defined(DISABLE_MOUSE)
void do_writeout_void(void);
char *real_dir_from_tilde(const char *buf);
#ifndef DISABLE_TABCOMP
-int append_slash_if_dir(char *buf, int *lastwastab, int *place);
+int append_slash_if_dir(char *buf, bool *lastwastab, int *place);
char **username_tab_completion(char *buf, int *num_matches);
char **cwd_tab_completion(char *buf, int *num_matches);
-char *input_tab(char *buf, int place, int *lastwastab, int *newplace,
- int *list);
+char *input_tab(char *buf, int place, bool *lastwastab, int *newplace,
+ bool *list);
#endif
const char *tail(const char *foo);
#ifndef DISABLE_BROWSER
#endif
const shortcut *s
#ifndef DISABLE_TABCOMP
- , int *list
+ , bool *list
#endif
);
void titlebar(const char *path);
found = TRUE;
}
len = strlen(text);
- if (found == FALSE && len != 0) {
+ if (!found && len != 0) {
return FALSE;
}
- if (found == TRUE) {
+ if (found) {
if (strlen(pattern) == 0 && len == 1) {
return TRUE;
}
#endif
const shortcut *s
#ifndef DISABLE_TABCOMP
- , int *list
+ , bool *list
#endif
)
{
/* the cursor position in 'answer' */
int xend;
/* length of 'answer', the status bar text */
- int tabbed = 0;
+ bool tabbed = FALSE;
/* used by input_tab() */
const shortcut *t;
assert(0 <= x && x <= xend && xend == strlen(answer));
if (kbinput != '\t')
- tabbed = 0;
+ tabbed = FALSE;
switch (kbinput) {
#ifndef DISABLE_MOUSE
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput,
kbinput);
#endif
- if (meta_key == TRUE && (kbinput == t->metaval || kbinput == t->miscval))
+ if (meta_key && (kbinput == t->metaval || kbinput == t->miscval))
/* We hit a meta key. Do like above. We don't
* just ungetch() the letter and let it get
* caught above cause that screws the
char *foo = charalloc(COLS - 3);
int ret;
#ifndef DISABLE_TABCOMP
- int list = 0;
+ bool list = FALSE;
#endif
bottombars(s);