diff options
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/misc.c b/apps/misc.c index 0bac986a6f..66d1c272ae 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -1418,6 +1418,16 @@ int string_option(const char *option, const char *const oplist[], bool ignore_ca | |||
1418 | return -1; | 1418 | return -1; |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | /* open but with a builtin printf for assembling the path */ | ||
1422 | int open_pathfmt(int oflag, const char *pathfmt, ...) | ||
1423 | { | ||
1424 | static char buf[MAX_PATH]; | ||
1425 | va_list ap; | ||
1426 | vsnprintf(buf, sizeof(buf), pathfmt, ap); | ||
1427 | va_end(ap); | ||
1428 | return open(buf, oflag, 0666); | ||
1429 | } | ||
1430 | |||
1421 | /** Open a UTF-8 file and set file descriptor to first byte after BOM. | 1431 | /** Open a UTF-8 file and set file descriptor to first byte after BOM. |
1422 | * If no BOM is present this behaves like open(). | 1432 | * If no BOM is present this behaves like open(). |
1423 | * If the file is opened for writing and O_TRUNC is set, write a BOM to | 1433 | * If the file is opened for writing and O_TRUNC is set, write a BOM to |