diff options
author | Alberto Ruiz <aruiz@gnome.org> | 2011-09-02 16:05:13 +0100 |
---|---|---|
committer | Alberto Ruiz <aruiz@gnome.org> | 2011-09-02 16:05:13 +0100 |
commit | af73bdc18bd9b53d79254f2aa5bd70eb5b6d975b (patch) | |
tree | 5dd0f6f35e42ed86a6bbf2483472151a428deacb | |
parent | 0a30b08dbfdf87b45cb29dbed8a46224637ed6d2 (diff) | |
download | tbdiff-af73bdc18bd9b53d79254f2aa5bd70eb5b6d975b.tar.gz |
Make output file name parametric. Add install/uninstall option to Makefile.
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | create.c | 20 |
2 files changed, 18 insertions, 11 deletions
@@ -28,7 +28,14 @@ ifeq (,$(findstring clean,$(MAKECMDGOALS))) -include $(patsubst %.c,%.d,$(SHARED_SRC) $(DEPLOY_SRC) $(CREATE_SRC)) endif +install: otap_create otap_deploy + install otap_create /usr/local/bin + install otap_deploy /usr/local/bin + +uninstall: + rm -rf /usr/local/bin/otap_create + rm -rf /usr/local/bin/otap_crate + .PHONY: clean clean: rm -f otap_deploy otap_create *.o *.d - @@ -9,8 +9,8 @@ int main(int argc, char** argv) { - if(argc < 3) { - fprintf(stderr, "Error: Need to designate 2 trees to difference.\n"); + if(argc < 4) { + fprintf(stderr, "Usage: %s OUTPUT SOURCE_DIR TARGET_DIR.\n", argv[0]); return EXIT_FAILURE; } @@ -21,31 +21,31 @@ int main(int argc, char** argv) { otap_stat_t* tstat[2]; - tstat[0] = otap_stat(argv[1]); + tstat[0] = otap_stat(argv[2]); if(tstat[0] == NULL) { - fprintf(stderr, "Error: Unable to stat '%s'.\n", argv[1]); + fprintf(stderr, "Error: Unable to stat '%s'.\n", argv[2]); return EXIT_FAILURE; } if (chdir(cwd_buff) != 0) { fprintf(stderr, "Error: Unable to return to '%s'.\n", cwd_buff); return EXIT_FAILURE; - } + } - tstat[1] = otap_stat(argv[2]); + tstat[1] = otap_stat(argv[3]); if(tstat[1] == NULL) { - fprintf(stderr, "Error: Unable to stat '%s'.\n", argv[2]); + fprintf(stderr, "Error: Unable to stat '%s'.\n", argv[3]); return EXIT_FAILURE; } if (chdir(cwd_buff) != 0) { fprintf(stderr, "Error: Unable to return to '%s'.\n", cwd_buff); return EXIT_FAILURE; - } + } - FILE* fp = fopen("patch.otap", "wb"); + FILE* fp = fopen(argv[1], "wb"); if(fp == NULL) { - fprintf(stderr, "Error: Unable to open patch for writing.\n"); + fprintf(stderr, "ERROR: Unable to open patch for writing.\n"); return EXIT_FAILURE; } |