-------arm----中编译---ftp命令-----

step1:tar zxvf netkit-ftp-0.17 (1).tar.gz
step2:patch -p1< netkit-ftp-0.17-cross.patch 
step3:./configure --with-c-compiler=arm-none-linux-gnueabi-gcc 
step4:make

使用:
[root@FriendlyARM bin]# ftp -h


        Usage: { ftp | pftp } [-pinegvtd] [hostname]
           -p: enable passive mode (default for pftp)
           -i: turn off prompting during mget
           -n: inhibit auto-login
           -e: disable readline support, if present
           -g: disable filename globbing
           -v: verbose mode
           -t: enable packet tracing [nonfunctional]
           -d: enable debugging
          
ftp> ?
Commands may be abbreviated.  Commands are:


!               debug           mdir            sendport        site
$               dir             mget            put             size
account         disconnect      mkdir           pwd             status
append          exit            mls             quit            struct
ascii           form            mode            quote           system
bell            get             modtime         recv            sunique
binary          glob            mput            reget           tenex
bye             hash            newer           rstatus         tick
case            help            nmap            rhelp           trace
cd              idle            nlist           rename          type
cdup            image           ntrans          reset           user
chmod           lcd             open            restart         umask
close           ls              prompt          rmdir           verbose
cr              macdef          passive         runique         ?
delete          mdelete         proxy           send
ftp> 






ftp> bin #bin 代表采用二进制的文件  //<----windows和嵌入式拷贝的时候,很重要.
200 Type set to I
ftp> hash #显示传输进度
Hash mark printing on (1024 bytes/hash mark).
ftp> ls #查看ftp目录下文件




一般使用: 
step1: #./ftp
#open 192.168.1.10
输入 sno
mima 123456
ftp>bin
ftp>hash
get xxx.file
put xxx.file
quit.
退出一定用quit




ftp上传的时候,有bin和ascii两种区别
使用bin命令传输时,什么也不会改变,按照源文件传输,
而用ascii方式传输时会将行结束符从来源的机器所用的行结束符转换成接收机器所用的行结束符。
例如:ascii可能将一个 cr 转换成 一个 nl (这通常表示成一个 lf)。
而且ascii指示ftp注意文件的结束符,在pc中表现为: control-z 
(因此,文件结束符可以结束文件的内容,但不一定表示文件的物理结束)
所以,如果文件本身是二进制的,应该完全不变的传输,这时需要使用bin模式
而对文本文件而言,就需要转换。否则有可能得到这样的结果:
this line ends ^M
and another line ends ^M
and we should have ended^M but did not^M which does^M
not look great.^M^Z
这种情况发生在当来源机器使用lf cr作为行结束符而 lf 是接收机器的行结束符,
并且使用bin模式传输文件时。当不确定使用什么模式时,使用bin模式。使用bin更快些,
并且不会对文件产生什么伤害(因为 bin模式没有检查文件和转换行结束符)。
有很多软件可以将文本(ascii)文件在不同的行结束符之间进行转换,可以用bin下载后再转换。
根据vim里面的help,vim里dos格式使用单个的<nl>或<cr><nl>作为行结束符,写文件时,
vim使用<cr><nl>,如果编辑一个文件并在dos格式下保存,vim使用<cr><nl>替换单个的<nl>;
如果是unix格式,vim使用单个<nl>作为行结束符,将<cr>显示为^M。

在dos格式下读并在unix格式下保存,可以将<cr><nl>替换为单个的<nl>



diff -Naur netkit-ftp-0.17.orig/configure netkit-ftp-0.17/configure
--- netkit-ftp-0.17.orig/configure	2008-01-21 15:27:56.000000000 -0500
+++ netkit-ftp-0.17/configure	2008-01-21 15:27:58.000000000 -0500
@@ -93,7 +93,6 @@
          echo 'no'
          echo 'Compiler '"$CC"' does not exist or cannot compile C; try another.'
          rm -f __conftest*
-         exit
      fi
 fi
 
