- DIR *dirp;
- register struct direct *d;
- char *new_buf;
- char *namebuf;
- int bufsiz;
- int len;
- PTR the_buffer;
- char *buf;
- size_t n_strs;
-/* int n_size;*/
- char *p_buf;
- char **vec,**p_vec;
-
- extern int errno;
-
- errno=0;
- dirp=opendir(p);
- bufsiz=strlen(p)+NAMSIZ;
- namebuf=ck_malloc(bufsiz+2);
- if(!dirp) {
- if(errno)
- msg_perror("can't open directory %s",p);
- else
- msg("error opening directory %s",p);
- new_buf=NULL;
- } else {
- struct dirname *dp;
- int all_children;
-
- dp=get_dir(p);
- all_children= dp ? dp->allnew : 0;
- (void) strcpy(namebuf,p);
- if(p[strlen(p)-1]!='/')
- (void) strcat(namebuf,"/");
- len=strlen(namebuf);
-
- the_buffer=init_buffer();
- while(d=readdir(dirp)) {
- struct stat hs;
-
- /* Skip . and .. */
- if(is_dot_or_dotdot(d->d_name))
- continue;
- if(DP_NAMELEN(d) + len >=bufsiz) {
- bufsiz+=NAMSIZ;
- namebuf=ck_realloc(namebuf,bufsiz+2);
- }
- (void) strcpy(namebuf+len,d->d_name);
+ DIR *dirp;
+ register struct dirent *d;
+ char *new_buf;
+ char *namebuf;
+ int bufsiz;
+ int len;
+ PTR the_buffer;
+ char *buf;
+ size_t n_strs;
+ /* int n_size;*/
+ char *p_buf;
+ char **vec, **p_vec;
+
+ extern int errno;
+
+ errno = 0;
+ dirp = opendir (p);
+ bufsiz = strlen (p) + NAMSIZ;
+ namebuf = ck_malloc (bufsiz + 2);
+ if (!dirp)
+ {
+ if (errno)
+ msg_perror ("can't open directory %s", p);
+ else
+ msg ("error opening directory %s", p);
+ new_buf = NULL;
+ }
+ else
+ {
+ struct dirname *dp;
+ int all_children;
+
+ dp = get_dir (p);
+ all_children = dp ? dp->allnew : 0;
+ (void) strcpy (namebuf, p);
+ if (p[strlen (p) - 1] != '/')
+ (void) strcat (namebuf, "/");
+ len = strlen (namebuf);
+
+ the_buffer = init_buffer ();
+ while (d = readdir (dirp))
+ {
+ struct stat hs;
+
+ /* Skip . and .. */
+ if (is_dot_or_dotdot (d->d_name))
+ continue;
+ if (NLENGTH (d) + len >= bufsiz)
+ {
+ bufsiz += NAMSIZ;
+ namebuf = ck_realloc (namebuf, bufsiz + 2);
+ }
+ (void) strcpy (namebuf + len, d->d_name);