mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 09:19:24 +03:00
replaced g_snprintf() by snprintf()
This commit is contained in:
parent
a1b47185c9
commit
e4a4f77ac2
@ -1,6 +1,7 @@
|
|||||||
2009-01-31 Enrico Weigelt, metux ITS <weigelt@metux.de>
|
2009-01-31 Enrico Weigelt, metux ITS <weigelt@metux.de>
|
||||||
|
|
||||||
* replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file() (in mhl/string.h)
|
* replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file() (in mhl/string.h)
|
||||||
|
* replaced g_snprintf() by snprintf()
|
||||||
|
|
||||||
2009-01-30 Enrico Weigelt, metux ITS <weigelt@metux.de>
|
2009-01-30 Enrico Weigelt, metux ITS <weigelt@metux.de>
|
||||||
|
|
||||||
|
@ -2337,7 +2337,7 @@ edit_goto_cmd (WEdit *edit)
|
|||||||
char *error;
|
char *error;
|
||||||
char s[32];
|
char s[32];
|
||||||
|
|
||||||
g_snprintf (s, sizeof (s), "%ld", line);
|
snprintf (s, sizeof (s), "%ld", line);
|
||||||
f = input_dialog (_(" Goto line "), _(" Enter line: "), MC_HISTORY_EDIT_GOTO_LINE,
|
f = input_dialog (_(" Goto line "), _(" Enter line: "), MC_HISTORY_EDIT_GOTO_LINE,
|
||||||
line ? s : "");
|
line ? s : "");
|
||||||
if (!f)
|
if (!f)
|
||||||
|
@ -72,7 +72,7 @@ static void status_string (WEdit * edit, char *s, int w)
|
|||||||
*/
|
*/
|
||||||
if (edit->curs1 < edit->last_byte) {
|
if (edit->curs1 < edit->last_byte) {
|
||||||
unsigned char cur_byte = edit_get_byte (edit, edit->curs1);
|
unsigned char cur_byte = edit_get_byte (edit, edit->curs1);
|
||||||
g_snprintf (byte_str, sizeof (byte_str), "%c %3d 0x%02X",
|
snprintf (byte_str, sizeof (byte_str), "%c %3d 0x%02X",
|
||||||
is_printable (cur_byte) ? cur_byte : '.',
|
is_printable (cur_byte) ? cur_byte : '.',
|
||||||
(int) cur_byte,
|
(int) cur_byte,
|
||||||
(unsigned) cur_byte);
|
(unsigned) cur_byte);
|
||||||
@ -81,7 +81,7 @@ static void status_string (WEdit * edit, char *s, int w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The field lengths just prevent the status line from shortening too much */
|
/* The field lengths just prevent the status line from shortening too much */
|
||||||
g_snprintf (s, w,
|
snprintf (s, w,
|
||||||
"[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s",
|
"[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s",
|
||||||
edit->mark1 != edit->mark2 ? ( column_highlighting ? 'C' : 'B') : '-',
|
edit->mark1 != edit->mark2 ? ( column_highlighting ? 'C' : 'B') : '-',
|
||||||
edit->modified ? 'M' : '-',
|
edit->modified ? 'M' : '-',
|
||||||
|
@ -147,9 +147,9 @@ edit_options_dialog (void)
|
|||||||
i18n_flag = 1;
|
i18n_flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_snprintf (wrap_length, sizeof (wrap_length), "%d",
|
snprintf (wrap_length, sizeof (wrap_length), "%d",
|
||||||
option_word_wrap_line_length);
|
option_word_wrap_line_length);
|
||||||
g_snprintf (tab_spacing, sizeof (tab_spacing), "%d",
|
snprintf (tab_spacing, sizeof (tab_spacing), "%d",
|
||||||
option_tab_spacing);
|
option_tab_spacing);
|
||||||
|
|
||||||
quick_widgets[3].text = wrap_length;
|
quick_widgets[3].text = wrap_length;
|
||||||
|
@ -571,7 +571,7 @@ sel_charset_button (int action)
|
|||||||
: codepages[new_display_codepage].name;
|
: codepages[new_display_codepage].name;
|
||||||
|
|
||||||
/* avoid strange bug with label repainting */
|
/* avoid strange bug with label repainting */
|
||||||
g_snprintf (buf, sizeof (buf), "%-27s", cpname);
|
snprintf (buf, sizeof (buf), "%-27s", cpname);
|
||||||
label_set_text (cplabel, buf);
|
label_set_text (cplabel, buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -772,12 +772,12 @@ configure_vfs (void)
|
|||||||
ret_use_netrc = use_netrc;
|
ret_use_netrc = use_netrc;
|
||||||
ret_ftpfs_use_passive_connections = ftpfs_use_passive_connections;
|
ret_ftpfs_use_passive_connections = ftpfs_use_passive_connections;
|
||||||
ret_ftpfs_use_passive_connections_over_proxy = ftpfs_use_passive_connections_over_proxy;
|
ret_ftpfs_use_passive_connections_over_proxy = ftpfs_use_passive_connections_over_proxy;
|
||||||
g_snprintf(buffer3, sizeof (buffer3), "%i", ftpfs_directory_timeout);
|
snprintf(buffer3, sizeof (buffer3), "%i", ftpfs_directory_timeout);
|
||||||
confvfs_widgets[8].text = buffer3;
|
confvfs_widgets[8].text = buffer3;
|
||||||
confvfs_widgets[10].text = ftpfs_anonymous_passwd;
|
confvfs_widgets[10].text = ftpfs_anonymous_passwd;
|
||||||
confvfs_widgets[5].text = ftpfs_proxy_host;
|
confvfs_widgets[5].text = ftpfs_proxy_host;
|
||||||
#endif
|
#endif
|
||||||
g_snprintf (buffer2, sizeof (buffer2), "%i", vfs_timeout);
|
snprintf (buffer2, sizeof (buffer2), "%i", vfs_timeout);
|
||||||
confvfs_widgets [3 + VFS_WIDGETBASE].text = buffer2;
|
confvfs_widgets [3 + VFS_WIDGETBASE].text = buffer2;
|
||||||
|
|
||||||
if (quick_dialog (&confvfs_dlg) != B_CANCEL) {
|
if (quick_dialog (&confvfs_dlg) != B_CANCEL) {
|
||||||
|
@ -196,7 +196,7 @@ init_translation_table (int cpsource, int cpdisplay)
|
|||||||
|
|
||||||
cd = iconv_open (cpdisp, cpsour);
|
cd = iconv_open (cpdisp, cpsour);
|
||||||
if (cd == (iconv_t) - 1) {
|
if (cd == (iconv_t) - 1) {
|
||||||
g_snprintf (errbuf, sizeof (errbuf),
|
snprintf (errbuf, sizeof (errbuf),
|
||||||
_("Cannot translate from %s to %s"), cpsour, cpdisp);
|
_("Cannot translate from %s to %s"), cpsour, cpdisp);
|
||||||
return errbuf;
|
return errbuf;
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ init_translation_table (int cpsource, int cpdisplay)
|
|||||||
|
|
||||||
cd = iconv_open (cpsour, cpdisp);
|
cd = iconv_open (cpsour, cpdisp);
|
||||||
if (cd == (iconv_t) - 1) {
|
if (cd == (iconv_t) - 1) {
|
||||||
g_snprintf (errbuf, sizeof (errbuf),
|
snprintf (errbuf, sizeof (errbuf),
|
||||||
_("Cannot translate from %s to %s"), cpdisp, cpsour);
|
_("Cannot translate from %s to %s"), cpdisp, cpsour);
|
||||||
return errbuf;
|
return errbuf;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ chmod_callback (Dlg_head *h, dlg_msg_t msg, int parm)
|
|||||||
case DLG_ACTION:
|
case DLG_ACTION:
|
||||||
if (id >= 0) {
|
if (id >= 0) {
|
||||||
c_stat ^= check_perm[id].mode;
|
c_stat ^= check_perm[id].mode;
|
||||||
g_snprintf (buffer, sizeof (buffer), "%o", c_stat);
|
snprintf (buffer, sizeof (buffer), "%o", c_stat);
|
||||||
label_set_text (statl, buffer);
|
label_set_text (statl, buffer);
|
||||||
chmod_toggle_select (h, id);
|
chmod_toggle_select (h, id);
|
||||||
mode_change = 1;
|
mode_change = 1;
|
||||||
@ -302,7 +302,7 @@ void chmod_cmd (void)
|
|||||||
add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown));
|
add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown));
|
||||||
c_fgrp = name_trunc (get_group (sf_stat.st_gid), 21);
|
c_fgrp = name_trunc (get_group (sf_stat.st_gid), 21);
|
||||||
add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp));
|
add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp));
|
||||||
g_snprintf (buffer, sizeof (buffer), "%o", c_stat);
|
snprintf (buffer, sizeof (buffer), "%o", c_stat);
|
||||||
statl = label_new (FY+4, FX+2, buffer);
|
statl = label_new (FY+4, FX+2, buffer);
|
||||||
add_widget (ch_dlg, statl);
|
add_widget (ch_dlg, statl);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ view_file_at_line (const char *filename, int plain_view, int internal,
|
|||||||
char view_entry[BUF_TINY];
|
char view_entry[BUF_TINY];
|
||||||
|
|
||||||
if (start_line != 0)
|
if (start_line != 0)
|
||||||
g_snprintf (view_entry, sizeof (view_entry), "View:%d",
|
snprintf (view_entry, sizeof (view_entry), "View:%d",
|
||||||
start_line);
|
start_line);
|
||||||
else
|
else
|
||||||
strcpy (view_entry, "View");
|
strcpy (view_entry, "View");
|
||||||
|
@ -1692,10 +1692,10 @@ panel_operate_generate_prompt (const WPanel *panel, const int operation,
|
|||||||
|
|
||||||
if (single_source) {
|
if (single_source) {
|
||||||
i = fmd_xlen - strlen (format_string) - 4;
|
i = fmd_xlen - strlen (format_string) - 4;
|
||||||
g_snprintf (cmd_buf, sizeof (cmd_buf), format_string,
|
snprintf (cmd_buf, sizeof (cmd_buf), format_string,
|
||||||
name_trunc (single_source, i));
|
name_trunc (single_source, i));
|
||||||
} else {
|
} else {
|
||||||
g_snprintf (cmd_buf, sizeof (cmd_buf), format_string,
|
snprintf (cmd_buf, sizeof (cmd_buf), format_string,
|
||||||
panel->marked);
|
panel->marked);
|
||||||
i = strlen (cmd_buf) + 6 - fmd_xlen;
|
i = strlen (cmd_buf) + 6 - fmd_xlen;
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -2114,7 +2114,7 @@ real_do_file_error (enum OperationMode mode, const char *error)
|
|||||||
int
|
int
|
||||||
file_error (const char *format, const char *file)
|
file_error (const char *format, const char *file)
|
||||||
{
|
{
|
||||||
g_snprintf (cmd_buf, sizeof (cmd_buf), format,
|
snprintf (cmd_buf, sizeof (cmd_buf), format,
|
||||||
path_trunc (file, 30), unix_error_string (errno));
|
path_trunc (file, 30), unix_error_string (errno));
|
||||||
|
|
||||||
return do_file_error (cmd_buf);
|
return do_file_error (cmd_buf);
|
||||||
@ -2130,7 +2130,7 @@ files_error (const char *format, const char *file1, const char *file2)
|
|||||||
strcpy (nfile1, path_trunc (file1, 15));
|
strcpy (nfile1, path_trunc (file1, 15));
|
||||||
strcpy (nfile2, path_trunc (file2, 15));
|
strcpy (nfile2, path_trunc (file2, 15));
|
||||||
|
|
||||||
g_snprintf (cmd_buf, sizeof (cmd_buf), format, nfile1, nfile2,
|
snprintf (cmd_buf, sizeof (cmd_buf), format, nfile1, nfile2,
|
||||||
unix_error_string (errno));
|
unix_error_string (errno));
|
||||||
|
|
||||||
return do_file_error (cmd_buf);
|
return do_file_error (cmd_buf);
|
||||||
|
@ -320,7 +320,7 @@ file_eta_show (FileOpContext *ctx)
|
|||||||
eta_hours = ctx->eta_secs / (60 * 60);
|
eta_hours = ctx->eta_secs / (60 * 60);
|
||||||
eta_mins = (ctx->eta_secs - (eta_hours * 60 * 60)) / 60;
|
eta_mins = (ctx->eta_secs - (eta_hours * 60 * 60)) / 60;
|
||||||
eta_s = ctx->eta_secs - (eta_hours * 60 * 60 + eta_mins * 60);
|
eta_s = ctx->eta_secs - (eta_hours * 60 * 60 + eta_mins * 60);
|
||||||
g_snprintf (eta_buffer, sizeof (eta_buffer), _("ETA %d:%02d.%02d"),
|
snprintf (eta_buffer, sizeof (eta_buffer), _("ETA %d:%02d.%02d"),
|
||||||
eta_hours, eta_mins, eta_s);
|
eta_hours, eta_mins, eta_s);
|
||||||
} else
|
} else
|
||||||
*eta_buffer = 0;
|
*eta_buffer = 0;
|
||||||
@ -343,13 +343,13 @@ file_bps_show (FileOpContext *ctx)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (ctx->bps > 1024 * 1024) {
|
if (ctx->bps > 1024 * 1024) {
|
||||||
g_snprintf (bps_buffer, sizeof (bps_buffer), _("%.2f MB/s"),
|
snprintf (bps_buffer, sizeof (bps_buffer), _("%.2f MB/s"),
|
||||||
ctx->bps / (1024 * 1024.0));
|
ctx->bps / (1024 * 1024.0));
|
||||||
} else if (ctx->bps > 1024) {
|
} else if (ctx->bps > 1024) {
|
||||||
g_snprintf (bps_buffer, sizeof (bps_buffer), _("%.2f KB/s"),
|
snprintf (bps_buffer, sizeof (bps_buffer), _("%.2f KB/s"),
|
||||||
ctx->bps / 1024.0);
|
ctx->bps / 1024.0);
|
||||||
} else if (ctx->bps > 1) {
|
} else if (ctx->bps > 1) {
|
||||||
g_snprintf (bps_buffer, sizeof (bps_buffer), _("%ld B/s"),
|
snprintf (bps_buffer, sizeof (bps_buffer), _("%ld B/s"),
|
||||||
ctx->bps);
|
ctx->bps);
|
||||||
} else
|
} else
|
||||||
*bps_buffer = 0;
|
*bps_buffer = 0;
|
||||||
@ -540,7 +540,7 @@ static struct {
|
|||||||
NORMAL_BUTTON, rd_widgets [i].text, 0))
|
NORMAL_BUTTON, rd_widgets [i].text, 0))
|
||||||
|
|
||||||
#define ADD_RD_LABEL(ui,i,p1,p2)\
|
#define ADD_RD_LABEL(ui,i,p1,p2)\
|
||||||
g_snprintf (buffer, sizeof (buffer), rd_widgets [i].text, p1, p2);\
|
snprintf (buffer, sizeof (buffer), rd_widgets [i].text, p1, p2);\
|
||||||
add_widget (ui->replace_dlg,\
|
add_widget (ui->replace_dlg,\
|
||||||
label_new (rd_widgets [i].ypos, rd_widgets [i].xpos, buffer))
|
label_new (rd_widgets [i].ypos, rd_widgets [i].xpos, buffer))
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ search_content (Dlg_head *h, const char *directory, const char *filename)
|
|||||||
if (file_fd == -1)
|
if (file_fd == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), _("Grepping in %s"), name_trunc (filename, FIND2_X_USE));
|
snprintf (buffer, sizeof (buffer), _("Grepping in %s"), name_trunc (filename, FIND2_X_USE));
|
||||||
|
|
||||||
status_update (buffer);
|
status_update (buffer);
|
||||||
mc_refresh ();
|
mc_refresh ();
|
||||||
@ -666,7 +666,7 @@ do_search (struct Dlg_head *h)
|
|||||||
if (verbose){
|
if (verbose){
|
||||||
char buffer [BUF_SMALL];
|
char buffer [BUF_SMALL];
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), _("Searching %s"),
|
snprintf (buffer, sizeof (buffer), _("Searching %s"),
|
||||||
name_trunc (directory, FIND2_X_USE));
|
name_trunc (directory, FIND2_X_USE));
|
||||||
status_update (buffer);
|
status_update (buffer);
|
||||||
}
|
}
|
||||||
|
@ -873,7 +873,7 @@ const char *get_nth_panel_name (int num)
|
|||||||
else if (num == 1)
|
else if (num == 1)
|
||||||
return "New Right Panel";
|
return "New Right Panel";
|
||||||
else {
|
else {
|
||||||
g_snprintf (buffer, sizeof (buffer), "%ith Panel", num);
|
snprintf (buffer, sizeof (buffer), "%ith Panel", num);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ init_learn (void)
|
|||||||
for (i = j - 1, key = key_name_conv_tab + j - 1; i >= 0; i--, key--) {
|
for (i = j - 1, key = key_name_conv_tab + j - 1; i >= 0; i--, key--) {
|
||||||
learnkeys[i].ok = 0;
|
learnkeys[i].ok = 0;
|
||||||
learnkeys[i].sequence = NULL;
|
learnkeys[i].sequence = NULL;
|
||||||
g_snprintf (buffer, sizeof (buffer), "%-16s", _(key->longname));
|
snprintf (buffer, sizeof (buffer), "%-16s", _(key->longname));
|
||||||
add_widget (learn_dlg, learnkeys[i].button = (Widget *)
|
add_widget (learn_dlg, learnkeys[i].button = (Widget *)
|
||||||
button_new (y, x, B_USER + i, NARROW_BUTTON, buffer,
|
button_new (y, x, B_USER + i, NARROW_BUTTON, buffer,
|
||||||
learn_button));
|
learn_button));
|
||||||
|
@ -1650,7 +1650,7 @@ load_hint (int force)
|
|||||||
} else {
|
} else {
|
||||||
char text[BUF_SMALL];
|
char text[BUF_SMALL];
|
||||||
|
|
||||||
g_snprintf (text, sizeof (text), _("GNU Midnight Commander %s\n"),
|
snprintf (text, sizeof (text), _("GNU Midnight Commander %s\n"),
|
||||||
VERSION);
|
VERSION);
|
||||||
set_hintbar (text);
|
set_hintbar (text);
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ fopen_check (const char *filename, const char *flags)
|
|||||||
|
|
||||||
f = fopen (filename, flags);
|
f = fopen (filename, flags);
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
g_snprintf (tmp, sizeof (tmp), "man2hlp: Cannot open file \"%s\"",
|
snprintf (tmp, sizeof (tmp), "man2hlp: Cannot open file \"%s\"",
|
||||||
filename);
|
filename);
|
||||||
perror (tmp);
|
perror (tmp);
|
||||||
exit (3);
|
exit (3);
|
||||||
@ -584,7 +584,7 @@ handle_command (char *buffer)
|
|||||||
} else {
|
} else {
|
||||||
/* Other commands are ignored */
|
/* Other commands are ignored */
|
||||||
char warn_str[BUFFER_SIZE];
|
char warn_str[BUFFER_SIZE];
|
||||||
g_snprintf (warn_str, sizeof (warn_str),
|
snprintf (warn_str, sizeof (warn_str),
|
||||||
"Warning: unsupported command %s", buffer);
|
"Warning: unsupported command %s", buffer);
|
||||||
print_error (warn_str);
|
print_error (warn_str);
|
||||||
return;
|
return;
|
||||||
@ -813,7 +813,7 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
g_snprintf (buffer, sizeof (buffer), "Stale link \"%s\"",
|
snprintf (buffer, sizeof (buffer), "Stale link \"%s\"",
|
||||||
current_link->linkname);
|
current_link->linkname);
|
||||||
c_in = current_link->filename;
|
c_in = current_link->filename;
|
||||||
in_row = current_link->line;
|
in_row = current_link->line;
|
||||||
|
@ -357,7 +357,7 @@ int GetPrivateProfileInt (const char * AppName, const char * KeyName, int Defaul
|
|||||||
char IntBuf [BUF_TINY];
|
char IntBuf [BUF_TINY];
|
||||||
char buf [BUF_TINY];
|
char buf [BUF_TINY];
|
||||||
|
|
||||||
g_snprintf (buf, sizeof (buf), "%d", Default);
|
snprintf (buf, sizeof (buf), "%d", Default);
|
||||||
|
|
||||||
/* Check the exact semantic with the SDK */
|
/* Check the exact semantic with the SDK */
|
||||||
GetPrivateProfileString (AppName, KeyName, buf, IntBuf, BUF_TINY, File);
|
GetPrivateProfileString (AppName, KeyName, buf, IntBuf, BUF_TINY, File);
|
||||||
|
16
src/screen.c
16
src/screen.c
@ -212,7 +212,7 @@ static void format_device_number (char *buf, size_t bufsize, dev_t dev)
|
|||||||
|
|
||||||
g_assert(bufsize >= 1);
|
g_assert(bufsize >= 1);
|
||||||
if (major_digits + 1 + minor_digits + 1 <= bufsize) {
|
if (major_digits + 1 + minor_digits + 1 <= bufsize) {
|
||||||
g_snprintf(buf, bufsize, "%lu,%lu", (unsigned long) major_dev,
|
snprintf(buf, bufsize, "%lu,%lu", (unsigned long) major_dev,
|
||||||
(unsigned long) minor_dev);
|
(unsigned long) minor_dev);
|
||||||
} else {
|
} else {
|
||||||
g_strlcpy(buf, _("[dev]"), bufsize);
|
g_strlcpy(buf, _("[dev]"), bufsize);
|
||||||
@ -337,7 +337,7 @@ string_file_perm_octal (file_entry *fe, int len)
|
|||||||
{
|
{
|
||||||
static char buffer [10];
|
static char buffer [10];
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "0%06lo", (unsigned long) fe->st.st_mode);
|
snprintf (buffer, sizeof (buffer), "0%06lo", (unsigned long) fe->st.st_mode);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ string_file_nlinks (file_entry *fe, int len)
|
|||||||
{
|
{
|
||||||
static char buffer[BUF_TINY];
|
static char buffer[BUF_TINY];
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%16d", (int) fe->st.st_nlink);
|
snprintf (buffer, sizeof (buffer), "%16d", (int) fe->st.st_nlink);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ string_inode (file_entry *fe, int len)
|
|||||||
{
|
{
|
||||||
static char buffer [10];
|
static char buffer [10];
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%lu",
|
snprintf (buffer, sizeof (buffer), "%lu",
|
||||||
(unsigned long) fe->st.st_ino);
|
(unsigned long) fe->st.st_ino);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ string_file_nuid (file_entry *fe, int len)
|
|||||||
{
|
{
|
||||||
static char buffer [10];
|
static char buffer [10];
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%lu",
|
snprintf (buffer, sizeof (buffer), "%lu",
|
||||||
(unsigned long) fe->st.st_uid);
|
(unsigned long) fe->st.st_uid);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
@ -379,7 +379,7 @@ string_file_ngid (file_entry *fe, int len)
|
|||||||
{
|
{
|
||||||
static char buffer [10];
|
static char buffer [10];
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%lu",
|
snprintf (buffer, sizeof (buffer), "%lu",
|
||||||
(unsigned long) fe->st.st_gid);
|
(unsigned long) fe->st.st_gid);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
@ -686,11 +686,11 @@ display_mini_info (WPanel *panel)
|
|||||||
* This is a trick to use two ngettext() calls in one sentence.
|
* This is a trick to use two ngettext() calls in one sentence.
|
||||||
* First make "N bytes", then insert it into "X in M files".
|
* First make "N bytes", then insert it into "X in M files".
|
||||||
*/
|
*/
|
||||||
g_snprintf(b_bytes, sizeof (b_bytes),
|
snprintf(b_bytes, sizeof (b_bytes),
|
||||||
ngettext("%s byte", "%s bytes",
|
ngettext("%s byte", "%s bytes",
|
||||||
(unsigned long)panel->total),
|
(unsigned long)panel->total),
|
||||||
size_trunc_sep(panel->total));
|
size_trunc_sep(panel->total));
|
||||||
g_snprintf(buffer, sizeof (buffer),
|
snprintf(buffer, sizeof (buffer),
|
||||||
ngettext("%s in %d file", "%s in %d files", panel->marked),
|
ngettext("%s in %d file", "%s in %d files", panel->marked),
|
||||||
b_bytes, panel->marked);
|
b_bytes, panel->marked);
|
||||||
|
|
||||||
|
@ -62,12 +62,12 @@ select_charset (int current_charset, int seldisplay)
|
|||||||
/* insert all the items found */
|
/* insert all the items found */
|
||||||
for (i = 0; i < n_codepages; i++) {
|
for (i = 0; i < n_codepages; i++) {
|
||||||
char *name = codepages[i].name;
|
char *name = codepages[i].name;
|
||||||
g_snprintf (buffer, sizeof (buffer), "%c %s", get_hotkey (i),
|
snprintf (buffer, sizeof (buffer), "%c %s", get_hotkey (i),
|
||||||
name);
|
name);
|
||||||
LISTBOX_APPEND_TEXT (listbox, get_hotkey (i), buffer, NULL);
|
LISTBOX_APPEND_TEXT (listbox, get_hotkey (i), buffer, NULL);
|
||||||
}
|
}
|
||||||
if (seldisplay) {
|
if (seldisplay) {
|
||||||
g_snprintf (buffer, sizeof (buffer), "%c %s",
|
snprintf (buffer, sizeof (buffer), "%c %s",
|
||||||
get_hotkey (n_codepages), _("Other 8 bit"));
|
get_hotkey (n_codepages), _("Other 8 bit"));
|
||||||
LISTBOX_APPEND_TEXT (listbox, get_hotkey (n_codepages), buffer,
|
LISTBOX_APPEND_TEXT (listbox, get_hotkey (n_codepages), buffer,
|
||||||
NULL);
|
NULL);
|
||||||
|
14
src/setup.c
14
src/setup.c
@ -245,11 +245,11 @@ panel_save_setup (struct WPanel *panel, const char *section)
|
|||||||
char buffer [BUF_TINY];
|
char buffer [BUF_TINY];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%d", panel->reverse);
|
snprintf (buffer, sizeof (buffer), "%d", panel->reverse);
|
||||||
save_string (section, "reverse", buffer, profile_name);
|
save_string (section, "reverse", buffer, profile_name);
|
||||||
g_snprintf (buffer, sizeof (buffer), "%d", panel->case_sensitive);
|
snprintf (buffer, sizeof (buffer), "%d", panel->case_sensitive);
|
||||||
save_string (section, "case_sensitive", buffer, profile_name);
|
save_string (section, "case_sensitive", buffer, profile_name);
|
||||||
g_snprintf (buffer, sizeof (buffer), "%d", panel->exec_first);
|
snprintf (buffer, sizeof (buffer), "%d", panel->exec_first);
|
||||||
save_string (section, "exec_first", buffer, profile_name);
|
save_string (section, "exec_first", buffer, profile_name);
|
||||||
for (i = 0; sort_names [i].key; i++)
|
for (i = 0; sort_names [i].key; i++)
|
||||||
if (sort_names [i].sort_type == (sortfn *) panel->sort_type){
|
if (sort_names [i].sort_type == (sortfn *) panel->sort_type){
|
||||||
@ -268,12 +268,12 @@ panel_save_setup (struct WPanel *panel, const char *section)
|
|||||||
panel->user_format, profile_name);
|
panel->user_format, profile_name);
|
||||||
|
|
||||||
for (i = 0; i < LIST_TYPES; i++){
|
for (i = 0; i < LIST_TYPES; i++){
|
||||||
g_snprintf (buffer, sizeof (buffer), "user_status%d", i);
|
snprintf (buffer, sizeof (buffer), "user_status%d", i);
|
||||||
save_string (section, buffer,
|
save_string (section, buffer,
|
||||||
panel->user_status_format [i], profile_name);
|
panel->user_status_format [i], profile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%d", panel->user_mini_status);
|
snprintf (buffer, sizeof (buffer), "%d", panel->user_mini_status);
|
||||||
save_string (section, "user_mini_status", buffer,
|
save_string (section, "user_mini_status", buffer,
|
||||||
profile_name);
|
profile_name);
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ save_layout (void)
|
|||||||
|
|
||||||
/* Save integer options */
|
/* Save integer options */
|
||||||
for (i = 0; layout [i].opt_name; i++){
|
for (i = 0; layout [i].opt_name; i++){
|
||||||
g_snprintf (buffer, sizeof (buffer), "%d", *layout [i].opt_addr);
|
snprintf (buffer, sizeof (buffer), "%d", *layout [i].opt_addr);
|
||||||
save_string ("Layout", layout [i].opt_name, buffer, profile);
|
save_string ("Layout", layout [i].opt_name, buffer, profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ panel_load_setup (WPanel *panel, const char *section)
|
|||||||
profile_name));
|
profile_name));
|
||||||
for (i = 0; i < LIST_TYPES; i++){
|
for (i = 0; i < LIST_TYPES; i++){
|
||||||
g_free (panel->user_status_format [i]);
|
g_free (panel->user_status_format [i]);
|
||||||
g_snprintf (buffer, sizeof (buffer), "user_status%d", i);
|
snprintf (buffer, sizeof (buffer), "user_status%d", i);
|
||||||
panel->user_status_format [i] =
|
panel->user_status_format [i] =
|
||||||
g_strdup (get_profile_string (section, buffer,
|
g_strdup (get_profile_string (section, buffer,
|
||||||
DEFAULT_USER_FORMAT, profile_name));
|
DEFAULT_USER_FORMAT, profile_name));
|
||||||
|
@ -253,10 +253,10 @@ slang_reset_softkeys (void)
|
|||||||
char tmp[BUF_SMALL];
|
char tmp[BUF_SMALL];
|
||||||
|
|
||||||
for (key = 1; key < 9; key++) {
|
for (key = 1; key < 9; key++) {
|
||||||
g_snprintf (tmp, sizeof (tmp), "k%d", key);
|
snprintf (tmp, sizeof (tmp), "k%d", key);
|
||||||
send = (char *) SLtt_tgetstr (tmp);
|
send = (char *) SLtt_tgetstr (tmp);
|
||||||
if (send) {
|
if (send) {
|
||||||
g_snprintf (tmp, sizeof (tmp), "\033&f%dk%dd%dL%s%s", key,
|
snprintf (tmp, sizeof (tmp), "\033&f%dk%dd%dL%s%s", key,
|
||||||
(int) (sizeof (display) - 1), (int) strlen (send),
|
(int) (sizeof (display) - 1), (int) strlen (send),
|
||||||
display, send);
|
display, send);
|
||||||
SLtt_write_string (tmp);
|
SLtt_write_string (tmp);
|
||||||
|
@ -227,7 +227,7 @@ init_subshell_child (const char *pty_name)
|
|||||||
mc_sid = getsid (0);
|
mc_sid = getsid (0);
|
||||||
if (mc_sid != -1) {
|
if (mc_sid != -1) {
|
||||||
char sid_str[BUF_SMALL];
|
char sid_str[BUF_SMALL];
|
||||||
g_snprintf (sid_str, sizeof (sid_str), "MC_SID=%ld",
|
snprintf (sid_str, sizeof (sid_str), "MC_SID=%ld",
|
||||||
(long) mc_sid);
|
(long) mc_sid);
|
||||||
putenv (g_strdup (sid_str));
|
putenv (g_strdup (sid_str));
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ init_subshell (void)
|
|||||||
/* Create a pipe for receiving the subshell's CWD */
|
/* Create a pipe for receiving the subshell's CWD */
|
||||||
|
|
||||||
if (subshell_type == TCSH) {
|
if (subshell_type == TCSH) {
|
||||||
g_snprintf (tcsh_fifo, sizeof (tcsh_fifo), "%s/mc.pipe.%d",
|
snprintf (tcsh_fifo, sizeof (tcsh_fifo), "%s/mc.pipe.%d",
|
||||||
mc_tmpdir (), (int) getpid ());
|
mc_tmpdir (), (int) getpid ());
|
||||||
if (mkfifo (tcsh_fifo, 0600) == -1) {
|
if (mkfifo (tcsh_fifo, 0600) == -1) {
|
||||||
fprintf (stderr, "mkfifo(%s) failed: %s\r\n", tcsh_fifo,
|
fprintf (stderr, "mkfifo(%s) failed: %s\r\n", tcsh_fifo,
|
||||||
@ -468,19 +468,19 @@ init_subshell (void)
|
|||||||
|
|
||||||
switch (subshell_type) {
|
switch (subshell_type) {
|
||||||
case BASH:
|
case BASH:
|
||||||
g_snprintf (precmd, sizeof (precmd),
|
snprintf (precmd, sizeof (precmd),
|
||||||
" PROMPT_COMMAND='pwd>&%d;kill -STOP $$'\n",
|
" PROMPT_COMMAND='pwd>&%d;kill -STOP $$'\n",
|
||||||
subshell_pipe[WRITE]);
|
subshell_pipe[WRITE]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZSH:
|
case ZSH:
|
||||||
g_snprintf (precmd, sizeof (precmd),
|
snprintf (precmd, sizeof (precmd),
|
||||||
" precmd(){ pwd>&%d;kill -STOP $$ }\n",
|
" precmd(){ pwd>&%d;kill -STOP $$ }\n",
|
||||||
subshell_pipe[WRITE]);
|
subshell_pipe[WRITE]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TCSH:
|
case TCSH:
|
||||||
g_snprintf (precmd, sizeof (precmd),
|
snprintf (precmd, sizeof (precmd),
|
||||||
"set echo_style=both;"
|
"set echo_style=both;"
|
||||||
"alias precmd 'echo $cwd:q >>%s;kill -STOP $$'\n",
|
"alias precmd 'echo $cwd:q >>%s;kill -STOP $$'\n",
|
||||||
tcsh_fifo);
|
tcsh_fifo);
|
||||||
|
@ -597,7 +597,7 @@ static void tree_copy (WTree *tree, const char *default_dest)
|
|||||||
|
|
||||||
if (!tree->selected_ptr)
|
if (!tree->selected_ptr)
|
||||||
return;
|
return;
|
||||||
g_snprintf (cmd_buf, sizeof(cmd_buf), _("Copy \"%s\" directory to:"),
|
snprintf (cmd_buf, sizeof(cmd_buf), _("Copy \"%s\" directory to:"),
|
||||||
name_trunc (tree->selected_ptr->name, 50));
|
name_trunc (tree->selected_ptr->name, 50));
|
||||||
dest = input_expand_dialog (_(" Copy "), cmd_buf, MC_HISTORY_FM_TREE_COPY, default_dest);
|
dest = input_expand_dialog (_(" Copy "), cmd_buf, MC_HISTORY_FM_TREE_COPY, default_dest);
|
||||||
|
|
||||||
@ -640,7 +640,7 @@ static void tree_move (WTree *tree, const char *default_dest)
|
|||||||
|
|
||||||
if (!tree->selected_ptr)
|
if (!tree->selected_ptr)
|
||||||
return;
|
return;
|
||||||
g_snprintf (cmd_buf, sizeof (cmd_buf), _("Move \"%s\" directory to:"),
|
snprintf (cmd_buf, sizeof (cmd_buf), _("Move \"%s\" directory to:"),
|
||||||
name_trunc (tree->selected_ptr->name, 50));
|
name_trunc (tree->selected_ptr->name, 50));
|
||||||
dest = input_expand_dialog (_(" Move "), cmd_buf, MC_HISTORY_FM_TREE_MOVE, default_dest);
|
dest = input_expand_dialog (_(" Move "), cmd_buf, MC_HISTORY_FM_TREE_MOVE, default_dest);
|
||||||
if (!dest)
|
if (!dest)
|
||||||
|
14
src/util.c
14
src/util.c
@ -285,7 +285,7 @@ size_trunc (double size)
|
|||||||
xtra = "M";
|
xtra = "M";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_snprintf (x, sizeof (x), "%.0f%s", (size/divisor), xtra);
|
snprintf (x, sizeof (x), "%.0f%s", (size/divisor), xtra);
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,18 +344,18 @@ size_trunc_len (char *buffer, int len, off_t size, int units)
|
|||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
if (j == units) {
|
if (j == units) {
|
||||||
/* Empty files will print "0" even with minimal width. */
|
/* Empty files will print "0" even with minimal width. */
|
||||||
g_snprintf (buffer, len + 1, "0");
|
snprintf (buffer, len + 1, "0");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use "~K" or just "K" if len is 1. Use "B" for bytes. */
|
/* Use "~K" or just "K" if len is 1. Use "B" for bytes. */
|
||||||
g_snprintf (buffer, len + 1, (len > 1) ? "~%s" : "%s",
|
snprintf (buffer, len + 1, (len > 1) ? "~%s" : "%s",
|
||||||
(j > 1) ? suffix[j - 1] : "B");
|
(j > 1) ? suffix[j - 1] : "B");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size < power10 [len - (j > 0)]) {
|
if (size < power10 [len - (j > 0)]) {
|
||||||
g_snprintf (buffer, len + 1, "%lu%s", (unsigned long) size, suffix[j]);
|
snprintf (buffer, len + 1, "%lu%s", (unsigned long) size, suffix[j]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ set_int (const char *file, const char *key, int value)
|
|||||||
{
|
{
|
||||||
char buffer [BUF_TINY];
|
char buffer [BUF_TINY];
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%d", value);
|
snprintf (buffer, sizeof (buffer), "%d", value);
|
||||||
return WritePrivateProfileString (app_text, key, buffer, file);
|
return WritePrivateProfileString (app_text, key, buffer, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,11 +845,11 @@ unix_error_string (int error_num)
|
|||||||
gchar *strerror_currentlocale;
|
gchar *strerror_currentlocale;
|
||||||
|
|
||||||
strerror_currentlocale = g_locale_from_utf8(g_strerror (error_num), -1, NULL, NULL, NULL);
|
strerror_currentlocale = g_locale_from_utf8(g_strerror (error_num), -1, NULL, NULL, NULL);
|
||||||
g_snprintf (buffer, sizeof (buffer), "%s (%d)",
|
snprintf (buffer, sizeof (buffer), "%s (%d)",
|
||||||
strerror_currentlocale, error_num);
|
strerror_currentlocale, error_num);
|
||||||
g_free(strerror_currentlocale);
|
g_free(strerror_currentlocale);
|
||||||
#else
|
#else
|
||||||
g_snprintf (buffer, sizeof (buffer), "%s (%d)",
|
snprintf (buffer, sizeof (buffer), "%s (%d)",
|
||||||
g_strerror (error_num), error_num);
|
g_strerror (error_num), error_num);
|
||||||
#endif
|
#endif
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -93,7 +93,7 @@ char *get_owner (int uid)
|
|||||||
return pwd->pw_name;
|
return pwd->pw_name;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_snprintf (ibuf, sizeof (ibuf), "%d", uid);
|
snprintf (ibuf, sizeof (ibuf), "%d", uid);
|
||||||
return ibuf;
|
return ibuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ char *get_group (int gid)
|
|||||||
i_cache_add (gid, gid_cache, GID_CACHE_SIZE, grp->gr_name, &gid_last);
|
i_cache_add (gid, gid_cache, GID_CACHE_SIZE, grp->gr_name, &gid_last);
|
||||||
return grp->gr_name;
|
return grp->gr_name;
|
||||||
} else {
|
} else {
|
||||||
g_snprintf (gbuf, sizeof (gbuf), "%d", gid);
|
snprintf (gbuf, sizeof (gbuf), "%d", gid);
|
||||||
return gbuf;
|
return gbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,10 +254,10 @@ mc_tmpdir (void)
|
|||||||
pwd = getpwuid (getuid ());
|
pwd = getpwuid (getuid ());
|
||||||
|
|
||||||
if (pwd)
|
if (pwd)
|
||||||
g_snprintf (buffer, sizeof (buffer), "%s/mc-%s", sys_tmp,
|
snprintf (buffer, sizeof (buffer), "%s/mc-%s", sys_tmp,
|
||||||
pwd->pw_name);
|
pwd->pw_name);
|
||||||
else
|
else
|
||||||
g_snprintf (buffer, sizeof (buffer), "%s/mc-%lu", sys_tmp,
|
snprintf (buffer, sizeof (buffer), "%s/mc-%lu", sys_tmp,
|
||||||
(unsigned long) getuid ());
|
(unsigned long) getuid ());
|
||||||
|
|
||||||
canonicalize_pathname (buffer);
|
canonicalize_pathname (buffer);
|
||||||
@ -306,11 +306,11 @@ mc_tmpdir (void)
|
|||||||
if (fallback_ok) {
|
if (fallback_ok) {
|
||||||
fprintf (stderr, _("Temporary files will be created in %s\n"),
|
fprintf (stderr, _("Temporary files will be created in %s\n"),
|
||||||
sys_tmp);
|
sys_tmp);
|
||||||
g_snprintf (buffer, sizeof (buffer), "%s", sys_tmp);
|
snprintf (buffer, sizeof (buffer), "%s", sys_tmp);
|
||||||
error = NULL;
|
error = NULL;
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, _("Temporary files will not be created\n"));
|
fprintf (stderr, _("Temporary files will not be created\n"));
|
||||||
g_snprintf (buffer, sizeof (buffer), "%s", "/dev/null/");
|
snprintf (buffer, sizeof (buffer), "%s", "/dev/null/");
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (stderr, "%s\n", _("Press any key to continue..."));
|
fprintf (stderr, "%s\n", _("Press any key to continue..."));
|
||||||
|
12
src/view.c
12
src/view.c
@ -1516,7 +1516,7 @@ view_load (WView *view, const char *command, const char *file,
|
|||||||
} else if (file != NULL && file[0] != '\0') {
|
} else if (file != NULL && file[0] != '\0') {
|
||||||
/* Open the file */
|
/* Open the file */
|
||||||
if ((fd = mc_open (file, O_RDONLY | O_NONBLOCK)) == -1) {
|
if ((fd = mc_open (file, O_RDONLY | O_NONBLOCK)) == -1) {
|
||||||
g_snprintf (tmp, sizeof (tmp), _(" Cannot open \"%s\"\n %s "),
|
snprintf (tmp, sizeof (tmp), _(" Cannot open \"%s\"\n %s "),
|
||||||
file, unix_error_string (errno));
|
file, unix_error_string (errno));
|
||||||
view_show_error (view, tmp);
|
view_show_error (view, tmp);
|
||||||
goto finish;
|
goto finish;
|
||||||
@ -1525,7 +1525,7 @@ view_load (WView *view, const char *command, const char *file,
|
|||||||
/* Make sure we are working with a regular file */
|
/* Make sure we are working with a regular file */
|
||||||
if (mc_fstat (fd, &st) == -1) {
|
if (mc_fstat (fd, &st) == -1) {
|
||||||
mc_close (fd);
|
mc_close (fd);
|
||||||
g_snprintf (tmp, sizeof (tmp), _(" Cannot stat \"%s\"\n %s "),
|
snprintf (tmp, sizeof (tmp), _(" Cannot stat \"%s\"\n %s "),
|
||||||
file, unix_error_string (errno));
|
file, unix_error_string (errno));
|
||||||
view_show_error (view, tmp);
|
view_show_error (view, tmp);
|
||||||
goto finish;
|
goto finish;
|
||||||
@ -1741,7 +1741,7 @@ view_display_ruler (WView *view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((cl != 0) && (cl % 10) == 0) {
|
if ((cl != 0) && (cl % 10) == 0) {
|
||||||
g_snprintf (r_buff, sizeof (r_buff), "%"OFFSETTYPE_PRId, cl);
|
snprintf (r_buff, sizeof (r_buff), "%"OFFSETTYPE_PRId, cl);
|
||||||
if (nums_row < height) {
|
if (nums_row < height) {
|
||||||
widget_move (view, top + nums_row, left + c - 1);
|
widget_move (view, top + nums_row, left + c - 1);
|
||||||
tty_print_string (r_buff);
|
tty_print_string (r_buff);
|
||||||
@ -1789,7 +1789,7 @@ view_display_hex (WView *view)
|
|||||||
col = 0;
|
col = 0;
|
||||||
|
|
||||||
/* Print the hex offset */
|
/* Print the hex offset */
|
||||||
g_snprintf (hex_buff, sizeof (hex_buff), "%08"OFFSETTYPE_PRIX" ", from);
|
snprintf (hex_buff, sizeof (hex_buff), "%08"OFFSETTYPE_PRIX" ", from);
|
||||||
widget_move (view, top + row, left);
|
widget_move (view, top + row, left);
|
||||||
tty_setcolor (MARKED_COLOR);
|
tty_setcolor (MARKED_COLOR);
|
||||||
for (i = 0; col < width && hex_buff[i] != '\0'; i++) {
|
for (i = 0; col < width && hex_buff[i] != '\0'; i++) {
|
||||||
@ -2731,7 +2731,7 @@ view_moveto_line_cmd (WView *view)
|
|||||||
|
|
||||||
view_offset_to_coord (view, &line, &col, view->dpy_start);
|
view_offset_to_coord (view, &line, &col, view->dpy_start);
|
||||||
|
|
||||||
g_snprintf (prompt, sizeof (prompt),
|
snprintf (prompt, sizeof (prompt),
|
||||||
_(" The current line number is %d.\n"
|
_(" The current line number is %d.\n"
|
||||||
" Enter the new line number:"), (int) (line + 1));
|
" Enter the new line number:"), (int) (line + 1));
|
||||||
answer = input_dialog (_(" Goto line "), prompt, MC_HISTORY_VIEW_GOTO_LINE, "");
|
answer = input_dialog (_(" Goto line "), prompt, MC_HISTORY_VIEW_GOTO_LINE, "");
|
||||||
@ -2752,7 +2752,7 @@ view_moveto_addr_cmd (WView *view)
|
|||||||
char *line, *error, prompt[BUF_SMALL];
|
char *line, *error, prompt[BUF_SMALL];
|
||||||
offset_type addr;
|
offset_type addr;
|
||||||
|
|
||||||
g_snprintf (prompt, sizeof (prompt),
|
snprintf (prompt, sizeof (prompt),
|
||||||
_(" The current address is 0x%lx.\n"
|
_(" The current address is 0x%lx.\n"
|
||||||
" Enter the new address:"), view->hex_cursor);
|
" Enter the new address:"), view->hex_cursor);
|
||||||
line = input_dialog (_(" Goto Address "), prompt, MC_HISTORY_VIEW_GOTO_ADDR, "");
|
line = input_dialog (_(" Goto Address "), prompt, MC_HISTORY_VIEW_GOTO_ADDR, "");
|
||||||
|
10
src/widget.c
10
src/widget.c
@ -158,15 +158,15 @@ button_callback (Widget *w, widget_msg_t msg, int parm)
|
|||||||
|
|
||||||
switch (b->flags) {
|
switch (b->flags) {
|
||||||
case DEFPUSH_BUTTON:
|
case DEFPUSH_BUTTON:
|
||||||
g_snprintf (buf, sizeof (buf), "[< %s >]", b->text);
|
snprintf (buf, sizeof (buf), "[< %s >]", b->text);
|
||||||
off = 3;
|
off = 3;
|
||||||
break;
|
break;
|
||||||
case NORMAL_BUTTON:
|
case NORMAL_BUTTON:
|
||||||
g_snprintf (buf, sizeof (buf), "[ %s ]", b->text);
|
snprintf (buf, sizeof (buf), "[ %s ]", b->text);
|
||||||
off = 2;
|
off = 2;
|
||||||
break;
|
break;
|
||||||
case NARROW_BUTTON:
|
case NARROW_BUTTON:
|
||||||
g_snprintf (buf, sizeof (buf), "[%s]", b->text);
|
snprintf (buf, sizeof (buf), "[%s]", b->text);
|
||||||
off = 1;
|
off = 1;
|
||||||
break;
|
break;
|
||||||
case HIDDEN_BUTTON:
|
case HIDDEN_BUTTON:
|
||||||
@ -871,7 +871,7 @@ history_get (const char *input_name)
|
|||||||
for (i = 0;; i++) {
|
for (i = 0;; i++) {
|
||||||
char key_name[BUF_TINY];
|
char key_name[BUF_TINY];
|
||||||
char this_entry[BUF_LARGE];
|
char this_entry[BUF_LARGE];
|
||||||
g_snprintf (key_name, sizeof (key_name), "%d", i);
|
snprintf (key_name, sizeof (key_name), "%d", i);
|
||||||
GetPrivateProfileString (input_name, key_name, "", this_entry,
|
GetPrivateProfileString (input_name, key_name, "", this_entry,
|
||||||
sizeof (this_entry), profile);
|
sizeof (this_entry), profile);
|
||||||
if (!*this_entry)
|
if (!*this_entry)
|
||||||
@ -935,7 +935,7 @@ 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 && *text) {
|
if (text && *text) {
|
||||||
char key_name[BUF_TINY];
|
char key_name[BUF_TINY];
|
||||||
g_snprintf (key_name, sizeof (key_name), "%d", i++);
|
snprintf (key_name, sizeof (key_name), "%d", i++);
|
||||||
WritePrivateProfileString (input_name, key_name, text,
|
WritePrivateProfileString (input_name, key_name, text,
|
||||||
profile);
|
profile);
|
||||||
}
|
}
|
||||||
|
20
vfs/fish.c
20
vfs/fish.c
@ -228,7 +228,7 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
|
|||||||
if (SUP.flags > FISH_FLAG_RSH)
|
if (SUP.flags > FISH_FLAG_RSH)
|
||||||
{
|
{
|
||||||
argv[i++] = "-p";
|
argv[i++] = "-p";
|
||||||
g_snprintf (gbuf, sizeof (gbuf), "%d", SUP.flags);
|
snprintf (gbuf, sizeof (gbuf), "%d", SUP.flags);
|
||||||
argv[i++] = gbuf;
|
argv[i++] = gbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,7 +906,7 @@ static int
|
|||||||
fish_chmod (struct vfs_class *me, const char *path, int mode)
|
fish_chmod (struct vfs_class *me, const char *path, int mode)
|
||||||
{
|
{
|
||||||
PREFIX
|
PREFIX
|
||||||
g_snprintf(buf, sizeof(buf), "#CHMOD %4.4o /%s\n"
|
snprintf(buf, sizeof(buf), "#CHMOD %4.4o /%s\n"
|
||||||
"chmod %4.4o /%s 2>/dev/null\n"
|
"chmod %4.4o /%s 2>/dev/null\n"
|
||||||
"echo '### 000'\n",
|
"echo '### 000'\n",
|
||||||
mode & 07777, rpath,
|
mode & 07777, rpath,
|
||||||
@ -934,7 +934,7 @@ static int fish_##name (struct vfs_class *me, const char *path1, const char *pat
|
|||||||
g_free (mpath1); \
|
g_free (mpath1); \
|
||||||
rpath2 = mhl_shell_escape_dup (crpath2); \
|
rpath2 = mhl_shell_escape_dup (crpath2); \
|
||||||
g_free (mpath2); \
|
g_free (mpath2); \
|
||||||
g_snprintf(buf, sizeof(buf), string "\n", rpath1, rpath2, rpath1, rpath2); \
|
snprintf(buf, sizeof(buf), string "\n", rpath1, rpath2, rpath1, rpath2); \
|
||||||
mhl_mem_free (rpath1); \
|
mhl_mem_free (rpath1); \
|
||||||
mhl_mem_free (rpath2); \
|
mhl_mem_free (rpath2); \
|
||||||
return fish_send_command(me, super2, buf, OPT_FLUSH); \
|
return fish_send_command(me, super2, buf, OPT_FLUSH); \
|
||||||
@ -952,7 +952,7 @@ static int fish_symlink (struct vfs_class *me, const char *setto, const char *pa
|
|||||||
char *qsetto;
|
char *qsetto;
|
||||||
PREFIX
|
PREFIX
|
||||||
qsetto = mhl_shell_escape_dup (setto);
|
qsetto = mhl_shell_escape_dup (setto);
|
||||||
g_snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"#SYMLINK %s /%s\n"
|
"#SYMLINK %s /%s\n"
|
||||||
"ln -s %s /%s 2>/dev/null\n"
|
"ln -s %s /%s 2>/dev/null\n"
|
||||||
"echo '### 000'\n",
|
"echo '### 000'\n",
|
||||||
@ -978,7 +978,7 @@ fish_chown (struct vfs_class *me, const char *path, int owner, int group)
|
|||||||
sgroup = gr->gr_name;
|
sgroup = gr->gr_name;
|
||||||
{
|
{
|
||||||
PREFIX
|
PREFIX
|
||||||
g_snprintf (buf, sizeof(buf),
|
snprintf (buf, sizeof(buf),
|
||||||
"#CHOWN %s /%s\n"
|
"#CHOWN %s /%s\n"
|
||||||
"chown %s /%s 2>/dev/null\n"
|
"chown %s /%s 2>/dev/null\n"
|
||||||
"echo '### 000'\n",
|
"echo '### 000'\n",
|
||||||
@ -986,7 +986,7 @@ fish_chown (struct vfs_class *me, const char *path, int owner, int group)
|
|||||||
sowner, rpath);
|
sowner, rpath);
|
||||||
fish_send_command (me, super, buf, OPT_FLUSH);
|
fish_send_command (me, super, buf, OPT_FLUSH);
|
||||||
/* FIXME: what should we report if chgrp succeeds but chown fails? */
|
/* FIXME: what should we report if chgrp succeeds but chown fails? */
|
||||||
g_snprintf (buf, sizeof(buf),
|
snprintf (buf, sizeof(buf),
|
||||||
"#CHGRP /%s \"/%s\"\n"
|
"#CHGRP /%s \"/%s\"\n"
|
||||||
"chgrp %s \"/%s\" 2>/dev/null\n"
|
"chgrp %s \"/%s\" 2>/dev/null\n"
|
||||||
"echo '### 000'\n",
|
"echo '### 000'\n",
|
||||||
@ -1000,7 +1000,7 @@ fish_chown (struct vfs_class *me, const char *path, int owner, int group)
|
|||||||
static int fish_unlink (struct vfs_class *me, const char *path)
|
static int fish_unlink (struct vfs_class *me, const char *path)
|
||||||
{
|
{
|
||||||
PREFIX
|
PREFIX
|
||||||
g_snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"#DELE /%s\n"
|
"#DELE /%s\n"
|
||||||
"rm -f /%s 2>/dev/null\n"
|
"rm -f /%s 2>/dev/null\n"
|
||||||
"echo '### 000'\n",
|
"echo '### 000'\n",
|
||||||
@ -1014,7 +1014,7 @@ static int fish_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
|||||||
|
|
||||||
(void) mode;
|
(void) mode;
|
||||||
|
|
||||||
g_snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"#MKD /%s\n"
|
"#MKD /%s\n"
|
||||||
"mkdir /%s 2>/dev/null\n"
|
"mkdir /%s 2>/dev/null\n"
|
||||||
"echo '### 000'\n",
|
"echo '### 000'\n",
|
||||||
@ -1025,7 +1025,7 @@ static int fish_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
|||||||
static int fish_rmdir (struct vfs_class *me, const char *path)
|
static int fish_rmdir (struct vfs_class *me, const char *path)
|
||||||
{
|
{
|
||||||
PREFIX
|
PREFIX
|
||||||
g_snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"#RMD /%s\n"
|
"#RMD /%s\n"
|
||||||
"rmdir /%s 2>/dev/null\n"
|
"rmdir /%s 2>/dev/null\n"
|
||||||
"echo '### 000'\n",
|
"echo '### 000'\n",
|
||||||
@ -1084,7 +1084,7 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
|
|||||||
if (SUP.flags > FISH_FLAG_RSH)
|
if (SUP.flags > FISH_FLAG_RSH)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
g_snprintf (gbuf, sizeof (gbuf), ":%d", SUP.flags);
|
snprintf (gbuf, sizeof (gbuf), ":%d", SUP.flags);
|
||||||
flags = gbuf;
|
flags = gbuf;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1528,7 +1528,7 @@ static int ftpfs_chmod (struct vfs_class *me, const char *path, int mode)
|
|||||||
{
|
{
|
||||||
char buf[BUF_SMALL];
|
char buf[BUF_SMALL];
|
||||||
|
|
||||||
g_snprintf(buf, sizeof(buf), "SITE CHMOD %4.4o /%%s", mode & 07777);
|
snprintf(buf, sizeof(buf), "SITE CHMOD %4.4o /%%s", mode & 07777);
|
||||||
return ftpfs_send_command(me, path, buf, OPT_FLUSH);
|
return ftpfs_send_command(me, path, buf, OPT_FLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,8 +975,8 @@ mcfs_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
|
|||||||
atime = (long) times->actime;
|
atime = (long) times->actime;
|
||||||
mtime = (long) times->modtime;
|
mtime = (long) times->modtime;
|
||||||
|
|
||||||
g_snprintf (abuf, sizeof (abuf), "%lx", atime);
|
snprintf (abuf, sizeof (abuf), "%lx", atime);
|
||||||
g_snprintf (mbuf, sizeof (mbuf), "%lx", mtime);
|
snprintf (mbuf, sizeof (mbuf), "%lx", mtime);
|
||||||
|
|
||||||
rpc_send (mc->sock, RPC_INT, MC_UTIME,
|
rpc_send (mc->sock, RPC_INT, MC_UTIME,
|
||||||
RPC_STRING, file,
|
RPC_STRING, file,
|
||||||
|
@ -367,7 +367,7 @@ undelfs_readdir(void *vfs_info)
|
|||||||
if (readdir_ptr < 0)
|
if (readdir_ptr < 0)
|
||||||
strcpy (dirent_dest, readdir_ptr == -2 ? "." : "..");
|
strcpy (dirent_dest, readdir_ptr == -2 ? "." : "..");
|
||||||
else
|
else
|
||||||
g_snprintf(dirent_dest, MC_MAXPATHLEN, "%ld:%d",
|
snprintf(dirent_dest, MC_MAXPATHLEN, "%ld:%d",
|
||||||
(long) delarray[readdir_ptr].ino,
|
(long) delarray[readdir_ptr].ino,
|
||||||
delarray[readdir_ptr].num_blocks);
|
delarray[readdir_ptr].num_blocks);
|
||||||
readdir_ptr++;
|
readdir_ptr++;
|
||||||
|
Loading…
Reference in New Issue
Block a user