⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.h

📁 linux下网络下载软件的源码
💻 H
字号:
/*      Get and Resume Elite EDition source codeGet and Resume Elite EDition (GREED)Copyright (C) 1999  Anoakie TurnerThis program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.For more information on the GPL, please go to:http://www.gnu.org/copyleft/gpl.html        Contact:  Anoakie Turner                  Anoakie.Turner@asu.edu                  13240 N. 94th Pl.                  Scottsdale, AZ 85260*//***  To compile, use gcc -O2 -Wall -o greed greed.c******  To compile under any non linux OS, use:**  gcc -O2 -Wall -lsocket -lxnet -o greed greed.c*/#include <stdio.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <netdb.h>#include <unistd.h>#include <errno.h>#include <string.h>#include <stdlib.h>#include <fcntl.h>#include <signal.h>#include <sys/wait.h>#include <ctype.h>#include <sys/time.h>#include <sys/stat.h>#include <arpa/inet.h>#define HTTP 1#define FTP 2#define CURRENT_VERSION "GREED/0.81+ STABLE"#define GGR "http://www.public.asu.edu/~arturner/greed.tar.gz"#define BASE64 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"typedef int bool;long ROLLBACK;int TIMEOUT_SEC;int MINSPEED;long FTP_WAIT_TIME;int OUTPUT_LEVEL;int REFERRER;int WAIT_RETRY;bool STDOUT;bool NOSIZE;int DEBUG;int CALL_ME;char *CALL_ADDR;char *PROXY;char *PROXYPORT;char *DEFAULT_DIR;int dlstat;long dldots;struct sockaddr_in address;unsigned int dport;time_t start, end;fd_set testfds;char REF[1024];typedef struct URLstruct{	char *name;	char *server;	char *file;	char *filename;	char *user;	char *pass;	char *left;	char *size;	char *total;	char *cport;	char *b64pass;	unsigned int port;	int protocol;	int sockfd;	int recurse;	struct hostent *host;	struct servent *serv;	long lleft;	long lsize;	long ltotal;	FILE *fp;	bool done, resume, retry;} *URLp, URLst;void DownloadLoop(URLp URL);void Switches(int i, char *argv[]);void Download(URLp URL);bool ReadHTTPHeader(URLp URL);int  ReadSock (int sockfd, char* buffer, char* stopstr);int  ReadPASVPort(char *buffer);bool ReadFTPListing(URLp URL);bool Parse(URLp URL);bool Connect(URLp URL);void SendFTPConnectData(URLp URL);void SendHTTPConnectData(URLp URL);char *ReadString(char *str1, int *ind, char stopchar, int stopint);char *ReadString2(char *str1, char stopchar);char *Base64Encode(char *str1);void Proxy(int NEWRC);void CreateNewRC(FILE* fp);void unescape_url (char *url);char x2c (char *what);void InsertURL (char *U, int);void PrintList ();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -