summaryrefslogtreecommitdiff
path: root/misc/bsdsfv/bsdsfv-1.18-color.patch
blob: 92607f96f3de6db8c24f62a73f82618250a5e170 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
--- bsdsfv.orig/bsdsfv.c	2003-10-05 03:07:45.000000000 +0200
+++ bsdsfv/bsdsfv.c	2009-11-11 09:04:53.000000000 +0100
@@ -40,6 +40,14 @@
 #define BSDSFV_VERSION	"BSDSFV for UNiX, $Revision: 1.18 $"
 #define MISSINGTAG 		".missing"
 #define BADTAG 			".bad"
+#define OPENBRACKET             "\e[34;01m[\e[0m"
+#define CLOSEBRACKET            "\e[34;01m]\e[0m"
+#define OKCOLOR                 "\e[32;01m"
+#define OKMSG                   "OK"
+#define BADCOLOR                "\e[31;01m"
+#define BADMSG                  "BAD"
+#define MISSINGCOLOR            "\e[33;01m"
+#define MISSINGMSG              "MISSING"
 
 typedef struct sfvtable {
 	char filename[FNAMELEN];
@@ -558,7 +566,7 @@
 				printf("0x%08X - ", sfvTable[0].crc);
 
 				if (sfvTable[0].crc == mycrc) {
-					printf("OK\n");
+					printf ("%s %s%s %s\n", OPENBRACKET, OKCOLOR, OKMSG, CLOSEBRACKET);
 					if (glftpdmode) {
 						sprintf(crap, "%s%s",
 						    sfvTable[0].filename,
@@ -570,7 +578,7 @@
 						unlink(crap);
 					}
 				} else {
-					printf("BAD\n");
+					printf ("%s %s%s %s\n", OPENBRACKET, BADCOLOR, BADMSG, CLOSEBRACKET);
 					badfiles++;
 					if (glftpdmode) {
 						sprintf(crap, "%s%s",
@@ -584,7 +592,7 @@
 					}
 				}
 			} else {
-				printf("MISSING\n");
+				printf ("%s %s%s %s\n", OPENBRACKET, MISSINGCOLOR, MISSINGMSG, CLOSEBRACKET);
 				missingfiles++;
 			}
 			numfiles++;
@@ -592,10 +600,11 @@
 			fclose(sfvfile);
 		}
 
-		printf
-		    ("\n%d file(s) tested - %d OK - %d bad - %d missing...\n",
-		    numfiles, numfiles - badfiles - missingfiles, badfiles,
-		    missingfiles);
+		printf ("\n%d file(s) tested - %s %s%d %s %s - %s %s%d %s %s - %s %s%d %s %s ...\n\n",
+		    numfiles,
+		    OPENBRACKET, OKCOLOR, numfiles - (badfiles + missingfiles), OKMSG, CLOSEBRACKET,
+		    OPENBRACKET, BADCOLOR, badfiles, BADMSG, CLOSEBRACKET,
+		    OPENBRACKET, MISSINGCOLOR, missingfiles, MISSINGMSG, CLOSEBRACKET);
 		fflush(stdout);
 
 
@@ -678,13 +687,13 @@
 					printf("local = 0x%08lX ... ", mycrc);
 
 					if (mycrc == sfvTable[cnt].crc) {
-						printf("OK\n");
+						printf ("%s %s%s %s\n", OPENBRACKET, OKCOLOR, OKMSG, CLOSEBRACKET);
 					} else {
 						if (mycrc == 0xffffffff) {
-							printf("MISSING\n");
+							printf ("%s %s%s %s\n", OPENBRACKET, MISSINGCOLOR, MISSINGMSG, CLOSEBRACKET);
 							missingfiles++;
 						} else {
-							printf("BAD\n");
+							printf ("%s %s%s %s\n", OPENBRACKET, BADCOLOR, BADMSG, CLOSEBRACKET);
 							badfiles++;
 						}
 					}
@@ -704,8 +713,9 @@
 				}
 			} else {
 				printf
-				    ("Testing %s ... listed = 0x%08X ... Local = MISSING\n",
-				    sfvTable[cnt].filename, sfvTable[cnt].crc);
+				    ("Testing %s ... listed = 0x%08X ... Local =            ... %s %s%s %s\n",
+				    sfvTable[cnt].filename, sfvTable[cnt].crc,
+				    OPENBRACKET, MISSINGCOLOR, MISSINGMSG, CLOSEBRACKET);
 				missingfiles++;
 				if (glftpdmode) {
 					sprintf(crap, "%s%s",
@@ -751,9 +761,11 @@
 		}
 
 		printf
-		    ("\n%d file(s) tested - %d OK - %d bad - %d missing ...\n\n",
-		    numfiles, numfiles - (badfiles + missingfiles), badfiles,
-		    missingfiles);
+		    ("\n%d file(s) tested - %s %s%d %s %s - %s %s%d %s %s - %s %s%d %s %s ...\n\n",
+		    numfiles,
+		    OPENBRACKET, OKCOLOR, numfiles - (badfiles + missingfiles), OKMSG, CLOSEBRACKET,
+		    OPENBRACKET, BADCOLOR, badfiles, BADMSG, CLOSEBRACKET,
+		    OPENBRACKET, MISSINGCOLOR, missingfiles, MISSINGMSG, CLOSEBRACKET);
 
 		if (missingfiles)
 			return 2;