* wtools.c: Merge mc_message() and message() into one background

safe function message().  Fix all callers.
This commit is contained in:
Pavel Roskin 2003-10-26 04:47:20 +00:00
parent f9e5058942
commit 211ce16fac
16 changed files with 93 additions and 133 deletions

View File

@ -1,5 +1,8 @@
2003-10-26 Pavel Roskin <proski@gnu.org>
* wtools.c: Merge mc_message() and message() into one background
safe function message(). Fix all callers.
* i18n.h: Include into global.h.
* Makefile.am: Remove i18n.h.

View File

@ -1,23 +1,4 @@
/* {{{ Copyright */
/* File managing. Important notes on this file:
About the use of dialogs in this file:
If you want to add a new dialog box (or call a routine that pops
up a dialog box), you have to provide a wrapper for background
operations (ie, background operations have to up-call to the parent
process).
For example, instead of using the message() routine, in this
file, you should use mc_message(), which can talk to the foreground
process.
Actually, that is a rule that should be followed by any routines
that may be called from this module.
*/
/* File managing
/* File management.
Copyright (C) 1994, 1995, 1996 The Free Software Foundation
Written by: 1994, 1995 Janne Kukonlehto
@ -50,7 +31,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* }}} */
/*
* Please note that all dialogs used here must be safe for background
* operations.
*/
/* {{{ Include files */
@ -230,7 +214,7 @@ do_transform_source (FileOpContext *ctx, unsigned char *source)
case '*':
if (next_reg < 0 || next_reg >= RE_NREGS
|| ctx->regs.start[next_reg] < 0) {
mc_message (1, MSG_ERROR, _(" Invalid target mask "));
message (1, MSG_ERROR, _(" Invalid target mask "));
transform_error = FILE_ABORT;
return NULL;
}
@ -329,7 +313,7 @@ check_hardlinks (char *src_name, char *dst_name, struct stat *pstat)
}
}
}
mc_message (1, MSG_ERROR, _(" Cannot make the hardlink "));
message (1, MSG_ERROR, _(" Cannot make the hardlink "));
return 0;
}
lp = (struct link *) g_malloc (sizeof (struct link) + strlen (src_name)
@ -382,7 +366,7 @@ make_symlink (FileOpContext *ctx, char *src_path, char *dst_path)
if (ctx->stable_symlinks)
if (!vfs_file_is_local (src_path) || !vfs_file_is_local (dst_path)) {
mc_message (1, MSG_ERROR,
message (1, MSG_ERROR,
_(" Cannot make stable symlinks across "
"non-local filesystems: \n\n"
" Option Stable Symlinks will be disabled "));
@ -526,7 +510,7 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path,
if (dst_exists) {
/* Destination already exists */
if (sb.st_dev == sb2.st_dev && sb.st_ino == sb2.st_ino) {
mc_message (1, MSG_ERROR,
message (1, MSG_ERROR,
_(" `%s' and `%s' are the same file "), src_path,
dst_path);
do_refresh ();
@ -612,7 +596,7 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path,
if (ctx->do_reget) {
if (mc_lseek (src_desc, ctx->do_reget, SEEK_SET) != ctx->do_reget) {
mc_message (1, _("Warning"),
message (1, _("Warning"),
_(" Reget failed, about to overwrite file "));
ctx->do_reget = ctx->do_append = 0;
}
@ -922,7 +906,7 @@ copy_dir_dir (FileOpContext *ctx, char *s, char *d, int toplevel,
if (is_in_linklist (parent_dirs, s, &cbuf)) {
/* we found a cyclic symbolic link */
mc_message (1, MSG_ERROR,
message (1, MSG_ERROR,
_(" Cannot copy cyclic symbolic link \n `%s' "), s);
return FILE_SKIP;
}
@ -1127,14 +1111,14 @@ move_file_file (FileOpContext *ctx, char *s, char *d,
strcpy (st, name_trunc (s, msize));
strcpy (dt, name_trunc (d, msize));
mc_message (1, MSG_ERROR,
message (1, MSG_ERROR,
_(" `%s' and `%s' are the same file "), st, dt);
do_refresh ();
return FILE_SKIP;
}
if (S_ISDIR (dst_stats.st_mode)) {
mc_message (1, MSG_ERROR,
message (1, MSG_ERROR,
_(" Cannot overwrite directory `%s' "), d);
do_refresh ();
return FILE_SKIP;
@ -1245,7 +1229,7 @@ move_dir_dir (FileOpContext *ctx, char *s, char *d,
strcpy (st, name_trunc (s, msize));
strcpy (dt, name_trunc (d, msize));
mc_message (1, MSG_ERROR,
message (1, MSG_ERROR,
_(" `%s' and `%s' are the same directory "), st, dt);
do_refresh ();
return FILE_SKIP;

View File

@ -1,23 +1,4 @@
/* {{{ Copyright */
/* File managing. Important notes on this file:
*
* About the use of dialogs in this file:
* If you want to add a new dialog box (or call a routine that pops
* up a dialog box), you have to provide a wrapper for background
* operations (ie, background operations have to up-call to the parent
* process).
*
* For example, instead of using the message() routine, in this
* file, you should use mc_message(), which can talk to the foreground
* process.
*
* Actually, that is a rule that should be followed by any routines
* that may be called from this module.
*
*/
/* File managing GUI for the text mode edition
/* File management GUI for the text mode edition
*
* Copyright (C) 1994, 1995, 1996 The Free Software Foundation
*
@ -52,7 +33,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* }}} */
/*
* Please note that all dialogs used here must be safe for background
* operations.
*/
/* {{{ Include files */
@ -75,7 +60,7 @@
#include "setup.h" /* verbose */
#include "dialog.h" /* do_refresh() */
#include "color.h" /* dialog_colors */
#include "background.h" /* mc_message */
#include "background.h" /* message */
#include "widget.h" /* WLabel */
#define WANT_WIDGETS
#include "main.h" /* the_hint */
@ -878,7 +863,7 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, char *text,
g_return_val_if_fail (ctx != NULL, NULL);
#if 0
mc_message (1, __FUNCTION__, "text = `%s' \n def_text = `%s'", text,
message (1, __FUNCTION__, "text = `%s' \n def_text = `%s'", text,
def_text);
#endif
fmd_init_i18n (FALSE);
@ -951,7 +936,7 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, char *text,
&ctx->rx);
if (error) {
mc_message (1, MSG_ERROR, _("Invalid source pattern `%s' \n %s "),
message (1, MSG_ERROR, _("Invalid source pattern `%s' \n %s "),
orig_mask, error);
if (orig_mask)
g_free (orig_mask);

View File

@ -236,20 +236,12 @@ create_message (int flags, const char *title, const char *text, ...)
* Show message dialog. Dismiss it when any key is pressed.
* Not safe to call from background.
*/
void
message (int flags, const char *title, const char *text, ...)
static void
fg_message (int flags, const char *title, const char *text)
{
va_list args;
Dlg_head *d;
char *p;
va_start (args, text);
p = g_strdup_vprintf (text, args);
va_end (args);
d = do_create_message (flags, title, p);
g_free (p);
d = do_create_message (flags, title, text);
mi_getch ();
dlg_run_done (d);
destroy_dlg (d);
@ -262,7 +254,7 @@ static void
bg_message (int dummy, int *flags, char *title, const char *text)
{
title = g_strdup_printf ("%s %s", _("Background process:"), title);
message (*flags, title, "%s", text);
fg_message (*flags, title, text);
g_free (title);
}
#endif /* WITH_BACKGROUND */
@ -270,7 +262,7 @@ bg_message (int dummy, int *flags, char *title, const char *text)
/* Show message box, background safe */
void
mc_message (int flags, char *title, const char *text, ...)
message (int flags, const char *title, const char *text, ...)
{
char *p;
va_list ap;
@ -279,15 +271,16 @@ mc_message (int flags, char *title, const char *text, ...)
p = g_strdup_vprintf (text, ap);
va_end (ap);
if (title == MSG_ERROR)
title = _("Error");
#ifdef WITH_BACKGROUND
if (we_are_background) {
if (title == MSG_ERROR)
title = _("Error");
parent_call ((void *) bg_message, NULL, 3, sizeof (flags), &flags,
strlen (title), title, strlen (p), p);
} else
#endif /* WITH_BACKGROUND */
message (flags, title, "%s", p);
fg_message (flags, title, p);
g_free (p);
}

View File

@ -71,12 +71,8 @@ struct Dlg_head *create_message (int flags, const char *title,
const char *text, ...)
__attribute__ ((format (printf, 3, 4)));
/* Show message box, not background safe */
void message (int flags, const char *title, const char *text, ...)
__attribute__ ((format (printf, 3, 4)));
/* Show message box, background safe */
void mc_message (int flags, char *title, const char *text, ...)
void message (int flags, const char *title, const char *text, ...)
__attribute__ ((format (printf, 3, 4)));

View File

@ -134,7 +134,7 @@ static int cpio_open_cpio_file(struct vfs_class *me, struct vfs_s_super *super,
struct vfs_s_inode *root;
if((fd = mc_open(name, O_RDONLY)) == -1) {
mc_message (1, MSG_ERROR, _("Cannot open cpio archive\n%s"), name);
message (1, MSG_ERROR, _("Cannot open cpio archive\n%s"), name);
return -1;
}
@ -150,7 +150,7 @@ static int cpio_open_cpio_file(struct vfs_class *me, struct vfs_s_super *super,
mc_close(fd);
s = g_strconcat(name, decompress_extension(type), NULL);
if((fd = mc_open(s, O_RDONLY)) == -1) {
mc_message (1, MSG_ERROR, _("Cannot open cpio archive\n%s"), s);
message (1, MSG_ERROR, _("Cannot open cpio archive\n%s"), s);
g_free(s);
return -1;
}
@ -216,7 +216,7 @@ static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super)
ptr -= top - 128;
}
if((tmp = mc_read(super->u.arch.fd, buf, top)) == 0 || tmp == -1) {
mc_message (1, MSG_ERROR, _("Premature end of cpio archive\n%s"), super->name);
message (1, MSG_ERROR, _("Premature end of cpio archive\n%s"), super->name);
cpio_free_archive(me, super);
return CPIO_UNKNOWN;
}
@ -302,7 +302,7 @@ static int cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super)
&hd.c_dev, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
&hd.c_nlink, &hd.c_rdev, &hd.c_mtime,
&hd.c_namesize, &hd.c_filesize) < 10) {
mc_message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"), super->name);
message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"), super->name);
return STATUS_FAIL;
}
@ -352,7 +352,7 @@ static int cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super)
&hd.c_nlink, &hd.c_mtime, &hd.c_filesize,
&hd.c_dev, &hd.c_devmin, &hd.c_rdev, &hd.c_rdevmin,
&hd.c_namesize, &hd.c_chksum) < 14) {
mc_message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
super->name);
return STATUS_FAIL;
}
@ -423,7 +423,7 @@ static int cpio_create_entry(struct vfs_class *me, struct vfs_s_super *super, st
if((l = defer_find(super->u.arch.deferred, &i)) != NULL) {
inode = l->inode;
if(inode->st.st_size && stat->st_size && (inode->st.st_size != stat->st_size)) {
mc_message (1, MSG_ERROR, _("Inconsistent hardlinks of\n%s\nin cpio archive\n%s"),
message (1, MSG_ERROR, _("Inconsistent hardlinks of\n%s\nin cpio archive\n%s"),
name, super->name);
inode = NULL;
}
@ -446,7 +446,7 @@ static int cpio_create_entry(struct vfs_class *me, struct vfs_s_super *super, st
'No such file or directory' is such case) */
if(!S_ISDIR(entry->ino->st.st_mode)) { /* This can be considered archive inconsistency */
mc_message (1, MSG_ERROR, _("%s contains duplicate entries! Skipping!"), super->name);
message (1, MSG_ERROR, _("%s contains duplicate entries! Skipping!"), super->name);
} else {
entry->ino->st.st_mode = stat->st_mode;
entry->ino->st.st_uid = stat->st_uid;
@ -515,7 +515,7 @@ static int cpio_open_archive(struct vfs_class *me, struct vfs_s_super *super, ch
switch(status) {
case STATUS_EOF:
mc_message (1, MSG_ERROR, _("Unexpected end of file\n%s"), name);
message (1, MSG_ERROR, _("Unexpected end of file\n%s"), name);
return 0;
case STATUS_OK:
continue;

View File

@ -425,12 +425,12 @@ vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
#if 0
/* FIXME: We currently leak small ammount of memory, sometimes. Fix it if you can. */
if (super->ino_usage)
mc_message (1, " Direntry warning ",
message (1, " Direntry warning ",
"Super ino_usage is %d, memory leak",
super->ino_usage);
if (super->want_stale)
mc_message (1, " Direntry warning ", "Super has want_stale set");
message (1, " Direntry warning ", "Super has want_stale set");
#endif
if (super->prevp){

View File

@ -287,7 +287,7 @@ read_archive (int fstype, char *name, struct archive **pparc)
char *current_file_name, *current_link_name;
if ((extfsd = open_archive (fstype, name, &current_archive)) == NULL) {
mc_message (1, MSG_ERROR, _("Cannot open %s archive\n%s"),
message (1, MSG_ERROR, _("Cannot open %s archive\n%s"),
extfs_prefixes[fstype], name);
return -1;
}
@ -1273,7 +1273,7 @@ static int extfs_init (struct vfs_class *me)
mc_extfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "extfs.ini");
cfg = fopen (mc_extfsini, "r");
/* We may not use vfs_die() message or mc_message or similar,
/* We may not use vfs_die() message or message or similar,
* UI is not initialized at this time and message would not
* appear on screen. */
if (!cfg) {

View File

@ -237,7 +237,7 @@ open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
/dev/tty, not from stdin :-(. */
#ifndef HAVE_HACKED_SSH
mc_message (1, MSG_ERROR, _("Sorry, we cannot do password authenticated connections for now."));
message (1, MSG_ERROR, _("Sorry, we cannot do password authenticated connections for now."));
ERRNOR (EPERM, -1);
#endif
if (!SUP.password){

View File

@ -504,7 +504,7 @@ login_server (struct vfs_class *me, struct vfs_s_super *super, const char *netrc
goto login_fail;
}
}
mc_message (1, MSG_ERROR, _("ftpfs: Login incorrect for user %s "),
message (1, MSG_ERROR, _("ftpfs: Login incorrect for user %s "),
SUP.user);
login_fail:
wipe_password (pass);
@ -1764,7 +1764,7 @@ static int netrc_has_incorrect_mode (char *netrcname, char *netrc)
if (stat (netrcname, &mystat) >= 0 && (mystat.st_mode & 077)) {
if (be_angry) {
mc_message (1, MSG_ERROR,
message (1, MSG_ERROR,
_("~/.netrc file has not correct mode.\n"
"Remove password or correct mode."));
be_angry = 0;

View File

@ -119,7 +119,7 @@ mcfs_login_server (int my_socket, char *user, int port,
return 0;
if (result != MC_VERSION_OK) {
mc_message (1, _(" MCFS "),
message (1, _(" MCFS "),
_(" The server does not support this version "));
close (my_socket);
return 0;
@ -164,7 +164,7 @@ mcfs_login_server (int my_socket, char *user, int port,
return 0;
if (result != MC_LOGINOK) {
mc_message (1, _(" MCFS "), _(" Invalid password "));
message (1, _(" MCFS "), _(" Invalid password "));
rpc_send (my_socket, RPC_INT, MC_QUIT, RPC_END);
close (my_socket);
return 0;
@ -224,7 +224,7 @@ open_tcp_link (char *host, int *port, int *version, char *caller)
sizeof (inaddr));
else {
if ((hp = gethostbyname (host)) == NULL) {
mc_message (1, caller, _(" Cannot locate hostname: %s "),
message (1, caller, _(" Cannot locate hostname: %s "),
host);
return 0;
}
@ -243,13 +243,13 @@ open_tcp_link (char *host, int *port, int *version, char *caller)
server_address.sin_port = htons (*port);
if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
mc_message (1, caller, _(" Cannot create socket: %s "),
message (1, caller, _(" Cannot create socket: %s "),
unix_error_string (errno));
return 0;
}
if (connect (my_socket, (struct sockaddr *) &server_address,
sizeof (server_address)) < 0) {
mc_message (1, caller, _(" Cannot connect to server: %s "),
message (1, caller, _(" Cannot connect to server: %s "),
unix_error_string (errno));
close (my_socket);
return 0;
@ -319,7 +319,7 @@ mcfs_open_link (char *host, char *user, int *port, char *netrcpass)
return &mcfs_connections[i];
}
if (mcfs_open_connections == MCFS_MAX_CONNECTIONS) {
mc_message (1, MSG_ERROR, _(" Too many open connections "));
message (1, MSG_ERROR, _(" Too many open connections "));
return 0;
}

View File

@ -571,7 +571,7 @@ reconnect(smbfs_connection *conn, int *retries)
cli_shutdown(conn->cli);
if (!(conn->cli = smbfs_do_connect(host, conn->service))) {
mc_message (1, MSG_ERROR,
message (1, MSG_ERROR,
_(" reconnect to %s failed\n "), conn->host);
g_free(host);
return False;
@ -1108,7 +1108,7 @@ smbfs_open_link (char *host, char *path, const char *user, int *port,
if (my_errno != EPERM)
return 0;
mc_message (1, MSG_ERROR, _(" Authentication failed "));
message (1, MSG_ERROR, _(" Authentication failed "));
/* authentication failed, try again */
authinfo_remove (bucket->host, bucket->service);
@ -1620,7 +1620,7 @@ smbfs_mkdir (struct vfs_class * me, char *path, mode_t mode)
if (!cli_mkdir (sc->cli, path)) {
my_errno = cli_error (sc->cli, NULL, &err, NULL);
mc_message (1, MSG_ERROR, _(" Error %s creating directory %s "),
message (1, MSG_ERROR, _(" Error %s creating directory %s "),
cli_errstr (sc->cli), CNV_LANG (path));
g_free (path);
return -1;
@ -1643,7 +1643,7 @@ smbfs_rmdir (struct vfs_class *me, char *path)
if (!cli_rmdir(sc->cli, path)) {
my_errno = cli_error(sc->cli, NULL, &err, NULL);
mc_message (1, MSG_ERROR, _(" Error %s removing directory %s "),
message (1, MSG_ERROR, _(" Error %s removing directory %s "),
cli_errstr(sc->cli), CNV_LANG(path));
g_free (path);
return -1;
@ -1752,7 +1752,7 @@ open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int mode)
DENY_NONE);
if (remote_handle->fnum == -1) {
mc_message (1, MSG_ERROR, _(" %s opening remote file %s "),
message (1, MSG_ERROR, _(" %s opening remote file %s "),
cli_errstr (remote_handle->cli), CNV_LANG (rname));
DEBUG (1, ("smbfs_open(rname:%s) error:%s\n",
rname, cli_errstr (remote_handle->cli)));
@ -1768,7 +1768,7 @@ open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int mode)
NULL)
&& !cli_getattrE (remote_handle->cli, remote_handle->fnum,
&remote_handle->attr, &size, NULL, NULL, NULL)) {
mc_message (1, MSG_ERROR, " getattrib: %s ",
message (1, MSG_ERROR, " getattrib: %s ",
cli_errstr (remote_handle->cli));
DEBUG (1,
("smbfs_open(rname:%s) getattrib:%s\n", rname,
@ -1825,7 +1825,7 @@ smbfs_unlink (struct vfs_class *me, char *path)
g_free (p);
if (!cli_unlink(sc->cli, remote_file)) {
mc_message (1, MSG_ERROR, _(" %s removing remote file %s "),
message (1, MSG_ERROR, _(" %s removing remote file %s "),
cli_errstr(sc->cli), CNV_LANG(remote_file));
g_free (remote_file);
return -1;
@ -1863,7 +1863,7 @@ smbfs_rename (struct vfs_class *me, char *a, char *b)
g_free (rb);
if (!retval) {
mc_message (1, MSG_ERROR, _(" %s renaming files\n"),
message (1, MSG_ERROR, _(" %s renaming files\n"),
cli_errstr(sc->cli));
return -1;
}

View File

@ -206,7 +206,7 @@ static int tar_open_archive (struct vfs_class *me, char *name, struct vfs_s_supe
result = mc_open (name, O_RDONLY);
if (result == -1) {
mc_message (1, MSG_ERROR, _("Cannot open tar archive\n%s"), name);
message (1, MSG_ERROR, _("Cannot open tar archive\n%s"), name);
ERRNOR (ENOENT, -1);
}
@ -223,7 +223,7 @@ static int tar_open_archive (struct vfs_class *me, char *name, struct vfs_s_supe
s = g_strconcat ( archive->name, decompress_extension (type), NULL );
result = mc_open (s, O_RDONLY);
if (result == -1)
mc_message (1, MSG_ERROR, _("Cannot open tar archive\n%s"), s);
message (1, MSG_ERROR, _("Cannot open tar archive\n%s"), s);
g_free(s);
if (result == -1)
ERRNOR (ENOENT, -1);
@ -406,7 +406,7 @@ read_header (struct vfs_class *me, struct vfs_s_super *archive, int tard)
size -= written) {
data = get_next_record (archive, tard)->charptr;
if (data == NULL) {
mc_message (1, MSG_ERROR, _("Unexpected EOF on archive file"));
message (1, MSG_ERROR, _("Unexpected EOF on archive file"));
return STATUS_BADCHECKSUM;
}
written = RECORDSIZE;
@ -458,14 +458,14 @@ read_header (struct vfs_class *me, struct vfs_s_super *archive, int tard)
parent = vfs_s_find_inode (me, archive->root, q, LINK_NO_FOLLOW, FL_MKDIR);
if (parent == NULL) {
mc_message (1, MSG_ERROR, _("Inconsistent tar archive"));
message (1, MSG_ERROR, _("Inconsistent tar archive"));
return STATUS_BADCHECKSUM;
}
if (header->header.linkflag == LF_LINK) {
inode = vfs_s_find_inode (me, archive->root, current_link_name, LINK_NO_FOLLOW, 0);
if (inode == NULL) {
mc_message (1, MSG_ERROR, _("Inconsistent tar archive"));
message (1, MSG_ERROR, _("Inconsistent tar archive"));
} else {
entry = vfs_s_new_entry(me, p, inode);
vfs_s_insert_entry(me, parent, entry);
@ -535,7 +535,7 @@ static int open_archive (struct vfs_class *me, struct vfs_s_super *archive, char
/* Error on first record */
case STATUS_EOFMARK:
mc_message (1, MSG_ERROR, _("Hmm,...\n%s\ndoesn't look like a tar archive."), name);
message (1, MSG_ERROR, _("Hmm,...\n%s\ndoesn't look like a tar archive."), name);
/* FALL THRU */
/* Error after header rec */

View File

@ -179,20 +179,20 @@ undelfs_loaddel (void)
num_delarray = 0;
delarray = g_new (struct deleted_info, max_delarray);
if (!delarray) {
mc_message (1, undelfserr, _(" not enough memory "));
message (1, undelfserr, _(" not enough memory "));
return 0;
}
block_buf = g_malloc (fs->blocksize * 3);
if (!block_buf) {
mc_message (1, undelfserr, _(" while allocating block buffer "));
message (1, undelfserr, _(" while allocating block buffer "));
goto free_delarray;
}
if ((retval = ext2fs_open_inode_scan(fs, 0, &scan))){
mc_message (1, undelfserr, _(" open_inode_scan: %d "), retval);
message (1, undelfserr, _(" open_inode_scan: %d "), retval);
goto free_block_buf;
}
if ((retval = ext2fs_get_next_inode(scan, &ino, &inode))){
mc_message (1, undelfserr, _(" while starting inode scan %d "), retval);
message (1, undelfserr, _(" while starting inode scan %d "), retval);
goto error_out;
}
@ -214,7 +214,7 @@ undelfs_loaddel (void)
retval = ext2fs_block_iterate(fs, ino, 0, block_buf,
lsdel_proc, &lsd);
if (retval) {
mc_message (1, undelfserr, _(" while calling ext2_block_iterate %d "), retval);
message (1, undelfserr, _(" while calling ext2_block_iterate %d "), retval);
goto next;
}
if (lsd.free_blocks && !lsd.bad_blocks) {
@ -222,7 +222,7 @@ undelfs_loaddel (void)
max_delarray += 50;
delarray = g_renew (struct deleted_info, delarray, max_delarray);
if (!delarray) {
mc_message (1, undelfserr, _(" no more memory while reallocating array "));
message (1, undelfserr, _(" no more memory while reallocating array "));
goto error_out;
}
}
@ -241,7 +241,7 @@ undelfs_loaddel (void)
next:
retval = ext2fs_get_next_inode(scan, &ino, &inode);
if (retval) {
mc_message (1, undelfserr, _(" while doing inode scan %d "), retval);
message (1, undelfserr, _(" while doing inode scan %d "), retval);
goto error_out;
}
}
@ -265,7 +265,7 @@ void com_err (const char *str, long err_code, const char *s2, ...)
char *cptr;
cptr = g_strdup_printf (" %s (%s: %ld) ", s2, str, err_code);
mc_message (1, _(" Ext2lib error "), cptr);
message (1, _(" Ext2lib error "), cptr);
g_free (cptr);
}
@ -292,18 +292,18 @@ undelfs_opendir (struct vfs_class *me, char *dirname)
}
if (ext2fs_open (ext2_fname, 0, 0, 0, unix_io_manager, &fs)){
mc_message (1, undelfserr, _(" Cannot open file %s "), ext2_fname);
message (1, undelfserr, _(" Cannot open file %s "), ext2_fname);
return 0;
}
print_vfs_message (_("undelfs: reading inode bitmap..."));
if (ext2fs_read_inode_bitmap (fs)){
mc_message (1, undelfserr,
message (1, undelfserr,
_(" Cannot load inode bitmap from: \n %s \n"), ext2_fname);
goto quit_opendir;
}
print_vfs_message (_("undelfs: reading block bitmap..."));
if (ext2fs_read_block_bitmap (fs)){
mc_message (1, undelfserr,
message (1, undelfserr,
_(" Cannot load block bitmap from: \n %s \n"), ext2_fname);
goto quit_opendir;
}
@ -327,7 +327,7 @@ undelfs_readdir(void *vfs_info)
char *dirent_dest;
if (vfs_info != fs) {
mc_message (1, undelfserr, _(" vfs_info is not fs! "));
message (1, undelfserr, _(" vfs_info is not fs! "));
return NULL;
}
if (readdir_ptr == num_delarray)
@ -383,7 +383,7 @@ undelfs_open (struct vfs_class *me, char *fname, int flags, int mode)
return 0;
if (!ext2_fname || strcmp (ext2_fname, file)){
mc_message (1, undelfserr, _(" You have to chdir to extract files first "));
message (1, undelfserr, _(" You have to chdir to extract files first "));
g_free (file);
g_free (f);
return 0;
@ -506,7 +506,7 @@ undelfs_read (void *vfs_info, char *buffer, int count)
retval = ext2fs_block_iterate(fs, p->inode, 0, NULL,
dump_read, p);
if (retval){
mc_message (1, undelfserr, _(" while iterating over blocks "));
message (1, undelfserr, _(" while iterating over blocks "));
return -1;
}
if (p->error_code && !p->finished)
@ -567,7 +567,7 @@ undelfs_lstat(struct vfs_class *me, char *path, struct stat *buf)
}
if (!ext2_fname || strcmp (ext2_fname, file)){
mc_message (1, undelfserr, _(" You have to chdir to extract files first "));
message (1, undelfserr, _(" You have to chdir to extract files first "));
g_free (file);
g_free (f);
return 0;
@ -611,7 +611,7 @@ undelfs_chdir(struct vfs_class *me, char *path)
/* this could be fixed by making an ext2fs io manager to use */
/* our vfs, but that is left as an excercise for the reader */
if ((fd = open (file, O_RDONLY)) == -1){
mc_message (1, undelfserr, _(" Cannot open file %s "), file);
message (1, undelfserr, _(" Cannot open file %s "), file);
g_free (f);
g_free (file);
return -1;

View File

@ -4,8 +4,7 @@
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* MSG_ERROR */
#include "../src/background.h" /* mc_message */
#include "../src/wtools.h" /* message() */
#include "../src/main.h" /* print_vfs_message */
/* Flags for vfs_split_url() */

View File

@ -1113,7 +1113,7 @@ mc_def_ungetlocalcopy (struct vfs_class *vfs, char *filename, char *local, int h
return 0;
failed:
mc_message (1, _("Changes to file lost"), filename);
message (1, _("Changes to file lost"), filename);
if (fdout!=-1) mc_close(fdout);
if (fdin!=-1) close(fdin);
unlink (local);
@ -1156,7 +1156,7 @@ vfs_expire (int now)
struct vfs_stamping *stamp, *st;
/* Avoid recursive invocation, e.g. when one of the free functions
calls mc_message */
calls message */
if (locked)
return;
locked = 1;
@ -1788,9 +1788,9 @@ error:
static int errorcount = 0;
if (++errorcount < 5) {
mc_message (1, _("Cannot parse:"), (p_copy && *p_copy) ? p_copy : line);
message (1, _("Cannot parse:"), (p_copy && *p_copy) ? p_copy : line);
} else if (errorcount == 5)
mc_message (1, _("Error"), _("More parsing errors will be ignored."));
message (1, _("Error"), _("More parsing errors will be ignored."));
}
g_free (p_copy);
@ -1800,7 +1800,7 @@ error:
void
vfs_die (const char *m)
{
mc_message (1, _("Internal error:"), m);
message (1, _("Internal error:"), m);
exit (1);
}