Mercurial > hg > dmlib
changeset 1870:1e8f60ce21d1
Add check for writability in output format option -f
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 24 Jun 2018 18:53:15 +0300 |
parents | 1067df067f28 |
children | 7d615a735ce1 |
files | tools/gfxconv.c |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/gfxconv.c Sun Jun 24 18:45:33 2018 +0300 +++ b/tools/gfxconv.c Sun Jun 24 18:53:15 2018 +0300 @@ -585,7 +585,7 @@ dmGetConvFormat(optInFormat, optForcedInSubFormat, &fmt); if ((fmt.flags & DM_FMT_RD) == 0) { - dmErrorMsg("Invalid input format '%s'.\n", + dmErrorMsg("Invalid input format '%s', does not support reading.\n", fmt.name); return FALSE; } @@ -605,8 +605,20 @@ break; case 5: - if (!dmParseFormatOption("output", "Output", optArg, &optOutFormat, &optOutSubFormat)) - return FALSE; + { + DMConvFormat fmt; + + if (!dmParseFormatOption("output", "Output", optArg, &optOutFormat, &optOutSubFormat)) + return FALSE; + + dmGetConvFormat(optOutFormat, optOutSubFormat, &fmt); + if ((fmt.flags & DM_FMT_WR) == 0) + { + dmErrorMsg("Invalid output format '%s', does not support writing.\n", + fmt.name); + return FALSE; + } + } break; case 6: