Skip to content

Instantly share code, notes, and snippets.

@dpk
Created February 22, 2012 13:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpk/1885224 to your computer and use it in GitHub Desktop.
Save dpk/1885224 to your computer and use it in GitHub Desktop.
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