forked from wwoods/gridfs-fuse
-
Notifications
You must be signed in to change notification settings - Fork 3
/
options.cpp
68 lines (60 loc) · 2.35 KB
/
options.cpp
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright 2009 Michael Stephens
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "options.h"
#include <iostream>
using namespace std;
struct gridfs_options gridfs_options;
struct fuse_opt gridfs_opts[] = {
GRIDFS_OPT_KEY("--host=%s", host, 0),
GRIDFS_OPT_KEY("--port=%d", port, 0),
GRIDFS_OPT_KEY("--db=%s", db, 0),
GRIDFS_OPT_KEY("--prefix=%s", prefix, 0),
GRIDFS_OPT_KEY("--username=%s", username, 0),
GRIDFS_OPT_KEY("--password=%s", password, 0),
FUSE_OPT_KEY("-v", KEY_VERSION),
FUSE_OPT_KEY("--version", KEY_VERSION),
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
NULL
};
int gridfs_opt_proc(void* data, const char* arg, int key, struct fuse_args* outargs) {
if (key == KEY_HELP) {
print_help();
return -1;
}
if (key == KEY_VERSION) {
cout << "gridfs-fuse version 0.3" << endl;
return -1;
}
return 1;
}
void print_help() {
cout << "usage: ./mount_gridfs [options] mountpoint" << endl;
cout << endl << "general options:" << endl;
cout << "\t--host=[hostname]\thostname of your mongodb server" << endl;
cout << "\t--port=[port]\tport of your mongodb server" << endl;
cout << "\t--db=[dbname]\t\twhich mongo database to use" << endl;
cout << "\t--prefix=[prefix]\tprefix of your gridFS" << endl;
cout << "\t--username=[username]\tusername of your mongodb server" << endl;
cout << "\t--password=[password]\tpassword of your mongodb server" << endl;
cout << "\t-h, --help\t\tprint help" << endl;
cout << "\t-v, --version\t\tprint version" << endl;
cout << endl << "FUSE options: " << endl;
cout << "\t-d, -o debug\t\tenable debug output (implies -f)" << endl;
cout << "\t-f\t\t\tforeground operation" << endl;
cout << "\t-s\t\t\tdisable multi-threaded operation" << endl;
}