From a6549ded40f0dc8d3bcee8a78f47d89cec051b67 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 14 Jul 2018 10:51:53 +0200 Subject: [PATCH] change: spaces on loop and if --- discspan.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/discspan.c b/discspan.c index c37f8cd..b3110dd 100644 --- a/discspan.c +++ b/discspan.c @@ -13,11 +13,11 @@ void printHumanReadSize(const char *output, unsigned long long int splitgroesse) char i = 0; humanread = splitgroesse; - while(humanread >= 1024) { + while (humanread >= 1024) { i++; humanread /= 1024; - switch(i) { + switch (i) { case 1: einheit = 'K'; break; @@ -39,11 +39,11 @@ int cmpfunc(const void *filea, const void *fileb) long long unsigned int a = ((const struct file_size*)filea)->fsize; long long unsigned int b = ((const struct file_size*)fileb)->fsize; - if(a < b) + if (a < b) return 1; - else if(a > b) + else if (a > b) return -1; - else if(a == b) + else if (a == b) return 0; else return -2; @@ -54,7 +54,7 @@ int get_array_length(FILE *in) int lines = 0; char pfad[255]; - while(fscanf(in, "%[^\n]\n", pfad) == 1) { + while (fscanf(in, "%[^\n]\n", pfad) == 1) { lines++; } rewind(in); @@ -71,16 +71,16 @@ unsigned long fill_array_from_file(FILE *in, struct file_size *fs, struct stat st; int lines = 0; - while(fscanf(in, "%[^\n]\n", pfad) == 1) { + while (fscanf(in, "%[^\n]\n", pfad) == 1) { // Lese Dateieigenschaften in st struct stat(pfad, &st); - if(st.st_size <= split) { + if (st.st_size <= split) { strcpy(fs[lines].name, pfad); fs[lines++].fsize = st.st_size; } else { // irgnore List erstellen - if(ignore == NULL) + if (ignore == NULL) ignore = fopen("ignore", "w"); fprintf(ignore, "%s\n", pfad); @@ -88,7 +88,7 @@ unsigned long fill_array_from_file(FILE *in, struct file_size *fs, } lines--; - if(ignore != NULL) + if (ignore != NULL) fclose(ignore); return lines; @@ -122,11 +122,11 @@ int splitter(struct file_size *input, const char *output, FILE *out; out = fopen(output, "w"); - for(int i = 0; i <= length; i++) { + for (int i = 0; i <= length; i++) { // ISO9660 filesystem overhead filesize = ceil(input[i].fsize / 2048.0) * 2048; - if(splitgroesse >= filesize) { + if (splitgroesse >= filesize) { splitgroesse -= filesize; fprintf(out, "%s\n", input[i].name); } else { @@ -137,7 +137,7 @@ int splitter(struct file_size *input, const char *output, printHumanReadSize(output, splitgroesse); - if(restcount > 0) { + if (restcount > 0) { memcpy(input, rest, length * sizeof(struct file_size)); input = (struct file_size *) realloc(input, restcount * sizeof(struct file_size)); @@ -162,15 +162,15 @@ int main(int argc, char *argv[]) unsigned long long split = dvd5; // gib die Funktionsübersicht aus bei zu wenig Parameter - if(argc <= 3) { + if (argc <= 3) { usage(); return 1; } // Lese Parameter ein int c; - while((c = getopt(argc, argv, ":59bcf:")) != -1) { - switch(c) { + while ((c = getopt(argc, argv, ":59bcf:")) != -1) { + switch (c) { case '5': split = dvd5; break; @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) char outname[strlen(output) + 3]; int num = 1; - while(s_length > 0) { + while (s_length > 0) { sprintf(outname, "%s%03d", output, num++); s_length = splitter(fs, outname, split, s_length); } -- 2.39.5