9fans archive / 1997 / 12 / 5 /    prev next

From: arisawa@veg... arisawa@veg...
Subject: [9fans] A patch for ftp
Date: Fri, 5 Dec 1997 10:57:52 +0900

Hello 9fans

This is a patch to /sys/src/cmd/service/ftp.c
The patch includes:
1. bug fix to:
	tcp!port messgae
     This problem is already spoken elsewhere.
2. bug fix to:
	ls -l
    I announced previously.
3. support size command
    New patch
4. put "/" after directory names
    New patch

Change the source to work it:

term% diff ftp.c.orig ftp.c
62a63
> int	sizecmd(char*);
102a104
> 	{ "size",  	sizecmd, },
673c675
< 		sprint(buf, "tcp!%d", port);
---
> 		sprint(buf, "tcp!*!%d", port);
753c755,756
< 	n += sprint(buf+n, "%s", name);
---
> 	if(d->mode & CHDIR) n += sprint(buf+n, "%s/", name);
> 	else n += sprint(buf+n, "%s", name);
898,899c901,902
< 	if(Cflag)
< 		lflag = 0;
---
> 	if(lflag)
> 		Cflag = 0;
1532a1536,1545
> }
> 
> int
> sizecmd(char *file)
> {	Dir edir;
> 	if(stat(file,(char*)&edir))
> 		return reply("550 %s: No such file or directory.",file);
> 	if(edir.mode & CHDIR) /* directory */
> 		return reply("550 %s: not a plain file.",file);
> 	return reply("213 %lld",edir.vlength);

You can get this boddle from:
	ftp://plan9.aichi-u.ac.jp/netlib/patchs/ftp.bod

Kenji Arisawa
E-mail: arisawa@aic...