1 /*******************************************************************************
2 ********************************************************************************
4 Copyright (c) 2008 Ahmed S. Badran
6 Licensed under the FreeBSD License (see LICENSE)
9 Description: Vimicxx main.
10 Created: 09/01/2008 06:35:01 PM PDT
11 Author: Ahmed S. Badran (Ahmed B.), ahmed.badran@gmail.com
13 ********************************************************************************
14 *******************************************************************************/
20 #include "vimicxx_conf.h"
23 bool vimicxx_init(string
*);
24 void vimicxx_config(configfile
*);
25 bool vimicxx_parse_cmd(int argc
, char** argv
);
27 int main(int argc
, char* argv
[])
29 string DOTVIMICXX_PATH
;
30 if (!vimicxx_init(&DOTVIMICXX_PATH
)) {
33 vimicxx_conf
conf(DOTVIMICXX_PATH
);
35 conf
.add_project("test", "/home/ahmed/data", tmp
);
36 conf
.add_project("test2", "/home/ahmed/data", tmp
);
37 /* vimicxx_config(&vimicxx_conf); */
38 if (!vimicxx_parse_cmd(argc
, argv
)) {
45 * Check for the .vimicxx directory, create it if it
46 * doesn't exist, checks for DOTVIMICXX_PATH
48 bool vimicxx_init(string
* vimicxx_path
)
51 if ((tmp
= getenv("DOTVIMICXX_PATH")) != NULL
) {
54 passwd
* tmp2
= getpwuid(geteuid());
55 *vimicxx_path
= tmp2
->pw_dir
;
56 *vimicxx_path
+= "/.vimicxx";
60 if ((stat(vimicxx_path
->c_str(), &tmp_stat
) == 0) &&
61 (S_ISDIR(tmp_stat
.st_mode
))) {
63 } else if (mkdir(vimicxx_path
->c_str(), S_IRUSR
| S_IWUSR
| S_IXUSR
|
64 S_IRGRP
| S_IXGRP
| S_IROTH
| S_IXOTH
) == 0) {
67 perror("mkdir error");
73 * Parse the command, figure out what are we being asked for
75 bool vimicxx_parse_cmd(int argc
, char** argv
)