From 7367b7fdd2366afa7d608c8a3a082a768e4818f3 Mon Sep 17 00:00:00 2001 From: Lutz Mueller Date: Sun, 3 Feb 2002 08:20:46 +0000 Subject: [PATCH] =?UTF-8?q?2002-02-02=20=20Lutz=20M=EF=BF=BDller=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * frontends/command-line: Let --show-exif accept image numbers, too. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4067 67ed7778-7388-44ab-90cf-0a291f65f57c --- ChangeLog | 4 ++++ frontends/command-line/foreach.c | 2 +- frontends/command-line/foreach.h | 4 ++++ frontends/command-line/gphoto2-cmd-exif.c | 11 +++++++---- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29fb72e53..d5489618a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-02-02 Lutz Müller + + * frontends/command-line: Let --show-exif accept image numbers, too. + 2002-02-01 Lutz Müller * frontends/command-line/gphoto2-cmd-exif.[c,h]: New diff --git a/frontends/command-line/foreach.c b/frontends/command-line/foreach.c index de1e3d5ab..1e3a7d8ba 100644 --- a/frontends/command-line/foreach.c +++ b/frontends/command-line/foreach.c @@ -200,7 +200,7 @@ get_path_for_id_rec (const char *base_folder, unsigned int id, } } -static int +int get_path_for_id (const char *base_folder, unsigned char recurse, unsigned int id, const char **folder, const char **filename) { diff --git a/frontends/command-line/foreach.h b/frontends/command-line/foreach.h index 98e724713..67d1a1302 100644 --- a/frontends/command-line/foreach.h +++ b/frontends/command-line/foreach.h @@ -30,4 +30,8 @@ int for_each_image (const char *folder, image_action iaction, int for_each_image_in_range (const char *folder, unsigned char recurse, char *range, image_action action, int reverse); +int get_path_for_id (const char *base_folder, unsigned char recurse, + unsigned int id, const char **folder, + const char **filename); + #endif /* __FOREACH_H__ */ diff --git a/frontends/command-line/gphoto2-cmd-exif.c b/frontends/command-line/gphoto2-cmd-exif.c index c20dfe9a0..0e143f488 100644 --- a/frontends/command-line/gphoto2-cmd-exif.c +++ b/frontends/command-line/gphoto2-cmd-exif.c @@ -20,10 +20,14 @@ #include #include "gphoto2-cmd-exif.h" +#include #include +#include #include +#include "foreach.h" + #ifdef ENABLE_NLS # include # undef _ @@ -84,10 +88,9 @@ gp_cmd_exif (Camera *camera, const char *folder, const char *filename, ExifData *ed; /* Did the user specify a number? */ - if (!strchr (filename, '.')) { - gp_context_error (context, _("Please specify a filename.")); - return (GP_ERROR); - } + if (!strchr (filename, '.')) + CR (get_path_for_id (folder, 1, atoi (filename) - 1, &folder, + &filename)); CR (gp_file_new (&file)); CRU (gp_camera_file_get (camera, folder, filename, GP_FILE_TYPE_EXIF,