Created
January 13, 2011 09:31
-
-
Save crmne/777632 to your computer and use it in GitHub Desktop.
Create directory hard links on Mac OS X
This file contains 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
hlink.o | |
hlink |
This file contains 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
/* Credit goes to http://bit.ly/fyXkcg */ | |
#include <unistd.h> | |
#include <stdio.h> | |
int main(int argc, char* argv[]) { | |
if (argc != 3) { | |
fprintf(stderr,"Use: hlink <src_dir> <target_dir>\n"); | |
return 1; | |
} | |
int ret = link(argv[1],argv[2]); | |
if (ret != 0) | |
perror("link"); | |
return ret; | |
} |
This file contains 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
.PHONY: clean | |
%.c.o: | |
hlink: hlink.o | |
${CC} ${LDFLAGS} $^ -o $@ | |
clean: | |
-rm hlink.o hlink |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment