mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-22 20:18:27 +02:00
ant-cl/ant-cl.c (image): accept standard input (-) as image source
This commit is contained in:
parent
64f441ce3a
commit
1e7fb38c04
@ -286,16 +286,21 @@ static void image(struct atrf_dsc *dsc, const char *name)
|
|||||||
uint8_t img[200] = { 0 };
|
uint8_t img[200] = { 0 };
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
|
if (!strcmp(name, "-")) {
|
||||||
|
file = stdin;
|
||||||
|
} else {
|
||||||
file = fopen(name, "r");
|
file = fopen(name, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
perror(name);
|
perror(name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
len = fread(img, 1, sizeof(img), file);
|
len = fread(img, 1, sizeof(img), file);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
perror(name);
|
perror(name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
if (file != stdin)
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
send_image(dsc, img, len);
|
send_image(dsc, img, len);
|
||||||
|
Loading…
Reference in New Issue
Block a user