1 diff -rNu screen-3.9.4-orig/Makefile.in screen-3.9.4/Makefile.in
2 --- screen-3.9.4-orig/Makefile.in Wed Aug 11 22:19:51 1999
3 +++ screen-3.9.4/Makefile.in Wed Feb 2 20:55:17 2000
5 search.c tty.c term.c window.c utmp.c loadav.c putenv.c help.c \
6 termcap.c input.c attacher.c pty.c process.c display.c comm.c \
7 kmapdef.c acls.c braille.c braille_tsi.c logfile.c layer.c \
8 - sched.c teln.c nethack.c
9 + sched.c teln.c nethack.c userdir.c
10 OFILES= screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o \
11 search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o \
12 termcap.o input.o attacher.o pty.o process.o display.o comm.o \
13 kmapdef.o acls.o braille.o braille_tsi.o logfile.o layer.o \
14 - sched.o teln.o nethack.o
15 + sched.o teln.o nethack.o userdir.o
20 comm.h layer.h term.h image.h display.h window.h braille.h extern.h \
22 fileio.o: fileio.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \
23 - comm.h layer.h term.h image.h display.h window.h extern.h
24 + comm.h layer.h term.h image.h display.h window.h extern.h userdir.h
25 mark.o: mark.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \
26 comm.h layer.h term.h image.h display.h window.h mark.h extern.h
27 misc.o: misc.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \
28 diff -rNu screen-3.9.4-orig/config.h.in screen-3.9.4/config.h.in
29 --- screen-3.9.4-orig/config.h.in Wed Aug 11 22:19:51 1999
30 +++ screen-3.9.4/config.h.in Wed Feb 2 20:38:44 2000
34 * Screen sources two startup files. First a global file with a path
35 - * specified here, second your local $HOME/.screenrc
36 + * specified here, second your local $HOME/etc/screenrc
37 * Don't define this, if you don't want it.
40 diff -rNu screen-3.9.4-orig/fileio.c screen-3.9.4/fileio.c
41 --- screen-3.9.4-orig/fileio.c Mon Jul 26 19:51:02 1999
42 +++ screen-3.9.4/fileio.c Wed Feb 2 21:02:40 2000
44 #include <sys/types.h>
47 +#include <sys/param.h>
57 extern struct display *display, *displays;
58 extern struct win *fore;
63 - static char buf[256];
64 + static char buf[MAXPATHLEN];
74 - debug(" ...nothing in $SCREENRC, defaulting $HOME/.screenrc\n");
75 - if (strlen(home) > sizeof(buf) - 12)
76 - Panic(0, "Rc: home too large");
77 - sprintf(buf, "%s/.screenrc", home);
79 + debug(" ...nothing in $SCREENRC, defaulting $HOME/etc/screenrc\n");
80 + etcfile.variable = "CONFIG_DIR";
81 + etcfile.home_dir = NULL;
82 + etcfile.home_scd = NULL;
83 + etcfile.subname = "screenrc";
84 + etcfile.prefix = ".";
85 + etcfile.suffix = "";
86 + etcfile.mode = M_REGULAR_FILE;
87 + if ((usercfv (&etcfile)) == -1) {
88 + if (strlen(home) > sizeof(buf) - 12)
89 + Panic(0, "Rc: home too large");
90 + sprintf(buf, "%s/.screenrc", home);
94 + rc = SaveStr(etcfile.result);
98 diff -rNu screen-3.9.4-orig/userdir.c screen-3.9.4/userdir.c
99 --- screen-3.9.4-orig/userdir.c Thu Jan 1 01:00:00 1970
100 +++ screen-3.9.4/userdir.c Wed Feb 2 00:18:04 2000
102 +#include "userdir.h"
104 +static char *nonulhome = "";
106 +/******************************************************************************/
108 +int getusercfv (char *variable,
116 + bzero (user_dir, stringsize);
117 + if (variable == NULL || *variable == '\0') return (-1);
118 + if (home_dir == NULL) home_dir = nonulhome;
119 + d = getenv (variable);
120 + if (d == NULL || *d == '\0') return (-1);
123 + strncpy (user_dir, d, stringsize-1);
127 + snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
130 + if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode))
138 +/******************************************************************************/
140 +int usercfv (struct cfv *CFV)
146 + if (CFV->subname == NULL) CFV->subname = nonulhome;
147 + if (CFV->home_dir == NULL) CFV->home_dir = getenv ("HOME");
148 + if (CFV->home_dir == NULL) CFV->home_dir = CFV->home_scd;
149 + if (CFV->home_dir == NULL) return (-1);
151 + gr = getusercfv (CFV->variable,
156 + if (gr != -1) /* have main directory */
158 + if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0')
160 + snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s", CFV->subname);
161 + if (stat( CFV->result,&st) != -1
162 + && CFV->mode ? S_ISDIR(st.st_mode) : S_ISREG(st.st_mode)) /* have file or dir */
166 + /* don't have main directory or a proper variable set */
168 + if (CFV->home_dir == NULL || *(CFV->home_dir) == '\0') return (-1);
169 + if (CFV->prefix == NULL && CFV->suffix == NULL) return (-1);
170 + snprintf (CFV->result, MAXPATHLEN-1, "%s/%s%s%s",
172 + CFV->prefix? CFV->prefix:"",
174 + CFV->suffix? CFV->suffix:"");
175 + if (stat(CFV->result,&st) != -1
176 + && CFV->mode ? S_ISDIR(st.st_mode) : S_ISREG(st.st_mode)) /* have file or dir */
181 +/******************************************************************************/
183 +FILE *fopencfv (struct cfv *CFV, const char *mode)
185 + FILE *cfvfile = NULL;
187 + CFV->mode = M_REGULAR_FILE;
188 + if ((usercfv (CFV)) == -1) return (NULL);
189 + cfvfile = fopen (CFV->result, mode);
193 +/******************************************************************************/
194 \ No newline at end of file
195 diff -rNu screen-3.9.4-orig/userdir.h screen-3.9.4/userdir.h
196 --- screen-3.9.4-orig/userdir.h Thu Jan 1 01:00:00 1970
197 +++ screen-3.9.4/userdir.h Wed Feb 2 00:18:04 2000
206 +#include <sys/types.h>
207 +#include <sys/stat.h>
208 +#include <sys/param.h>
210 +#define M_REGULAR_FILE 0
211 +#define M_DIRECTORY 1
214 + char result[MAXPATHLEN]; /* our result */
215 + char *variable; /* name of an environment variable */
216 + char *home_dir; /* home directory or NULL for autodetect */
217 + char *home_scd; /* directory if home_dir==NULL and no result */
218 + char *subname; /* core name of a file/directory */
219 + char *prefix; /* prefix when using directly home_dir */
220 + char *suffix; /* suffix when using directly home_dir */
221 + int mode; /* expected: M_REGULAR_FILE or M_DIRECTORY */
224 +int getusercfv (char *variable,
227 + size_t stringsize);
229 +int usercfv (struct cfv *CFV);
231 +FILE *fopencfv (struct cfv *CFV, const char *mode);
234 \ No newline at end of file