]>
Commit | Line | Data |
---|---|---|
07219c67 TO |
1 | diff -ruN lftp-2.5.2.org/src/bookmark.cc lftp-2.5.2/src/bookmark.cc |
2 | --- lftp-2.5.2.org/src/bookmark.cc Mon Jan 21 17:25:16 2002 | |
73ccd2d7 TO |
3 | +++ lftp-2.5.2/src/bookmark.cc Mon Jun 3 10:38:02 2002 |
4 | @@ -34,9 +34,16 @@ | |
07219c67 | 5 | const char *home=getenv("HOME"); |
07219c67 TO |
6 | if(home==0) |
7 | home=""; | |
8 | - const char *add="/.lftp/bookmarks"; | |
9 | - bm_file=xstrdup(home,+strlen(add)); | |
10 | - strcat(bm_file,add); | |
73ccd2d7 | 11 | + if (getenv("CONFIG_DIR")) { |
07219c67 | 12 | + const char *add="/lftp/bookmarks"; |
73ccd2d7 TO |
13 | + bm_file=xstrdup(home,+strlen(add)+strlen(getenv("CONFIG_DIR"))+1); |
14 | + sprintf(bm_file,"%s/%s%s", home, getenv("CONFIG_DIR"), add); | |
07219c67 TO |
15 | + } |
16 | + else { | |
17 | + const char *add="/.lftp/bookmarks"; | |
18 | + bm_file=xstrdup(home,+strlen(add)); | |
19 | + strcat(bm_file,add); | |
20 | + } | |
21 | ||
22 | bm_fd=-1; | |
23 | stamp=(time_t)-1; | |
24 | diff -ruN lftp-2.5.2.org/src/commands.cc lftp-2.5.2/src/commands.cc | |
25 | --- lftp-2.5.2.org/src/commands.cc Sun May 5 16:22:55 2002 | |
73ccd2d7 | 26 | +++ lftp-2.5.2/src/commands.cc Mon Jun 3 10:38:02 2002 |
07219c67 TO |
27 | @@ -2451,7 +2451,10 @@ |
28 | } | |
29 | else if(!strcasecmp(op,"edit")) | |
30 | { | |
31 | - parent->PrependCmd("shell \"/bin/sh -c 'exec ${EDITOR:-vi} $HOME/.lftp/bookmarks'\"\n"); | |
32 | + if (getenv("CONFIG_DIR")) | |
33 | + parent->PrependCmd("shell \"/bin/sh -c 'exec ${EDITOR:-vi} $HOME/$CONFIG_DIR/lftp/bookmarks'\"\n"); | |
34 | + else | |
35 | + parent->PrependCmd("shell \"/bin/sh -c 'exec ${EDITOR:-vi} $HOME/.lftp/bookmarks'\"\n"); | |
36 | } | |
37 | else if(!strcasecmp(op,"import")) | |
38 | { | |
39 | diff -ruN lftp-2.5.2.org/src/history.cc lftp-2.5.2/src/history.cc | |
40 | --- lftp-2.5.2.org/src/history.cc Mon Jan 21 17:25:17 2002 | |
73ccd2d7 TO |
41 | +++ lftp-2.5.2/src/history.cc Mon Jun 3 10:38:02 2002 |
42 | @@ -42,9 +42,16 @@ | |
07219c67 | 43 | const char *home=getenv("HOME"); |
07219c67 TO |
44 | if(home==0) |
45 | home=""; | |
46 | - const char *add="/.lftp/cwd_history"; | |
47 | - file=xstrdup(home,+strlen(add)); | |
48 | - strcat(file,add); | |
73ccd2d7 | 49 | + if (getenv("CONFIG_DIR")) { |
07219c67 | 50 | + const char *add="/lftp/cwd_history"; |
73ccd2d7 TO |
51 | + file=xstrdup(home,+strlen(add)+strlen(getenv("CONFIG_DIR"))+1); |
52 | + sprintf(file,"%s/%s%s", home, getenv("CONFIG_DIR"), add); | |
07219c67 TO |
53 | + } |
54 | + else { | |
55 | + const char *add="/.lftp/cwd_history"; | |
56 | + file=xstrdup(home,+strlen(add)); | |
57 | + strcat(file,add); | |
58 | + } | |
59 | } | |
60 | ||
61 | History::~History() | |
62 | diff -ruN lftp-2.5.2.org/src/lftp.cc lftp-2.5.2/src/lftp.cc | |
63 | --- lftp-2.5.2.org/src/lftp.cc Wed Feb 27 10:15:57 2002 | |
73ccd2d7 TO |
64 | +++ lftp-2.5.2/src/lftp.cc Mon Jun 3 10:39:57 2002 |
65 | @@ -231,8 +231,15 @@ | |
07219c67 TO |
66 | const char *home=getenv("HOME"); |
67 | if(home) | |
68 | { | |
69 | - char *log=(char*)alloca(strlen(home)+1+9+1); | |
70 | - sprintf(log,"%s/.lftp",home); | |
73ccd2d7 TO |
71 | + char *log; |
72 | + if (getenv("CONFIG_DIR")) { | |
73 | + log=(char*)alloca(strlen(home)+strlen(getenv("CONFIG_DIR"))+1+9+1); | |
74 | + sprintf(log,"%s/%s/lftp",home,getenv("CONFIG_DIR")); | |
75 | + } | |
76 | + else { | |
77 | + log=(char*)alloca(strlen(home)+1+9+1); | |
07219c67 | 78 | + sprintf(log,"%s/.lftp",home); |
73ccd2d7 | 79 | + } |
07219c67 TO |
80 | if(access(log,F_OK)==-1) |
81 | strcat(log,"_log"); | |
82 | else | |
73ccd2d7 | 83 | @@ -329,9 +336,19 @@ |
07219c67 TO |
84 | const char *home=getenv("HOME"); |
85 | if(home) | |
86 | { | |
87 | - char *rc=(char*)alloca(strlen(home)+9+1); | |
73ccd2d7 | 88 | + // create lftp own directory |
07219c67 | 89 | + if (getenv("CONFIG_DIR")) { |
73ccd2d7 | 90 | + char *rc=(char*)alloca(strlen(home)+strlen(getenv("CONFIG_DIR"))+9+1); |
07219c67 TO |
91 | + sprintf(rc,"%s/%s/lftp",home,getenv("CONFIG_DIR")); |
92 | + mkdir(rc,0755); | |
73ccd2d7 TO |
93 | |
94 | - // create lftp own directory | |
07219c67 TO |
95 | + sprintf(rc,"%s/%s/lftprc",home,getenv("CONFIG_DIR")); |
96 | + source_if_exist(top_exec,rc); | |
97 | + sprintf(rc,"%s/%s/lftp/rc",home,getenv("CONFIG_DIR")); | |
98 | + source_if_exist(top_exec,rc); | |
99 | + } | |
100 | + else { | |
73ccd2d7 | 101 | + char *rc=(char*)alloca(strlen(home)+9+1); |
07219c67 TO |
102 | sprintf(rc,"%s/.lftp",home); |
103 | mkdir(rc,0755); | |
104 | ||
73ccd2d7 | 105 | @@ -339,6 +356,7 @@ |
07219c67 TO |
106 | source_if_exist(top_exec,rc); |
107 | sprintf(rc,"%s/.lftp/rc",home); | |
108 | source_if_exist(top_exec,rc); | |
109 | + } | |
110 | } | |
111 | ||
112 | WaitDone(top_exec); |