mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 08:52:18 +01:00
example/stb-imagedumper: alias - to /dev/stdin
This commit is contained in:
1 parent
ee923a973c
commit
09b8cbb82f
1 file changed
+6
-5
@@ -684,7 +684,7 @@ struct {
|
|||||||
static const char* g_usage =
|
static const char* g_usage =
|
||||||
"Usage: stb-imagedumper *.{jpeg,png}\n"
|
"Usage: stb-imagedumper *.{jpeg,png}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"If no filenames are given then it defaults to /dev/stdin\n"
|
"The \"-\" filename is a special case, a short equivalent of /dev/stdin\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Flags:\n"
|
"Flags:\n"
|
||||||
" -a or -ascii-art (use ASCII art instead of ANSI color codes)\n"
|
" -a or -ascii-art (use ASCII art instead of ANSI color codes)\n"
|
||||||
@@ -994,7 +994,11 @@ handle(const char* filename,
|
|||||||
&src_w, &src_h, &channels_in_file,
|
&src_w, &src_h, &channels_in_file,
|
||||||
bytes_per_pixel);
|
bytes_per_pixel);
|
||||||
} else {
|
} else {
|
||||||
src_pixels = stbi_load(filename, //
|
const char* fn = filename;
|
||||||
|
if ((fn[0] == '-') && (fn[1] == '\x00')) {
|
||||||
|
fn = "/dev/stdin";
|
||||||
|
}
|
||||||
|
src_pixels = stbi_load(fn, //
|
||||||
&src_w, &src_h, &channels_in_file, bytes_per_pixel);
|
&src_w, &src_h, &channels_in_file, bytes_per_pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1201,9 +1205,6 @@ main(int argc, char** argv) {
|
|||||||
handle(demos[c].filename, demos[c].src_len, demos[c].src_ptr,
|
handle(demos[c].filename, demos[c].src_len, demos[c].src_ptr,
|
||||||
demos[c].src_len);
|
demos[c].src_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (g_flags.remaining_argc == 0) {
|
|
||||||
handle("/dev/stdin", 0, NULL, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int c = 0; c < g_flags.remaining_argc; c++) {
|
for (int c = 0; c < g_flags.remaining_argc; c++) {
|
||||||
|
|||||||
Reference in new issue
Block a user