src/scanner.c

Fri, 17 May 2013 14:41:44 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 17 May 2013 14:41:44 +0200
changeset 40
5938a9b74e8e
parent 36
a7ff583e153f
child 41
c2e73e175341
permissions
-rw-r--r--

improved printing the results and fixed bug where the filename was displayed as an empty string

10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
1 /*
34
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
36
a7ff583e153f updated copyright year + added make install + removed project files
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
3 * Copyright 2013 Mike Becker. All rights reserved.
34
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
4 *
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
5 * Redistribution and use in source and binary forms, with or without
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
6 * modification, are permitted provided that the following conditions are met:
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
7 *
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
8 * 1. Redistributions of source code must retain the above copyright
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
9 * notice, this list of conditions and the following disclaimer.
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
10 *
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
11 * 2. Redistributions in binary form must reproduce the above copyright
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
12 * notice, this list of conditions and the following disclaimer in the
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
13 * documentation and/or other materials provided with the distribution.
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
14 *
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
25 *
20
43725438ac50 Changed author comments + added signatures for upcomming bfile heuristics
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
26 * scanner.c
10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
27 *
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
28 * Created on: 23.05.2011
20
43725438ac50 Changed author comments + added signatures for upcomming bfile heuristics
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
29 * Author: Mike
10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
30 */
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
31
8
28319b20968c encapsulated common operations
Mike Becker <universe@uap-core.de>
parents: 6
diff changeset
32
10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
33 #include "scanner.h"
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
34 #include "suffix_fnc.h"
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
35 #include "bfile_heuristics.h"
27
95a958e3de88 added regexp_parser struct and compile function
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
36 #include "regex_parser.h"
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
37 #include <sys/stat.h>
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
38
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
39 int scanDirectory(scanner_t scanner, settings_t* settings) {
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
40
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
41 DIR *dirf;
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
42 struct dirent *entry;
40
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
43 int entrynamelen;
18
cae1294702aa Increased warning level, fixed resulting warnings, changed std form c99 to gnu99
Mike Becker <universe@uap-core.de>
parents: 16
diff changeset
44 int lines, a;
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
45 int lineSum = 0;
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
46 bool bfile;
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
47 struct stat statbuf;
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
48
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
49 if ((dirf = opendir(scanner.dir)) == NULL) {
34
fa9bda32de17 moved src files to src subdirectory and added licence text
Mike Becker <universe@uap-core.de>
parents: 30
diff changeset
50 printf("%s", scanner.dir);
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
51 perror(" Directory access failed");
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
52 return 0;
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
53 }
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
54
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
55 while ((entry = readdir(dirf)) != NULL) {
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
56 if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) {
40
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
57 /* Construct absolute pathname string */
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
58 entrynamelen = strlen(entry->d_name);
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
59 char filename[(1+strlen(scanner.dir)+entrynamelen)];
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
60 strcpy(filename, scanner.dir);
14
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
61 strncat(filename, &settings->fileSeparator, 1);
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
62 strcat(filename, entry->d_name);
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
63
22
4508da679ffb completed binary file heuristics
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
64 /* Check for subdirectory */
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
65 if (stat(filename, &statbuf) == 0) {
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
66 if (!(statbuf.st_mode & S_IFREG)) {
40
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
67 printf("%*s\n", entrynamelen+scanner.spaces, entry->d_name);
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
68 if (settings->recursive && (statbuf.st_mode & S_IFDIR)) {
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
69 lineSum += scanDirectory(
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
70 (scanner_t) {filename, scanner.spaces+1}, settings);
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
71 }
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
72 continue;
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
73 }
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
74 } else {
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
75 perror(" Error in stat call");
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
76 continue;
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
77 }
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
78
30
d642fdb6745e allow parallel use of -s and -S
Mike Becker <universe@uap-core.de>
parents: 28
diff changeset
79 if ((settings->includeSuffixes->count == 0
d642fdb6745e allow parallel use of -s and -S
Mike Becker <universe@uap-core.de>
parents: 28
diff changeset
80 || testSuffix(filename, settings->includeSuffixes))
d642fdb6745e allow parallel use of -s and -S
Mike Becker <universe@uap-core.de>
parents: 28
diff changeset
81 && !testSuffix(filename, settings->excludeSuffixes)) {
25
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
82 /* Count lines */
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
83 lines = 0;
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
84 bfile = false;
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
85 bfile_reset(settings->bfileHeuristics);
27
95a958e3de88 added regexp_parser struct and compile function
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
86 char line_buffer[REGEX_MAX_LINELENGTH];
25
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
87 int line_buffer_offset = 0;
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
88
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
89 FILE *file = fopen(filename, "r");
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
90 if (file == NULL) {
40
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
91 printf("%*s", entrynamelen+scanner.spaces, entry->d_name);
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
92 perror(" File acces failed");
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
93 continue;
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
94 }
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
95
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
96 do {
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
97 a = fgetc(file);
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
98
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
99 bfile = bfile_check(settings->bfileHeuristics, a);
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
100
28
72a98cbcb9f1 added regex parser
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
101 if (a == 10 || a == EOF) {
25
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
102 line_buffer[line_buffer_offset] = 0;
28
72a98cbcb9f1 added regex parser
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
103 if (regex_parser_do(settings->regex, line_buffer) == 0) {
72a98cbcb9f1 added regex parser
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
104 /* Only subtract lines when matching has finished */
72a98cbcb9f1 added regex parser
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
105 if (!regex_parser_matching(settings->regex)) {
72a98cbcb9f1 added regex parser
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
106 lines -= settings->regex->matched_lines;
72a98cbcb9f1 added regex parser
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
107 }
72a98cbcb9f1 added regex parser
Mike Becker <universe@uap-core.de>
parents: 27
diff changeset
108 }
25
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
109
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
110 line_buffer_offset = 0;
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
111 lines++;
25
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
112 } else {
27
95a958e3de88 added regexp_parser struct and compile function
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
113 if (line_buffer_offset < REGEX_MAX_LINELENGTH) {
25
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
114 line_buffer[line_buffer_offset] = a;
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
115 line_buffer_offset++;
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
116 } else {
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
117 line_buffer[line_buffer_offset-1] = 0;
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
118 settings->confusing_lnlen = true;
802c5382f499 Added line buffer (and warning message - there is no regexp parser, though)
Mike Becker <universe@uap-core.de>
parents: 23
diff changeset
119 }
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
120 }
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
121 } while (!bfile && a != EOF);
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
122 fclose(file);
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
123
22
4508da679ffb completed binary file heuristics
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
124 /* Print and sum line count */
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
125 if (bfile) {
22
4508da679ffb completed binary file heuristics
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
126 if (!settings->matchesOnly) {
40
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
127 printf("%*s%*s%19s\n",
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
128 entrynamelen+scanner.spaces, entry->d_name,
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
129 60-entrynamelen-scanner.spaces, "", "binary");
22
4508da679ffb completed binary file heuristics
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
130 }
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
131 } else {
22
4508da679ffb completed binary file heuristics
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
132 lineSum += lines;
40
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
133 printf("%*s%*s%13d lines\n",
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
134 entrynamelen+scanner.spaces, entry->d_name,
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
135 60-entrynamelen-scanner.spaces, "", lines);
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
136 }
16
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
137 } else {
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
138 if (!settings->matchesOnly) {
22
4508da679ffb completed binary file heuristics
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
139 /* Print hint */
40
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
140 printf("%*s%*s%19s\n",
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
141 entrynamelen+scanner.spaces, entry->d_name,
5938a9b74e8e improved printing the results and fixed bug where the filename was displayed as an empty string
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
142 60-entrynamelen-scanner.spaces, "", "no match");
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
143 }
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
144 }
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
145 }
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
146 }
23
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
147
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
148 closedir(dirf);
778388400f7b encapsulated scanner arguments + enabled optimizer + empty file is no bfile
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
149
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
150 return lineSum;
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
151 }

mercurial