aboutsummaryrefslogtreecommitdiffstats
path: root/bin/nfextract.c
diff options
context:
space:
mode:
authorYunchih Chen <yunchih.cat@gmail.com>2018-03-05 10:57:00 +0800
committerYunchih Chen <yunchih.cat@gmail.com>2018-03-05 10:57:00 +0800
commita3fd587346f4f1b8868b0a147c561c55b1b1da38 (patch)
tree7c78ae724e03904fabd5d16c56090baf1c615de3 /bin/nfextract.c
parentdd91a91704b76c3f46b841d86f5cedee684e7fa9 (diff)
downloadnfcollect-a3fd587346f4f1b8868b0a147c561c55b1b1da38.tar
nfcollect-a3fd587346f4f1b8868b0a147c561c55b1b1da38.tar.gz
nfcollect-a3fd587346f4f1b8868b0a147c561c55b1b1da38.tar.bz2
nfcollect-a3fd587346f4f1b8868b0a147c561c55b1b1da38.tar.lz
nfcollect-a3fd587346f4f1b8868b0a147c561c55b1b1da38.tar.xz
nfcollect-a3fd587346f4f1b8868b0a147c561c55b1b1da38.tar.zst
nfcollect-a3fd587346f4f1b8868b0a147c561c55b1b1da38.zip
Apply clang-format changes
Diffstat (limited to 'bin/nfextract.c')
-rw-r--r--bin/nfextract.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/bin/nfextract.c b/bin/nfextract.c
index 884665a..00b285e 100644
--- a/bin/nfextract.c
+++ b/bin/nfextract.c
@@ -22,8 +22,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-#include "extract.h"
#include "common.h"
+#include "extract.h"
#include <dirent.h>
#include <fcntl.h>
#include <getopt.h>
@@ -58,45 +58,46 @@ static void sig_handler(int signo) {
static void extract_each(const char *filename) {
nflog_state_t trunk;
- if(nfl_extract_worker(filename, &trunk) < 0)
+ if (nfl_extract_worker(filename, &trunk) < 0)
return;
char output[1024];
- for(int entry = 0; entry < trunk.header->n_entries; ++entry){
+ for (int entry = 0; entry < trunk.header->n_entries; ++entry) {
nfl_format_output(output, trunk.store);
- puts((char*)output);
- free((char*)output);
+ puts((char *)output);
+ free((char *)output);
}
- free((char*)filename);
+ free((char *)filename);
}
static void extract_all(const char *storage_dir) {
- DIR *dp;
- struct dirent *ep;
+ DIR *dp;
+ struct dirent *ep;
int i, index, max_index = -1;
char *trunk_files[MAX_TRUNK_ID];
memset(trunk_files, MAX_TRUNK_ID, 0);
- ERR(!(dp = opendir(storage_dir)),
- "Can't open the storage directory");
+ ERR(!(dp = opendir(storage_dir)), "Can't open the storage directory");
while ((ep = readdir(dp))) {
index = nfl_storage_match_index(ep->d_name);
- if(index >= 0) {
- if(index >= MAX_TRUNK_ID) {
+ if (index >= 0) {
+ if (index >= MAX_TRUNK_ID) {
WARN(1, "Storage trunk file index "
- "out of predefined range: %s", ep->d_name);
+ "out of predefined range: %s",
+ ep->d_name);
} else {
trunk_files[index] = strdup(ep->d_name);
- if(index > max_index) max_index = index;
+ if (index > max_index)
+ max_index = index;
}
}
}
- closedir (dp);
+ closedir(dp);
- for(i = 0; i < max_index; ++i)
- if(trunk_files[i])
+ for (i = 0; i < max_index; ++i)
+ if (trunk_files[i])
extract_each(trunk_files[i]);
}