summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorBenno Schulenberg <bensberg@justemail.net>2008-07-17 23:46:49 +0200
committerTheodore Ts'o <tytso@mit.edu>2008-07-18 21:14:54 -0400
commitcca95a827fbac56a8f17bb2900a44d6fb34fbe90 (patch)
tree4dcff758dcbd6f74e5aeb781ceecc296f0c053d5 /misc
parentad39bcd9e3b0fe98c33825db6dfdf343463e388c (diff)
downloade2fsprogs-cca95a827fbac56a8f17bb2900a44d6fb34fbe90.tar.gz
partinfo: Print clearer error messages.
Also use complete sentences, instead of separate words filled into a phrase. And gettextize the main output message. Signed-off-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/partinfo.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/misc/partinfo.c b/misc/partinfo.c
index 6c83fe9a..4424c5eb 100644
--- a/misc/partinfo.c
+++ b/misc/partinfo.c
@@ -23,12 +23,6 @@
#define BLKGETSIZE _IO(0x12,96) /* return device size */
#endif
-void print_error(char *operation, int error, char *device)
-{
- fprintf(stderr, _("%s failed for %s: %s\n"), operation, device,
- strerror(error));
-}
-
int main(int argc, char **argv)
{
struct hd_geometry loc;
@@ -52,24 +46,27 @@ int main(int argc, char **argv)
fd = open(argv[i], O_RDONLY);
if (fd < 0) {
- print_error(_("open"), errno, argv[i]);
+ fprintf(stderr, _("Cannot open %s: %s"),
+ argv[i], strerror(errno));
continue;
}
if (ioctl(fd, HDIO_GETGEO, &loc) < 0) {
- print_error(_("HDIO_GETGEO ioctl"), errno, argv[i]);
+ fprintf(stderr, _("Cannot get geometry of %s: %s"),
+ argv[i], strerror(errno));
close(fd);
continue;
}
if (ioctl(fd, BLKGETSIZE, &size) < 0) {
- print_error(_("BLKGETSIZE ioctl"), errno, argv[i]);
+ fprintf(stderr, _("Cannot get size of %s: %s"),
+ argv[i], strerror(errno));
close(fd);
continue;
}
- printf("%s: h=%3d s=%3d c=%4d start=%8d size=%8lu end=%8d\n",
+ printf(_("%s: h=%3d s=%3d c=%4d start=%8d size=%8lu end=%8d\n"),
argv[i],
loc.heads, (int)loc.sectors, loc.cylinders,
(int)loc.start, size, (int) loc.start + size -1);