mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 21:24:28 -08:00
Refactor code into utils, mfapi and mfshell
- utils is the low level library used by the others - mfapi uses utils and implements the api and some wrappers - mfshell uses mfapi and utils to provide a shell
This commit is contained in:
69
mfshell/commands/debug.c
Normal file
69
mfshell/commands/debug.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Bryan Christ <bryan.christ@mediafire.com>
|
||||
* 2014 Johannes Schauer <j.schauer@email.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2, as published by
|
||||
* the Free Software Foundation.
|
||||
*
|
||||
* 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, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "../mfshell.h"
|
||||
#include "../commands.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_debug(mfshell_t *mfshell, int argc, char **argv)
|
||||
{
|
||||
if (argc != 1) {
|
||||
fprintf(stderr, "Invalid number of arguments\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf(" %-15.15s %s\n\r",
|
||||
"server:",
|
||||
mfshell->server);
|
||||
|
||||
const char *session_token = mfconn_get_session_token(mfshell->mfconn);
|
||||
const char *secret_time = mfconn_get_secret_time(mfshell->mfconn);
|
||||
uint32_t secret_key = mfconn_get_secret_key(mfshell->mfconn);
|
||||
if(session_token != NULL && secret_time != NULL)
|
||||
{
|
||||
printf(" %-15.15s %"PRIu32"\n\r",
|
||||
"secret key:",
|
||||
secret_key);
|
||||
|
||||
printf(" %-15.15s %s\n\r",
|
||||
"secret time:",
|
||||
secret_time);
|
||||
|
||||
printf(" %-15.15s %s\n\r",
|
||||
"status:",
|
||||
"Authenticated");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(" %-15.15s %s\n\r",
|
||||
"status:",
|
||||
"Not authenticated");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user