Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/miscutils/rx.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/rx.c

    r821 r1765  
    22/*-------------------------------------------------------------------------
    33 * Filename:      xmodem.c
    4  * Version:       $Id: rx.c,v 1.2 2004/03/15 08:28:46 andersen Exp $
    54 * Copyright:     Copyright (C) 2001, Hewlett-Packard Company
    65 * Author:        Christopher Hoover <ch@hpl.hp.com>
     
    2120 */
    2221
    23 #include "busybox.h"
    24 #include <stdlib.h>
    25 #include <stdarg.h>
    26 #include <stdio.h>
    27 #include <unistd.h>
    28 #include <errno.h>
    29 #include <termios.h>
    30 #include <signal.h>
    31 #include <sys/types.h>
    32 #include <sys/stat.h>
    33 #include <fcntl.h>
    34 #include <string.h>
    35 
     22#include "libbb.h"
    3623
    3724#define SOH 0x01
     
    5744#define MAXERRORS 10
    5845
    59 static int read_byte(int fd, unsigned int timeout) {
     46static int read_byte(int fd, unsigned int timeout)
     47{
    6048    char buf[1];
    6149    int n;
     
    213201        length += blockLength;
    214202
    215         if (bb_full_write(filefd, blockBuf, blockLength) < 0) {
     203        if (full_write(filefd, blockBuf, blockLength) < 0) {
    216204            note_error("write to file failed: %m");
    217205            goto fatal;
     
    262250}
    263251
     252int rx_main(int argc, char **argv);
    264253int rx_main(int argc, char **argv)
    265254{
     
    275264
    276265    fn = argv[1];
    277     ttyfd = bb_xopen3(CURRENT_TTY, O_RDWR, 0);
    278     filefd = bb_xopen3(fn, O_RDWR|O_CREAT|O_TRUNC, 0666);
     266    ttyfd = xopen(CURRENT_TTY, O_RDWR);
     267    filefd = xopen(fn, O_RDWR|O_CREAT|O_TRUNC);
    279268
    280269    if (tcgetattr(ttyfd, &tty) < 0)
    281             bb_error_msg_and_die("%s: tcgetattr failed: %m\n", argv[0]);
     270            bb_perror_msg_and_die("tcgetattr");
    282271
    283272    orig_tty = tty;
     
    297286
    298287    if (n < 0)
    299             bb_error_msg_and_die("\n%s: receive failed:\n  %s\n",
    300                                argv[0], error_buf);
    301 
    302     bb_fflush_stdout_and_exit(EXIT_SUCCESS);
    303 }
     288        bb_error_msg_and_die("\nreceive failed:\n  %s", error_buf);
     289
     290    fflush_stdout_and_exit(EXIT_SUCCESS);
     291}
Note: See TracChangeset for help on using the changeset viewer.