Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/miscutils/mt.c


Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/miscutils/mt.c

    r821 r1765  
    11/* vi: set sw=4 ts=4: */
    2 #include "busybox.h"
    3 #include <stdio.h>
    4 #include <stdlib.h>
    5 #include <string.h>
     2/*
     3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     4 */
     5
     6#include "libbb.h"
    67#include <sys/mtio.h>
    7 #include <fcntl.h>
    88
    99struct mt_opcodes {
    10     char *name;
     10    const char *name;
    1111    short value;
    1212};
     
    5151};
    5252
     53int mt_main(int argc, char **argv);
    5354int mt_main(int argc, char **argv)
    5455{
     
    7980
    8081    if (code->name == 0) {
    81         bb_error_msg("unrecognized opcode %s.", argv[1]);
     82        bb_error_msg("unrecognized opcode %s", argv[1]);
    8283        return EXIT_FAILURE;
    8384    }
     
    8586    op.mt_op = code->value;
    8687    if (argc >= 3)
    87         op.mt_count = atoi(argv[2]);
     88        op.mt_count = xatoi_u(argv[2]);
    8889    else
    8990        op.mt_count = 1;        /* One, not zero, right? */
     
    102103    }
    103104
    104     fd = bb_xopen3(file, mode, 0);
     105    fd = xopen(file, mode);
    105106
    106107    switch (code->value) {
    107108        case MTTELL:
    108             if (ioctl(fd, MTIOCPOS, &position) < 0)
    109                 bb_perror_msg_and_die("%s", file);
    110             printf ("At block %d.\n", (int) position.mt_blkno);
     109            ioctl_or_perror_and_die(fd, MTIOCPOS, &position, "%s", file);
     110            printf("At block %d.\n", (int) position.mt_blkno);
    111111            break;
    112112
    113113        default:
    114             if (ioctl(fd, MTIOCTOP, &op) != 0)
    115                 bb_perror_msg_and_die("%s", file);
     114            ioctl_or_perror_and_die(fd, MTIOCTOP, &op, "%s", file);
    116115            break;
    117116    }
Note: See TracChangeset for help on using the changeset viewer.