Implement realpath

This commit is contained in:
jD91mZM2
2018-10-07 10:32:36 +02:00
parent 26d629674a
commit 418a960f3b
11 changed files with 120 additions and 11 deletions
+29
View File
@@ -0,0 +1,29 @@
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char* path = realpath("stdlib/realpath.c", NULL);
if (!path) {
perror("realpath");
return -1;
}
puts(path);
free(path);
path = malloc(PATH_MAX);
memset(path, 0, PATH_MAX);
realpath("stdlib/realpath.c", path);
if (!path) {
perror("realpath");
free(path);
return -1;
}
puts(path);
free(path);
}