00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <ctype.h>
00025 #include <stdio.h>
00026 #include <sys/stat.h>
00027 #include <sys/types.h>
00028 #include <dirent.h>
00029 #include <errno.h>
00030 #include <string.h>
00031 #include <stdlib.h>
00032 #include "others.h"
00033
00034
00039 static int
00040 filter (const struct dirent *entry)
00041 {
00042 char ext;
00043
00044 if ((strcmp (entry->d_name, ".") == 0) ||
00045 (strcmp (entry->d_name, "..") == 0))
00046 return (0);
00047
00048 ext=entry->d_name[0];
00049
00050 if (isdigit(ext)){
00051 return(1);
00052 }
00053 else
00054 return (0);
00055
00056 }
00057
00062 int get_proc_list(struct dirent ***proclist){
00063 int numfich;
00064
00065 if ((numfich = scandir ("/proc", proclist, &filter, numsort)) == -1)
00066 {
00067 perror ("scandir error");
00068 return (errno);
00069 }
00070
00071 return(numfich);
00072 }