PatchworkOS
3984a1d
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1
#include <
errno.h
>
2
#include <
stdbool.h
>
3
#include <
stdio.h
>
4
#include <
stdlib.h
>
5
#include <
string.h
>
6
#include <
sys/io.h
>
7
8
int
main
(
int
argc,
char
** argv)
9
{
10
for
(
int
i
= 1;
i
< argc;
i
++)
11
{
12
fd_t
fd =
open
(argv[
i
]);
13
if
(fd ==
ERR
)
14
{
15
printf
(
"open: failed to open %s (%s)\n"
, argv[
i
],
strerror
(
errno
));
16
return
EXIT_FAILURE
;
17
}
18
19
close
(fd);
20
}
21
22
return
EXIT_SUCCESS
;
23
}
main
int main(void)
Definition
main.c:5
y
int64_t y
Definition
main.c:153
errno.h
errno
#define errno
Error number variable.
Definition
errno.h:27
open
fd_t open(const char *path)
System call for opening files.
Definition
open.c:8
close
uint64_t close(fd_t fd)
System call for closing files.
Definition
close.c:8
ERR
#define ERR
Integer error value.
Definition
ERR.h:17
fd_t
__UINT64_TYPE__ fd_t
A file descriptor.
Definition
fd_t.h:12
io.h
stdbool.h
stdio.h
printf
_PUBLIC int printf(const char *_RESTRICT format,...)
Definition
printf.c:3
stdlib.h
EXIT_SUCCESS
#define EXIT_SUCCESS
Definition
stdlib.h:46
EXIT_FAILURE
#define EXIT_FAILURE
Definition
stdlib.h:47
string.h
strerror
_PUBLIC char * strerror(int errnum)
Definition
strerror.c:6
src
programs
utils
touch
main.c
Generated on Sat Jan 10 2026 00:03:15 for PatchworkOS by
1.9.8