#include <stdlib.h>
#include <limits.h>
#include "common.h"
#include "pathutils.h"
#include "connect.h"
void getfile_usage (void)
{
fprintf(stderr, "getfile [<deviceid>] <fileid/trackid> <filename>\n");
}
int
getfile_function(char * from_path,char * to_path)
{
int id = parse_path (from_path,files,folders);
if (id > 0) {
printf("Getting %s to %s\n",from_path,to_path);
printf("\nError getting file from MTP device.\n");
return 1;
}
}
return 0;
}
{
if (argc == 3)
if (argc == 4) {
uint32_t id;
char *endptr;
id = strtoul(argv[1], &endptr, 10);
if ( *endptr != 0 ) {
fprintf(stderr, "illegal value %s\n", argv[1]);
return NULL;
}
}
getfile_usage();
return NULL;
}
int getfile_command(int argc, char **argv)
{
uint32_t id;
char *endptr;
char *file;
int off = (argc == 4 ? 1 : 0);
int ret = 0;
if ( argc != 3 && argc != 4 ) {
getfile_usage();
return 0;
}
id = strtoul(argv[1 + off], &endptr, 10);
if ( *endptr != 0 ) {
fprintf(stderr, "illegal value %s\n", argv[1 + off]);
return 1;
} else if ( ! id ) {
fprintf(stderr, "bad file/track id %u\n", id);
return 1;
}
file = argv[2 + off];
printf("Getting file/track %d to local file %s\n", id, file);
printf("\nError getting file from MTP device.\n");
ret = 1;
}
printf("\n");
return ret;
}
LIBMTP_mtpdevice_t * LIBMTP_Get_First_Device(void)
Definition libmtp.c:1719
void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t *device)
Definition libmtp.c:2586
void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t *device)
Definition libmtp.c:2559
LIBMTP_mtpdevice_t * LIBMTP_Get_Device(int device_nr)
Definition libmtp.c:1687
int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t *device, uint32_t const id, char const *const path, LIBMTP_progressfunc_t const callback, void const *const data)
Definition libmtp.c:5212