mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
fuse: allow entering username and password via stdin
- when either username or password are not specified via commandline arguments or configuration file, ask them on standard input - unify function to read username and password - move function to read username and password from mfshell to utils/strings.c - remove commented cruft from utils/strings.c
This commit is contained in:
14
fuse/main.c
14
fuse/main.c
@@ -536,11 +536,6 @@ static void connect_mf(struct mediafirefs_user_options *options,
|
||||
options->server = "www.mediafire.com";
|
||||
}
|
||||
|
||||
if (options->username == NULL || options->password == NULL) {
|
||||
fprintf(stderr, "You must specify username and password\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ctx->conn = mfconn_create(options->server, options->username,
|
||||
options->password, options->app_id,
|
||||
options->api_key);
|
||||
@@ -657,6 +652,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
parse_arguments(&argc, &argv, &options, ctx->configfile);
|
||||
|
||||
if (options.username == NULL) {
|
||||
printf("login: ");
|
||||
options.username = string_line_from_stdin(false);
|
||||
}
|
||||
if (options.password == NULL) {
|
||||
printf("passwd: ");
|
||||
options.password = string_line_from_stdin(true);
|
||||
}
|
||||
|
||||
connect_mf(&options, ctx);
|
||||
|
||||
ret = fuse_main(argc, argv, &mediafirefs_oper, ctx);
|
||||
|
||||
Reference in New Issue
Block a user