@@ -180,7 +179,6 @@
         echo 'no'
         echo 'This package needs BSD signal semantics to run.'
         rm -f __conftest*
-        exit
     fi
 fi
 rm -f __conftest*
@@ -238,7 +236,6 @@
         echo 'not found'
         echo 'This package needs termcap to run.'
         rm -f __conftest*
-        exit
     fi
 fi
 rm -f __conftest*
@@ -323,7 +320,6 @@
             echo 'no'
             echo 'Cannot work out what to use for socklen_t. Help...'
             rm -f __conftest*
-            exit
         fi
     fi
 fi
@@ -400,7 +396,6 @@
             echo 'missing'
             echo 'This package requires snprintf.'
             rm -f __conftest*
-            exit
         fi
     fi
 fi
diff -Naur netkit-ftp-0.17.orig/ftp/cmds.c netkit-ftp-0.17/ftp/cmds.c
--- netkit-ftp-0.17.orig/ftp/cmds.c	2008-01-21 15:27:56.000000000 -0500
+++ netkit-ftp-0.17/ftp/cmds.c	2008-01-21 15:27:58.000000000 -0500
@@ -68,6 +68,10 @@
 #include "cmds.h"
 #include "glob.h"
 
+#ifndef index
+#define index strchr
+#endif
+
 void intr(int);
 
 extern FILE *cout;
diff -Naur netkit-ftp-0.17.orig/ftp/ftp.c netkit-ftp-0.17/ftp/ftp.c
--- netkit-ftp-0.17.orig/ftp/ftp.c	2008-01-21 15:27:56.000000000 -0500
+++ netkit-ftp-0.17/ftp/ftp.c	2008-01-21 15:27:58.000000000 -0500
@@ -65,6 +65,13 @@
 
 #include "../version.h"
 
+#ifndef index
+#define index strchr
+#endif
+#ifndef rindex
+#define rindex strrchr
+#endif
+
 int data = -1;
 off_t restart_point = 0;
 
diff -Naur netkit-ftp-0.17.orig/ftp/Makefile netkit-ftp-0.17/ftp/Makefile
--- netkit-ftp-0.17.orig/ftp/Makefile	2008-01-21 15:27:56.000000000 -0500
+++ netkit-ftp-0.17/ftp/Makefile	2008-01-21 15:30:01.000000000 -0500
@@ -16,11 +16,12 @@
 cmds.o glob.o: glob.h
 
 install: ftp
-	install -s -m$(BINMODE) ftp $(INSTALLROOT)$(BINDIR)
-	ln -sf ftp $(INSTALLROOT)$(BINDIR)/pftp
-	install -m$(MANMODE) ftp.1 $(INSTALLROOT)$(MANDIR)/man1
-	ln -sf ftp.1 $(INSTALLROOT)$(MANDIR)/man1/pftp.1
-	install -m$(MANMODE) netrc.5 $(INSTALLROOT)$(MANDIR)/man5
+	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man{1,5}
+	install -m$(BINMODE) ftp $(DESTDIR)$(BINDIR)
+	cd $(DESTDIR)$(BINDIR)/ && ln -sf ftp pftp
+	install -m$(MANMODE) ftp.1 $(DESTDIR)$(MANDIR)/man1
+	cd $(DESTDIR)$(MANDIR)/man1 && ln -sf ftp.1 pftp.1
+	install -m$(MANMODE) netrc.5 $(DESTDIR)$(MANDIR)/man5
 
 clean:
 	rm -f *.o ftp
diff -Naur netkit-ftp-0.17.orig/ftp/ruserpass.c netkit-ftp-0.17/ftp/ruserpass.c
--- netkit-ftp-0.17.orig/ftp/ruserpass.c	2008-01-21 15:27:56.000000000 -0500
+++ netkit-ftp-0.17/ftp/ruserpass.c	2008-01-21 15:27:58.000000000 -0500
@@ -58,6 +58,10 @@
 #define	ID	10
 #define	MACH	11
 
+#ifndef index
+#define index strchr
+#endif
+
 static char tokval[100];
 
 static struct toktab {


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值