summaryrefslogtreecommitdiff
path: root/prism.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-01-06 20:44:03 -0500
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-01-06 20:44:03 -0500
commitab5153e97557791e2c12418ad3f53f53bed2a67a (patch)
treed4fec73b911307c743416b45bade86db8c75bbb3 /prism.c
parent59a9b205dfb6d68545e75f28083cf68eb064547d (diff)
downloadprism-ab5153e97557791e2c12418ad3f53f53bed2a67a.tar.gz
prism-ab5153e97557791e2c12418ad3f53f53bed2a67a.zip
Prism now supports diff versus the repository
Diffstat (limited to 'prism.c')
-rw-r--r--prism.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/prism.c b/prism.c
index cdcaa90..bf493d1 100644
--- a/prism.c
+++ b/prism.c
@@ -156,6 +156,27 @@ int res;
}
}
+static void diff_task(const char *filename)
+{
+int res;
+
+ printf("Comparing current %s to latest repository revision...\n", filename);
+ res = diff_db_file(filename, -1);
+ switch(res) {
+ case PRET_OK:
+ printf(" diff complete\n");
+ break;
+ case PRET_GZFAILED:
+ printf(" ERR: decompression failure\n");
+ break;
+ case PRET_NOREVISION:
+ printf(" ERR: no applicable revision found\n");
+ break;
+ default:
+ printf(" ERR: diff failed\n");
+ }
+}
+
int main(int argc, char *argv[])
{
if(argc == 1) {
@@ -179,8 +200,12 @@ int main(int argc, char *argv[])
hash_task(argv[2]);
else if(strcmp(argv[1], "revert") == 0 && argc == 3)
revert_task(argv[2]);
- else
- printf("Error processing command...\n");
+ else if(strcmp(argv[1], "diff") == 0 && argc == 3)
+ diff_task(argv[2]);
+ else {
+ usage(argv[0]);
+ printf("Error processing command...\n\n");
+ }
printf("\n");