Logo: trait - as an alias for /dev/stdin

which can be useful where `/dev/stdin` is not available, eg. on Windows
This commit is contained in:
李通洲
2023-08-25 10:32:03 +08:00
parent f19a3b5549
commit fe3d38e542
2 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -1205,7 +1205,8 @@ static void parseArguments(FFdata* data, int argc, const char** argv)
}
if(i == argc - 1 || (
*argv[i + 1] == '-' &&
argv[i + 1][0] == '-' &&
argv[i + 1][1] != '\0' && // `-` is used as an alias for `/dev/stdin`
strcasecmp(argv[i], "--separator-string") != 0 // Separator string can start with a -
)) {
parseOption(data, argv[i], NULL);
+4 -1
View File
@@ -359,7 +359,10 @@ static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate();
if(!ffAppendFileBuffer(options->source.chars, &content))
if(ffStrbufEqualS(&options->source, "-")
? !ffAppendFDBuffer(FFUnixFD2NativeFD(STDIN_FILENO), &content)
: !ffAppendFileBuffer(options->source.chars, &content)
)
{
fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars);
return false;