diff --git a/ChangeLog b/ChangeLog index cc5b4dae0..a54e8eb30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2009-01-31 Enrico Weigelt, metux ITS * 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 diff --git a/edit/editcmd.c b/edit/editcmd.c index 9910f5c99..792322de2 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -2337,7 +2337,7 @@ edit_goto_cmd (WEdit *edit) char *error; 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, line ? s : ""); if (!f) diff --git a/edit/editdraw.c b/edit/editdraw.c index 86ea3f9c7..b19139163 100644 --- a/edit/editdraw.c +++ b/edit/editdraw.c @@ -72,7 +72,7 @@ static void status_string (WEdit * edit, char *s, int w) */ if (edit->curs1 < edit->last_byte) { 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 : '.', (int) 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 */ - g_snprintf (s, w, + snprintf (s, w, "[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s", edit->mark1 != edit->mark2 ? ( column_highlighting ? 'C' : 'B') : '-', edit->modified ? 'M' : '-', diff --git a/edit/editoptions.c b/edit/editoptions.c index 9011ded63..777431f0d 100644 --- a/edit/editoptions.c +++ b/edit/editoptions.c @@ -147,9 +147,9 @@ edit_options_dialog (void) i18n_flag = 1; } - g_snprintf (wrap_length, sizeof (wrap_length), "%d", + snprintf (wrap_length, sizeof (wrap_length), "%d", option_word_wrap_line_length); - g_snprintf (tab_spacing, sizeof (tab_spacing), "%d", + snprintf (tab_spacing, sizeof (tab_spacing), "%d", option_tab_spacing); quick_widgets[3].text = wrap_length; diff --git a/src/boxes.c b/src/boxes.c index 5c66f3d2b..23030ecd7 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -571,7 +571,7 @@ sel_charset_button (int action) : codepages[new_display_codepage].name; /* avoid strange bug with label repainting */ - g_snprintf (buf, sizeof (buf), "%-27s", cpname); + snprintf (buf, sizeof (buf), "%-27s", cpname); label_set_text (cplabel, buf); return 0; } @@ -772,12 +772,12 @@ configure_vfs (void) ret_use_netrc = use_netrc; ret_ftpfs_use_passive_connections = ftpfs_use_passive_connections; 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[10].text = ftpfs_anonymous_passwd; confvfs_widgets[5].text = ftpfs_proxy_host; #endif - g_snprintf (buffer2, sizeof (buffer2), "%i", vfs_timeout); + snprintf (buffer2, sizeof (buffer2), "%i", vfs_timeout); confvfs_widgets [3 + VFS_WIDGETBASE].text = buffer2; if (quick_dialog (&confvfs_dlg) != B_CANCEL) { diff --git a/src/charsets.c b/src/charsets.c index da9485308..ec1aca1a1 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -196,7 +196,7 @@ init_translation_table (int cpsource, int cpdisplay) cd = iconv_open (cpdisp, cpsour); if (cd == (iconv_t) - 1) { - g_snprintf (errbuf, sizeof (errbuf), + snprintf (errbuf, sizeof (errbuf), _("Cannot translate from %s to %s"), cpsour, cpdisp); return errbuf; } @@ -210,7 +210,7 @@ init_translation_table (int cpsource, int cpdisplay) cd = iconv_open (cpsour, cpdisp); if (cd == (iconv_t) - 1) { - g_snprintf (errbuf, sizeof (errbuf), + snprintf (errbuf, sizeof (errbuf), _("Cannot translate from %s to %s"), cpdisp, cpsour); return errbuf; } diff --git a/src/chmod.c b/src/chmod.c index 2671c6567..3f76b0c03 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -161,7 +161,7 @@ chmod_callback (Dlg_head *h, dlg_msg_t msg, int parm) case DLG_ACTION: if (id >= 0) { 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); chmod_toggle_select (h, id); mode_change = 1; @@ -302,7 +302,7 @@ void chmod_cmd (void) add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown)); c_fgrp = name_trunc (get_group (sf_stat.st_gid), 21); 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); add_widget (ch_dlg, statl); diff --git a/src/cmd.c b/src/cmd.c index e22271480..ee9a3ddcc 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -121,7 +121,7 @@ view_file_at_line (const char *filename, int plain_view, int internal, char view_entry[BUF_TINY]; if (start_line != 0) - g_snprintf (view_entry, sizeof (view_entry), "View:%d", + snprintf (view_entry, sizeof (view_entry), "View:%d", start_line); else strcpy (view_entry, "View"); diff --git a/src/file.c b/src/file.c index dff29deea..1ae15fdbd 100644 --- a/src/file.c +++ b/src/file.c @@ -1692,10 +1692,10 @@ panel_operate_generate_prompt (const WPanel *panel, const int operation, if (single_source) { 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)); } else { - g_snprintf (cmd_buf, sizeof (cmd_buf), format_string, + snprintf (cmd_buf, sizeof (cmd_buf), format_string, panel->marked); i = strlen (cmd_buf) + 6 - fmd_xlen; if (i > 0) { @@ -2114,7 +2114,7 @@ real_do_file_error (enum OperationMode mode, const char *error) int 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)); 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 (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)); return do_file_error (cmd_buf); diff --git a/src/filegui.c b/src/filegui.c index 299d80f80..68e36771e 100644 --- a/src/filegui.c +++ b/src/filegui.c @@ -320,7 +320,7 @@ file_eta_show (FileOpContext *ctx) eta_hours = ctx->eta_secs / (60 * 60); eta_mins = (ctx->eta_secs - (eta_hours * 60 * 60)) / 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); } else *eta_buffer = 0; @@ -343,13 +343,13 @@ file_bps_show (FileOpContext *ctx) return; 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)); } 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); } 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); } else *bps_buffer = 0; @@ -540,7 +540,7 @@ static struct { NORMAL_BUTTON, rd_widgets [i].text, 0)) #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,\ label_new (rd_widgets [i].ypos, rd_widgets [i].xpos, buffer)) diff --git a/src/find.c b/src/find.c index 7590811eb..bb0a1e2a4 100644 --- a/src/find.c +++ b/src/find.c @@ -530,7 +530,7 @@ search_content (Dlg_head *h, const char *directory, const char *filename) if (file_fd == -1) 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); mc_refresh (); @@ -666,7 +666,7 @@ do_search (struct Dlg_head *h) if (verbose){ char buffer [BUF_SMALL]; - g_snprintf (buffer, sizeof (buffer), _("Searching %s"), + snprintf (buffer, sizeof (buffer), _("Searching %s"), name_trunc (directory, FIND2_X_USE)); status_update (buffer); } diff --git a/src/layout.c b/src/layout.c index 8bd8e7ec2..a9386a565 100644 --- a/src/layout.c +++ b/src/layout.c @@ -873,7 +873,7 @@ const char *get_nth_panel_name (int num) else if (num == 1) return "New Right Panel"; else { - g_snprintf (buffer, sizeof (buffer), "%ith Panel", num); + snprintf (buffer, sizeof (buffer), "%ith Panel", num); return buffer; } } diff --git a/src/learn.c b/src/learn.c index fb9803335..93208834f 100644 --- a/src/learn.c +++ b/src/learn.c @@ -270,7 +270,7 @@ init_learn (void) for (i = j - 1, key = key_name_conv_tab + j - 1; i >= 0; i--, key--) { learnkeys[i].ok = 0; 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 *) button_new (y, x, B_USER + i, NARROW_BUTTON, buffer, learn_button)); diff --git a/src/main.c b/src/main.c index 8be5841b8..359d5492f 100644 --- a/src/main.c +++ b/src/main.c @@ -1650,7 +1650,7 @@ load_hint (int force) } else { char text[BUF_SMALL]; - g_snprintf (text, sizeof (text), _("GNU Midnight Commander %s\n"), + snprintf (text, sizeof (text), _("GNU Midnight Commander %s\n"), VERSION); set_hintbar (text); } diff --git a/src/man2hlp.c b/src/man2hlp.c index 6a922377a..231639ed1 100644 --- a/src/man2hlp.c +++ b/src/man2hlp.c @@ -146,7 +146,7 @@ fopen_check (const char *filename, const char *flags) f = fopen (filename, flags); if (f == NULL) { - g_snprintf (tmp, sizeof (tmp), "man2hlp: Cannot open file \"%s\"", + snprintf (tmp, sizeof (tmp), "man2hlp: Cannot open file \"%s\"", filename); perror (tmp); exit (3); @@ -584,7 +584,7 @@ handle_command (char *buffer) } else { /* Other commands are ignored */ char warn_str[BUFFER_SIZE]; - g_snprintf (warn_str, sizeof (warn_str), + snprintf (warn_str, sizeof (warn_str), "Warning: unsupported command %s", buffer); print_error (warn_str); return; @@ -813,7 +813,7 @@ main (int argc, char **argv) } } if (!found) { - g_snprintf (buffer, sizeof (buffer), "Stale link \"%s\"", + snprintf (buffer, sizeof (buffer), "Stale link \"%s\"", current_link->linkname); c_in = current_link->filename; in_row = current_link->line; diff --git a/src/profile.c b/src/profile.c index cbd60e536..67a2992d7 100644 --- a/src/profile.c +++ b/src/profile.c @@ -357,7 +357,7 @@ int GetPrivateProfileInt (const char * AppName, const char * KeyName, int Defaul char IntBuf [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 */ GetPrivateProfileString (AppName, KeyName, buf, IntBuf, BUF_TINY, File); diff --git a/src/screen.c b/src/screen.c index 42c4337b6..b5b337c74 100644 --- a/src/screen.c +++ b/src/screen.c @@ -212,7 +212,7 @@ static void format_device_number (char *buf, size_t bufsize, dev_t dev) g_assert(bufsize >= 1); 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); } else { g_strlcpy(buf, _("[dev]"), bufsize); @@ -337,7 +337,7 @@ string_file_perm_octal (file_entry *fe, int len) { 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; } @@ -347,7 +347,7 @@ string_file_nlinks (file_entry *fe, int len) { 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; } @@ -357,7 +357,7 @@ string_inode (file_entry *fe, int len) { static char buffer [10]; - g_snprintf (buffer, sizeof (buffer), "%lu", + snprintf (buffer, sizeof (buffer), "%lu", (unsigned long) fe->st.st_ino); return buffer; } @@ -368,7 +368,7 @@ string_file_nuid (file_entry *fe, int len) { static char buffer [10]; - g_snprintf (buffer, sizeof (buffer), "%lu", + snprintf (buffer, sizeof (buffer), "%lu", (unsigned long) fe->st.st_uid); return buffer; } @@ -379,7 +379,7 @@ string_file_ngid (file_entry *fe, int len) { static char buffer [10]; - g_snprintf (buffer, sizeof (buffer), "%lu", + snprintf (buffer, sizeof (buffer), "%lu", (unsigned long) fe->st.st_gid); return buffer; } @@ -686,11 +686,11 @@ display_mini_info (WPanel *panel) * This is a trick to use two ngettext() calls in one sentence. * 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", (unsigned long)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), b_bytes, panel->marked); diff --git a/src/selcodepage.c b/src/selcodepage.c index 4f7fa3e85..4959882d9 100644 --- a/src/selcodepage.c +++ b/src/selcodepage.c @@ -62,12 +62,12 @@ select_charset (int current_charset, int seldisplay) /* insert all the items found */ for (i = 0; i < n_codepages; i++) { 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); LISTBOX_APPEND_TEXT (listbox, get_hotkey (i), buffer, NULL); } if (seldisplay) { - g_snprintf (buffer, sizeof (buffer), "%c %s", + snprintf (buffer, sizeof (buffer), "%c %s", get_hotkey (n_codepages), _("Other 8 bit")); LISTBOX_APPEND_TEXT (listbox, get_hotkey (n_codepages), buffer, NULL); diff --git a/src/setup.c b/src/setup.c index aa0f6bcb6..1913361e0 100644 --- a/src/setup.c +++ b/src/setup.c @@ -245,11 +245,11 @@ panel_save_setup (struct WPanel *panel, const char *section) char buffer [BUF_TINY]; int i; - g_snprintf (buffer, sizeof (buffer), "%d", panel->reverse); + snprintf (buffer, sizeof (buffer), "%d", panel->reverse); 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); - 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); for (i = 0; sort_names [i].key; i++) 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); 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, 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, profile_name); } @@ -289,7 +289,7 @@ save_layout (void) /* Save integer options */ 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); } @@ -419,7 +419,7 @@ panel_load_setup (WPanel *panel, const char *section) profile_name)); for (i = 0; i < LIST_TYPES; 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] = g_strdup (get_profile_string (section, buffer, DEFAULT_USER_FORMAT, profile_name)); diff --git a/src/slint.c b/src/slint.c index c30fac1b1..16fc3d235 100644 --- a/src/slint.c +++ b/src/slint.c @@ -253,10 +253,10 @@ slang_reset_softkeys (void) char tmp[BUF_SMALL]; 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); 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), display, send); SLtt_write_string (tmp); diff --git a/src/subshell.c b/src/subshell.c index 99cf28ce4..05e177f08 100644 --- a/src/subshell.c +++ b/src/subshell.c @@ -227,7 +227,7 @@ init_subshell_child (const char *pty_name) mc_sid = getsid (0); if (mc_sid != -1) { 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); putenv (g_strdup (sid_str)); } @@ -420,7 +420,7 @@ init_subshell (void) /* Create a pipe for receiving the subshell's CWD */ 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 ()); if (mkfifo (tcsh_fifo, 0600) == -1) { fprintf (stderr, "mkfifo(%s) failed: %s\r\n", tcsh_fifo, @@ -468,19 +468,19 @@ init_subshell (void) switch (subshell_type) { case BASH: - g_snprintf (precmd, sizeof (precmd), + snprintf (precmd, sizeof (precmd), " PROMPT_COMMAND='pwd>&%d;kill -STOP $$'\n", subshell_pipe[WRITE]); break; case ZSH: - g_snprintf (precmd, sizeof (precmd), + snprintf (precmd, sizeof (precmd), " precmd(){ pwd>&%d;kill -STOP $$ }\n", subshell_pipe[WRITE]); break; case TCSH: - g_snprintf (precmd, sizeof (precmd), + snprintf (precmd, sizeof (precmd), "set echo_style=both;" "alias precmd 'echo $cwd:q >>%s;kill -STOP $$'\n", tcsh_fifo); diff --git a/src/tree.c b/src/tree.c index f4e7ceeca..580cfc4a1 100644 --- a/src/tree.c +++ b/src/tree.c @@ -597,7 +597,7 @@ static void tree_copy (WTree *tree, const char *default_dest) if (!tree->selected_ptr) 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)); 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) 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)); dest = input_expand_dialog (_(" Move "), cmd_buf, MC_HISTORY_FM_TREE_MOVE, default_dest); if (!dest) diff --git a/src/util.c b/src/util.c index 0b4a7efdf..6f5d443c1 100644 --- a/src/util.c +++ b/src/util.c @@ -285,7 +285,7 @@ size_trunc (double size) xtra = "M"; } } - g_snprintf (x, sizeof (x), "%.0f%s", (size/divisor), xtra); + snprintf (x, sizeof (x), "%.0f%s", (size/divisor), xtra); return x; } @@ -344,18 +344,18 @@ size_trunc_len (char *buffer, int len, off_t size, int units) if (size == 0) { if (j == units) { /* Empty files will print "0" even with minimal width. */ - g_snprintf (buffer, len + 1, "0"); + snprintf (buffer, len + 1, "0"); break; } /* 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"); break; } 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; } @@ -629,7 +629,7 @@ set_int (const char *file, const char *key, int value) { char buffer [BUF_TINY]; - g_snprintf (buffer, sizeof (buffer), "%d", value); + snprintf (buffer, sizeof (buffer), "%d", value); return WritePrivateProfileString (app_text, key, buffer, file); } @@ -845,11 +845,11 @@ unix_error_string (int error_num) gchar *strerror_currentlocale; 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); g_free(strerror_currentlocale); #else - g_snprintf (buffer, sizeof (buffer), "%s (%d)", + snprintf (buffer, sizeof (buffer), "%s (%d)", g_strerror (error_num), error_num); #endif return buffer; diff --git a/src/utilunix.c b/src/utilunix.c index cd3c7cced..7cefb5aa2 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -93,7 +93,7 @@ char *get_owner (int uid) return pwd->pw_name; } else { - g_snprintf (ibuf, sizeof (ibuf), "%d", uid); + snprintf (ibuf, sizeof (ibuf), "%d", uid); 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); return grp->gr_name; } else { - g_snprintf (gbuf, sizeof (gbuf), "%d", gid); + snprintf (gbuf, sizeof (gbuf), "%d", gid); return gbuf; } } @@ -254,10 +254,10 @@ mc_tmpdir (void) pwd = getpwuid (getuid ()); if (pwd) - g_snprintf (buffer, sizeof (buffer), "%s/mc-%s", sys_tmp, + snprintf (buffer, sizeof (buffer), "%s/mc-%s", sys_tmp, pwd->pw_name); else - g_snprintf (buffer, sizeof (buffer), "%s/mc-%lu", sys_tmp, + snprintf (buffer, sizeof (buffer), "%s/mc-%lu", sys_tmp, (unsigned long) getuid ()); canonicalize_pathname (buffer); @@ -306,11 +306,11 @@ mc_tmpdir (void) if (fallback_ok) { fprintf (stderr, _("Temporary files will be created in %s\n"), sys_tmp); - g_snprintf (buffer, sizeof (buffer), "%s", sys_tmp); + snprintf (buffer, sizeof (buffer), "%s", sys_tmp); error = NULL; } else { 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...")); diff --git a/src/view.c b/src/view.c index 1d389a942..afa9aad4a 100644 --- a/src/view.c +++ b/src/view.c @@ -1516,7 +1516,7 @@ view_load (WView *view, const char *command, const char *file, } else if (file != NULL && file[0] != '\0') { /* Open the file */ 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)); view_show_error (view, tmp); 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 */ if (mc_fstat (fd, &st) == -1) { 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)); view_show_error (view, tmp); goto finish; @@ -1741,7 +1741,7 @@ view_display_ruler (WView *view) } 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) { widget_move (view, top + nums_row, left + c - 1); tty_print_string (r_buff); @@ -1789,7 +1789,7 @@ view_display_hex (WView *view) col = 0; /* 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); tty_setcolor (MARKED_COLOR); 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); - g_snprintf (prompt, sizeof (prompt), + snprintf (prompt, sizeof (prompt), _(" The current line number is %d.\n" " Enter the new line number:"), (int) (line + 1)); 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]; offset_type addr; - g_snprintf (prompt, sizeof (prompt), + snprintf (prompt, sizeof (prompt), _(" The current address is 0x%lx.\n" " Enter the new address:"), view->hex_cursor); line = input_dialog (_(" Goto Address "), prompt, MC_HISTORY_VIEW_GOTO_ADDR, ""); diff --git a/src/widget.c b/src/widget.c index 59392eaf5..431267770 100644 --- a/src/widget.c +++ b/src/widget.c @@ -158,15 +158,15 @@ button_callback (Widget *w, widget_msg_t msg, int parm) switch (b->flags) { case DEFPUSH_BUTTON: - g_snprintf (buf, sizeof (buf), "[< %s >]", b->text); + snprintf (buf, sizeof (buf), "[< %s >]", b->text); off = 3; break; case NORMAL_BUTTON: - g_snprintf (buf, sizeof (buf), "[ %s ]", b->text); + snprintf (buf, sizeof (buf), "[ %s ]", b->text); off = 2; break; case NARROW_BUTTON: - g_snprintf (buf, sizeof (buf), "[%s]", b->text); + snprintf (buf, sizeof (buf), "[%s]", b->text); off = 1; break; case HIDDEN_BUTTON: @@ -871,7 +871,7 @@ history_get (const char *input_name) for (i = 0;; i++) { char key_name[BUF_TINY]; 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, sizeof (this_entry), profile); 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 */ if (text && *text) { 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, profile); } diff --git a/vfs/fish.c b/vfs/fish.c index 5d24d5276..1723d04f6 100644 --- a/vfs/fish.c +++ b/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) { argv[i++] = "-p"; - g_snprintf (gbuf, sizeof (gbuf), "%d", SUP.flags); + snprintf (gbuf, sizeof (gbuf), "%d", SUP.flags); argv[i++] = gbuf; } @@ -906,7 +906,7 @@ static int fish_chmod (struct vfs_class *me, const char *path, int mode) { 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" "echo '### 000'\n", mode & 07777, rpath, @@ -934,7 +934,7 @@ static int fish_##name (struct vfs_class *me, const char *path1, const char *pat g_free (mpath1); \ rpath2 = mhl_shell_escape_dup (crpath2); \ 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 (rpath2); \ 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; PREFIX qsetto = mhl_shell_escape_dup (setto); - g_snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "#SYMLINK %s /%s\n" "ln -s %s /%s 2>/dev/null\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; { PREFIX - g_snprintf (buf, sizeof(buf), + snprintf (buf, sizeof(buf), "#CHOWN %s /%s\n" "chown %s /%s 2>/dev/null\n" "echo '### 000'\n", @@ -986,7 +986,7 @@ fish_chown (struct vfs_class *me, const char *path, int owner, int group) sowner, rpath); fish_send_command (me, super, buf, OPT_FLUSH); /* 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\" 2>/dev/null\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) { PREFIX - g_snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "#DELE /%s\n" "rm -f /%s 2>/dev/null\n" "echo '### 000'\n", @@ -1014,7 +1014,7 @@ static int fish_mkdir (struct vfs_class *me, const char *path, mode_t mode) (void) mode; - g_snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "#MKD /%s\n" "mkdir /%s 2>/dev/null\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) { PREFIX - g_snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "#RMD /%s\n" "rmdir /%s 2>/dev/null\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) { break; - g_snprintf (gbuf, sizeof (gbuf), ":%d", SUP.flags); + snprintf (gbuf, sizeof (gbuf), ":%d", SUP.flags); flags = gbuf; } break; diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 023f14bf4..852b305cd 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -1528,7 +1528,7 @@ static int ftpfs_chmod (struct vfs_class *me, const char *path, int mode) { 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); } diff --git a/vfs/mcfs.c b/vfs/mcfs.c index 884c523c9..27a0cfbf3 100644 --- a/vfs/mcfs.c +++ b/vfs/mcfs.c @@ -975,8 +975,8 @@ mcfs_utime (struct vfs_class *me, const char *path, struct utimbuf *times) atime = (long) times->actime; mtime = (long) times->modtime; - g_snprintf (abuf, sizeof (abuf), "%lx", atime); - g_snprintf (mbuf, sizeof (mbuf), "%lx", mtime); + snprintf (abuf, sizeof (abuf), "%lx", atime); + snprintf (mbuf, sizeof (mbuf), "%lx", mtime); rpc_send (mc->sock, RPC_INT, MC_UTIME, RPC_STRING, file, diff --git a/vfs/undelfs.c b/vfs/undelfs.c index 010e7d563..496c800fb 100644 --- a/vfs/undelfs.c +++ b/vfs/undelfs.c @@ -367,7 +367,7 @@ undelfs_readdir(void *vfs_info) if (readdir_ptr < 0) strcpy (dirent_dest, readdir_ptr == -2 ? "." : ".."); else - g_snprintf(dirent_dest, MC_MAXPATHLEN, "%ld:%d", + snprintf(dirent_dest, MC_MAXPATHLEN, "%ld:%d", (long) delarray[readdir_ptr].ino, delarray[readdir_ptr].num_blocks); readdir_ptr++;