mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 21:24:28 -08:00
Don't let api_folder_get_content print but let it fill datastructures
This commit is contained in:
@@ -22,12 +22,17 @@
|
||||
#include "../../mfapi/apicalls.h"
|
||||
#include "../mfshell.h"
|
||||
#include "../../mfapi/mfconn.h"
|
||||
#include "../../mfapi/folder.h"
|
||||
#include "../../mfapi/file.h"
|
||||
#include "../commands.h" // IWYU pragma: keep
|
||||
|
||||
int mfshell_cmd_list(mfshell * mfshell, int argc, char *const argv[])
|
||||
{
|
||||
(void)argv;
|
||||
int retval;
|
||||
mffolder **folder_result;
|
||||
mffile **file_result;
|
||||
int i;
|
||||
|
||||
if (mfshell == NULL)
|
||||
return -1;
|
||||
@@ -36,15 +41,26 @@ int mfshell_cmd_list(mfshell * mfshell, int argc, char *const argv[])
|
||||
fprintf(stderr, "Invalid number of arguments\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// first folders
|
||||
folder_result = NULL;
|
||||
retval =
|
||||
mfconn_api_folder_get_content(mfshell->conn, 0, mfshell->folder_curr);
|
||||
mfconn_api_folder_get_content(mfshell->conn, 0, mfshell->folder_curr, &folder_result, NULL);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
for (i = 0; folder_result[i] != NULL; i++) {
|
||||
printf("%s %s\n", folder_get_name(folder_result[i]), folder_get_key(folder_result[i]));
|
||||
}
|
||||
|
||||
// then files
|
||||
file_result = NULL;
|
||||
retval =
|
||||
mfconn_api_folder_get_content(mfshell->conn, 1, mfshell->folder_curr);
|
||||
mfconn_api_folder_get_content(mfshell->conn, 1, mfshell->folder_curr, NULL, &file_result);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
for (i = 0; file_result[i] != NULL; i++) {
|
||||
printf("%s %s\n", file_get_name(file_result[i]), file_get_key(file_result[i]));
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "../../mfapi/apicalls.h"
|
||||
#include "../mfshell.h"
|
||||
@@ -28,6 +29,7 @@ int mfshell_cmd_status(mfshell * mfshell, int argc, char *const argv[])
|
||||
{
|
||||
(void)argv;
|
||||
int retval;
|
||||
uint64_t revision;
|
||||
|
||||
if (mfshell == NULL)
|
||||
return -1;
|
||||
@@ -37,8 +39,13 @@ int mfshell_cmd_status(mfshell * mfshell, int argc, char *const argv[])
|
||||
return -1;
|
||||
}
|
||||
// then files
|
||||
retval = mfconn_api_device_get_status(mfshell->conn);
|
||||
retval = mfconn_api_device_get_status(mfshell->conn, &revision);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
if (retval == 0) {
|
||||
printf("device_revision: %" PRIu64 "\n", revision);
|
||||
} else {
|
||||
fprintf(stderr, "device/get_status() unsuccessful\n");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user