#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include "msg.h"
int get_cmd_type(char *cmd) //将命令字符串转换成整数
{
if(!strcmp("ls",cmd)) return LS;
if(!strcmp("quit",cmd)) return QUIT;
if(!strcmp("lpwd",cmd)) return LPWD;
if(!strcmp("pwd",cmd)) return PWD;
if(!strcmp("lls",cmd)) return LLS;
if(strstr(cmd,"lcd")) return LCD; //LCD必须写在CD前,否则当输入lcd时将会返回CD
if(strstr(cmd,"cd")) return CD;
if(strstr(cmd,"get")) return GET;
if(strstr(cmd,"put")) return PUT;
return -1;
}
char *getdir(char *cmd) //分离参数
{
char *p;
p=strtok(cmd," "); //strtok函数会破坏被分解字
基于TCP协议的简易FTP云盘(客户端)
于 2021-01-10 15:57:11 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)