[Frugalware-darcs] setup: formatdisk: new function: findfs()
VMiklos
vmiklos at frugalware.org
Wed Mar 29 23:54:23 CEST 2006
[formatdisk: new function: findfs()
VMiklos <vmiklos at frugalware.org>**20051111224358] {
hunk ./src/plugins/formatdisk.c 326
+char *findfs(char *dev)
+{
+ FILE *fp;
+ char line[PATH_MAX], *ptr;
+ int i;
+
+ if ((fp = fopen("/proc/mounts", "r"))== NULL)
+ {
+ perror("Could not open output file for reading");
+ return(NULL);
+ }
+ while(!feof(fp))
+ {
+ if(fgets(line, PATH_MAX, fp) == NULL)
+ break;
+ if(strstr(line, dev)==line)
+ {
+ ptr = strstr(line, " ")+1;
+ ptr = strstr(ptr, " ")+1;
+ for(i=0;*(ptr+i)!='\0';i++)
+ if(*(ptr+i)==' ')
+ *(ptr+i)='\0';
+ return(ptr);
+ }
+ }
+ fclose(fp);
+ return(NULL);
+}
+
}
More information about the Frugalware-darcs
mailing list