From 94823c65ac7555a7ed19521184064255902ff615 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Fri, 12 Jun 2009 17:12:41 +0000 Subject: Fix beastpatcher on linux and code police. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21263 a1c6a512-1295-4272-9138-f99709370657 --- utils/MTP/beastpatcher/main.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'utils/MTP/beastpatcher/main.c') diff --git a/utils/MTP/beastpatcher/main.c b/utils/MTP/beastpatcher/main.c index 56d1a1e94c..1ccff72a79 100644 --- a/utils/MTP/beastpatcher/main.c +++ b/utils/MTP/beastpatcher/main.c @@ -38,16 +38,17 @@ ****************************************************************************/ #include +#include #include "beastpatcher.h" #include "mtp_common.h" #if defined(__WIN32__) || defined(_WIN32) #include +#include "../MTP_DLL/MTP_DLL.h" #endif #define VERSION "1.0 with v1 bootloader" -#include "../MTP_DLL/MTP_DLL.h" static void print_usage(void) { @@ -56,7 +57,7 @@ static void print_usage(void) fprintf(stderr,"Where [action] is one of the following options:\n"); fprintf(stderr," -i, --install (default)\n"); fprintf(stderr," -h, --help\n"); - fprintf(stderr," -s, --send nk.bin\n"); + fprintf(stderr," -s, --send nk.bin\n"); fprintf(stderr,"\n"); } @@ -65,27 +66,30 @@ int main(int argc, char* argv[]) { int res; char yesno[4]; - struct mtp_info_t mtp_info; + struct mtp_info_t mtp_info; - fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n"); + fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n"); fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n"); fprintf(stderr,"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); - if(argc == 1 || strcmp(argv[1],"-i")==0 || strcmp(argv[1],"--install")==0) { - res = beastpatcher(); - /* don't ask for enter if started with command line arguments */ - if(argc == 1) { - printf("\nPress ENTER to exit beastpatcher: "); - fgets(yesno,4,stdin); - } - } - else if((argc > 2) && ((strcmp(argv[1],"-s")==0) || (strcmp(argv[1],"--send")==0))) { + if(argc == 1 || strcmp(argv[1],"-i")==0 || strcmp(argv[1],"--install")==0) { + res = beastpatcher(); + /* don't ask for enter if started with command line arguments */ + if(argc == 1) { + printf("\nPress ENTER to exit beastpatcher: "); + fgets(yesno,4,stdin); + } + } + else if((argc > 2) && ((strcmp(argv[1],"-s")==0) || (strcmp(argv[1],"--send")==0))) { + mtp_init(&mtp_info); + mtp_scan(&mtp_info); res = mtp_send_file(&mtp_info, argv[2]); - } - else { - print_usage(); + mtp_finished(&mtp_info); + } + else { + print_usage(); res = -1; - } + } return res; } -- cgit v1.2.3