*** flist.c Fri Feb 4 12:28:23 2000 --- flist.new.c Fri Feb 21 10:21:46 2003 *************** *** 17,22 **** --- 17,23 ---- */ #include <h/mh.h> + #include <regex.h> #define FALSE 0 #define TRUE 1 *************** *** 425,430 **** --- 426,449 ---- */ base = strcmp (dirName, ".") ? dirName : dirName + 1; + /* + * Build a regexp for later use, so that we can rapidly tell if + * something is terminated with /[0-9]*$ + */ + regex_t expr; + char *pattern; + int res; + + pattern = (char *) calloc(10,sizeof(char)); + strncpy(pattern,"\/[0-9]+",9); + res=regcomp(&expr,"\/[0-9]+$",REG_EXTENDED); + if (res) { + char errmsg[256]; + regerror(res,pattern,errmsg,256*sizeof(char)); + printf("Regcomp failed! (0)\n\n",res,errmsg); + exit(1); + } + while (nlinks && (dp = readdir(dir))) { if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) { nlinks--; *************** *** 436,441 **** --- 455,467 ---- if (*base) strcat(name, "/"); strncat(name, dp->d_name, sizeof(name) - strlen(name) - 1); + /* check to see if the name of the file matches the regexp + * if it is, we assume it's a mail file and skip it + */ + res = regexec(&expr,name,0,NULL,0) ; + if (!res) { + continue; + } if ((stat(name, &st) != -1) && S_ISDIR(st.st_mode)) { /* * Check if this was really a symbolic link pointing