summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-08-22 10:04:55 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-08-22 10:04:55 +0200
commitf46a8a98a79afcbb9e9910d7d71c1f8ef4e6637f (patch)
tree75d68cd50d5bd0e34801f944ea1230c3ca522ca6
parent4ade7486a562821df5b337cb238c7c69267dd1fc (diff)
vol_id: make the --offset= argument optional
-rw-r--r--extras/cdrom_id/cdrom_id.c6
-rw-r--r--extras/volume_id/vol_id.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
index acf7a97e41..9e27471863 100644
--- a/extras/cdrom_id/cdrom_id.c
+++ b/extras/cdrom_id/cdrom_id.c
@@ -693,11 +693,11 @@ print:
printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count);
if (cd_media_track_count > 0)
printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count);
- if (cd_media_track_count_audio)
+ if (cd_media_track_count_audio > 0)
printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio);
- if (cd_media_track_count_data)
+ if (cd_media_track_count_data > 0)
printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data);
- if (cd_media_session_last_offset)
+ if (cd_media_session_last_offset > 0)
printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset);
exit:
if (fd >= 0)
diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c
index 60428ab582..b3f810fc9d 100644
--- a/extras/volume_id/vol_id.c
+++ b/extras/volume_id/vol_id.c
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
{ "export", 0, NULL, 'x' },
{ "skip-raid", 0, NULL, 's' },
{ "probe-all", 0, NULL, 'a' },
- { "offset", 1, NULL, 'o' },
+ { "offset", 2, NULL, 'o' },
{ "help", 0, NULL, 'h' },
{}
};
@@ -196,7 +196,8 @@ int main(int argc, char *argv[])
probe_all = 1;
break;
case 'o':
- offset = strtoull(optarg, NULL, 0);
+ if (optarg[0] != '\0')
+ offset = strtoull(optarg, NULL, 0);
break;
case 'h':
printf("Usage: vol_id [options] <device>\n"