blob: 680e23af0bc63800f00537b749d732a74ee3a0f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char** argv)
{
if (argc != 2) {
printf("usage: realpath <path>\n");
return 1;
}
char* value = realpath(argv[1], nullptr);
if (value == nullptr) {
printf("realpath() error: %s\n", strerror(errno));
return 1;
}
printf("%s\n", value);
free(value);
return 0;
}
|