4 |
* |
* |
5 |
* Copyright (C) 2006 by Rob Sullivan, with ideas from code by Walter Harms |
* Copyright (C) 2006 by Rob Sullivan, with ideas from code by Walter Harms |
6 |
* |
* |
7 |
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ |
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 |
|
*/ |
9 |
#include "libbb.h" |
#include "libbb.h" |
10 |
|
|
11 |
int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
15 |
uint32_t crc; |
uint32_t crc; |
16 |
off_t length, filesize; |
off_t length, filesize; |
17 |
int bytes_read; |
int bytes_read; |
18 |
|
int exit_code = EXIT_SUCCESS; |
19 |
uint8_t *cp; |
uint8_t *cp; |
20 |
|
|
21 |
#if ENABLE_DESKTOP |
#if ENABLE_DESKTOP |
28 |
do { |
do { |
29 |
int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input); |
int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input); |
30 |
|
|
31 |
if (fd < 0) |
if (fd < 0) { |
32 |
|
exit_code = EXIT_FAILURE; |
33 |
continue; |
continue; |
34 |
|
} |
35 |
crc = 0; |
crc = 0; |
36 |
length = 0; |
length = 0; |
37 |
|
|
63 |
crc, filesize, *argv); |
crc, filesize, *argv); |
64 |
} while (*argv && *++argv); |
} while (*argv && *++argv); |
65 |
|
|
66 |
fflush_stdout_and_exit(EXIT_SUCCESS); |
fflush_stdout_and_exit(exit_code); |
67 |
} |
} |