summaryrefslogtreecommitdiffstats
path: root/src/Cnfg.cpp
blob: 6be27bdc282fe39e9b8a887286f4e10b3656f30b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// File: Cnfg.cpp
// Created by: User <Email>
// Created on: Sat Jan  3 13:49:21 2004
//

#include <stdio.h>
#include <string.h>
#include <string>
#include "Cnfg.h"
#include "FilesInDir.h"


Cnfg::Cnfg (int argc, char **textin, string & searchdir)
{
	RecurseMounts = FALSE;
	Success = TRUE;
	int counter = 1;

	while (counter < argc) {
		if (strncmp (textin[counter], "-", 1) == 0) {
			if (strcmp (textin[counter], "-r") == 0)
				RecurseMounts = TRUE;
		} else {
			string cdirsearch = textin[counter];
			FilesInDir *pfid = new FilesInDir (cdirsearch);

			if (pfid->open) {
				searchdir = cdirsearch;
			} else {
				Success = FALSE;
				char tmpchar[160];

				sprintf (tmpchar,
								 "unable to open the directory passed to dirsum: %s\n",
								 cdirsearch.c_str ());
				Error = tmpchar;
				delete pfid;

				return;
			}
			delete pfid;
		}
		counter++;
	}
}


Cnfg::~Cnfg ()
{
}