diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/albumart.c | 7 | ||||
-rw-r--r-- | examples/albums.c | 17 | ||||
-rw-r--r-- | examples/detect.c | 15 |
3 files changed, 36 insertions, 3 deletions
diff --git a/examples/albumart.c b/examples/albumart.c index 51ab400..7fe9077 100644 --- a/examples/albumart.c +++ b/examples/albumart.c @@ -34,7 +34,7 @@ #endif static void usage(void) { - printf("Usage: albumart -i <fileid/trackid> -n <albumname> -s <storage_id> -p <parent_id> <imagefile>\n"); + printf("Usage: albumart -d -i <fileid/trackid> -n <albumname> -s <storage_id> -p <parent_id> <imagefile>\n"); exit(0); } @@ -58,10 +58,13 @@ int main (int argc, char **argv) { fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); - while ( (opt = getopt(argc, argv, "hn:i:s:p:")) != -1 ) { + while ( (opt = getopt(argc, argv, "dhn:i:s:p:")) != -1 ) { switch (opt) { case 'h': usage(); + case 'd': + LIBMTP_Set_Debug(9); + break; case 'i': idcount++; if ((tmp = realloc(ids, sizeof(uint32_t) * (idcount))) == NULL) { diff --git a/examples/albums.c b/examples/albums.c index a653126..8296e35 100644 --- a/examples/albums.c +++ b/examples/albums.c @@ -34,9 +34,24 @@ static void dump_albuminfo(LIBMTP_album_t *album) printf(" Tracks: %d\n\n",album->no_tracks); } -int main () { +int main (int argc, char *argv[]) { LIBMTP_mtpdevice_t *device_list, *iter; + int opt; + extern int optind; + extern char *optarg; + + while ((opt = getopt(argc, argv, "d")) != -1 ) { + switch (opt) { + case 'd': + LIBMTP_Set_Debug(9); + break; + } + } + + argc -= optind; + argv += optind; + LIBMTP_Init(); fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); diff --git a/examples/detect.c b/examples/detect.c index 393fd2c..8dba1b4 100644 --- a/examples/detect.c +++ b/examples/detect.c @@ -64,6 +64,21 @@ int main (int argc, char **argv) LIBMTP_error_number_t err; int i; + int opt; + extern int optind; + extern char *optarg; + + while ((opt = getopt(argc, argv, "d")) != -1 ) { + switch (opt) { + case 'd': + LIBMTP_Set_Debug(9); + break; + } + } + + argc -= optind; + argv += optind; + LIBMTP_Init(); fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); |