📄 help.c
字号:
/* dftp: FTP client example * Copyright (c) 1996 by Donald C. Asonye * Email: donald@uh.edu * * help.c * * This and other files are hereby released to the public for * educational purposes. You may redistribute this and other files * or routines as long as you are not compensated for it, and as * long as this notice is included with it. You may not use the * released source codes in anyway commercial without permission. * * It'd be nice if you share your modifications with me and everyone * else. I encourage you to make the code better as I am very busy. * * Share your knowledge :) */#include <stdio.h>#include <stdlib.h>#include <string.h>#include "help.h"/* * help * general help function. you can specify more than one command * you want help on. i.e: help put get ls */void help( char *command ){ char *hstr; (void)strtok(command," "); hstr=strtok((char *)NULL," "); if( !hstr || ! *hstr) HelpIndex(); else { ExecHelp(hstr); while( (hstr=strtok((char *)NULL," ")) != NULL) ExecHelp(hstr); }}/* * display all commands supported. * a lot of commands still needs to be implemented. * you should try implementing them. */void HelpIndex(void){printf(" Help Topics\n\ ! ascii binary bye cd close dir exit get\n\ lcd lls ldir open put quit rhelp\n");}/* * show help on a command * :(( this will be a long function */void ExecHelp( char *command){ if( !strcmp(command,"!") ) printf("!<command> execute system command\n"); else if( !strcmp(command,"ascii") || !strcmp(command,"as") ) printf("ascii|as set file trasfer mode to ascii\n"); else if( !strcmp(command,"binary") || !strcmp(command,"bin") ) printf("binary|bin set file transfer mode to binary\n"); else if( !strcmp(command,"bye") ) printf("bye terminate connection and exit\n"); else if( !strcmp(command,"cd") ) printf("cd <remote-dir.> change remote working directory\n"); else if( !strcmp(command,"close") ) printf("close close connection without quiting\n"); else if( !strcmp(command,"dir") ) printf("dir get remote directory listing\n"); else if( !strcmp(command, "exit") ) printf("exit terminate connection and exit\n"); else if( !strcmp(command, "get") ) printf("get <remote-file> retrieve a remote file\n"); else if( !strcmp(command, "lcd")) printf("lcd <local-dir.> change local working directory\n"); else if(!strcmp(command,"lls") || !strcmp(command,"ldir") ) printf("lls|ldir get local directory listing\n"); else if( !strcmp(command, "ls") ) printf("ls [options] get remote directory listing\n"); else if( !strcmp(command, "open") ) printf("open <host|ip> open connection to server\n"); else if(!strcmp(command, "put") ) printf("put <local-file> send local file to remote host\n"); else if( !strcmp(command, "pwd") ) printf("pwd get remote current working \directory\n"); else if( !strcmp(command, "quit") ) printf("quit terminate connection and exit\n"); else if( !strcmp(command, "rhelp") ) printf("rhelp [command] get remote help\n"); else if( !strcmp(command, "user") ) printf("user <username> send new user information\n\ you will be prompted for password\n"); else printf("Invalid command\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -