Create a gist now

Instantly share code, notes, and snippets.

Command-line interface to realpath(3)
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
char* instr;
char outstr[PATH_MAX];
instr = argv[1];
if (!realpath(instr, outstr)) {
printf("Usage: %s path\n", argv[0]);
return 1;
}
printf("%s\n", outstr);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment