Created
February 22, 2012 13:44
-
-
Save dpk/1885224 to your computer and use it in GitHub Desktop.
Command-line interface to realpath(3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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