@@ -35,10 +35,11 @@
static void usage(void) {
printf("client <image .swu to be installed>...\n");
+ printf("\nWith - or no swu file given, read from STDIN.\n");
}
char buf[256];
-int fd;
+int fd = STDIN_FILENO;
int verbose = 1;
bool dryrun = false;
int end_status = EXIT_SUCCESS;
@@ -99,7 +100,7 @@ static int end(RECOVERY_STATUS status)
*/
static int send_file(const char* filename) {
int rc;
- if ( (fd = open(filename, O_RDONLY)) < 0) {
+ if (filename && (fd = open(filename, O_RDONLY)) < 0) {
printf ("I cannot open %s\n", filename);
return EXIT_FAILURE;
}
@@ -166,6 +167,7 @@ int main(int argc, char *argv[]) {
argv += optind;
if (argc == 0 || (argc == 1 && strcmp(argv[0], "-") == 0)) {
+ printf("no input given, reading from STDIN...\n");
if (send_file(NULL)) exit(1);
} else {
for (int i = 0; i < argc; i++) {
Signed-off-by: Johann Neuhauser <jneuhauser@dh-electronics.com> --- tools/client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)