I changed some indentation
This commit is contained in:
parent
4bee47593e
commit
4025416fd1
1 changed files with 37 additions and 37 deletions
74
expand.c
74
expand.c
|
@ -27,20 +27,20 @@ int main(int argc, char ** argv) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while(is_integer(argv[j]) && j < (argc - 1)) {
|
while(is_integer(argv[j]) && j < (argc - 1)) {
|
||||||
num_tab_stops++;
|
num_tab_stops++;
|
||||||
i++;
|
i++;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tab_stops = calloc(num_tab_stops, sizeof(*tab_stops));
|
tab_stops = calloc(num_tab_stops, sizeof(*tab_stops));
|
||||||
|
|
||||||
for(j = 2; j < num_tab_stops + 2; j++) {
|
for(j = 2; j < num_tab_stops + 2; j++) {
|
||||||
tab_stops[j-2] = stoi_mini(argv[j]);
|
tab_stops[j-2] = stoi_mini(argv[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(argv[1][0] == '-' && argv[1][1] == 't' &&
|
else if(argv[1][0] == '-' && argv[1][1] == 't' &&
|
||||||
argv[1][2] <= '9' && argv[1][2] >= '0'){
|
argv[1][2] <= '9' && argv[1][2] >= '0'){
|
||||||
char * str = strtok(argv[1], "t");
|
char * str = strtok(argv[1], "t");
|
||||||
str = strtok(NULL, "\0");
|
str = strtok(NULL, "\0");
|
||||||
num_tab_stops = comma_list_num_stops(str);
|
num_tab_stops = comma_list_num_stops(str);
|
||||||
|
@ -62,38 +62,38 @@ int main(int argc, char ** argv) {
|
||||||
else {
|
else {
|
||||||
cur_stop = 0; col_pos = 0;
|
cur_stop = 0; col_pos = 0;
|
||||||
for(c = fgetc(current_file); c != EOF; c = fgetc(current_file)) {
|
for(c = fgetc(current_file); c != EOF; c = fgetc(current_file)) {
|
||||||
if(c == '\t') {
|
if(c == '\t') {
|
||||||
if(num_tab_stops == 1) {
|
if(num_tab_stops == 1) {
|
||||||
cur_stop++;
|
cur_stop++;
|
||||||
printf(" "); col_pos++;
|
printf(" "); col_pos++;
|
||||||
while(col_pos % *tab_stops != 0) {
|
while(col_pos % *tab_stops != 0) {
|
||||||
printf(" "); col_pos++;
|
printf(" "); col_pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(cur_stop >= num_tab_stops) {
|
if(cur_stop >= num_tab_stops) {
|
||||||
printf(" ");
|
printf(" ");
|
||||||
col_pos++;
|
col_pos++;
|
||||||
cur_stop++;
|
cur_stop++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf(" "); col_pos++;
|
printf(" "); col_pos++;
|
||||||
while(col_pos % tab_stops[cur_stop] != 0) {
|
while(col_pos % tab_stops[cur_stop] != 0) {
|
||||||
printf(" "); col_pos++;
|
printf(" "); col_pos++;
|
||||||
}
|
}
|
||||||
cur_stop++;
|
cur_stop++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(c == '\n') {
|
else if(c == '\n') {
|
||||||
printf("%c", c);
|
printf("%c", c);
|
||||||
col_pos = 0;
|
col_pos = 0;
|
||||||
cur_stop = 0;
|
cur_stop = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%c", c);
|
printf("%c", c);
|
||||||
col_pos++;
|
col_pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(current_file);
|
fclose(current_file);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue