/* WebDownloader for X-Window * Copyright (C) 1999-2002 Koshelev Maxim * This Program is free but not GPL!!! You can't modify it * without agreement with author. You can't distribute modified * program but you can distribute unmodified program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #include #include #include #include #include #include #include #include #include #include #include #include "main.h" #include "config.h" #include "face/list.h" #include "var.h" #include "locstr.h" #include "ntlocale.h" #include "ftpd.h" #include "segments.h" #include "srvclt.h" #ifdef HAVE_SSL #include "openssl/ssl.h" #endif //HAVE_SSL //------------------------------------------------- tMain _aa_; char *VERSION_NAME="WebDownloader for X " VERSION; char *LOCK_FILE; char *LOCALE_CODEPAGE; static void init_string_variables(){ if (CFG.DEFAULT_NAME==NULL) CFG.DEFAULT_NAME=copy_string("index.html"); if (CFG.USER_AGENT==NULL) CFG.USER_AGENT=copy_string("%version"); if (CFG.ANONYMOUS_PASS==NULL) CFG.ANONYMOUS_PASS=copy_string("-mdem@chat.ru"); if (CFG.EXEC_WHEN_QUIT==NULL) CFG.EXEC_WHEN_QUIT=copy_string(""); if (!CFG.GLOBAL_SAVE_PATH) { if (HOME_VARIABLE) CFG.GLOBAL_SAVE_PATH=sum_strings(HOME_VARIABLE,"/MyDownloads",NULL); else CFG.GLOBAL_SAVE_PATH=copy_string("/"); }; if (CFG.SKIP_IN_CLIPBOARD==NULL) CFG.SKIP_IN_CLIPBOARD=copy_string("html htm php3 gif jpg png"); if (CFG.CATCH_IN_CLIPBOARD==NULL) CFG.CATCH_IN_CLIPBOARD=copy_string("zip .gz rar arj exe rpm .bz2 deb tgz mp3"); CFG.LOCAL_SAVE_PATH=copy_string(CFG.GLOBAL_SAVE_PATH); if (!CFG.SEARCH_ENGINES) CFG.SEARCH_ENGINES=copy_string("1"); if (!CFG.SOUND_COMPLETE) CFG.SOUND_COMPLETE=sum_strings(D4X_SHARE_PATH,"/sounds/complete.wav",NULL); if (!CFG.SOUND_ADD) CFG.SOUND_ADD=sum_strings(D4X_SHARE_PATH,"/sounds/add.wav",NULL); if (!CFG.SOUND_FAIL) CFG.SOUND_FAIL=sum_strings(D4X_SHARE_PATH,"/sounds/fail.wav",NULL); if (!CFG.SOUND_DND_DROP) CFG.SOUND_DND_DROP=sum_strings(D4X_SHARE_PATH,"/sounds/dnd.wav",NULL); if (!CFG.SOUND_QUEUE_FINISH) CFG.SOUND_QUEUE_FINISH=sum_strings(D4X_SHARE_PATH,"/sounds/finish.wav",NULL); if (!CFG.SOUND_STARTUP) CFG.SOUND_STARTUP=sum_strings(D4X_SHARE_PATH,"/sounds/startup.wav",NULL); if (!CFG.THEMES_DIR) CFG.THEMES_DIR=sum_strings(D4X_SHARE_PATH,"/themes/",NULL); }; static void send_popup(){ tMsgClient *clt=new tMsgClient; clt->send_command(PACKET_POPUP,NULL,0); }; #ifdef DEBUG_ALL static char *prog_name; /* aught! got sigsegv :( * try to attach gdb to failed process to look around */ void segv_handler(int signum) { char pid_str[128]; volatile int tmp; fprintf(stderr, "pid %d got sinal SIGSEGV\n", getpid()); if ((tmp=fork()) < 0) { perror("fork"); exit(EXIT_FAILURE); } if (tmp) { while (tmp) { /* do nothing forever :) */ } } else { sprintf(pid_str, "%d", getppid()); if (CFG.WITHOUT_FACE) { execlp("gdb", "gdb", prog_name, pid_str, NULL); } else { execlp("xterm", "xterm", "-e", "gdb", prog_name, pid_str, NULL); } perror("execlp"); exit(EXIT_FAILURE); } } #endif #include "xml.h" void test_segments(){ tSegmentator segments; printf("0-1500:%i\n",segments.insert(0,1500)); segments.print(); printf("0-1500:%i\n",segments.insert(0,1500)); segments.print(); printf("1500-1600:%i\n",segments.insert(1500,1600)); segments.print(); printf("1100-1200:%i\n",segments.insert(1100,1200)); segments.print(); }; #include int main(int argc,char **argv) { struct rlimit rl; getrlimit(RLIMIT_FSIZE,&rl); if (rl.rlim_cur