summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorLutz Mueller <lutz@users.sourceforge.net>2002-02-03 08:20:46 +0000
committerLutz Mueller <lutz@users.sourceforge.net>2002-02-03 08:20:46 +0000
commit7367b7fdd2366afa7d608c8a3a082a768e4818f3 (patch)
tree442031d06471351385777ebe52c0fe997e14c7e8 /frontends
parentc067af31c8a85a8797413667cabf1030d98e0c1e (diff)
downloadlibgphoto2-7367b7fdd2366afa7d608c8a3a082a768e4818f3.tar.gz
2002-02-02 Lutz M�ller <lutz@users.sourceforge.net>
* 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
Diffstat (limited to 'frontends')
-rw-r--r--frontends/command-line/foreach.c2
-rw-r--r--frontends/command-line/foreach.h4
-rw-r--r--frontends/command-line/gphoto2-cmd-exif.c11
3 files changed, 12 insertions, 5 deletions
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 <config.h>
#include "gphoto2-cmd-exif.h"
+#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <libexif/exif-data.h>
+#include "foreach.h"
+
#ifdef ENABLE_NLS
# include <libintl.h>
# 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,