Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/miscutils/rx.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/miscutils/rx.c
r821 r1770 2 2 /*------------------------------------------------------------------------- 3 3 * Filename: xmodem.c 4 * Version: $Id: rx.c,v 1.2 2004/03/15 08:28:46 andersen Exp $5 4 * Copyright: Copyright (C) 2001, Hewlett-Packard Company 6 5 * Author: Christopher Hoover <ch@hpl.hp.com> … … 21 20 */ 22 21 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" 36 23 37 24 #define SOH 0x01 … … 57 44 #define MAXERRORS 10 58 45 59 static int read_byte(int fd, unsigned int timeout) { 46 static int read_byte(int fd, unsigned int timeout) 47 { 60 48 char buf[1]; 61 49 int n; … … 213 201 length += blockLength; 214 202 215 if ( bb_full_write(filefd, blockBuf, blockLength) < 0) {203 if (full_write(filefd, blockBuf, blockLength) < 0) { 216 204 note_error("write to file failed: %m"); 217 205 goto fatal; … … 262 250 } 263 251 252 int rx_main(int argc, char **argv); 264 253 int rx_main(int argc, char **argv) 265 254 { … … 275 264 276 265 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); 279 268 280 269 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"); 282 271 283 272 orig_tty = tty; … … 297 286 298 287 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.