1
1

* background.c: Replace all message stubs with a new function

mc_message().  Protect against strlen(MSG_ERROR).  Adjust all
dependencies.
Этот коммит содержится в:
Pavel Roskin 2003-10-25 19:54:24 +00:00
родитель 16123e0850
Коммит 2d33b5047e
16 изменённых файлов: 119 добавлений и 201 удалений

Просмотреть файл

@ -1,3 +1,9 @@
2003-10-25 Pavel Roskin <proski@gnu.org>
* background.c: Replace all message stubs with a new function
mc_message(). Protect against strlen(MSG_ERROR). Adjust all
dependencies.
2003-10-25 Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
* hotlist.c (remove_from_hotlist): Fix improper check of the

Просмотреть файл

@ -157,52 +157,15 @@ do_background (struct FileOpContext *ctx, char *info)
}
}
static char *
background_title (char *str)
{
return g_strconcat (_("Background process:"), str, NULL);
}
/* {{{ Routines that do the real job */
static void
real_message_1s (enum OperationMode mode, int *flags, char *title, const char *str1)
bg_message (enum OperationMode mode, int *flags, char *title,
const char *text)
{
if (mode == Background)
title = background_title (title);
message (*flags, title, "%s", str1);
if (mode == Background)
g_free (title);
title = g_strdup_printf ("%s %s", _("Background process:"), title);
message (*flags, title, "%s", text);
g_free (title);
}
static void
real_message_2s (enum OperationMode mode, int *flags, char *title,
const char *str1, const char *str2)
{
if (mode == Background)
title = background_title (title);
message (*flags, title, str1, str2);
if (mode == Background)
g_free (title);
}
static void
real_message_3s (enum OperationMode mode, int *flags, char *title,
const char *str1, const char *str2, const char *str3)
{
if (mode == Background)
title = background_title (title);
message (*flags, title, str1, str2, str3);
if (mode == Background)
g_free (title);
}
/* }}} */
/* {{{ Parent handlers */
/* Parent/child protocol
@ -470,92 +433,44 @@ tell_parent (int msg)
{
write (parent_fd, &msg, sizeof (int));
}
#endif /* WITH_BACKGROUND */
/* Show message box, background safe */
void
message_1s (int flags, char *title, const char *str1)
mc_message (int flags, char *title, const char *text, ...)
{
if (we_are_background)
parent_call ((void *)real_message_1s, NULL, 3, sizeof (flags), &flags,
strlen (title), title, strlen (str1), str1);
else
real_message_1s (Foreground, &flags, title, str1);
}
char *p;
va_list ap;
void
message_2s (int flags, char *title, const char *str1, const char *str2)
{
if (we_are_background)
parent_call ((void *)real_message_2s, NULL, 4, sizeof (flags), &flags,
strlen (title), title, strlen (str1), str1,
strlen (str2), str2);
else
real_message_2s (Foreground, &flags, title, str1, str2);
}
va_start (ap, text);
p = g_strdup_vprintf (text, ap);
va_end (ap);
void
message_3s (int flags, char *title, const char *str1,
const char *str2, const char *str3)
{
if (we_are_background)
parent_call ((void *)real_message_3s, NULL, 5, sizeof (flags), &flags,
strlen (title), title, strlen (str1), str1,
strlen (str2), str2, strlen (str3), str3);
else
real_message_3s (Foreground, &flags, title, str1, str2, str3);
}
#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 (text), text);
} else
#endif /* WITH_BACKGROUND */
message (flags, title, "%s", text);
char *
input_dialog_help (char *header, char *text, char *help, char *def_text)
{
if (we_are_background)
return parent_call_string ((void *)real_input_dialog_help, 4,
strlen (header), header,
strlen (text), text,
strlen (help), help,
strlen (def_text), def_text);
else
return real_input_dialog_help (header, text, help, def_text);
}
#else /* Else => No background code support */
/* {{{ Stubs if background code is not supported */
void
message_1s (int flags, char *title, const char *str1)
{
message (flags, title, "%s", str1);
}
void
message_2s (int flags, char *title, const char *str1, const char *str2)
{
message (flags, title, str1, str2);
}
void
message_3s (int flags, char *title, const char *str1,
const char *str2, const char *str3)
{
message (flags, title, str1, str2, str3);
}
char *
input_dialog_help (char *header, char *text, char *help, char *def_text)
{
return real_input_dialog_help (header, text, help, def_text);
}
/* }}} */
#endif /* !WITH_BACKGROUND */
/* {{{ Functions shared between background and foreground */
void
message_1s1d (int flags, char *title, const char *str, int d)
{
char *p = g_strdup_printf (str, d);
message_1s (flags, title, p);
g_free (p);
}
/* }}} */
/* Show input dialog, background safe */
char *
input_dialog_help (char *header, char *text, char *help, char *def_text)
{
#ifdef WITH_BACKGROUND
if (we_are_background)
return parent_call_string ((void *) real_input_dialog_help, 4,
strlen (header), header, strlen (text),
text, strlen (help), help,
strlen (def_text), def_text);
else
#endif /* WITH_BACKGROUND */
return real_input_dialog_help (header, text, help, def_text);
}

