#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <errno.h>
int main (int argc, char **argv) {
char resolved_path[PATH_MAX];
if (argc != 2) {
printf("Usage: realpath <path>\n");
return 1;
} else {
if(realpath(argv[1], resolved_path) != NULL) {
printf("%s\n", resolved_path);
return 0;
}
if (errno) {
fprintf(stderr, "realpath: %s: %s\n", argv[1], strerror(errno));
return errno;
}
}
return 255;
}
Note: You are viewing an old version of this page. View the current version.
