mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Report "<stdin>" or "<stdout>" when using "-" as a filename placeholder (#1297)
Also fix a memory leak with `targetFileNames`
This commit is contained in:
@@ -142,25 +142,6 @@ void argErr(char flag, char const *fmt, ...)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
FILE *openFile(char const *fileName, char const *mode)
|
||||
{
|
||||
if (!fileName)
|
||||
return NULL;
|
||||
|
||||
FILE *file;
|
||||
if (strcmp(fileName, "-") != 0)
|
||||
file = fopen(fileName, mode);
|
||||
else if (mode[0] == 'r')
|
||||
file = fdopen(STDIN_FILENO, mode);
|
||||
else
|
||||
file = fdopen(STDOUT_FILENO, mode);
|
||||
|
||||
if (!file)
|
||||
err("Failed to open file \"%s\"", fileName);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
// Short options
|
||||
static const char *optstring = "dl:m:Mn:O:o:p:S:s:tVvWwx";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user