filelist.c (xcircuit-3.10.29.tgz) | : | filelist.c (xcircuit-3.10.30.tgz) | ||
---|---|---|---|---|
skipping to change at line 409 | skipping to change at line 409 | |||
XtnSetArg(XtNheight, &textheight); | XtnSetArg(XtNheight, &textheight); | |||
XtGetValues(w, wargs, n); | XtGetValues(w, wargs, n); | |||
#endif | #endif | |||
/* Generate a new flistpix pixmap if currently nonexistent */ | /* Generate a new flistpix pixmap if currently nonexistent */ | |||
if (!flistpix) { | if (!flistpix) { | |||
/* get list of files in the current directory (cwd) */ | /* get list of files in the current directory (cwd) */ | |||
if (files == NULL) | ||||
files = (fileliststruct *) malloc (INITDIRS * sizeof(fileliststruct)); | ||||
flfiles = 0; | flfiles = 0; | |||
if (cwdname == NULL) { | if (cwdname == NULL) { | |||
cwdname = (char *) malloc (sizeof(char)); | cwdname = (char *) malloc (sizeof(char)); | |||
cwdname[0] = '\0'; | cwdname[0] = '\0'; | |||
} | } | |||
if (cwdname[0] == '\0') | if (cwdname[0] == '\0') | |||
cwd = opendir("."); | cwd = opendir("."); | |||
else | else | |||
cwd = opendir(cwdname); | cwd = opendir(cwdname); | |||
skipping to change at line 433 | skipping to change at line 431 | |||
if (cwd == NULL) { | if (cwd == NULL) { | |||
XSetForeground(dpy, sgc, colorlist[BACKGROUND].color.pixel); | XSetForeground(dpy, sgc, colorlist[BACKGROUND].color.pixel); | |||
XFillRectangle(dpy, lwin, sgc, 0, 0, textwidth, textheight); | XFillRectangle(dpy, lwin, sgc, 0, 0, textwidth, textheight); | |||
XSetForeground(dpy, sgc, colorlist[AUXCOLOR].color.pixel); | XSetForeground(dpy, sgc, colorlist[AUXCOLOR].color.pixel); | |||
XDrawString(dpy, lwin, sgc, 10, textheight / 2, | XDrawString(dpy, lwin, sgc, 10, textheight / 2, | |||
"(Invalid Directory)", 19); | "(Invalid Directory)", 19); | |||
return; | return; | |||
} | } | |||
else { | else { | |||
if (files == NULL) | ||||
files = (fileliststruct *) malloc (INITDIRS * sizeof(fileliststruct)) | ||||
; | ||||
/* write the contents of the current directory into the */ | /* write the contents of the current directory into the */ | |||
/* array "filenames[]" (except for current directory ".") */ | /* array "filenames[]" (except for current directory ".") */ | |||
while ((dp = readdir(cwd)) != NULL) { | while ((dp = readdir(cwd)) != NULL) { | |||
/* don't put current directory in list */ | /* don't put current directory in list */ | |||
if (!strcmp(dp->d_name, ".")) continue; | if (!strcmp(dp->d_name, ".")) continue; | |||
/* record the type of file */ | /* record the type of file */ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added |