mirror of
https://github.com/MidnightCommander/mc
synced 2025-04-09 00:22:55 +03:00
Ticket #1990: code cleanup before 4.7.0.2 release.
Fixed warings: local variable shadows a global declaration. Signed-off-by: Andrew Borodin <aborodin@vmail.ru> Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
parent
f7c574b76e
commit
0bd03e07f5
@ -48,7 +48,7 @@ int mc_skin_color__cache[MC_SKIN_COLOR_CACHE_COUNT];
|
|||||||
static mc_skin_color_t *
|
static mc_skin_color_t *
|
||||||
mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
|
mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
|
||||||
{
|
{
|
||||||
gchar key_name[BUF_TINY];
|
gchar kname[BUF_TINY];
|
||||||
mc_skin_color_t *mc_skin_color;
|
mc_skin_color_t *mc_skin_color;
|
||||||
|
|
||||||
if (group == NULL || key == NULL)
|
if (group == NULL || key == NULL)
|
||||||
@ -57,8 +57,8 @@ mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gch
|
|||||||
if (mc_skin == NULL)
|
if (mc_skin == NULL)
|
||||||
mc_skin = &mc_skin__default;
|
mc_skin = &mc_skin__default;
|
||||||
|
|
||||||
g_snprintf (key_name, sizeof (key_name), "%s.%s", group, key);
|
g_snprintf (kname, sizeof (kname), "%s.%s", group, key);
|
||||||
mc_skin_color = (mc_skin_color_t *) g_hash_table_lookup (mc_skin->colors, (gpointer) key_name);
|
mc_skin_color = (mc_skin_color_t *) g_hash_table_lookup (mc_skin->colors, (gpointer) kname);
|
||||||
|
|
||||||
return mc_skin_color;
|
return mc_skin_color;
|
||||||
}
|
}
|
||||||
@ -69,15 +69,15 @@ mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gch
|
|||||||
static void
|
static void
|
||||||
mc_skin_color_remove_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
|
mc_skin_color_remove_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
|
||||||
{
|
{
|
||||||
gchar key_name[BUF_TINY];
|
gchar kname[BUF_TINY];
|
||||||
if (group == NULL || key == NULL)
|
if (group == NULL || key == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mc_skin == NULL)
|
if (mc_skin == NULL)
|
||||||
mc_skin = &mc_skin__default;
|
mc_skin = &mc_skin__default;
|
||||||
|
|
||||||
g_snprintf (key_name, sizeof (key_name), "%s.%s", group, key);
|
g_snprintf (kname, sizeof (kname), "%s.%s", group, key);
|
||||||
g_hash_table_remove (mc_skin->colors, (gpointer) key_name);
|
g_hash_table_remove (mc_skin->colors, (gpointer) kname);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -86,16 +86,15 @@ static void
|
|||||||
mc_skin_color_add_to_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key,
|
mc_skin_color_add_to_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key,
|
||||||
mc_skin_color_t * mc_skin_color)
|
mc_skin_color_t * mc_skin_color)
|
||||||
{
|
{
|
||||||
gchar *key_name;
|
gchar *kname;
|
||||||
|
|
||||||
key_name = g_strdup_printf ("%s.%s", group, key);
|
kname = g_strdup_printf ("%s.%s", group, key);
|
||||||
if (key_name == NULL)
|
if (kname != NULL) {
|
||||||
return;
|
if (g_hash_table_lookup (mc_skin->colors, (gpointer) kname) != NULL)
|
||||||
|
g_hash_table_remove (mc_skin->colors, (gpointer) kname);
|
||||||
|
|
||||||
if (g_hash_table_lookup (mc_skin->colors, (gpointer) key_name) != NULL)
|
g_hash_table_insert (mc_skin->colors, (gpointer) kname, (gpointer) mc_skin_color);
|
||||||
g_hash_table_remove (mc_skin->colors, (gpointer) key_name);
|
}
|
||||||
|
|
||||||
g_hash_table_insert (mc_skin->colors, (gpointer) key_name, (gpointer) mc_skin_color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
102
lib/tty/key.c
102
lib/tty/key.c
@ -560,7 +560,7 @@ check_selects (fd_set * select_set)
|
|||||||
static void
|
static void
|
||||||
try_channels (int set_timeout)
|
try_channels (int set_timeout)
|
||||||
{
|
{
|
||||||
struct timeval timeout;
|
struct timeval time_out;
|
||||||
static fd_set select_set;
|
static fd_set select_set;
|
||||||
struct timeval *timeptr;
|
struct timeval *timeptr;
|
||||||
int v;
|
int v;
|
||||||
@ -573,9 +573,9 @@ try_channels (int set_timeout)
|
|||||||
|
|
||||||
timeptr = NULL;
|
timeptr = NULL;
|
||||||
if (set_timeout) {
|
if (set_timeout) {
|
||||||
timeout.tv_sec = 0;
|
time_out.tv_sec = 0;
|
||||||
timeout.tv_usec = 100000;
|
time_out.tv_usec = 100000;
|
||||||
timeptr = &timeout;
|
timeptr = &time_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
v = select (maxfdp + 1, &select_set, NULL, NULL, timeptr);
|
v = select (maxfdp + 1, &select_set, NULL, NULL, timeptr);
|
||||||
@ -981,14 +981,14 @@ xgetch_second (void)
|
|||||||
{
|
{
|
||||||
fd_set Read_FD_Set;
|
fd_set Read_FD_Set;
|
||||||
int c;
|
int c;
|
||||||
struct timeval timeout;
|
struct timeval time_out;
|
||||||
|
|
||||||
timeout.tv_sec = keyboard_key_timeout / 1000000;
|
time_out.tv_sec = keyboard_key_timeout / 1000000;
|
||||||
timeout.tv_usec = keyboard_key_timeout % 1000000;
|
time_out.tv_usec = keyboard_key_timeout % 1000000;
|
||||||
tty_nodelay (TRUE);
|
tty_nodelay (TRUE);
|
||||||
FD_ZERO (&Read_FD_Set);
|
FD_ZERO (&Read_FD_Set);
|
||||||
FD_SET (input_fd, &Read_FD_Set);
|
FD_SET (input_fd, &Read_FD_Set);
|
||||||
select (input_fd + 1, &Read_FD_Set, NULL, NULL, &timeout);
|
select (input_fd + 1, &Read_FD_Set, NULL, NULL, &time_out);
|
||||||
c = tty_lowlevel_getch ();
|
c = tty_lowlevel_getch ();
|
||||||
tty_nodelay (FALSE);
|
tty_nodelay (FALSE);
|
||||||
return c;
|
return c;
|
||||||
@ -1268,16 +1268,16 @@ sort_key_name_conv_tab (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
lookup_keyname (const char *keyname, int *lc_index)
|
lookup_keyname (const char *name, int *idx)
|
||||||
{
|
{
|
||||||
if (keyname[0] != '\0') {
|
if (name[0] != '\0') {
|
||||||
const key_code_name_t key = { 0, keyname, NULL, NULL };
|
const key_code_name_t key = { 0, name, NULL, NULL };
|
||||||
const key_code_name_t *keyp = &key;
|
const key_code_name_t *keyp = &key;
|
||||||
key_code_name_t **res;
|
key_code_name_t **res;
|
||||||
|
|
||||||
if (keyname[1] == '\0') {
|
if (name[1] == '\0') {
|
||||||
*lc_index = -1;
|
*idx = -1;
|
||||||
return (int) keyname[0];
|
return (int) name[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
sort_key_name_conv_tab ();
|
sort_key_name_conv_tab ();
|
||||||
@ -1288,18 +1288,18 @@ lookup_keyname (const char *keyname, int *lc_index)
|
|||||||
key_code_name_comparator);
|
key_code_name_comparator);
|
||||||
|
|
||||||
if (res != NULL) {
|
if (res != NULL) {
|
||||||
*lc_index = (int) (res - (key_code_name_t **) key_name_conv_tab_sorted);
|
*idx = (int) (res - (key_code_name_t **) key_name_conv_tab_sorted);
|
||||||
return (*res)->code;
|
return (*res)->code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*lc_index = -1;
|
*idx = -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the code associated with the symbolic name keyname */
|
/* Return the code associated with the symbolic name keyname */
|
||||||
long
|
long
|
||||||
lookup_key (const char *keyname, char **label)
|
lookup_key (const char *name, char **label)
|
||||||
{
|
{
|
||||||
char **lc_keys, **p;
|
char **lc_keys, **p;
|
||||||
int k = -1;
|
int k = -1;
|
||||||
@ -1310,12 +1310,12 @@ lookup_key (const char *keyname, char **label)
|
|||||||
int use_ctrl = -1;
|
int use_ctrl = -1;
|
||||||
int use_shift = -1;
|
int use_shift = -1;
|
||||||
|
|
||||||
if (keyname == NULL)
|
if (name == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
keyname = g_strstrip (g_strdup (keyname));
|
name = g_strstrip (g_strdup (name));
|
||||||
p = lc_keys = g_strsplit_set (keyname, "-+ ", -1);
|
p = lc_keys = g_strsplit_set (name, "-+ ", -1);
|
||||||
g_free ((char *) keyname);
|
g_free ((char *) name);
|
||||||
|
|
||||||
while ((p != NULL) && (*p != NULL)) {
|
while ((p != NULL) && (*p != NULL)) {
|
||||||
if ((*p)[0] != '\0') {
|
if ((*p)[0] != '\0') {
|
||||||
@ -1455,7 +1455,7 @@ is_idle (void)
|
|||||||
{
|
{
|
||||||
int maxfdp;
|
int maxfdp;
|
||||||
fd_set select_set;
|
fd_set select_set;
|
||||||
struct timeval timeout;
|
struct timeval time_out;
|
||||||
|
|
||||||
FD_ZERO (&select_set);
|
FD_ZERO (&select_set);
|
||||||
FD_SET (input_fd, &select_set);
|
FD_SET (input_fd, &select_set);
|
||||||
@ -1466,9 +1466,9 @@ is_idle (void)
|
|||||||
maxfdp = max (maxfdp, gpm_fd);
|
maxfdp = max (maxfdp, gpm_fd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
timeout.tv_sec = 0;
|
time_out.tv_sec = 0;
|
||||||
timeout.tv_usec = 0;
|
time_out.tv_usec = 0;
|
||||||
return (select (maxfdp + 1, &select_set, 0, 0, &timeout) <= 0);
|
return (select (maxfdp + 1, &select_set, 0, 0, &time_out) <= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -1515,20 +1515,20 @@ get_key_code (int no_delay)
|
|||||||
tty_nodelay (FALSE);
|
tty_nodelay (FALSE);
|
||||||
if (c == -1) {
|
if (c == -1) {
|
||||||
if (this != NULL && parent != NULL && parent->action == MCKEY_ESCAPE && old_esc_mode) {
|
if (this != NULL && parent != NULL && parent->action == MCKEY_ESCAPE && old_esc_mode) {
|
||||||
struct timeval current, timeout;
|
struct timeval current, time_out;
|
||||||
|
|
||||||
if (esctime.tv_sec == -1)
|
if (esctime.tv_sec == -1)
|
||||||
return -1;
|
return -1;
|
||||||
GET_TIME (current);
|
GET_TIME (current);
|
||||||
timeout.tv_sec = keyboard_key_timeout / 1000000 + esctime.tv_sec;
|
time_out.tv_sec = keyboard_key_timeout / 1000000 + esctime.tv_sec;
|
||||||
timeout.tv_usec = keyboard_key_timeout % 1000000 + esctime.tv_usec;
|
time_out.tv_usec = keyboard_key_timeout % 1000000 + esctime.tv_usec;
|
||||||
if (timeout.tv_usec > 1000000) {
|
if (time_out.tv_usec > 1000000) {
|
||||||
timeout.tv_usec -= 1000000;
|
time_out.tv_usec -= 1000000;
|
||||||
timeout.tv_sec++;
|
time_out.tv_sec++;
|
||||||
}
|
}
|
||||||
if (current.tv_sec < timeout.tv_sec)
|
if (current.tv_sec < time_out.tv_sec)
|
||||||
return -1;
|
return -1;
|
||||||
if (current.tv_sec == timeout.tv_sec && current.tv_usec < timeout.tv_usec)
|
if (current.tv_sec == time_out.tv_sec && current.tv_usec < time_out.tv_usec)
|
||||||
return -1;
|
return -1;
|
||||||
this = NULL;
|
this = NULL;
|
||||||
pending_keys = seq_append = NULL;
|
pending_keys = seq_append = NULL;
|
||||||
@ -1643,7 +1643,7 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
|
|||||||
#ifdef HAVE_LIBGPM
|
#ifdef HAVE_LIBGPM
|
||||||
static struct Gpm_Event ev; /* Mouse event */
|
static struct Gpm_Event ev; /* Mouse event */
|
||||||
#endif
|
#endif
|
||||||
struct timeval timeout;
|
struct timeval time_out;
|
||||||
struct timeval *time_addr = NULL;
|
struct timeval *time_addr = NULL;
|
||||||
static int dirty = 3;
|
static int dirty = 3;
|
||||||
|
|
||||||
@ -1689,10 +1689,10 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (redo_event) {
|
if (redo_event) {
|
||||||
timeout.tv_usec = mou_auto_repeat * 1000;
|
time_out.tv_usec = mou_auto_repeat * 1000;
|
||||||
timeout.tv_sec = 0;
|
time_out.tv_sec = 0;
|
||||||
|
|
||||||
time_addr = &timeout;
|
time_addr = &time_out;
|
||||||
} else {
|
} else {
|
||||||
int seconds;
|
int seconds;
|
||||||
|
|
||||||
@ -1705,16 +1705,16 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
|
|||||||
* timeouts in the stamp list.
|
* timeouts in the stamp list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
timeout.tv_sec = seconds;
|
time_out.tv_sec = seconds;
|
||||||
timeout.tv_usec = 0;
|
time_out.tv_usec = 0;
|
||||||
time_addr = &timeout;
|
time_addr = &time_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!block || winch_flag) {
|
if (!block || winch_flag) {
|
||||||
time_addr = &timeout;
|
time_addr = &time_out;
|
||||||
timeout.tv_sec = 0;
|
time_out.tv_sec = 0;
|
||||||
timeout.tv_usec = 0;
|
time_out.tv_usec = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tty_enable_interrupt_key ();
|
tty_enable_interrupt_key ();
|
||||||
@ -1795,7 +1795,7 @@ learn_key (void)
|
|||||||
|
|
||||||
fd_set Read_FD_Set;
|
fd_set Read_FD_Set;
|
||||||
struct timeval endtime;
|
struct timeval endtime;
|
||||||
struct timeval timeout;
|
struct timeval time_out;
|
||||||
int c;
|
int c;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
@ -1814,15 +1814,15 @@ learn_key (void)
|
|||||||
tty_nodelay (TRUE);
|
tty_nodelay (TRUE);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while ((c = tty_lowlevel_getch ()) == -1) {
|
while ((c = tty_lowlevel_getch ()) == -1) {
|
||||||
GET_TIME (timeout);
|
GET_TIME (time_out);
|
||||||
timeout.tv_usec = endtime.tv_usec - timeout.tv_usec;
|
time_out.tv_usec = endtime.tv_usec - time_out.tv_usec;
|
||||||
if (timeout.tv_usec < 0)
|
if (time_out.tv_usec < 0)
|
||||||
timeout.tv_sec++;
|
time_out.tv_sec++;
|
||||||
timeout.tv_sec = endtime.tv_sec - timeout.tv_sec;
|
time_out.tv_sec = endtime.tv_sec - time_out.tv_sec;
|
||||||
if (timeout.tv_sec >= 0 && timeout.tv_usec > 0) {
|
if (time_out.tv_sec >= 0 && time_out.tv_usec > 0) {
|
||||||
FD_ZERO (&Read_FD_Set);
|
FD_ZERO (&Read_FD_Set);
|
||||||
FD_SET (input_fd, &Read_FD_Set);
|
FD_SET (input_fd, &Read_FD_Set);
|
||||||
select (input_fd + 1, &Read_FD_Set, NULL, NULL, &timeout);
|
select (input_fd + 1, &Read_FD_Set, NULL, NULL, &time_out);
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ void done_key (void);
|
|||||||
typedef void (*move_fn) (void *data, int param);
|
typedef void (*move_fn) (void *data, int param);
|
||||||
cb_ret_t check_movement_keys (int key, int page_size, void *data,
|
cb_ret_t check_movement_keys (int key, int page_size, void *data,
|
||||||
move_fn backfn, move_fn forfn, move_fn topfn, move_fn bottomfn);
|
move_fn backfn, move_fn forfn, move_fn topfn, move_fn bottomfn);
|
||||||
long lookup_key (const char *keyname, char **label);
|
long lookup_key (const char *name, char **label);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int code;
|
int code;
|
||||||
|
@ -1184,16 +1184,16 @@ int
|
|||||||
vfs_s_select_on_two (int fd1, int fd2)
|
vfs_s_select_on_two (int fd1, int fd2)
|
||||||
{
|
{
|
||||||
fd_set set;
|
fd_set set;
|
||||||
struct timeval timeout;
|
struct timeval time_out;
|
||||||
int v;
|
int v;
|
||||||
int maxfd = (fd1 > fd2 ? fd1 : fd2) + 1;
|
int maxfd = (fd1 > fd2 ? fd1 : fd2) + 1;
|
||||||
|
|
||||||
timeout.tv_sec = 1;
|
time_out.tv_sec = 1;
|
||||||
timeout.tv_usec = 0;
|
time_out.tv_usec = 0;
|
||||||
FD_ZERO (&set);
|
FD_ZERO (&set);
|
||||||
FD_SET (fd1, &set);
|
FD_SET (fd1, &set);
|
||||||
FD_SET (fd2, &set);
|
FD_SET (fd2, &set);
|
||||||
v = select (maxfd, &set, 0, 0, &timeout);
|
v = select (maxfd, &set, 0, 0, &time_out);
|
||||||
if (v <= 0)
|
if (v <= 0)
|
||||||
return v;
|
return v;
|
||||||
if (FD_ISSET (fd1, &set))
|
if (FD_ISSET (fd1, &set))
|
||||||
|
@ -252,7 +252,7 @@ enter (WInput *lc_cmdline)
|
|||||||
for (i = j = 0; i < cmd_len; i++) {
|
for (i = j = 0; i < cmd_len; i++) {
|
||||||
if (cmd[i] == '%') {
|
if (cmd[i] == '%') {
|
||||||
i++;
|
i++;
|
||||||
s = expand_format (NULL, cmd[i], 1);
|
s = expand_format (NULL, cmd[i], TRUE);
|
||||||
command = g_realloc (command, j + strlen (s) + cmd_len - i + 1);
|
command = g_realloc (command, j + strlen (s) + cmd_len - i + 1);
|
||||||
strcpy (command + j, s);
|
strcpy (command + j, s);
|
||||||
g_free (s);
|
g_free (s);
|
||||||
|
@ -979,20 +979,20 @@ query_callback (Dlg_head *h, Widget *sender,
|
|||||||
if (strncmp (&e1->text[end - start], buff, bl) == 0) {
|
if (strncmp (&e1->text[end - start], buff, bl) == 0) {
|
||||||
if (need_redraw) {
|
if (need_redraw) {
|
||||||
char *si, *sl;
|
char *si, *sl;
|
||||||
char *ni, *nl;
|
char *nexti, *nextl;
|
||||||
si = &(e1->text[end - start]);
|
si = &(e1->text[end - start]);
|
||||||
sl = &(last_text[end - start]);
|
sl = &(last_text[end - start]);
|
||||||
|
|
||||||
for (; si[0] != '\0' && sl[0] != '\0';) {
|
for (; si[0] != '\0' && sl[0] != '\0';) {
|
||||||
|
|
||||||
ni = str_get_next_char (si);
|
nexti = str_get_next_char (si);
|
||||||
nl = str_get_next_char (sl);
|
nextl = str_get_next_char (sl);
|
||||||
|
|
||||||
if (ni - si != nl - sl) break;
|
if (nexti - si != nextl - sl) break;
|
||||||
if (strncmp (si, sl, ni - si) != 0) break;
|
if (strncmp (si, sl, nexti - si) != 0) break;
|
||||||
|
|
||||||
si = ni;
|
si = nexti;
|
||||||
sl = nl;
|
sl = nextl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (low > si - &e1->text[end - start])
|
if (low > si - &e1->text[end - start])
|
||||||
|
@ -241,16 +241,16 @@ default_dlg_callback (Dlg_head *h, Widget *sender,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dlg_head *
|
Dlg_head *
|
||||||
create_dlg (int y1, int x1, int lines, int cols, const int *color_set,
|
create_dlg (int y1, int x1, int lines, int cols, const int *colors,
|
||||||
dlg_cb_fn callback, const char *help_ctx, const char *title,
|
dlg_cb_fn callback, const char *help_ctx, const char *title,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
Dlg_head *new_d;
|
Dlg_head *new_d;
|
||||||
|
|
||||||
new_d = g_new0 (Dlg_head, 1);
|
new_d = g_new0 (Dlg_head, 1);
|
||||||
if (color_set != NULL) {
|
if (colors != NULL) {
|
||||||
new_d->color = g_new (int, DLG_COLOR_NUM);
|
new_d->color = g_new (int, DLG_COLOR_NUM);
|
||||||
memmove (new_d->color, color_set, sizeof (int) * DLG_COLOR_NUM);
|
memmove (new_d->color, colors, sizeof (int) * DLG_COLOR_NUM);
|
||||||
}
|
}
|
||||||
new_d->help_ctx = help_ctx;
|
new_d->help_ctx = help_ctx;
|
||||||
new_d->callback = (callback != NULL) ? callback : default_dlg_callback;
|
new_d->callback = (callback != NULL) ? callback : default_dlg_callback;
|
||||||
|
@ -180,7 +180,7 @@ void draw_box (Dlg_head *h, int y, int x, int ys, int xs);
|
|||||||
|
|
||||||
/* Creates a dialog head */
|
/* Creates a dialog head */
|
||||||
Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
|
Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
|
||||||
const int *color_set, dlg_cb_fn callback,
|
const int *colors, dlg_cb_fn callback,
|
||||||
const char *help_ctx, const char *title, int flags);
|
const char *help_ctx, const char *title, int flags);
|
||||||
|
|
||||||
void dlg_set_default_colors (void);
|
void dlg_set_default_colors (void);
|
||||||
|
16
src/dir.c
16
src/dir.c
@ -279,7 +279,7 @@ set_zero_dir (dir_list *list)
|
|||||||
/* If you change handle_dirent then check also handle_path. */
|
/* If you change handle_dirent then check also handle_path. */
|
||||||
/* Return values: -1 = failure, 0 = don't add, 1 = add to the list */
|
/* Return values: -1 = failure, 0 = don't add, 1 = add to the list */
|
||||||
static int
|
static int
|
||||||
handle_dirent (dir_list *list, const char *filter, struct dirent *dp,
|
handle_dirent (dir_list *list, const char *fltr, struct dirent *dp,
|
||||||
struct stat *buf1, int next_free, int *link_to_dir,
|
struct stat *buf1, int next_free, int *link_to_dir,
|
||||||
int *stale_link)
|
int *stale_link)
|
||||||
{
|
{
|
||||||
@ -313,8 +313,8 @@ handle_dirent (dir_list *list, const char *filter, struct dirent *dp,
|
|||||||
else
|
else
|
||||||
*stale_link = 1;
|
*stale_link = 1;
|
||||||
}
|
}
|
||||||
if (!(S_ISDIR (buf1->st_mode) || *link_to_dir) && filter
|
if (!(S_ISDIR (buf1->st_mode) || *link_to_dir) && (fltr != NULL)
|
||||||
&& !mc_search(filter, dp->d_name, MC_SEARCH_T_GLOB) )
|
&& !mc_search (fltr, dp->d_name, MC_SEARCH_T_GLOB))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Need to grow the *list? */
|
/* Need to grow the *list? */
|
||||||
@ -392,7 +392,7 @@ handle_path (dir_list *list, const char *path,
|
|||||||
|
|
||||||
int
|
int
|
||||||
do_load_dir (const char *path, dir_list *list, sortfn *sort, int lc_reverse,
|
do_load_dir (const char *path, dir_list *list, sortfn *sort, int lc_reverse,
|
||||||
int lc_case_sensitive, int exec_ff, const char *filter)
|
int lc_case_sensitive, int exec_ff, const char *fltr)
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
@ -422,7 +422,7 @@ do_load_dir (const char *path, dir_list *list, sortfn *sort, int lc_reverse,
|
|||||||
|
|
||||||
while ((dp = mc_readdir (dirp))) {
|
while ((dp = mc_readdir (dirp))) {
|
||||||
status =
|
status =
|
||||||
handle_dirent (list, filter, dp, &st, next_free, &link_to_dir,
|
handle_dirent (list, fltr, dp, &st, next_free, &link_to_dir,
|
||||||
&stale_link);
|
&stale_link);
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -492,10 +492,10 @@ alloc_dir_copy (int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If filter is null, then it is a match */
|
/* If fltr is null, then it is a match */
|
||||||
int
|
int
|
||||||
do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count,
|
do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count,
|
||||||
int rev, int lc_case_sensitive, int exec_ff, const char *filter)
|
int rev, int lc_case_sensitive, int exec_ff, const char *fltr)
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
@ -549,7 +549,7 @@ do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count,
|
|||||||
|
|
||||||
while ((dp = mc_readdir (dirp))) {
|
while ((dp = mc_readdir (dirp))) {
|
||||||
status =
|
status =
|
||||||
handle_dirent (list, filter, dp, &st, next_free, &link_to_dir,
|
handle_dirent (list, fltr, dp, &st, next_free, &link_to_dir,
|
||||||
&stale_link);
|
&stale_link);
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -41,11 +41,11 @@ typedef struct {
|
|||||||
typedef int sortfn (const void *, const void *);
|
typedef int sortfn (const void *, const void *);
|
||||||
|
|
||||||
int do_load_dir (const char *path, dir_list * list, sortfn * sort, int reverse,
|
int do_load_dir (const char *path, dir_list * list, sortfn * sort, int reverse,
|
||||||
int case_sensitive, int exec_ff, const char *filter);
|
int case_sensitive, int exec_ff, const char *fltr);
|
||||||
void do_sort (dir_list * list, sortfn * sort, int top, int reverse,
|
void do_sort (dir_list * list, sortfn * sort, int top, int reverse,
|
||||||
int case_sensitive, int exec_ff);
|
int case_sensitive, int exec_ff);
|
||||||
int do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
|
int do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
|
||||||
int reverse, int case_sensitive, int exec_ff, const char *filter);
|
int reverse, int case_sensitive, int exec_ff, const char *fltr);
|
||||||
void clean_dir (dir_list * list, int count);
|
void clean_dir (dir_list * list, int count);
|
||||||
gboolean set_zero_dir (dir_list *list);
|
gboolean set_zero_dir (dir_list *list);
|
||||||
int handle_path (dir_list *list, const char *path, struct stat *buf1,
|
int handle_path (dir_list *list, const char *path, struct stat *buf1,
|
||||||
|
@ -1833,7 +1833,8 @@ int line_is_blank (WEdit * edit, long line)
|
|||||||
|
|
||||||
/* moves up until a blank line is reached, or until just
|
/* moves up until a blank line is reached, or until just
|
||||||
before a non-blank line is reached */
|
before a non-blank line is reached */
|
||||||
static void edit_move_up_paragraph (WEdit * edit, int scroll)
|
static void
|
||||||
|
edit_move_up_paragraph (WEdit * edit, int do_scroll)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (edit->curs_line > 1) {
|
if (edit->curs_line > 1) {
|
||||||
@ -1855,12 +1856,13 @@ static void edit_move_up_paragraph (WEdit * edit, int scroll)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
edit_move_up (edit, edit->curs_line - i, scroll);
|
edit_move_up (edit, edit->curs_line - i, do_scroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* moves down until a blank line is reached, or until just
|
/* moves down until a blank line is reached, or until just
|
||||||
before a non-blank line is reached */
|
before a non-blank line is reached */
|
||||||
static void edit_move_down_paragraph (WEdit * edit, int scroll)
|
static void
|
||||||
|
edit_move_down_paragraph (WEdit * edit, int do_scroll)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (edit->curs_line >= edit->total_lines - 1) {
|
if (edit->curs_line >= edit->total_lines - 1) {
|
||||||
@ -1884,7 +1886,7 @@ static void edit_move_down_paragraph (WEdit * edit, int scroll)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
edit_move_down (edit, i - edit->curs_line, scroll);
|
edit_move_down (edit, i - edit->curs_line, do_scroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void edit_begin_page (WEdit *edit)
|
static void edit_begin_page (WEdit *edit)
|
||||||
@ -2137,7 +2139,7 @@ static void edit_left_char_move_cmd (WEdit * edit)
|
|||||||
= FALSE - move down
|
= FALSE - move down
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
edit_move_updown (WEdit * edit, unsigned long i, int scroll, gboolean direction)
|
edit_move_updown (WEdit * edit, unsigned long i, int do_scroll, gboolean direction)
|
||||||
{
|
{
|
||||||
unsigned long p;
|
unsigned long p;
|
||||||
unsigned long l = (direction)
|
unsigned long l = (direction)
|
||||||
@ -2152,7 +2154,7 @@ edit_move_updown (WEdit * edit, unsigned long i, int scroll, gboolean direction)
|
|||||||
|
|
||||||
if (i > 1)
|
if (i > 1)
|
||||||
edit->force |= REDRAW_PAGE;
|
edit->force |= REDRAW_PAGE;
|
||||||
if (scroll) {
|
if (do_scroll) {
|
||||||
if (direction)
|
if (direction)
|
||||||
edit_scroll_upward (edit, i);
|
edit_scroll_upward (edit, i);
|
||||||
else
|
else
|
||||||
@ -3364,14 +3366,16 @@ edit_stack_free (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* move i lines */
|
/* move i lines */
|
||||||
void edit_move_up (WEdit * edit, unsigned long i, int scroll)
|
void
|
||||||
|
edit_move_up (WEdit * edit, unsigned long i, int do_scroll)
|
||||||
{
|
{
|
||||||
edit_move_updown (edit, i, scroll, TRUE);
|
edit_move_updown (edit, i, do_scroll, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move i lines */
|
/* move i lines */
|
||||||
void edit_move_down (WEdit * edit, unsigned long i, int scroll)
|
void
|
||||||
|
edit_move_down (WEdit * edit, unsigned long i, int do_scroll)
|
||||||
{
|
{
|
||||||
edit_move_updown (edit, i, scroll, FALSE);
|
edit_move_updown (edit, i, do_scroll, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +140,8 @@ edit_refresh_cmd (WEdit * edit)
|
|||||||
tty_touch_screen ();
|
tty_touch_screen ();
|
||||||
mc_refresh ();
|
mc_refresh ();
|
||||||
#else
|
#else
|
||||||
|
(void) edit;
|
||||||
|
|
||||||
clr_scr ();
|
clr_scr ();
|
||||||
repaint_screen ();
|
repaint_screen ();
|
||||||
#endif /* !HAVE_SLANG */
|
#endif /* !HAVE_SLANG */
|
||||||
|
@ -131,7 +131,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
|||||||
handle_console (CONSOLE_RESTORE);
|
handle_console (CONSOLE_RESTORE);
|
||||||
|
|
||||||
if (!use_subshell && command && !(flags & EXECUTE_INTERNAL)) {
|
if (!use_subshell && command && !(flags & EXECUTE_INTERNAL)) {
|
||||||
printf ("%s%s\n", prompt, command);
|
printf ("%s%s\n", mc_prompt, command);
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
|
@ -953,9 +953,9 @@ keybind_cmd_bind (GArray *keymap, const char *keybind, unsigned long action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
lookup_action (const char *keyname)
|
lookup_action (const char *name)
|
||||||
{
|
{
|
||||||
const name_keymap_t key = { keyname, 0 };
|
const name_keymap_t key = { name, 0 };
|
||||||
name_keymap_t *res;
|
name_keymap_t *res;
|
||||||
|
|
||||||
sort_command_names ();
|
sort_command_names ();
|
||||||
|
@ -25,7 +25,7 @@ typedef struct global_keymap_t {
|
|||||||
} global_keymap_t;
|
} global_keymap_t;
|
||||||
|
|
||||||
void keybind_cmd_bind (GArray *keymap, const char *keybind, unsigned long action);
|
void keybind_cmd_bind (GArray *keymap, const char *keybind, unsigned long action);
|
||||||
unsigned long lookup_action (const char *keyname);
|
unsigned long lookup_action (const char *name);
|
||||||
const char *lookup_keymap_shortcut (const global_keymap_t *keymap, unsigned long action);
|
const char *lookup_keymap_shortcut (const global_keymap_t *keymap, unsigned long action);
|
||||||
unsigned long lookup_keymap_command (const global_keymap_t *keymap, long key);
|
unsigned long lookup_keymap_command (const global_keymap_t *keymap, long key);
|
||||||
|
|
||||||
|
37
src/layout.c
37
src/layout.c
@ -601,12 +601,12 @@ mc_refresh (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panel_do_cols (int lc_index)
|
panel_do_cols (int idx)
|
||||||
{
|
{
|
||||||
if (get_display_type (lc_index) == view_listing)
|
if (get_display_type (idx) == view_listing)
|
||||||
set_panel_formats ((WPanel *) panels [lc_index].widget);
|
set_panel_formats ((WPanel *) panels [idx].widget);
|
||||||
else
|
else
|
||||||
panel_update_cols (panels [lc_index].widget, frame_half);
|
panel_update_cols (panels [idx].widget, frame_half);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -653,7 +653,7 @@ setup_panels (void)
|
|||||||
panel_do_cols (0);
|
panel_do_cols (0);
|
||||||
panel_do_cols (1);
|
panel_do_cols (1);
|
||||||
|
|
||||||
promptl = str_term_width1 (prompt);
|
promptl = str_term_width1 (mc_prompt);
|
||||||
|
|
||||||
widget_set_size (&the_menubar->widget, 0, 0, 1, COLS);
|
widget_set_size (&the_menubar->widget, 0, 0, 1, COLS);
|
||||||
|
|
||||||
@ -909,6 +909,7 @@ set_display_type (int num, panel_view_mode_t type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case view_nothing:
|
||||||
case view_listing:
|
case view_listing:
|
||||||
new_widget = restore_into_right_dir_panel (num, old_widget);
|
new_widget = restore_into_right_dir_panel (num, old_widget);
|
||||||
break;
|
break;
|
||||||
@ -1062,15 +1063,15 @@ void swap_panels ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
panel_view_mode_t
|
panel_view_mode_t
|
||||||
get_display_type (int lc_index)
|
get_display_type (int idx)
|
||||||
{
|
{
|
||||||
return panels [lc_index].type;
|
return panels [idx].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Widget *
|
struct Widget *
|
||||||
get_panel_widget (int lc_index)
|
get_panel_widget (int idx)
|
||||||
{
|
{
|
||||||
return panels[lc_index].widget;
|
return panels[idx].widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_current_index (void)
|
int get_current_index (void)
|
||||||
@ -1114,30 +1115,30 @@ get_other_type (void)
|
|||||||
|
|
||||||
/* Save current list_view widget directory into panel */
|
/* Save current list_view widget directory into panel */
|
||||||
void
|
void
|
||||||
save_panel_dir (int lc_index)
|
save_panel_dir (int idx)
|
||||||
{
|
{
|
||||||
panel_view_mode_t type = get_display_type (lc_index);
|
panel_view_mode_t type = get_display_type (idx);
|
||||||
Widget *widget = get_panel_widget (lc_index);
|
Widget *widget = get_panel_widget (idx);
|
||||||
|
|
||||||
if ((type == view_listing) && (widget != NULL)) {
|
if ((type == view_listing) && (widget != NULL)) {
|
||||||
WPanel *w = (WPanel *) widget;
|
WPanel *w = (WPanel *) widget;
|
||||||
char *widget_work_dir = w->cwd;
|
char *widget_work_dir = w->cwd;
|
||||||
|
|
||||||
g_free(panels [lc_index].last_saved_dir); /* last path no needed */
|
g_free(panels [idx].last_saved_dir); /* last path no needed */
|
||||||
/* Because path can be nonlocal */
|
/* Because path can be nonlocal */
|
||||||
panels [lc_index].last_saved_dir = vfs_translate_url(widget_work_dir);
|
panels [idx].last_saved_dir = vfs_translate_url (widget_work_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save current list_view widget directory into panel */
|
/* Save current list_view widget directory into panel */
|
||||||
Widget *
|
Widget *
|
||||||
restore_into_right_dir_panel (int lc_index, Widget *from_widget)
|
restore_into_right_dir_panel (int idx, Widget *from_widget)
|
||||||
{
|
{
|
||||||
Widget *new_widget = NULL;
|
Widget *new_widget = NULL;
|
||||||
const char *saved_dir = panels [lc_index].last_saved_dir;
|
const char *saved_dir = panels [idx].last_saved_dir;
|
||||||
gboolean last_was_panel = (from_widget &&
|
gboolean last_was_panel = (from_widget &&
|
||||||
get_display_type(lc_index) != view_listing);
|
get_display_type(idx) != view_listing);
|
||||||
const char *p_name = get_nth_panel_name (lc_index);
|
const char *p_name = get_nth_panel_name (idx);
|
||||||
|
|
||||||
if (last_was_panel)
|
if (last_was_panel)
|
||||||
new_widget = (Widget *) panel_new_with_dir (p_name, saved_dir);
|
new_widget = (Widget *) panel_new_with_dir (p_name, saved_dir);
|
||||||
|
@ -16,19 +16,19 @@ void sigwinch_handler (int dummy);
|
|||||||
void change_screen_size (void);
|
void change_screen_size (void);
|
||||||
void set_display_type (int num, panel_view_mode_t type);
|
void set_display_type (int num, panel_view_mode_t type);
|
||||||
void swap_panels (void);
|
void swap_panels (void);
|
||||||
panel_view_mode_t get_display_type (int index);
|
panel_view_mode_t get_display_type (int idx);
|
||||||
panel_view_mode_t get_current_type (void);
|
panel_view_mode_t get_current_type (void);
|
||||||
panel_view_mode_t get_other_type (void);
|
panel_view_mode_t get_other_type (void);
|
||||||
int get_current_index (void);
|
int get_current_index (void);
|
||||||
int get_other_index (void);
|
int get_other_index (void);
|
||||||
const char *get_nth_panel_name (int num);
|
const char *get_nth_panel_name (int num);
|
||||||
|
|
||||||
struct Widget *get_panel_widget (int index);
|
struct Widget *get_panel_widget (int idx);
|
||||||
|
|
||||||
struct WPanel *get_other_panel (void);
|
struct WPanel *get_other_panel (void);
|
||||||
|
|
||||||
void save_panel_dir (int index);
|
void save_panel_dir (int idx);
|
||||||
Widget *restore_into_right_dir_panel (int index, Widget *from_widget);
|
Widget *restore_into_right_dir_panel (int idx, Widget *from_widget);
|
||||||
const char *get_panel_dir_for (const WPanel *widget);
|
const char *get_panel_dir_for (const WPanel *widget);
|
||||||
|
|
||||||
void set_hintbar (const char *str);
|
void set_hintbar (const char *str);
|
||||||
|
16
src/main.c
16
src/main.c
@ -203,7 +203,7 @@ int navigate_with_arrows = 0;
|
|||||||
int reset_hp_softkeys = 0;
|
int reset_hp_softkeys = 0;
|
||||||
|
|
||||||
/* The prompt */
|
/* The prompt */
|
||||||
const char *prompt = NULL;
|
const char *mc_prompt = NULL;
|
||||||
|
|
||||||
/* The widget where we draw the prompt */
|
/* The widget where we draw the prompt */
|
||||||
WLabel *the_prompt;
|
WLabel *the_prompt;
|
||||||
@ -602,8 +602,8 @@ load_prompt (int fd, void *unused)
|
|||||||
tmp_prompt[COLS - 8] = '\0';
|
tmp_prompt[COLS - 8] = '\0';
|
||||||
prompt_len = COLS - 8;
|
prompt_len = COLS - 8;
|
||||||
}
|
}
|
||||||
prompt = tmp_prompt;
|
mc_prompt = tmp_prompt;
|
||||||
label_set_text (the_prompt, prompt);
|
label_set_text (the_prompt, mc_prompt);
|
||||||
winput_set_origin ((WInput *) cmdline, prompt_len,
|
winput_set_origin ((WInput *) cmdline, prompt_len,
|
||||||
COLS - prompt_len);
|
COLS - prompt_len);
|
||||||
|
|
||||||
@ -977,7 +977,7 @@ create_panels (void)
|
|||||||
|
|
||||||
/* Create the nice widgets */
|
/* Create the nice widgets */
|
||||||
cmdline = command_new (0, 0, 0);
|
cmdline = command_new (0, 0, 0);
|
||||||
the_prompt = label_new (0, 0, prompt);
|
the_prompt = label_new (0, 0, mc_prompt);
|
||||||
the_prompt->transparent = 1;
|
the_prompt->transparent = 1;
|
||||||
the_bar = buttonbar_new (keybar_visible);
|
the_bar = buttonbar_new (keybar_visible);
|
||||||
|
|
||||||
@ -2203,12 +2203,12 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
if (use_subshell) {
|
if (use_subshell) {
|
||||||
prompt = strip_ctrl_codes (subshell_prompt);
|
mc_prompt = strip_ctrl_codes (subshell_prompt);
|
||||||
if (!prompt)
|
if (mc_prompt == NULL)
|
||||||
prompt = "";
|
mc_prompt = "";
|
||||||
} else
|
} else
|
||||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||||
prompt = (geteuid () == 0) ? "# " : "$ ";
|
mc_prompt = (geteuid () == 0) ? "# " : "$ ";
|
||||||
|
|
||||||
|
|
||||||
/* Program main loop */
|
/* Program main loop */
|
||||||
|
@ -120,7 +120,7 @@ void load_hint (int force);
|
|||||||
void print_vfs_message(const char *msg, ...)
|
void print_vfs_message(const char *msg, ...)
|
||||||
__attribute__ ((format (__printf__, 1, 2)));
|
__attribute__ ((format (__printf__, 1, 2)));
|
||||||
|
|
||||||
extern const char *prompt;
|
extern const char *mc_prompt;
|
||||||
extern const char *edit_one_file;
|
extern const char *edit_one_file;
|
||||||
extern char *mc_home;
|
extern char *mc_home;
|
||||||
extern char *mc_home_alt;
|
extern char *mc_home_alt;
|
||||||
|
15
src/user.c
15
src/user.c
@ -178,7 +178,7 @@ strip_ext(char *ss)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
expand_format (WEdit *edit_widget, char c, int lc_quote)
|
expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
|
||||||
{
|
{
|
||||||
WPanel *panel = NULL;
|
WPanel *panel = NULL;
|
||||||
char *(*quote_func) (const char *, int);
|
char *(*quote_func) (const char *, int);
|
||||||
@ -208,7 +208,7 @@ expand_format (WEdit *edit_widget, char c, int lc_quote)
|
|||||||
fname = str_unconst (edit_get_file_name (edit_widget));
|
fname = str_unconst (edit_get_file_name (edit_widget));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (lc_quote)
|
if (do_quote)
|
||||||
quote_func = name_quote;
|
quote_func = name_quote;
|
||||||
else
|
else
|
||||||
quote_func = fake_name_quote;
|
quote_func = fake_name_quote;
|
||||||
@ -610,7 +610,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
|
|||||||
int cmd_file_fd;
|
int cmd_file_fd;
|
||||||
int expand_prefix_found = 0;
|
int expand_prefix_found = 0;
|
||||||
char *parameter = 0;
|
char *parameter = 0;
|
||||||
int do_quote = 0;
|
gboolean do_quote = FALSE;
|
||||||
char lc_prompt [80];
|
char lc_prompt [80];
|
||||||
int col;
|
int col;
|
||||||
char *file_name;
|
char *file_name;
|
||||||
@ -658,7 +658,8 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (do_quote) {
|
if (do_quote) {
|
||||||
fputs (tmp = name_quote (parameter, 0), cmd_file);
|
tmp = name_quote (parameter, 0);
|
||||||
|
fputs (tmp, cmd_file);
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
} else
|
} else
|
||||||
fputs (parameter, cmd_file);
|
fputs (parameter, cmd_file);
|
||||||
@ -672,7 +673,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
|
|||||||
} else if (expand_prefix_found){
|
} else if (expand_prefix_found){
|
||||||
expand_prefix_found = 0;
|
expand_prefix_found = 0;
|
||||||
if (g_ascii_isdigit ((gchar) *commands)) {
|
if (g_ascii_isdigit ((gchar) *commands)) {
|
||||||
do_quote = atoi (commands);
|
do_quote = (atoi (commands) != 0);
|
||||||
while (g_ascii_isdigit ((gchar) *commands))
|
while (g_ascii_isdigit ((gchar) *commands))
|
||||||
commands++;
|
commands++;
|
||||||
}
|
}
|
||||||
@ -690,7 +691,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
|
|||||||
commands += i;
|
commands += i;
|
||||||
run_view = 1;
|
run_view = 1;
|
||||||
} else {
|
} else {
|
||||||
do_quote = 1; /* Default: Quote expanded macro */
|
do_quote = TRUE; /* Default: Quote expanded macro */
|
||||||
expand_prefix_found = 1;
|
expand_prefix_found = 1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -747,7 +748,7 @@ menu_file_own(char* path)
|
|||||||
* otherwise we are called from the mcedit menu.
|
* otherwise we are called from the mcedit menu.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
user_menu_cmd (WEdit *edit_widget)
|
user_menu_cmd (struct WEdit *edit_widget)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char *data, **entries;
|
char *data, **entries;
|
||||||
|
10
src/user.h
10
src/user.h
@ -6,12 +6,14 @@
|
|||||||
#ifndef MC_USER_H
|
#ifndef MC_USER_H
|
||||||
#define MC_USER_H
|
#define MC_USER_H
|
||||||
|
|
||||||
#include "src/editor/edit.h"
|
#include "lib/global.h"
|
||||||
|
|
||||||
void user_menu_cmd (WEdit *edit_widget);
|
struct WEdit;
|
||||||
char *expand_format (WEdit *edit_widget, char c, int quote);
|
|
||||||
|
void user_menu_cmd (struct WEdit *edit_widget);
|
||||||
|
char *expand_format (struct WEdit *edit_widget, char c, gboolean do_quote);
|
||||||
int check_format_view (const char *);
|
int check_format_view (const char *);
|
||||||
int check_format_var (const char *, char **);
|
int check_format_var (const char *, char **);
|
||||||
int check_format_cd (const char *);
|
int check_format_cd (const char *);
|
||||||
|
|
||||||
#endif
|
#endif /* MC_USER_H */
|
||||||
|
12
src/widget.c
12
src/widget.c
@ -1017,9 +1017,9 @@ history_get (const char *input_name)
|
|||||||
g_strfreev (keys);
|
g_strfreev (keys);
|
||||||
|
|
||||||
for (i = 0; i < keys_num; i++) {
|
for (i = 0; i < keys_num; i++) {
|
||||||
char key_name[BUF_TINY];
|
char key[BUF_TINY];
|
||||||
g_snprintf (key_name, sizeof (key_name), "%lu", (unsigned long)i);
|
g_snprintf (key, sizeof (key), "%lu", (unsigned long)i);
|
||||||
this_entry = mc_config_get_string (cfg, input_name, key_name, "");
|
this_entry = mc_config_get_string (cfg, input_name, key, "");
|
||||||
|
|
||||||
if (this_entry != NULL)
|
if (this_entry != NULL)
|
||||||
hist = list_append_unique (hist, this_entry);
|
hist = list_append_unique (hist, this_entry);
|
||||||
@ -1080,9 +1080,9 @@ history_put (const char *input_name, GList *h)
|
|||||||
|
|
||||||
/* We shouldn't have null entries, but let's be sure */
|
/* We shouldn't have null entries, but let's be sure */
|
||||||
if (text != NULL) {
|
if (text != NULL) {
|
||||||
char key_name[BUF_TINY];
|
char key[BUF_TINY];
|
||||||
g_snprintf (key_name, sizeof (key_name), "%d", i++);
|
g_snprintf (key, sizeof (key), "%d", i++);
|
||||||
mc_config_set_string(cfg,input_name, key_name, text);
|
mc_config_set_string (cfg, input_name, key, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ char *listbox_add_item (WListbox *l, enum append_pos pos, int
|
|||||||
struct global_keymap_t;
|
struct global_keymap_t;
|
||||||
|
|
||||||
WButtonBar *find_buttonbar (const Dlg_head *h);
|
WButtonBar *find_buttonbar (const Dlg_head *h);
|
||||||
void buttonbar_set_label (WButtonBar *bb, int index, const char *text,
|
void buttonbar_set_label (WButtonBar *bb, int idx, const char *text,
|
||||||
const struct global_keymap_t *keymap, const Widget *receiver);
|
const struct global_keymap_t *keymap, const Widget *receiver);
|
||||||
#define buttonbar_clear_label(bb, idx, recv) buttonbar_set_label (bb, idx, "", NULL, recv)
|
#define buttonbar_clear_label(bb, idx, recv) buttonbar_set_label (bb, idx, "", NULL, recv)
|
||||||
void buttonbar_set_visible (WButtonBar *bb, gboolean visible);
|
void buttonbar_set_visible (WButtonBar *bb, gboolean visible);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user