PatchworkOS
Loading...
Searching...
No Matches
openf.c
Go to the documentation of this file.
1#include <stdarg.h>
2#include <stdio.h>
3#include <stdlib.h>
4#include <sys/io.h>
5
6#include "common/print.h"
8
9fd_t openf(const char* _RESTRICT format, ...)
10{
11 char path[MAX_PATH];
12
13 va_list args;
14 va_start(args, format);
15 vsnprintf(path, MAX_PATH, format, args);
16 va_end(args);
17
18 return open(path);
19}
#define MAX_PATH
Maximum length of filepaths.
Definition MAX_PATH.h:11
fd_t open(const char *path)
System call for opening files.
Definition open.c:9
fd_t openf(const char *_RESTRICT format,...)
Wrapper for opening files with a formatted path.
Definition openf.c:9
__UINT64_TYPE__ fd_t
A file descriptor.
Definition fd_t.h:12
#define _RESTRICT
Definition config.h:17
#define va_start(ap, parmN)
Definition stdarg.h:14
#define va_end(ap)
Definition stdarg.h:13
__builtin_va_list va_list
Definition stdarg.h:9
_PUBLIC int vsnprintf(char *_RESTRICT s, size_t n, const char *_RESTRICT format, va_list arg)
Definition vsnprintf.c:5