Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fw32.git;a=commitdiff;h=13953ae03097c84556d6b77b9b68bdece98d0ef7
commit 13953ae03097c84556d6b77b9b68bdece98d0ef7 Author: James Buren <r...@frugalware.org> Date: Thu Nov 3 00:29:36 2011 -0500 fw32.c: add umount_all function diff --git a/fw32.c b/fw32.c index 1c7ca26..3e8cc89 100644 --- a/fw32.c +++ b/fw32.c @@ -146,4 +146,36 @@ mount_all(void) mount_directory(*p); } -int main(int argc,char **argv) { umount_directory(argv[1]); } +static void +umount_all(void) +{ + FILE *f; + char line[LINE_MAX], *s, *e; + + f = fopen("/proc/mounts","rb"); + + if(!f) + error("Cannot open /proc/mounts for reading.\n"); + + while(fgets(line,sizeof line,f)) + { + s = strchr(line,' '); + + if(!s) + continue; + + e = strchr(++s,' '); + + if(!e) + continue; + + *e = 0; + + if(strncmp(s,FW32_ROOT,strlen(FW32_ROOT))) + umount_directory(s); + } + + fclose(f); +} + +int main(int argc,char **argv) { printf("%d\n",sizeof(FW32_ROOT)); } _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git