PatchworkOS
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1
#define __STDC_WANT_LIB_EXT1__ 1
2
#include <
errno.h
>
3
#include <
stdbool.h
>
4
#include <
stdint.h
>
5
#include <
stdio.h
>
6
#include <
stdlib.h
>
7
#include <
string.h
>
8
#include <
sys/io.h
>
9
10
uint32_t
main
(
uint32_t
argc,
char
** argv)
11
{
12
if
(argc != 3)
13
{
14
fprintf
(
stderr
,
"Usage: %s <source> <destination>\n"
, argv[0]);
15
return
EXIT_FAILURE
;
16
}
17
18
if
(
rename
(argv[1], argv[2]) ==
EOF
)
19
{
20
fprintf
(
stderr
,
"mv: failed to rename file (%s)\n"
,
strerror
(
errno
));
21
return
EXIT_FAILURE
;
22
}
23
24
return
EXIT_SUCCESS
;
25
}
errno.h
errno
#define errno
Error number variable.
Definition
errno.h:27
io.h
main
int main()
Definition
main.c:97
stdbool.h
stdint.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:15
stdio.h
rename
_PUBLIC int rename(const char *oldpath, const char *newpath)
Definition
rename.c:5
EOF
#define EOF
Definition
stdio.h:25
stderr
FILE * stderr
Definition
std_streams.c:18
fprintf
_PUBLIC int fprintf(FILE *_RESTRICT stream, const char *_RESTRICT format,...)
Definition
fprintf.c:5
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
mv
main.c
Generated by
1.9.8