* xdirentry.h (vfs_s_fh.u.fish): Add append field.

* fish.c (fish_fh_open): Care about append.
(linear_open): Likewise.
(fish_store): Append data to target file if append is true.
This commit is contained in:
Andrew V. Samoilov 2002-07-26 01:33:40 +00:00
parent 3dc53f9d41
commit 6bd685bd7c
3 changed files with 28 additions and 4 deletions

View File

@ -1,5 +1,10 @@
2002-07-25 Andrew V. Samoilov <kai@cmail.ru>
* xdirentry.h (vfs_s_fh.u.fish): Add append field.
* fish.c (fish_fh_open): Care about append.
(linear_open): Likewise.
(fish_store): Append data to target file if append is true.
* mcserv.c [HAVE_MAD]: Include "../src/mad.c" at the end of
file to fix compilation.
(main): Add mad_init() and mad_finalize().

View File

@ -497,7 +497,8 @@ file_store(vfs *me, vfs_s_fh *fh, char *name, char *localname)
* FIXME: Limit size to unsigned long for now.
* Files longer than 256 * ULONG_MAX are not supported.
*/
if (command (me, super, WAIT_REPLY,
if (!fh->u.fish.append)
n = command (me, super, WAIT_REPLY,
"#STOR %lu /%s\n"
"> \"/%s\"\n"
"echo '### 001'\n"
@ -510,8 +511,23 @@ file_store(vfs *me, vfs_s_fh *fh, char *name, char *localname)
"); echo '### 200'\n",
(unsigned long) s.st_size, name, name,
(unsigned long) (s.st_size >> 8),
((unsigned long) s.st_size) & (256 - 1), name)
!= PRELIM)
((unsigned long) s.st_size) & (256 - 1), name);
else
n = command (me, super, WAIT_REPLY,
"#STOR %lu /%s\n"
"echo '### 001'\n"
"(\n"
"dd ibs=256 obs=4096 count=%lu\n"
"dd bs=%lu count=1\n"
") 2>/dev/null | (\n"
"cat >> \"/%s\"\n"
"cat > /dev/null\n"
"); echo '### 200'\n",
(unsigned long) s.st_size, name,
(unsigned long) (s.st_size >> 8),
((unsigned long) s.st_size) & (256 - 1), name);
if (n != PRELIM)
ERRNOR(E_REMOTE, -1);
total = 0;
@ -555,6 +571,7 @@ static int linear_start(vfs *me, vfs_s_fh *fh, int offset)
name = vfs_s_fullpath (me, fh->ino);
if (!name)
return 0;
fh->u.fish.append = 0;
offset = command(me, FH_SUPER, WANT_STRING,
"#RETR /%s\n"
"ls -l \"/%s\" 2>/dev/null | (\n"
@ -786,8 +803,10 @@ static int fish_rmdir (vfs *me, char *path)
static int fish_fh_open (vfs *me, vfs_s_fh *fh, int flags, int mode)
{
fh->u.fish.append = 0;
/* File will be written only, so no need to retrieve it */
if (((flags & O_WRONLY) == O_WRONLY) && !(flags & (O_RDONLY|O_RDWR))){
fh->u.fish.append = flags & O_APPEND;
if (!fh->ino->localname){
int tmp_handle = mc_mkstemps (&fh->ino->localname, me->name, NULL);
if (tmp_handle == -1)

View File

@ -137,7 +137,7 @@ typedef struct vfs_s_fh {
int linear; /* Is that file open with O_LINEAR? */
union {
struct {
int got, total;
int got, total, append;
} fish;
struct {
int sock, append;