1999-12-15 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>

* Merged changes by Andrew V. Samoilov <sav@bcs.zp.ua>. They are
	mostly internationalization + fixing stupid bugs of mine
This commit is contained in:
Pavel Machek 1999-12-16 12:55:16 +00:00
parent 8ce6f164c9
commit 748e4c38f9
8 changed files with 83 additions and 74 deletions

View File

@ -1,3 +1,8 @@
1999-12-15 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
* Merged changes by Andrew V. Samoilov <sav@bcs.zp.ua>. They are
mostly internationalization + fixing stupid bugs of mine
1999-12-08 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
* ftpfs.c: basically replaced ftpfs with new one. Unlike the

View File

@ -3,6 +3,8 @@
*
* Written at 1998 by Pavel Machek <pavel@ucw.cz>, distribute under LGPL.
*
* $Id$
*
* Very loosely based on tar.c from midnight and archives.[ch] from
* avfs by Miklos Szeredi (mszeredi@inf.bme.hu)
*
@ -313,7 +315,7 @@ vfs_s_find_entry_linear (vfs *me, vfs_s_inode *root, char *path, int follow, int
if (ent && (! (MEDATA->dir_uptodate) (me, ent->ino))){
#if 1
print_vfs_message ("Dir cache expired for %s", path);
print_vfs_message (_("Dir cache expired for %s"), path);
sleep(1);
#endif
vfs_s_free_entry (me, ent);
@ -441,12 +443,12 @@ vfs_s_free_super (vfs *me, vfs_s_super *super)
}
#if 0
/* We currently leak small ammount of memory, sometimes. Fix it if you can. */
/* FIXME: We currently leak small ammount of memory, sometimes. Fix it if you can. */
if (super->ino_usage)
message_1s1d (1, " Direntry warning ", "Super ino_usage is %d, memory leak", super->ino_usage);
message_1s1d (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");
message_1s (1, _(" Direntry warning "), _("Super has want_stale set"));
#endif
if (super->prevp){
@ -557,8 +559,6 @@ vfs_s_fullpath (vfs *me, vfs_s_inode *ino)
if (MEDATA->find_entry != vfs_s_find_entry_linear)
vfs_die ("Implement me!");
if (!ino->ent) /* That must be directory... */
if (!ino->ent)
ERRNOR (EAGAIN, NULL);
if ((!ino->ent->dir) || (!ino->ent->dir->ent)) /* It must be directory */
@ -584,16 +584,12 @@ vfs_s_inode *
vfs_s_inode_from_path (vfs *me, char *name, int flags)
{
struct vfs_s_super *super;
struct vfs_s_inode *ino;
char *q;
if (!(q = vfs_s_get_path_mangle (me, name, &super, 0)))
return NULL;
ino = vfs_s_find_inode (me, super->root, q, flags & FL_FOLLOW ? LINK_FOLLOW : LINK_NO_FOLLOW, flags & ~FL_FOLLOW);
if (ino) return ino;
return ino;
return vfs_s_find_inode (me, super->root, q, flags & FL_FOLLOW ? LINK_FOLLOW : LINK_NO_FOLLOW, flags & ~FL_FOLLOW);
}
@ -823,7 +819,7 @@ vfs_s_read (void *fh, char *buffer, int count)
vfs *me = FH_SUPER->me;
if (FH->linear == LS_LINEAR_CLOSED){
print_vfs_message ("Starting linear transfer...");
print_vfs_message (_("Starting linear transfer..."));
if (!MEDATA->linear_start (me, FH, 0))
return -1;
}
@ -968,7 +964,7 @@ vfs_s_retrieve_file(vfs *me, struct vfs_s_inode *ino)
break;
total += n;
vfs_print_stats (me->name, "Getting file", ino->ent->name, total, stat_size);
vfs_print_stats (me->name, _("Getting file"), ino->ent->name, total, stat_size);
if (write(handle, buffer, n) < 0) {
me->verrno = errno;

View File

@ -5,6 +5,8 @@
Written by: 1998 Pavel Machek
$Id$
Derived from ftpfs.c.
This program is free software; you can redistribute it and/or
@ -226,7 +228,7 @@ open_archive_int (vfs *me, vfs_s_super *super)
#endif
if (!SUP.password){
char *p, *op;
p = g_strconcat (" fish: Password required for ", SUP.user,
p = g_strconcat (_(" fish: Password required for "), SUP.user,
" ", NULL);
op = vfs_get_password (p);
g_free (p);

View File

@ -6,7 +6,8 @@
1995, 1996, 1997 Miguel de Icaza
1997 Norbert Warmuth
1998 Pavel Machek
$Id$
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2 of
@ -132,14 +133,12 @@ static char reply_str [80];
*/
static char *
translate_path (vfs *me, vfs_s_super *super, char *remote_path)
translate_path (vfs *me, vfs_s_super *super, const char *remote_path)
{
char *p;
if (!SUP.remote_is_amiga)
return remote_path;
return g_strdup (remote_path);
else {
char *ret;
char *ret, *p;
if (logfile) {
fprintf (logfile, "MC -- translate_path: %s\n", remote_path);
@ -931,10 +930,11 @@ open_data_connection (vfs *me, vfs_s_super *super, char *cmd, char *remote,
if (j != CONTINUE)
return -1;
}
if (remote)
j = command (me, super, WAIT_REPLY, "%s /%s", cmd,
translate_path (me, super, remote));
else
if (remote) {
char * remote_path = translate_path (me, super, remote);
j = command (me, super, WAIT_REPLY, "%s /%s", cmd, remote_path);
g_free (remote_path);
} else
j = command (me, super, WAIT_REPLY, "%s", cmd);
if (j != PRELIM)
ERRNOR (EPERM, -1);
@ -1155,10 +1155,12 @@ dir_load(vfs *me, vfs_s_inode *dir, char *remote_path)
p = translate_path (me, super, remote_path);
if (ftpfs_chdir_internal (me, super, p) != COMPLETE) {
g_free (p);
my_errno = ENOENT;
print_vfs_message(_("ftpfs: CWD failed."));
return -1;
}
g_free (p);
}
gettimeofday(&dir->u.ftp.timestamp, NULL);
@ -1414,8 +1416,9 @@ send_ftp_command(vfs *me, char *filename, char *cmd, int flags)
if (!(rpath = vfs_s_get_path_mangle(me, filename, &super, 0)))
return -1;
p = translate_path (me, super, rpath);
r = command (me, super, WAIT_REPLY, cmd, p);
g_free(rpath);
r = command (me, super, WAIT_REPLY, cmd, p);
g_free (p);
vfs_add_noncurrent_stamps (&vfs_ftpfs_ops, (vfsid) super, NULL);
if (flags & OPT_IGNORE_ERROR)
r = COMPLETE;
@ -1499,6 +1502,7 @@ ftpfs_chdir_internal (vfs *me, vfs_s_super *super, char *remote_path)
p = translate_path (me, super, remote_path);
r = command (me, super, WAIT_REPLY, "CWD /%s", p);
g_free (p);
if (r != COMPLETE) {
my_errno = EIO;

View File

@ -6,6 +6,8 @@
Andrej Borsenkow
Norbert Warmuth
$Id$
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2 of
@ -173,7 +175,7 @@ static int mcfs_login_server (int my_socket, char *user, int port,
" not be safe on the remote side. Continue? \n"), 3, 2,
_(" Yes "), _(" No "));
#else
message_1s( 1, " MCFS ", _(" The remote server is running on strange port. Giving up.\n"));
message_1s( 1, _(" MCFS "), _(" The remote server is running on strange port. Giving up.\n"));
v = 1;
#endif
@ -199,7 +201,7 @@ static int mcfs_login_server (int my_socket, char *user, int port,
return 0;
if (result != MC_LOGINOK){
message_1s (1, " MCFS ", _(" Invalid password "));
message_1s (1, _(" MCFS "), _(" Invalid password "));
rpc_send (my_socket, RPC_INT, MC_QUIT, RPC_END);
close (my_socket);
return 0;
@ -230,7 +232,7 @@ open_tcp_link (char *host, int *port, int *version, char *caller)
sizeof (inaddr));
else {
if ((hp = gethostbyname (host)) == NULL){
message_2s (1, caller, " Can't locate hostname: %s ", host);
message_2s (1, caller, _(" Can't locate hostname: %s "), host);
return 0;
}
bcopy ((char *) hp->h_addr, (char *) &server_address.sin_addr,
@ -248,13 +250,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, " Can't create socket: %s ",
message_2s (1, caller, _(" Can't 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, " Can't connect to server: %s ",
message_2s (1, caller, _(" Can't connect to server: %s "),
unix_error_string (errno));
close (my_socket);
return 0;
@ -1122,7 +1124,7 @@ mcfs_setctl (vfs *me, char *path, int ctlop, char *arg)
vfs vfs_mcfs_ops = {
NULL, /* This is place of next pointer */
"Midnight Commander's private remote filesystem",
N_("Midnight Commander's private remote filesystem"),
F_NET, /* flags */
"mc:", /* prefix */
NULL, /* data */

View File

@ -1,6 +1,8 @@
/*
* Shared code between the fish.c and the ftp.c file systems
*
* $Id$
*
* Actually, this code is not being used by fish.c any more :-).
*
* Namespace pollution: X_hint_reread, X_flushdir.
@ -861,7 +863,7 @@ static int retrieve_file(struct direntry *fe)
break;
total += n;
vfs_print_stats (X, "Getting file", fe->remote_filename, total, stat_size);
vfs_print_stats (X, _("Getting file"), fe->remote_filename, total, stat_size);
while (write(local_handle, buffer, n) < 0) {
if (errno == EINTR) {

View File

@ -10,6 +10,8 @@
Written by: 1995 Miguel de Icaza.
1997 Norbert Warmuth.
$Id$
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2 of
@ -75,7 +77,7 @@ static struct lsdel_struct lsd;
static struct deleted_info *delarray;
static int num_delarray, max_delarray;
static char *block_buf;
static char *undelfserr = " undelfs: error ";
static char *undelfserr = N_(" undelfs: error ");
static int readdir_ptr;
static int undelfs_usage;
@ -178,27 +180,27 @@ undelfs_loaddel (void)
num_delarray = 0;
delarray = g_new (struct deleted_info, max_delarray);
if (!delarray) {
message_1s (1, undelfserr, " not enough memory ");
message_1s (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 ");
message_1s (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);
message_1s1d (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);
message_1s1d (1, undelfserr, _(" while starting inode scan %d "), retval);
goto error_out;
}
count = 0;
while (ino) {
if ((count++ % 1024) == 0)
print_vfs_message ("undelfs: loading deleted files information %d inodes", count);
print_vfs_message (_("undelfs: loading deleted files information %d inodes"), count);
if (inode.i_dtime == 0)
goto next;
@ -213,7 +215,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);
message_1s1d (1, undelfserr, _(" while calling ext2_block_iterate %d "), retval);
goto next;
}
if (lsd.free_blocks && !lsd.bad_blocks) {
@ -221,7 +223,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 ");
message_1s (1, undelfserr, _(" no more memory while reallocating array "));
goto error_out;
}
}
@ -240,7 +242,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);
message_1s1d(1, undelfserr, _(" while doing inode scan %d "), retval);
goto error_out;
}
}
@ -264,7 +266,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);
message_1s (1, _(" Ext2lib error "), cptr);
g_free (cptr);
}
@ -291,28 +293,28 @@ undelfs_opendir (vfs *me, char *dirname)
}
if (ext2fs_open (ext2_fname, 0, 0, 0, unix_io_manager, &fs)){
message_2s (1, undelfserr, " Could not open file %s ", ext2_fname);
message_2s (1, undelfserr, _(" Could not open file %s "), ext2_fname);
return 0;
}
print_vfs_message ("undelfs: reading inode bitmap...");
print_vfs_message (_("undelfs: reading inode bitmap..."));
if (ext2fs_read_inode_bitmap (fs)){
message_2s (1, undelfserr,
" Could not load inode bitmap from: \n %s \n", ext2_fname);
_(" Could not load inode bitmap from: \n %s \n"), ext2_fname);
goto quit_opendir;
}
print_vfs_message ("undelfs: reading block bitmap...");
print_vfs_message (_("undelfs: reading block bitmap..."));
if (ext2fs_read_block_bitmap (fs)){
message_2s (1, undelfserr,
" Could not load block bitmap from: \n %s \n", ext2_fname);
_(" Could not load block bitmap from: \n %s \n"), ext2_fname);
goto quit_opendir;
}
/* Now load the deleted information */
if (!undelfs_loaddel ())
goto quit_opendir;
print_vfs_message ("undelfs: done.");
print_vfs_message (_("undelfs: done."));
return fs;
quit_opendir:
print_vfs_message ("undelfs: failure");
print_vfs_message (_("undelfs: failure"));
ext2fs_close (fs);
fs = NULL;
return 0;
@ -336,8 +338,8 @@ undelfs_readdir (void *vfs_info)
char *dirent_dest;
if (vfs_info != fs){
message_1s (1, " delfs: internal error ",
" vfs_info is not fs! ");
message_1s (1, _(" delfs: internal error "),
_(" vfs_info is not fs! "));
return NULL;
}
if (readdir_ptr == num_delarray)
@ -393,7 +395,7 @@ undelfs_open (vfs *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 ");
message_1s (1, undelfserr, _(" You have to chdir to extract files first "));
g_free (file);
g_free (f);
return 0;
@ -516,7 +518,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 ");
message_1s (1, undelfserr, _(" while iterating over blocks "));
return -1;
}
if (p->error_code && !p->finished)
@ -577,7 +579,7 @@ undelfs_lstat(vfs *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 ");
message_1s (1, undelfserr, _(" You have to chdir to extract files first "));
g_free (file);
g_free (f);
return 0;
@ -621,7 +623,7 @@ undelfs_chdir(vfs *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, " Could not open file: %s ", file);
message_2s (1, undelfserr, _(" Could not open file: %s "), file);
g_free (f);
g_free (file);
return -1;
@ -669,7 +671,7 @@ undelfs_free(vfsid id)
vfs vfs_undelfs_ops = {
NULL, /* This is place of next pointer */
"Undelete filesystem for ext2",
N_("Undelete filesystem for ext2"),
0, /* flags */
"undel:", /* prefix */
NULL, /* data */

View File

@ -315,7 +315,7 @@ vfs_addstamp (vfs *v, vfsid id, struct vfs_stamping *parent)
stamp->id = id;
if (parent){
struct vfs_stamping *st = stamp;
for (; parent;){
while (parent){
st->parent = g_new (struct vfs_stamping, 1);
*st->parent = *parent;
parent = parent->parent;
@ -456,12 +456,9 @@ MC_HANDLEOP(read, (int handle, char *buffer, int count), (vfs_info (handle), buf
int
mc_ctl (int handle, int ctlop, int arg)
{
vfs *vfs;
int result;
vfs *vfs = vfs_op (handle);
vfs = vfs_op (handle);
result = vfs->ctl ? (*vfs->ctl)(vfs_info (handle), ctlop, arg) : 0;
return result;
return vfs->ctl ? (*vfs->ctl)(vfs_info (handle), ctlop, arg) : 0;
}
int
@ -1157,7 +1154,7 @@ mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local, int has_changed)
return 0;
failed:
message_1s (1, "Changes to file lost", filename);
message_1s (1, _("Changes to file lost"), filename);
if (fdout) mc_close(fdout);
if (fdin) close(fdin);
unlink (local);
@ -1169,7 +1166,6 @@ int
mc_ungetlocalcopy (char *path, char *local, int has_changed)
{
vfs *vfs;
int res;
path = vfs_canon (path);
vfs = vfs_type (path);
@ -1758,11 +1754,11 @@ vfs_parse_ls_lga (char *p, struct stat *s, char **filename, char **linkname)
}
if (linkname){
s = g_strdup (p_copy + column_ptr [idx2+1]);
p = strlen (s);
p = strlen (s) - 1;
if (s [p] == '\r' || s [p] == '\n')
s [p] = 0;
if (s [p-1] == '\r' || s [p-1] == '\n')
s [p-1] = 0;
if (s [p-2] == '\r' || s [p-2] == '\n')
s [p-2] = 0;
*linkname = s;
}
@ -1778,12 +1774,12 @@ vfs_parse_ls_lga (char *p, struct stat *s, char **filename, char **linkname)
char *s;
s = g_strdup (p_copy + column_ptr [idx++]);
p = strlen (s);
p = strlen (s) - 1;
/* g_strchomp(); */
if (s [p] == '\r' || s [p] == '\n')
s [p] = 0;
if (s [p-1] == '\r' || s [p-1] == '\n')
s [p-1] = 0;
if (s [p-2] == '\r' || s [p-2] == '\n')
s [p-2] = 0;
s [p-1] = 0;
*filename = s;
}
@ -1798,9 +1794,9 @@ error:
static int errorcount = 0;
if (++errorcount < 5) {
message_1s (1, "Could not parse:", p_copy);
message_1s (1, _("Could not parse:"), p_copy);
} else if (errorcount == 5)
message_1s (1, "More parsing errors will be ignored.", "(sorry)" );
message_1s (1, _("More parsing errors will be ignored."), _("(sorry)"));
}
if (p_copy != p) /* Carefull! */
@ -1811,7 +1807,7 @@ error:
void
vfs_die (char *m)
{
message_1s (1, "Internal error:", m);
message_1s (1, _("Internal error:"), m);
exit (1);
}