diff --git a/src/ChangeLog b/src/ChangeLog index 534db7654..363d45e46 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2001-06-05 Pavel Roskin + + * achown.c: Make global variables static if possible. Remove now + useless preprocessor directives, since this file is now used in + the text edition only. + * boxes.c: Remove useless ifdefs. + [USE_VFS]: Don't undef USE_NETCODE - it's done in extraconf.h. + * cmd.c [USE_VFS]: Don't undef USE_NETCODE. + * chmod.c: Remove useless ifdefs. + * filegui.c: Likewise. + * hotlist.c: Likewise. + * info.c: Likewise. + * layout.c: Likewise. + * listmode.c: Likewise. + * option.c: Likewise. + * subshell.c: Likewise. + * help.c: Remove useless ifdefs. Make global variables static if + possible. + * key.c: Likewise. + * learn.c: Likewise. + 2001-06-04 Andrew V. Samoilov * charsets.c (load_codepages_list): Lines in mc.charset beginning diff --git a/src/achown.c b/src/achown.c index e8b0354a6..f813d450b 100644 --- a/src/achown.c +++ b/src/achown.c @@ -64,7 +64,7 @@ #define B_OUSER B_USER + 6 #define B_OGROUP B_USER + 7 -struct { +static struct { int ret_cmd, flags, y, x; char *text; } chown_advanced_but [BUTTONS] = { @@ -79,8 +79,8 @@ struct { { B_ENTER, NARROW_BUTTON, 0, 3, " "}, }; -WButton *b_att[3]; /* permission */ -WButton *b_user, *b_group; /* owner */ +static WButton *b_att[3]; /* permission */ +static WButton *b_user, *b_group; /* owner */ static int files_on_begin; /* Number of files at startup */ static int flag_pos; @@ -181,15 +181,6 @@ static umode_t get_mode () return m; } -#ifdef HAVE_X -static void update_mode (Dlg_head *h) -{ -} -static void print_flags (void) -{ -} - -#else static void print_flags (void) { int i; @@ -233,7 +224,6 @@ static void update_mode (Dlg_head * h) printw ("%12o", get_mode ()); send_message (h, h->current->widget, WIDGET_FOCUS, 0); } -#endif /* HAVE_X */ static int l_call (void *data) { @@ -244,11 +234,9 @@ static int chl_callback (Dlg_head * h, int Par, int Msg) { switch (Msg) { case DLG_DRAW: -#ifndef HAVE_X attrset (COLOR_NORMAL); dlg_erase (h); draw_box (h, 0, 0, 13, 17); -#endif break; case DLG_KEY: @@ -350,7 +338,6 @@ static void do_enter_key (Dlg_head *h, int f_pos) } while (chl_end); } -#ifndef HAVE_X static void chown_refresh (void) { attrset (COLOR_NORMAL); @@ -407,7 +394,6 @@ static void chown_info_update () set_perm (b_att[1]->text, sf_stat->st_mode >> 3); set_perm (b_att[2]->text, sf_stat->st_mode); } -#endif static void b_setpos (int f_pos) { b_att[0]->hotpos=-1; @@ -422,10 +408,8 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg) switch (Msg) { case DLG_DRAW: -#ifndef HAVE_X chown_refresh (); chown_info_update (); -#endif return 1; case DLG_POST_KEY: @@ -688,9 +672,7 @@ chown_advanced_cmd (void) } ch_cmode = sf_stat->st_mode; -#ifndef HAVE_X chown_refresh (); -#endif get_ownership (); diff --git a/src/boxes.c b/src/boxes.c index 690381e21..186cba679 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -77,7 +77,6 @@ static int user_hotkey = 'u'; static int display_callback (struct Dlg_head *h, int id, int Msg) { -#ifndef HAVE_X switch (Msg){ case DLG_DRAW: attrset (COLOR_NORMAL); @@ -126,7 +125,6 @@ display_callback (struct Dlg_head *h, int id, int Msg) return MSG_HANDLED; } } -#endif return MSG_NOT_HANDLED; } @@ -203,11 +201,7 @@ display_init (int radio_sel, char *init_text, add_widget (dd, user); input_set_point (user, 0); -#ifdef PORT_HAS_ICON_VIEW - my_radio = radio_new (3, 5, LIST_TYPES, displays, 1, "radio"); -#else my_radio = radio_new (3, 5, LIST_TYPES-1, displays, 1, "radio"); -#endif my_radio->sel = my_radio->pos = current_mode; add_widget (dd, my_radio); } @@ -449,8 +443,6 @@ confirm_box () } } -#ifndef HAVE_GNOME - #define DISPY 11 #define DISPX 46 @@ -532,12 +524,10 @@ display_bits_box () eight_bit_clean = new_mode < 2; full_eight_bits = new_mode == 0; -#ifndef HAVE_X #ifndef HAVE_SLANG meta (stdscr, eight_bit_clean); #else SLsmg_Display_Eight_Bit = full_eight_bits ? 128 : 160; -#endif #endif use_8th_bit_as_meta = !new_meta; } @@ -597,13 +587,6 @@ tree (char *current_dir) destroy_dlg (dlg); return val; } -#endif /* !HAVE_GNOME */ - -#ifndef USE_VFS -#ifdef USE_NETCODE -#undef USE_NETCODE -#endif -#endif #ifdef USE_VFS @@ -761,7 +744,6 @@ cd_dialog (void) return 0; } -#ifndef HAVE_GNOME void symlink_dialog (char *existing, char *new, char **ret_existing, char **ret_new) { @@ -793,7 +775,6 @@ symlink_dialog (char *existing, char *new, char **ret_existing, char **ret_new) *ret_existing = NULL; } } -#endif #ifdef WITH_BACKGROUND #define B_STOP B_USER+1 diff --git a/src/chmod.c b/src/chmod.c index a22735524..62c283468 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -115,12 +115,6 @@ struct { { B_ALL, NORMAL_BUTTON, 0, 0, N_("Set &all") }, }; -#ifdef HAVE_X -static void chmod_toggle_select (void) -{ -} - -#else static void chmod_toggle_select (void) { int Id = ch_dlg->current->dlg_id - BUTTONS + single_set * 2; @@ -170,7 +164,6 @@ static void chmod_refresh (void) dlg_move (ch_dlg, TY + 3, TX); addstr (_("and T or INS to mark")); } -#endif static int chmod_callback (Dlg_head *h, int Par, int Msg) { @@ -196,11 +189,10 @@ static int chmod_callback (Dlg_head *h, int Par, int Msg) return 1; } break; -#ifndef HAVE_X + case DLG_DRAW: chmod_refresh (); break; -#endif } return 0; } diff --git a/src/cmd.c b/src/cmd.c index b052522bc..7d71155bd 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1338,12 +1338,6 @@ char *get_random_hint (void) return result; } -#ifndef USE_VFS -#ifdef USE_NETCODE -#undef USE_NETCODE -#endif -#endif - #ifdef USE_NETCODE static char *machine_str = N_(" Enter machine name (F1 for details): "); diff --git a/src/filegui.c b/src/filegui.c index 04e09da0e..22c3f5b2e 100644 --- a/src/filegui.c +++ b/src/filegui.c @@ -144,10 +144,8 @@ typedef struct { /* Replace dialog: color set */ static int replace_colors [4]; -#ifndef HAVE_X /* Used to save the hint line */ static int last_hint_line; -#endif /* File operate window sizes */ #define WX 62 @@ -208,13 +206,11 @@ static int op_win_callback (struct Dlg_head *h, int id, int msg) { switch (msg){ -#ifndef HAVE_X case DLG_DRAW: attrset (COLOR_NORMAL); dlg_erase (h); draw_box (h, 1, 2, h->lines-2, h->cols-4); return 1; -#endif } return 0; } @@ -252,11 +248,9 @@ file_op_context_create_ui (FileOpContext *ctx, FileOperation op, int with_eta) ui->op_dlg = create_dlg (0, 0, WY-minus+4, x_size, dialog_colors, op_win_callback, "", "opwin", DLG_CENTER); -#ifndef HAVE_X last_hint_line = the_hint->widget.y; if ((ui->op_dlg->y + ui->op_dlg->lines) > last_hint_line) the_hint->widget.y = ui->op_dlg->y + ui->op_dlg->lines+1; -#endif x_set_dialog_title (ui->op_dlg, ""); @@ -303,9 +297,7 @@ file_op_context_destroy_ui (FileOpContext *ctx) g_free (ui); } -#ifndef HAVE_X the_hint->widget.y = last_hint_line; -#endif ctx->ui = NULL; } @@ -461,11 +453,7 @@ file_progress_show_bytes (FileOpContext *ctx, double done, double total) /* }}} */ -#ifndef HAVE_X #define truncFileString(ui, s) name_trunc (s, ui->eta_extra + 47) -#else -#define truncFileString(ui, s) s -#endif FileProgressStatus file_progress_show_source (FileOpContext *ctx, char *s) @@ -543,22 +531,15 @@ file_progress_show_deleting (FileOpContext *ctx, char *s) static int replace_callback (struct Dlg_head *h, int Id, int Msg) { -#ifndef HAVE_X - switch (Msg){ case DLG_DRAW: dialog_repaint (h, ERROR_COLOR, ERROR_COLOR); break; } -#endif return 0; } -#ifdef HAVE_X -#define X_TRUNC 128 -#else #define X_TRUNC 52 -#endif /* * FIXME: probably it is better to replace this with quick dialog machinery, diff --git a/src/help.c b/src/help.c index e172377e5..26909d22d 100644 --- a/src/help.c +++ b/src/help.c @@ -66,7 +66,7 @@ static int history_ptr; /* For the history queue */ static char *main_node; /* The main node */ static char *last_shown = 0; /* Last byte shown in a screen */ static int end_of_node = 0; /* Flag: the last character of the node shown? */ -char *currentpoint, *startpoint; +static char *currentpoint, *startpoint; static char *selected_item; /* The widget variables */ @@ -90,7 +90,7 @@ static int inside_link_area = 0; static int help_callback (struct Dlg_head *h, int id, int msg); #ifdef HAS_ACS_AS_PCCHARS -struct { +static struct { int acscode; int pccode; } acs2pc_table [] = { @@ -769,7 +769,6 @@ interactive_display (char *filename, char *node) return; } -#ifndef HAVE_X if (help_lines > LINES - 4) help_lines = LINES - 4; @@ -779,7 +778,6 @@ interactive_display (char *filename, char *node) /* allow us to process the tab key */ whelp->raw = 1; -#endif selected_item = search_string_node (main_node, STRING_LINK_START) - 1; currentpoint = startpoint = main_node + 1; @@ -789,7 +787,6 @@ interactive_display (char *filename, char *node) history [history_ptr].link = selected_item; } -#ifndef HAVE_X help_bar = buttonbar_new (keybar_visible); help_bar->widget.y -= whelp->y; help_bar->widget.x -= whelp->x; @@ -816,8 +813,5 @@ interactive_display (char *filename, char *node) run_dlg (whelp); interactive_display_finish (); destroy_dlg (whelp); -#else - x_interactive_display (); -#endif } diff --git a/src/hotlist.c b/src/hotlist.c index 822989ced..d83a3836e 100644 --- a/src/hotlist.c +++ b/src/hotlist.c @@ -154,7 +154,6 @@ void add_new_group_cmd (void); #define new_hotlist() g_new0(struct hotlist, 1) -#ifndef HAVE_X static void hotlist_refresh (Dlg_head *dlg) { dialog_repaint (dlg, COLOR_NORMAL, COLOR_HOT_NORMAL); @@ -165,7 +164,6 @@ static void hotlist_refresh (Dlg_head *dlg) if (!hotlist_state.moving) draw_box (dlg, dlg->lines-8, 5, 3, dlg->cols - (UX*2)); } -#endif /* If current->data is 0, then we are dealing with a VFS pathname */ static INLINE void update_path_name () @@ -183,14 +181,12 @@ static INLINE void update_path_name () else text = _("Subgroup - press ENTER to see list"); -#ifndef HAVE_X p = g_strconcat (" ", current_group->label, " ", NULL); if (!hotlist_state.moving) label_set_text (pname_group, name_trunc (p, dlg->cols - (UX*2+4))); else label_set_text (movelist_group, name_trunc (p, dlg->cols - (UX*2+4))); g_free (p); -#endif } else { text = list->current->text; } @@ -330,9 +326,6 @@ static int hotlist_button_callback (int action, void *data) } listbox_remove_list (l_hotlist); fill_listbox (); -#ifdef HAVE_X - x_listbox_select_nth (l_hotlist, 0); -#endif repaint_screen (); hotlist_state.modified = 1; return 0; @@ -385,9 +378,6 @@ static int hotlist_button_callback (int action, void *data) listbox_remove_list (list); current_group = current_group->up; fill_listbox (); -#ifdef HAVE_X - x_listbox_select_nth (list, 0); -#endif return 0; break; } @@ -402,19 +392,15 @@ static int hotlist_button_callback (int action, void *data) static int hotlist_callback (Dlg_head * h, int Par, int Msg) { switch (Msg) { -#ifndef HAVE_X case DLG_DRAW: hotlist_refresh (h); break; -#endif case DLG_UNHANDLED_KEY: switch (Par) { case '\n': -#ifndef HAVE_X if (ctrl_pressed()) goto l1; -#endif case KEY_ENTER: case KEY_RIGHT: if (hotlist_button_callback (B_ENTER, 0)) { @@ -618,7 +604,6 @@ static void init_hotlist (int list_type) */ pname = label_new (UY-11+LINES, UX+2, "", "the-lab"); add_widget (hotlist_dlg, pname); -#ifndef HAVE_X if (!hotlist_state.moving) { add_widget (hotlist_dlg, label_new (UY-12+LINES, UX+1, _(" Directory path "), NULL)); @@ -626,7 +611,6 @@ static void init_hotlist (int list_type) pname_group = label_new (UY, UX+1, _(" Directory label "), NULL); add_widget (hotlist_dlg, pname_group); } -#endif /* get new listbox */ l_hotlist = listbox_new (UY + 1, UX + 1, COLS-2*UX-8, LINES-14, listbox_cback, l_call, "listbox"); @@ -668,10 +652,8 @@ static void init_movelist (int list_type, struct hotlist *item) /* We add the labels. We are interested in the last one, * that one will hold the path name label */ -#ifndef HAVE_X movelist_group = label_new (UY, UX+1, _(" Directory label "), NULL); add_widget (movelist_dlg, movelist_group); -#endif /* get new listbox */ l_movelist = listbox_new (UY + 1, UX + 1, movelist_dlg->cols - 2*UX - 2, movelist_dlg->lines - 8, diff --git a/src/info.c b/src/info.c index 420f7c8a9..5a1ab4681 100644 --- a/src/info.c +++ b/src/info.c @@ -41,14 +41,13 @@ /* Have we called the init_my_statfs routine? */ static int initialized; -struct my_statfs myfs_stats; +static struct my_statfs myfs_stats; static int info_event (Gpm_Event *event, WInfo *info) { return 0; } -#ifndef HAVE_X static void info_box (Dlg_head *h, WInfo *info) { standend (); @@ -58,7 +57,6 @@ static void info_box (Dlg_head *h, WInfo *info) draw_double_box (h, info->widget.y, info->widget.x, info->widget.lines, info->widget.cols); } -#endif static void info_show_info (WInfo *info) @@ -68,7 +66,6 @@ info_show_info (WInfo *info) struct stat buf; -#ifndef HAVE_X if (!is_idle ()) return; @@ -79,9 +76,8 @@ info_show_info (WInfo *info) attrset (NORMAL_COLOR); widget_move (&info->widget, 2, 1); /* .ado: info->widget.x has wrong value (==0) on NT and OS/2, why? */ -#if !defined(OS2_NT) +#ifndef OS2_NT hline (ACS_HLINE|NORMAL_COLOR, info->widget.x-2); -#endif #endif if (get_current_type () != view_listing) return; @@ -97,7 +93,6 @@ info_show_info (WInfo *info) return; #endif -#ifndef HAVE_X /* Print only lines which fit */ if(!i18n_adjust) { @@ -211,9 +206,6 @@ info_show_info (WInfo *info) case 0: ; } /* switch */ -#else /* HAVE_X */ - x_show_info (info, &myfs_stats, &buf); -#endif } static void info_hook (void *data) @@ -243,17 +235,12 @@ static int info_callback (Dlg_head *h, WInfo *info, int msg, int par) case WIDGET_INIT: add_hook (&select_file_hook, info_hook, info); info->ready = 0; -#ifdef HAVE_X - x_create_info (h, h->wdata, info); -#endif break; -#ifndef HAVE_X case WIDGET_DRAW: info_hook (info); info_show_info (info); return 1; -#endif case WIDGET_FOCUS: return 0; diff --git a/src/key.c b/src/key.c index 9f7ac0f62..8d066578a 100644 --- a/src/key.c +++ b/src/key.c @@ -44,7 +44,7 @@ #include "cons.saver.h" #include "../vfs/vfs.h" -#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X) +#ifdef HAVE_TEXTMODE_X11_SUPPORT #include #endif @@ -72,7 +72,6 @@ int old_esc_mode = 0; int use_8th_bit_as_meta = 1; -#ifndef HAVE_X typedef struct key_def { char ch; /* Holds the matching char code */ int code; /* The code returned, valid if child == NULL */ @@ -85,14 +84,12 @@ typedef struct key_def { /* This holds all the key definitions */ static key_def *keys = 0; -#endif static int input_fd; static fd_set select_set; static int disabled_channels = 0; /* Disable channels checking */ int xgetch_second (void); -#ifndef PORT_HAS_FILE_HANDLERS /* File descriptor monitoring add/remove routines */ typedef struct SelectList { int fd; @@ -101,7 +98,7 @@ typedef struct SelectList { struct SelectList *next; } SelectList; -SelectList *select_list = 0; +static SelectList *select_list = 0; void add_select_channel (int fd, select_fn callback, void *info) { @@ -160,7 +157,6 @@ static void check_selects (fd_set *select_set) if (FD_ISSET (p->fd, select_set)) (*p->callback)(p->fd, p->info); } -#endif void channels_down (void) { @@ -181,8 +177,7 @@ typedef struct { int action; } key_define_t; -#ifndef HAVE_X -key_define_t mc_bindings [] = { +static key_define_t mc_bindings [] = { { KEY_END, ESC_STR ">", MCKEY_NOACTION }, { KEY_HOME, ESC_STR "<", MCKEY_NOACTION }, @@ -194,7 +189,7 @@ key_define_t mc_bindings [] = { }; /* Broken terminfo and termcap databases on xterminals */ -key_define_t xterm_key_defines [] = { +static key_define_t xterm_key_defines [] = { { KEY_F(1), ESC_STR "OP", MCKEY_NOACTION }, { KEY_F(2), ESC_STR "OQ", MCKEY_NOACTION }, { KEY_F(3), ESC_STR "OR", MCKEY_NOACTION }, @@ -212,25 +207,22 @@ key_define_t xterm_key_defines [] = { { 0, 0, MCKEY_NOACTION }, }; -key_define_t mc_default_keys [] = { +static key_define_t mc_default_keys [] = { { ESC_CHAR, ESC_STR, MCKEY_ESCAPE }, { ESC_CHAR, ESC_STR ESC_STR, MCKEY_NOACTION }, { 0, 0, MCKEY_NOACTION }, }; -#endif static void define_sequences (key_define_t *kd) { -#ifndef HAVE_X int i; for (i = 0; kd [i].code; i++) define_sequence(kd [i].code, kd [i].seq, kd [i].action); -#endif } -#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X) +#ifdef HAVE_TEXTMODE_X11_SUPPORT Display *display; Window w; @@ -247,7 +239,6 @@ init_textmode_x11_support (void) calls any define_sequence */ void init_key (void) { -#ifndef HAVE_X char *term = (char *) getenv ("TERM"); /* This has to be the first define_sequence */ @@ -281,21 +272,17 @@ void init_key (void) use_8th_bit_as_meta = 0; } #endif /* __QNX__ */ -#endif /* !HAVE_X */ } /* This has to be called after SLang_init_tty/slint_init */ void init_key_input_fd (void) { -#ifndef HAVE_X #ifdef HAVE_SLANG input_fd = SLang_TT_Read_FD; #endif -#endif /* !HAVE_X */ } -#ifndef HAVE_X static void xmouse_get_event (Gpm_Event *ev) { @@ -384,11 +371,9 @@ static int push_char (int c) *seq_append = 0; return 1; } -#endif /* !HAVE_X */ void define_sequence (int code, char *seq, int action) { -#ifndef HAVE_X key_def *base; if (strlen (seq) > sizeof (seq_buffer)-1) @@ -420,12 +405,9 @@ void define_sequence (int code, char *seq, int action) } } keys = create_sequence (seq, code, action); -#endif } -#ifndef HAVE_X static int *pending_keys; -#endif static int correct_key_code (int c) @@ -455,7 +437,6 @@ correct_key_code (int c) int get_key_code (int no_delay) { -#ifndef HAVE_X int c; static key_def *this = NULL, *parent; static struct timeval esctime = { -1, -1 }; @@ -620,12 +601,8 @@ int get_key_code (int no_delay) } this = NULL; return correct_key_code (c); -#else - return ERR; -#endif /* HAVE_X */ } -#ifndef PORT_HAS_FILE_HANDLERS /* If set timeout is set, then we wait 0.1 seconds, else, we block */ static void try_channels (int set_timeout) @@ -656,7 +633,6 @@ try_channels (int set_timeout) } } -#ifndef HAVE_X /* Workaround for System V Curses vt100 bug */ static int getch_with_delay (void) { @@ -678,16 +654,13 @@ static int getch_with_delay (void) /* Success -> return the character */ return c; } -#endif /* !HAVE_X */ #ifndef HAVE_LIBGPM #define gpm_flag 0 #endif -#endif /* !HAVE_FILE_HANDLERS */ extern int max_dirt_limit; -#ifndef HAVE_X /* Returns a character read from stdin with appropriate interpretation */ /* Also takes care of generated mouse events */ /* Returns EV_MOUSE if it is a mouse event */ @@ -816,15 +789,7 @@ int get_event (Gpm_Event *event, int redo_event, int block) return c; } -#else -/* X11 version of the get_event routine */ -int get_event (Gpm_Event *event, int redo_event, int block) -{ - return EV_NONE; -} -#endif -#ifndef PORT_HAS_GETCH /* Returns a key press, mouse events are discarded */ int mi_getch () { @@ -861,9 +826,7 @@ int xgetch_second (void) #endif return c; } -#endif -#ifndef HAVE_X static void learn_store_key (char *buffer, char **p, int c) { @@ -956,7 +919,6 @@ application_keypad_mode (void) } } -#endif /* !HAVE_X */ /* A function to check if we're idle. Currently checks only for key presses. @@ -980,7 +942,7 @@ int is_idle (void) int get_modifier (void) { -#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X) +#ifdef HAVE_TEXTMODE_X11_SUPPORT if (display) { Window root, child; int root_x, root_y; @@ -1028,7 +990,6 @@ ctrl_pressed () } #ifdef HAVE_MAD -#ifndef HAVE_X void k_dispose (key_def *k) { @@ -1059,14 +1020,13 @@ void done_key () { } -#endif /* HAVE_X */ #endif /* HAVE_MAD */ -#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X) +#ifdef HAVE_TEXTMODE_X11_SUPPORT void done_textmode_x11_support (void) { if (display) XCloseDisplay (display); } -#endif +#endif /* HAVE_TEXTMODE_X11_SUPPORT */ diff --git a/src/layout.c b/src/layout.c index 6a42b3cb4..03fb9d002 100644 --- a/src/layout.c +++ b/src/layout.c @@ -185,9 +185,7 @@ static char *layout_title, *title1, *title2, *title3, *output_lines_label; static WButton *bleft_widget, *bright_widget; /* Declarations for static functions */ -#ifdef PORT_NEEDS_CHANGE_SCREEN_SIZE static void low_level_change_screen_size (void); -#endif /* PORT_NEEDS_CHANGE_SCREEN_SIZE */ static void _check_split (void) { @@ -277,7 +275,6 @@ static int layout_callback (struct Dlg_head *h, int Id, int Msg) { switch (Msg){ case DLG_DRAW: -#ifndef HAVE_X /*When repainting the whole dialog (e.g. with C-l) we have to update everything*/ old_first_panel_size = -1; @@ -312,15 +309,12 @@ static int layout_callback (struct Dlg_head *h, int Id, int Msg) printw ("%02d", _output_lines); } } -#endif break; case DLG_POST_KEY: _filetype_mode = check_options [8].widget->state & C_BOOL; _permission_mode = check_options [7].widget->state & C_BOOL; -#ifndef HAVE_X _equal_split = check_options [6].widget->state & C_BOOL; -#endif _menubar_visible = check_options [5].widget->state & C_BOOL; _command_prompt = check_options [4].widget->state & C_BOOL; _keybar_visible = check_options [2].widget->state & C_BOOL; @@ -461,7 +455,6 @@ static void init_layout (void) button_new (BY, b2, B_EXIT, NORMAL_BUTTON, save_button, 0, 0, "s")); add_widget (layout_dlg, button_new (BY, b1, B_ENTER, DEFPUSH_BUTTON, ok_button, 0, 0, "o")); -#ifndef HAVE_X if (console_flag){ add_widget (layout_dlg, button_new (9, 12 + first_width, B_MINUS, NARROW_BUTTON, "&-", @@ -470,7 +463,6 @@ static void init_layout (void) button_new (9, 7 + first_width, B_PLUS, NARROW_BUTTON, "&+", bplus_cback, 0, NULL)); } -#endif #define XTRACT(i) *check_options[i].variable, check_options[i].text, check_options[i].tkname @@ -491,38 +483,32 @@ static void init_layout (void) _keybar_visible = keybar_visible; _message_visible = message_visible; _xterm_hintbar = xterm_hintbar; -#ifndef HAVE_X bright_widget = button_new(6, 15, B_2RIGHT, NARROW_BUTTON, "&>", b2right_cback, 0, ">"); add_widget (layout_dlg, bright_widget); bleft_widget = button_new (6, 9, B_2LEFT, NARROW_BUTTON, "&<", b2left_cback, 0, "<"); add_widget (layout_dlg, bleft_widget); check_options [6].widget = check_new (5, 6, XTRACT(6)); -#endif old_first_panel_size = -1; old_horizontal_split = -1; old_output_lines = -1; _first_panel_size = first_panel_size; _output_lines = output_lines; -#ifndef HAVE_X add_widget (layout_dlg, check_options [6].widget); radio_widget = radio_new (3, 6, 2, s_split_direction, 1, "r"); add_widget (layout_dlg, radio_widget); radio_widget->sel = horizontal_split; -#endif } void layout_change (void) { setup_panels (); layout_do_change = 0; -#ifndef HAVE_X /* re-init the menu, because perhaps there was a change in the way how the panel are split (horizontal/vertical). */ done_menu(); init_menu(); menubar_arrange(the_menubar); -#endif } void layout_cmd (void) @@ -538,12 +524,10 @@ void layout_cmd (void) for (i = 0; check_options [i].text; i++) if (check_options [i].widget) *check_options [i].variable = check_options [i].widget->state & C_BOOL; -#ifndef HAVE_X horizontal_split = radio_widget->sel; first_panel_size = _first_panel_size; output_lines = _output_lines; layout_do_change = 1; -#endif } if (result == B_EXIT){ save_layout (); @@ -578,7 +562,6 @@ int panel_event (Gpm_Event *event, WPanel *panel); int menu_bar_event (Gpm_Event *event, void *); extern char *prompt; -#ifndef HAVE_X #ifdef HAVE_SLANG void init_curses () { @@ -615,6 +598,7 @@ void init_curses (void) init_colors (); } #endif /* ! HAVE_SLANG */ + void done_screen () { if (!(quit & SUBSHELL_EXIT)) @@ -625,14 +609,6 @@ void done_screen () shut_mouse (); keypad (stdscr, FALSE); } -#else -void init_curses () -{ -} -void done_screen () -{ -} -#endif /* HAVE_X */ static void panel_do_cols (int index) @@ -648,28 +624,6 @@ panel_do_cols (int index) } } -#ifdef HAVE_X -void -setup_panels (void) -{ - Widget *w = panels [0].widget; - - winput_set_origin (&cmdline->input, 0, 60); - - /* Only needed by the startup code */ - if (panels [0].type == view_listing){ - x_panel_set_size (0); - } - - if (panels [1].type == view_listing){ - x_panel_set_size (1); - } - - load_hint (); -} - -#else - void setup_panels (void) { int start_y; @@ -751,19 +705,15 @@ void setup_panels (void) load_hint (); } -#endif void flag_winch (int dummy) { -#ifdef PORT_NEEDS_CHANGE_SCREEN_SIZE low_level_change_screen_size (); -#endif /* PORT_NEEDS_CHANGE_SCREEN_SIZE */ winch_flag = 1; } void edit_adjust_size (Dlg_head * h); -#ifdef PORT_NEEDS_CHANGE_SCREEN_SIZE static void low_level_change_screen_size (void) { @@ -831,7 +781,6 @@ void change_screen_size (void) #endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */ winch_flag = 0; } -#endif /* HAVE_X */ static int ok_to_refresh = 1; @@ -845,13 +794,10 @@ void use_dash (int flag) void set_hintbar(char *str) { -#ifndef HAVE_X if (xterm_flag && xterm_hintbar) { fprintf (stdout, "\33]0;mc - %s\7", str); fflush (stdout); - } else -#endif - { + } else { label_set_text (the_hint, str); if (ok_to_refresh > 0) refresh(); @@ -888,7 +834,6 @@ void print_vfs_message (char *msg, ...) void rotate_dash (void) { -#ifndef HAVE_X static char rotating_dash [] = "|/-\\"; static int pos = 0; @@ -901,12 +846,10 @@ void rotate_dash (void) addch (rotating_dash [pos]); mc_refresh (); pos++; -#endif } void remove_dash (void) { -#ifndef HAVE_X if (!nice_rotating_dash) return; @@ -920,7 +863,6 @@ void remove_dash (void) move (0, COLS-1); addch (' '); -#endif } char *get_nth_panel_name (int num) diff --git a/src/learn.c b/src/learn.c index 59f243272..cb410b037 100644 --- a/src/learn.c +++ b/src/learn.c @@ -51,7 +51,7 @@ #define BUTTONS 2 -struct { +static struct { int ret_cmd, flags, y, x; unsigned int hotkey; char *text; @@ -73,7 +73,6 @@ static int learnok; static int learnchanged; static char* learn_title = N_(" Learn keys "); -#ifndef HAVE_X static void learn_refresh (void) { attrset (COLOR_NORMAL); @@ -85,7 +84,6 @@ static void learn_refresh (void) dlg_move (learn_dlg, 1, (learn_dlg->cols - strlen (learn_title)) / 2); addstr (learn_title); } -#endif static int learn_button (int action, void *param) { @@ -344,9 +342,7 @@ void learn_keys (void) alternate_plus_minus = 1; /* don't translate KP_ADD, KP_SUBTRACT and KP_MULTIPLY to '+', '-' and '*' in correct_key_code */ -#ifndef HAVE_X application_keypad_mode (); -#endif init_learn (); run_dlg (learn_dlg); @@ -354,11 +350,8 @@ void learn_keys (void) old_esc_mode = save_old_esc_mode; alternate_plus_minus = save_alternate_plus_minus; -#ifndef HAVE_X if (!alternate_plus_minus) numeric_keypad_mode (); - -#endif switch (learn_dlg->ret_value) { case B_ENTER: diff --git a/src/listmode.c b/src/listmode.c index 872e607fb..f4df78691 100644 --- a/src/listmode.c +++ b/src/listmode.c @@ -104,7 +104,6 @@ struct { { UY+13, UX+22, "Item width:" } }; -#ifndef HAVE_X static void listmode_refresh (void) { attrset (COLOR_NORMAL); @@ -115,7 +114,6 @@ static void listmode_refresh (void) draw_box (listmode_dlg, UY + 4, UX, 11, 18); draw_box (listmode_dlg, UY + 4, UX+20, 11, 43); } -#endif static int bplus_cback (int action, void *data) { @@ -130,14 +128,14 @@ static int bminus_cback (int action, void *data) static int listmode_callback (Dlg_head * h, int Par, int Msg) { switch (Msg) { -#ifndef HAVE_X + case DLG_DRAW: listmode_refresh (); break; -#endif case DLG_POST_KEY: /* fall */ + case DLG_INIT: attrset (COLOR_NORMAL); dlg_move (h, UY+13, UX+35); diff --git a/src/option.c b/src/option.c index d674ba9ba..ed540dd15 100644 --- a/src/option.c +++ b/src/option.c @@ -59,8 +59,6 @@ static int r_but; extern int use_internal_edit; -int dummy; - static int OX = 33, first_width = 27, second_width = 27; static char *configure_title, *title1, *title2, *title3; @@ -75,11 +73,7 @@ static struct { {N_("cd follows lin&Ks"), &cd_symlinks, TOGGLE_VARIABLE, 0, "cd-follow" }, {N_("advanced cho&Wn"), &advanced_chfns, TOGGLE_VARIABLE, 0, "achown" }, {N_("l&Ynx-like motion"), &navigate_with_arrows,TOGGLE_VARIABLE, 0, "lynx" }, -#ifdef HAVE_GNOME - {N_("Animation"), &dummy, TOGGLE_VARIABLE, 0, "dummy" }, -#else {N_("rotatin&G dash"), &nice_rotating_dash,TOGGLE_VARIABLE, 0, "rotating" }, -#endif {N_("co&Mplete: show all"),&show_all_if_ambiguous,TOGGLE_VARIABLE, 0, "completion" }, {N_("&Use internal view"), &use_internal_view, TOGGLE_VARIABLE, 0, "view-int" }, {N_("use internal ed&It"), &use_internal_edit, TOGGLE_VARIABLE, 0, "edit-int" }, @@ -108,7 +102,6 @@ static int configure_callback (struct Dlg_head *h, int Id, int Msg) { switch (Msg) { case DLG_DRAW: -#ifndef HAVE_X attrset (COLOR_NORMAL); dlg_erase (h); draw_box (h, 1, 2, h->lines - 2, h->cols - 4); @@ -125,7 +118,6 @@ static int configure_callback (struct Dlg_head *h, int Id, int Msg) addstr (title2); dlg_move (h, PY, PX+1); addstr (title1); -#endif break; case DLG_END: @@ -228,9 +220,7 @@ static void init_configure (void) pause_radio = radio_new (RY+1, RX+2, 3, pause_options, 1, "pause-radio"); pause_radio->sel = pause_after_run; -#ifndef HAVE_GNOME add_widget (conf_dlg, pause_radio); -#endif for (i = 0; i < 6; i++){ check_options [i+13].widget = check_new (PY + (6-i), PX+2, XTRACT(i+13)); diff --git a/src/subshell.c b/src/subshell.c index d1ec704c7..3640dbf61 100644 --- a/src/subshell.c +++ b/src/subshell.c @@ -893,7 +893,6 @@ void sigchld_handler (int sig) /* }}} */ } -#ifndef HAVE_X #ifndef SCO_FLAVOR pid = waitpid (cons_saver_pid, &status, WUNTRACED | WNOHANG); @@ -916,7 +915,6 @@ void sigchld_handler (int sig) /* }}} */ } #endif /* ! SCO_FLAVOR */ -#endif /* ! HAVE_X */ /* If we get here, some other child exited; ignore it */ # ifdef __EMX__ /* Need to report */ pid = wait(&status);