Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
e2fsck: track errors/badness found for each inode
[tools/e2fsprogs.git]
/
misc
/
partinfo.c
diff --git
a/misc/partinfo.c
b/misc/partinfo.c
index
6c83fe9
..
c461e80
100644
(file)
--- a/
misc/partinfo.c
+++ b/
misc/partinfo.c
@@
-4,9
+4,10
@@
* Originally written by Alain Knaff, <alknaff@innet.lu>.
*
* Cleaned up by Theodore Ts'o, <tytso@mit.edu>.
* Originally written by Alain Knaff, <alknaff@innet.lu>.
*
* Cleaned up by Theodore Ts'o, <tytso@mit.edu>.
- *
+ *
*/
*/
+#include "config.h"
#include <sys/types.h>
#include <fcntl.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/types.h>
#include <fcntl.h>
#ifdef HAVE_SYS_IOCTL_H
@@
-23,12
+24,6
@@
#define BLKGETSIZE _IO(0x12,96) /* return device size */
#endif
#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;
int main(int argc, char **argv)
{
struct hd_geometry loc;
@@
-40,37
+35,41
@@
int main(int argc, char **argv)
setlocale(LC_CTYPE, "");
bindtextdomain(NLS_CAT_NAME, LOCALEDIR);
textdomain(NLS_CAT_NAME);
setlocale(LC_CTYPE, "");
bindtextdomain(NLS_CAT_NAME, LOCALEDIR);
textdomain(NLS_CAT_NAME);
+ set_com_err_gettext(gettext);
#endif
if (argc == 1) {
fprintf(stderr, _("Usage: %s device...\n\nPrints out the "
#endif
if (argc == 1) {
fprintf(stderr, _("Usage: %s device...\n\nPrints out the "
- "partition information for each given device.\n"
),
- "For example: %s /dev/hda\n\n", argv[0], argv[0]);
+ "partition information for each given device.\n"
+ "For example: %s /dev/hda\n\n"
)
, argv[0], argv[0]);
exit(1);
}
exit(1);
}
-
+
for (i=1; i < argc; i++) {
fd = open(argv[i], O_RDONLY);
if (fd < 0) {
for (i=1; i < argc; i++) {
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;
}
continue;
}
-
+
if (ioctl(fd, HDIO_GETGEO, &loc) < 0) {
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;
}
close(fd);
continue;
}
-
-
+
+
if (ioctl(fd, BLKGETSIZE, &size) < 0) {
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;
}
close(fd);
continue;
}
-
- printf(
"%s: h=%3d s=%3d c=%4d start=%8d size=%8lu end=%8d\n"
,
- argv[i],
+
+ 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);
close(fd);
loc.heads, (int)loc.sectors, loc.cylinders,
(int)loc.start, size, (int) loc.start + size -1);
close(fd);