aboutsummaryrefslogtreecommitdiff
path: root/importer
diff options
context:
space:
mode:
authorgabrielgio <gabrielgio@workstation.lan>2024-02-17 17:13:07 +0100
committergabrielgio <gabrielgio@workstation.lan>2024-02-17 17:13:07 +0100
commit0a2e62f57734f820cd20e151d1150342408552ed (patch)
treee1e9c786571bf1d856ba42c4c6cf014b008822c4 /importer
parent78b0ba12073b0940541d91a7568e8b7ada572848 (diff)
downloaddict-0a2e62f57734f820cd20e151d1150342408552ed.tar.gz
dict-0a2e62f57734f820cd20e151d1150342408552ed.tar.bz2
dict-0a2e62f57734f820cd20e151d1150342408552ed.zip
ref: Apply astyle --style=linux
Diffstat (limited to 'importer')
-rw-r--r--importer/main.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/importer/main.c b/importer/main.c
index d037745..b83e850 100644
--- a/importer/main.c
+++ b/importer/main.c
@@ -7,28 +7,28 @@
int run(const char *db, const char *txt);
-int main(int argc, char** argv) {
+int main(int argc, char** argv)
+{
int opt;
char* txt = NULL;
char* db = NULL;
while ((opt = getopt(argc, argv, "t:d:h")) != -1) {
switch(opt) {
- case 't':
- txt = copy_achar(optarg);
- break;
- case 'd':
- db = copy_achar(optarg);
- break;
- case 'h':
- // fall through
- default:
- printf("Usage: %s", argv[0]);
- goto end;
+ case 't':
+ txt = copy_achar(optarg);
+ break;
+ case 'd':
+ db = copy_achar(optarg);
+ break;
+ case 'h':
+ // fall through
+ default:
+ printf("Usage: %s", argv[0]);
+ goto end;
}
}
-
int r = run(db, txt);
end:
@@ -40,7 +40,8 @@ end:
return r;
}
-int run(const char *db, const char *txt) {
+int run(const char *db, const char *txt)
+{
char * line = NULL;
size_t len = 0;
int count = 0;
@@ -66,7 +67,7 @@ int run(const char *db, const char *txt) {
insert(data, line, read-1);
count++;
- if ((count % 321) == 0){
+ if ((count % 321) == 0) {
float t = ((float)count/(float)total)*100;
printf("\rLoading data [%03.0f%%] %d/%d", t, count, total);
}