Просмотреть файл

@ -36,11 +36,8 @@ int parent_call (void *routine, struct FileOpContext *ctx, int argc, ...);
void unregister_task_running (pid_t, int fd);
/* stubs */
void message_1s (int flags, char *title, const char *str1);
void message_2s (int flags, char *title, const char *str1, const char *str2);
void message_3s (int flags, char *title, const char *str1, const char *str2,
const char *str3);
void message_1s1d (int flags, char *title, const char *str, int d);
/* Show message box, background safe */
void mc_message (int flags, char *title, const char *text, ...)
__attribute__ ((format (printf, 3, 4)));
#endif

Просмотреть файл

@ -9,8 +9,8 @@
process).
For example, instead of using the message() routine, in this
file, you should use one of the stubs that call message with the
proper number of arguments (ie, message_1s, message_2s and so on).
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.
@ -229,7 +229,7 @@ do_transform_source (FileOpContext *ctx, unsigned char *source)
case '*':
if (next_reg < 0 || next_reg >= RE_NREGS
|| ctx->regs.start[next_reg] < 0) {
message_1s (1, MSG_ERROR, _(" Invalid target mask "));
mc_message (1, MSG_ERROR, _(" Invalid target mask "));
transform_error = FILE_ABORT;
return NULL;
}
@ -328,7 +328,7 @@ check_hardlinks (char *src_name, char *dst_name, struct stat *pstat)
}
}
}
message_1s (1, MSG_ERROR, _(" Cannot make the hardlink "));
mc_message (1, MSG_ERROR, _(" Cannot make the hardlink "));
return 0;
}
lp = (struct link *) g_malloc (sizeof (struct link) + strlen (src_name)
@ -381,7 +381,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)) {
message_1s (1, MSG_ERROR,
mc_message (1, MSG_ERROR,
_(" Cannot make stable symlinks across "
"non-local filesystems: \n\n"
" Option Stable Symlinks will be disabled "));
@ -525,7 +525,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) {
message_3s (1, MSG_ERROR,
mc_message (1, MSG_ERROR,
_(" `%s' and `%s' are the same file "), src_path,
dst_path);
do_refresh ();
@ -611,7 +611,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) {
message_1s (1, _("Warning"),
mc_message (1, _("Warning"),
_(" Reget failed, about to overwrite file "));
ctx->do_reget = ctx->do_append = 0;
}
@ -921,7 +921,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 */
message_2s (1, MSG_ERROR,
mc_message (1, MSG_ERROR,
_(" Cannot copy cyclic symbolic link \n `%s' "), s);
return FILE_SKIP;
}
@ -1126,14 +1126,14 @@ move_file_file (FileOpContext *ctx, char *s, char *d,
strcpy (st, name_trunc (s, msize));
strcpy (dt, name_trunc (d, msize));
message_3s (1, MSG_ERROR,
mc_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)) {
message_2s (1, MSG_ERROR,
mc_message (1, MSG_ERROR,
_(" Cannot overwrite directory `%s' "), d);
do_refresh ();
return FILE_SKIP;
@ -1244,7 +1244,7 @@ move_dir_dir (FileOpContext *ctx, char *s, char *d,
strcpy (st, name_trunc (s, msize));
strcpy (dt, name_trunc (d, msize));
message_3s (1, MSG_ERROR,
mc_message (1, MSG_ERROR,
_(" `%s' and `%s' are the same directory "), st, dt);
do_refresh ();
return FILE_SKIP;

Просмотреть файл

@ -9,8 +9,8 @@
* process).
*
* For example, instead of using the message() routine, in this
* file, you should use one of the stubs that call message with the
* proper number of arguments (ie, message_1s, message_2s and so on).
* 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.
@ -75,7 +75,7 @@
#include "setup.h" /* verbose */
#include "dialog.h" /* do_refresh() */
#include "color.h" /* dialog_colors */
#include "background.h" /* message_3s */
#include "background.h" /* mc_message */
#include "widget.h" /* WLabel */
#define WANT_WIDGETS
#include "main.h" /* the_hint */
@ -878,7 +878,7 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, char *text,
g_return_val_if_fail (ctx != NULL, NULL);
#if 0
message_3s (1, __FUNCTION__, "text = `%s' \n def_text = `%s'", text,
mc_message (1, __FUNCTION__, "text = `%s' \n def_text = `%s'", text,
def_text);
#endif
fmd_init_i18n (FALSE);
@ -951,7 +951,7 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, char *text,
&ctx->rx);
if (error) {
message_3s (1, MSG_ERROR, _("Invalid source pattern `%s' \n %s "),
mc_message (1, MSG_ERROR, _("Invalid source pattern `%s' \n %s "),
orig_mask, error);
if (orig_mask)
g_free (orig_mask);

Просмотреть файл

@ -138,7 +138,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) {
message_2s(1, MSG_ERROR, _("Cannot open cpio archive\n%s"), name);
mc_message (1, MSG_ERROR, _("Cannot open cpio archive\n%s"), name);
return -1;
}
@ -154,7 +154,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) {
message_2s(1, MSG_ERROR, _("Cannot open cpio archive\n%s"), s);
mc_message (1, MSG_ERROR, _("Cannot open cpio archive\n%s"), s);
g_free(s);
return -1;
}
@ -220,7 +220,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) {
message_2s(1, MSG_ERROR, _("Premature end of cpio archive\n%s"), super->name);
mc_message (1, MSG_ERROR, _("Premature end of cpio archive\n%s"), super->name);
cpio_free_archive(me, super);
return CPIO_UNKNOWN;
}
@ -306,7 +306,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) {
message_2s(1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"), super->name);
mc_message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"), super->name);
return STATUS_FAIL;
}
@ -356,7 +356,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) {
message_2s(1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
mc_message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
super->name);
return STATUS_FAIL;
}
@ -427,7 +427,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)) {
message_3s(1, MSG_ERROR, _("Inconsistent hardlinks of\n%s\nin cpio archive\n%s"),
mc_message (1, MSG_ERROR, _("Inconsistent hardlinks of\n%s\nin cpio archive\n%s"),
name, super->name);
inode = NULL;
}
@ -450,7 +450,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 */
message_2s(1, MSG_ERROR, _("%s contains duplicate entries! Skipping!"), super->name);
mc_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;
@ -519,7 +519,7 @@ static int cpio_open_archive(struct vfs_class *me, struct vfs_s_super *super, ch
switch(status) {
case STATUS_EOF:
message_2s(1, MSG_ERROR, _("Unexpected end of file\n%s"), name);
mc_message (1, MSG_ERROR, _("Unexpected end of file\n%s"), name);
return 0;
case STATUS_OK:
continue;

Просмотреть файл

@ -426,12 +426,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)
message_1s1d (1, " Direntry warning ",
mc_message (1, " Direntry warning ",
"Super ino_usage is %d, memory leak",
super->ino_usage);
if (super->want_stale)
message_1s (1, " Direntry warning ", "Super has want_stale set");
mc_message (1, " Direntry warning ", "Super has want_stale set");
#endif
if (super->prevp){

Просмотреть файл

@ -288,7 +288,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) {
message_3s (1, MSG_ERROR, _("Cannot open %s archive\n%s"),
mc_message (1, MSG_ERROR, _("Cannot open %s archive\n%s"),
extfs_prefixes[fstype], name);
return -1;
}
@ -1274,7 +1274,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 message_1s or similar,
/* We may not use vfs_die() message or mc_message or similar,
* UI is not initialized at this time and message would not
* appear on screen. */
if (!cfg) {

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -120,7 +120,7 @@ mcfs_login_server (int my_socket, char *user, int port,
return 0;
if (result != MC_VERSION_OK) {
message_1s (1, _(" MCFS "),
mc_message (1, _(" MCFS "),
_(" The server does not support this version "));
close (my_socket);
return 0;
@ -165,7 +165,7 @@ mcfs_login_server (int my_socket, char *user, int port,
return 0;
if (result != MC_LOGINOK) {
message_1s (1, _(" MCFS "), _(" Invalid password "));
mc_message (1, _(" MCFS "), _(" Invalid password "));
rpc_send (my_socket, RPC_INT, MC_QUIT, RPC_END);
close (my_socket);
return 0;
@ -225,7 +225,7 @@ open_tcp_link (char *host, int *port, int *version, char *caller)
sizeof (inaddr));
else {
if ((hp = gethostbyname (host)) == NULL) {
message_2s (1, caller, _(" Cannot locate hostname: %s "),
mc_message (1, caller, _(" Cannot locate hostname: %s "),
host);
return 0;
}
@ -244,13 +244,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) {
message_2s (1, caller, _(" Cannot create socket: %s "),
mc_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) {
message_2s (1, caller, _(" Cannot connect to server: %s "),
mc_message (1, caller, _(" Cannot connect to server: %s "),
unix_error_string (errno));
close (my_socket);
return 0;
@ -320,7 +320,7 @@ mcfs_open_link (char *host, char *user, int *port, char *netrcpass)
return &mcfs_connections[i];
}
if (mcfs_open_connections == MCFS_MAX_CONNECTIONS) {
message_1s (1, MSG_ERROR, _(" Too many open connections "));
mc_message (1, MSG_ERROR, _(" Too many open connections "));
return 0;
}

Просмотреть файл

@ -572,7 +572,7 @@ reconnect(smbfs_connection *conn, int *retries)
cli_shutdown(conn->cli);
if (!(conn->cli = smbfs_do_connect(host, conn->service))) {
message_2s (1, MSG_ERROR,
mc_message (1, MSG_ERROR,
_(" reconnect to %s failed\n "), conn->host);
g_free(host);
return False;
@ -1109,7 +1109,7 @@ smbfs_open_link (char *host, char *path, const char *user, int *port,
if (my_errno != EPERM)
return 0;
message_1s (1, MSG_ERROR, _(" Authentication failed "));
mc_message (1, MSG_ERROR, _(" Authentication failed "));
/* authentication failed, try again */
authinfo_remove (bucket->host, bucket->service);
@ -1621,7 +1621,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);
message_3s (1, MSG_ERROR, _(" Error %s creating directory %s "),
mc_message (1, MSG_ERROR, _(" Error %s creating directory %s "),
cli_errstr (sc->cli), CNV_LANG (path));
g_free (path);
return -1;
@ -1644,7 +1644,7 @@ smbfs_rmdir (struct vfs_class *me, char *path)
if (!cli_rmdir(sc->cli, path)) {
my_errno = cli_error(sc->cli, NULL, &err, NULL);
message_3s (1, MSG_ERROR, _(" Error %s removing directory %s "),
mc_message (1, MSG_ERROR, _(" Error %s removing directory %s "),
cli_errstr(sc->cli), CNV_LANG(path));
g_free (path);
return -1;
@ -1753,7 +1753,7 @@ open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int mode)
DENY_NONE);
if (remote_handle->fnum == -1) {
message_3s (1, MSG_ERROR, _(" %s opening remote file %s "),
mc_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)));
@ -1769,7 +1769,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)) {
message_2s (1, MSG_ERROR, " getattrib: %s ",
mc_message (1, MSG_ERROR, " getattrib: %s ",
cli_errstr (remote_handle->cli));
DEBUG (1,
("smbfs_open(rname:%s) getattrib:%s\n", rname,
@ -1826,7 +1826,7 @@ smbfs_unlink (struct vfs_class *me, char *path)
g_free (p);
if (!cli_unlink(sc->cli, remote_file)) {
message_3s (1, MSG_ERROR, _(" %s removing remote file %s "),
mc_message (1, MSG_ERROR, _(" %s removing remote file %s "),
cli_errstr(sc->cli), CNV_LANG(remote_file));
g_free (remote_file);
return -1;
@ -1864,7 +1864,7 @@ smbfs_rename (struct vfs_class *me, char *a, char *b)
g_free (rb);
if (!retval) {
message_2s (1, MSG_ERROR, _(" %s renaming files\n"),
mc_message (1, MSG_ERROR, _(" %s renaming files\n"),
cli_errstr(sc->cli));
return -1;
}

Просмотреть файл

@ -79,7 +79,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) {
message_2s (1, MSG_ERROR, _("Cannot open tar archive\n%s"), name);
mc_message (1, MSG_ERROR, _("Cannot open tar archive\n%s"), name);
ERRNOR (ENOENT, -1);
}
@ -96,7 +96,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)
message_2s (1, MSG_ERROR, _("Cannot open tar archive\n%s"), s);
mc_message (1, MSG_ERROR, _("Cannot open tar archive\n%s"), s);
g_free(s);
if (result == -1)
ERRNOR (ENOENT, -1);
@ -279,7 +279,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) {
message_1s (1, MSG_ERROR, _("Unexpected EOF on archive file"));
mc_message (1, MSG_ERROR, _("Unexpected EOF on archive file"));
return STATUS_BADCHECKSUM;
}
written = RECORDSIZE;
@ -331,14 +331,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) {
message_1s (1, MSG_ERROR, _("Inconsistent tar archive"));
mc_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) {
message_1s (1, MSG_ERROR, _("Inconsistent tar archive"));
mc_message (1, MSG_ERROR, _("Inconsistent tar archive"));
} else {
entry = vfs_s_new_entry(me, p, inode);
vfs_s_insert_entry(me, parent, entry);
@ -408,7 +408,7 @@ static int open_archive (struct vfs_class *me, struct vfs_s_super *archive, char
/* Error on first record */
case STATUS_EOFMARK:
message_2s (1, MSG_ERROR, _("Hmm,...\n%s\ndoesn't look like a tar archive."), name);
mc_message (1, MSG_ERROR, _("Hmm,...\n%s\ndoesn't look like a tar archive."), name);
/* FALL THRU */
/* Error after header rec */

Просмотреть файл

@ -179,20 +179,20 @@ undelfs_loaddel (void)
num_delarray = 0;
delarray = g_new (struct deleted_info, max_delarray);
if (!delarray) {
message_1s (1, undelfserr, _(" not enough memory "));
mc_message (1, undelfserr, _(" not enough memory "));
return 0;
}
block_buf = g_malloc (fs->blocksize * 3);
if (!block_buf) {
message_1s (1, undelfserr, _(" while allocating block buffer "));
mc_message (1, undelfserr, _(" while allocating block buffer "));
goto free_delarray;
}
if ((retval = ext2fs_open_inode_scan(fs, 0, &scan))){
message_1s1d (1, undelfserr, _(" open_inode_scan: %d "), retval);
mc_message (1, undelfserr, _(" open_inode_scan: %d "), retval);
goto free_block_buf;
}
if ((retval = ext2fs_get_next_inode(scan, &ino, &inode))){
message_1s1d (1, undelfserr, _(" while starting inode scan %d "), retval);
mc_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) {
message_1s1d (1, undelfserr, _(" while calling ext2_block_iterate %d "), retval);
mc_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) {
message_1s (1, undelfserr, _(" no more memory while reallocating array "));
mc_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) {
message_1s1d(1, undelfserr, _(" while doing inode scan %d "), retval);
mc_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);
message_1s (1, _(" Ext2lib error "), cptr);
mc_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)){
message_2s (1, undelfserr, _(" Cannot open file %s "), ext2_fname);
mc_message (1, undelfserr, _(" Cannot open file %s "), ext2_fname);
return 0;
}
print_vfs_message (_("undelfs: reading inode bitmap..."));
if (ext2fs_read_inode_bitmap (fs)){
message_2s (1, undelfserr,
mc_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)){
message_2s (1, undelfserr,
mc_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) {
message_1s(1, undelfserr, _(" vfs_info is not fs! "));
mc_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)){
message_1s (1, undelfserr, _(" You have to chdir to extract files first "));
mc_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){
message_1s (1, undelfserr, _(" while iterating over blocks "));
mc_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)){
message_1s (1, undelfserr, _(" You have to chdir to extract files first "));
mc_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){
message_2s (1, undelfserr, _(" Cannot open file %s "), file);
mc_message (1, undelfserr, _(" Cannot open file %s "), file);
g_free (f);
g_free (file);
return -1;

Просмотреть файл

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

Просмотреть файл

@ -1113,7 +1113,7 @@ mc_def_ungetlocalcopy (struct vfs_class *vfs, char *filename, char *local, int h
return 0;
failed:
message_1s (1, _("Changes to file lost"), filename);
mc_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 message_1s */
calls mc_message */
if (locked)
return;
locked = 1;
@ -1788,9 +1788,9 @@ error:
static int errorcount = 0;
if (++errorcount < 5) {
message_1s (1, _("Cannot parse:"), (p_copy && *p_copy) ? p_copy : line);
mc_message (1, _("Cannot parse:"), (p_copy && *p_copy) ? p_copy : line);
} else if (errorcount == 5)
message_1s (1, _("Error"), _("More parsing errors will be ignored."));
mc_message (1, _("Error"), _("More parsing errors will be ignored."));
}
g_free (p_copy);
@ -1800,7 +1800,7 @@ error:
void
vfs_die (const char *m)
{
message_1s (1, _("Internal error:"), m);
mc_message (1, _("Internal error:"), m);
exit (1);
}