summaryrefslogtreecommitdiffstats
path: root/src/MountArray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MountArray.cpp')
-rw-r--r--src/MountArray.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/MountArray.cpp b/src/MountArray.cpp
new file mode 100644
index 0000000..9278489
--- a/dev/null
+++ b/src/MountArray.cpp
@@ -0,0 +1,55 @@
+#include "MountArray.h"
+#include <stdio.h>
+#include <string.h>
+
+MountArray::MountArray (BOOL recurse)
+{
+ MountCount = 0;
+ if (recurse == FALSE) {
+ char *Word;
+
+ MountArr = new string *[50];
+ FILE *conffile = fopen ("/etc/mtab", "r");
+
+ if (conffile) {
+ char confline[350];
+
+ while (fgets (confline, 350, conffile) != 0) {
+ int wordcount = 0;
+
+ Word = strtok (confline, " ");
+ while (Word != NULL) {
+ Word = strtok (NULL, " ");
+ if (wordcount == 0) {
+ //printf("%s\n",Word);
+ MountArr[MountCount] = new string (Word);
+ MountCount++;
+ }
+ wordcount++;
+ }
+ //printf("%s\n",confline);
+ }
+ }
+ }
+}
+
+MountArray::~MountArray ()
+{
+ int i;
+
+ for (i = 0; i < MountCount; i++)
+ delete MountArr[i];
+ delete MountArr;
+}
+
+BOOL MountArray::MountCheck (string & instring)
+{
+ int counter;
+
+ BOOL retval = FALSE;
+
+ for (counter = 0; counter < MountCount; counter++)
+ if (*MountArr[counter] == instring)
+ retval = TRUE;
+ return retval;
+}