summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2013-03-24 14:29:22 +0100
committerHelmut Grohne <helmut@subdivi.de>2013-03-24 14:29:22 +0100
commit0c76d87bc1b66a4337a0abfc1cda5661be6b7ed8 (patch)
treee26ff26aea98e6f08d65a9e0630fe99cd2a50a62
parent95f03d03491f0673d4c527f5a23697be44ad0a28 (diff)
downloadssdeep-0c76d87bc1b66a4337a0abfc1cda5661be6b7ed8.tar.gz
moved main function to ssdeep.c
-rw-r--r--fuzzy.c27
-rw-r--r--ssdeep.c50
2 files changed, 50 insertions, 27 deletions
diff --git a/fuzzy.c b/fuzzy.c
index e165107..b530e92 100644
--- a/fuzzy.c
+++ b/fuzzy.c
@@ -370,30 +370,3 @@ int fuzzy_hash_filename(const char *filename, /*@out@*/ char *result) {
return status;
}
-#ifdef S_SPLINT_S
-extern /*@only@*/ /*@null@*/ char *realpath(const char *,
- /*@null@*/ const char *);
-#endif
-
-int main(int argc, char **argv) {
- char digest[FUZZY_MAX_RESULT], *p;
- int i;
- puts("ssdeep,1.1--blocksize:hash:hash,filename");
- for(i = 1; i < argc; ++i) {
- p = realpath(argv[i], NULL);
- if(p == NULL)
- return 1;
- if(fuzzy_hash_filename(argv[i], digest) < 0) {
- free(p);
- return 1;
- }
- printf("%s,\"%s\"\n", digest, p);
- free(p);
- }
- if(argc == 1) {
- if(fuzzy_hash_stream(stdin, digest) < 0)
- return 1;
- printf("%s,\"stdin\"\n", digest);
- }
- return 0;
-}
diff --git a/ssdeep.c b/ssdeep.c
new file mode 100644
index 0000000..5f55dc6
--- /dev/null
+++ b/ssdeep.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013 Helmut Grohne <helmut@subdivi.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "fuzzy.h"
+
+#ifdef S_SPLINT_S
+extern /*@only@*/ /*@null@*/ char *realpath(const char *,
+ /*@null@*/ const char *);
+#endif
+
+int main(int argc, char **argv) {
+ char digest[FUZZY_MAX_RESULT], *p;
+ int i;
+ puts("ssdeep,1.1--blocksize:hash:hash,filename");
+ for(i = 1; i < argc; ++i) {
+ p = realpath(argv[i], NULL);
+ if(p == NULL)
+ return 1;
+ if(fuzzy_hash_filename(argv[i], digest) < 0) {
+ free(p);
+ return 1;
+ }
+ printf("%s,\"%s\"\n", digest, p);
+ free(p);
+ }
+ if(argc == 1) {
+ if(fuzzy_hash_stream(stdin, digest) < 0)
+ return 1;
+ printf("%s,\"stdin\"\n", digest);
+ }
+ return 0;
+}