Skip to content
This repository
Browse code

Fix indentation of switch statements

  • Loading branch information...
commit 26678682ca90b68f19b993e259bf43384c0a18ec 1 parent 7d63900
ridiculousfish authored November 19, 2012
1,616  builtin.cpp
@@ -476,23 +476,23 @@ static int builtin_bind_add(wchar_t *seq, wchar_t *cmd, int terminfo)
476 476
             switch (errno)
477 477
             {
478 478
 
479  
-            case ENOENT:
480  
-            {
481  
-                append_format(stderr_buffer, _(L"%ls: No key with name '%ls' found\n"), L"bind", seq);
482  
-                break;
483  
-            }
  479
+                case ENOENT:
  480
+                {
  481
+                    append_format(stderr_buffer, _(L"%ls: No key with name '%ls' found\n"), L"bind", seq);
  482
+                    break;
  483
+                }
484 484
 
485  
-            case EILSEQ:
486  
-            {
487  
-                append_format(stderr_buffer, _(L"%ls: Key with name '%ls' does not have any mapping\n"), L"bind", seq);
488  
-                break;
489  
-            }
  485
+                case EILSEQ:
  486
+                {
  487
+                    append_format(stderr_buffer, _(L"%ls: Key with name '%ls' does not have any mapping\n"), L"bind", seq);
  488
+                    break;
  489
+                }
490 490
 
491  
-            default:
492  
-            {
493  
-                append_format(stderr_buffer, _(L"%ls: Unknown error trying to bind to key named '%ls'\n"), L"bind", seq);
494  
-                break;
495  
-            }
  491
+                default:
  492
+                {
  493
+                    append_format(stderr_buffer, _(L"%ls: Unknown error trying to bind to key named '%ls'\n"), L"bind", seq);
  494
+                    break;
  495
+                }
496 496
 
497 497
             }
498 498
 
@@ -612,45 +612,45 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
612 612
 
613 613
         switch (opt)
614 614
         {
615  
-        case 0:
616  
-            if (long_options[opt_index].flag != 0)
617  
-                break;
618  
-            append_format(stderr_buffer,
619  
-                          BUILTIN_ERR_UNKNOWN,
620  
-                          argv[0],
621  
-                          long_options[opt_index].name);
622  
-            builtin_print_help(parser, argv[0], stderr_buffer);
  615
+            case 0:
  616
+                if (long_options[opt_index].flag != 0)
  617
+                    break;
  618
+                append_format(stderr_buffer,
  619
+                              BUILTIN_ERR_UNKNOWN,
  620
+                              argv[0],
  621
+                              long_options[opt_index].name);
  622
+                builtin_print_help(parser, argv[0], stderr_buffer);
623 623
 
624  
-            return STATUS_BUILTIN_ERROR;
  624
+                return STATUS_BUILTIN_ERROR;
625 625
 
626  
-        case 'a':
627  
-            all = 1;
628  
-            break;
  626
+            case 'a':
  627
+                all = 1;
  628
+                break;
629 629
 
630  
-        case 'e':
631  
-            mode = BIND_ERASE;
632  
-            break;
  630
+            case 'e':
  631
+                mode = BIND_ERASE;
  632
+                break;
633 633
 
634 634
 
635  
-        case 'h':
636  
-            builtin_print_help(parser, argv[0], stdout_buffer);
637  
-            return STATUS_BUILTIN_OK;
  635
+            case 'h':
  636
+                builtin_print_help(parser, argv[0], stdout_buffer);
  637
+                return STATUS_BUILTIN_OK;
638 638
 
639  
-        case 'k':
640  
-            use_terminfo = 1;
641  
-            break;
  639
+            case 'k':
  640
+                use_terminfo = 1;
  641
+                break;
642 642
 
643  
-        case 'K':
644  
-            mode = BIND_KEY_NAMES;
645  
-            break;
  643
+            case 'K':
  644
+                mode = BIND_KEY_NAMES;
  645
+                break;
646 646
 
647  
-        case 'f':
648  
-            mode = BIND_FUNCTION_NAMES;
649  
-            break;
  647
+            case 'f':
  648
+                mode = BIND_FUNCTION_NAMES;
  649
+                break;
650 650
 
651  
-        case '?':
652  
-            builtin_unknown_option(parser, argv[0], argv[woptind-1]);
653  
-            return STATUS_BUILTIN_ERROR;
  651
+            case '?':
  652
+                builtin_unknown_option(parser, argv[0], argv[woptind-1]);
  653
+                return STATUS_BUILTIN_ERROR;
654 654
 
655 655
         }
656 656
 
@@ -659,58 +659,58 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
659 659
     switch (mode)
660 660
     {
661 661
 
662  
-    case BIND_ERASE:
663  
-    {
664  
-        builtin_bind_erase(&argv[woptind], all);
665  
-        break;
666  
-    }
667  
-
668  
-    case BIND_INSERT:
669  
-    {
670  
-        switch (argc-woptind)
671  
-        {
672  
-        case 0:
  662
+        case BIND_ERASE:
673 663
         {
674  
-            builtin_bind_list();
  664
+            builtin_bind_erase(&argv[woptind], all);
675 665
             break;
676 666
         }
677 667
 
678  
-        case 2:
  668
+        case BIND_INSERT:
679 669
         {
680  
-            builtin_bind_add(argv[woptind], argv[woptind+1], use_terminfo);
  670
+            switch (argc-woptind)
  671
+            {
  672
+                case 0:
  673
+                {
  674
+                    builtin_bind_list();
  675
+                    break;
  676
+                }
  677
+
  678
+                case 2:
  679
+                {
  680
+                    builtin_bind_add(argv[woptind], argv[woptind+1], use_terminfo);
  681
+                    break;
  682
+                }
  683
+
  684
+                default:
  685
+                {
  686
+                    res = STATUS_BUILTIN_ERROR;
  687
+                    append_format(stderr_buffer, _(L"%ls: Expected zero or two parameters, got %d"), argv[0], argc-woptind);
  688
+                    break;
  689
+                }
  690
+            }
681 691
             break;
682 692
         }
683 693
 
684  
-        default:
  694
+        case BIND_KEY_NAMES:
685 695
         {
686  
-            res = STATUS_BUILTIN_ERROR;
687  
-            append_format(stderr_buffer, _(L"%ls: Expected zero or two parameters, got %d"), argv[0], argc-woptind);
  696
+            builtin_bind_key_names(all);
688 697
             break;
689 698
         }
690  
-        }
691  
-        break;
692  
-    }
693  
-
694  
-    case BIND_KEY_NAMES:
695  
-    {
696  
-        builtin_bind_key_names(all);
697  
-        break;
698  
-    }
699 699
 
700 700
 
701  
-    case BIND_FUNCTION_NAMES:
702  
-    {
703  
-        builtin_bind_function_names();
704  
-        break;
705  
-    }
  701
+        case BIND_FUNCTION_NAMES:
  702
+        {
  703
+            builtin_bind_function_names();
  704
+            break;
  705
+        }
706 706
 
707 707
 
708  
-    default:
709  
-    {
710  
-        res = STATUS_BUILTIN_ERROR;
711  
-        append_format(stderr_buffer, _(L"%ls: Invalid state\n"), argv[0]);
712  
-        break;
713  
-    }
  708
+        default:
  709
+        {
  710
+            res = STATUS_BUILTIN_ERROR;
  711
+            append_format(stderr_buffer, _(L"%ls: Invalid state\n"), argv[0]);
  712
+            break;
  713
+        }
714 714
     }
715 715
 
716 716
     return res;
@@ -775,35 +775,35 @@ static int builtin_block(parser_t &parser, wchar_t **argv)
775 775
 
776 776
         switch (opt)
777 777
         {
778  
-        case 0:
779  
-            if (long_options[opt_index].flag != 0)
780  
-                break;
781  
-            append_format(stderr_buffer,
782  
-                          BUILTIN_ERR_UNKNOWN,
783  
-                          argv[0],
784  
-                          long_options[opt_index].name);
785  
-            builtin_print_help(parser, argv[0], stderr_buffer);
  778
+            case 0:
  779
+                if (long_options[opt_index].flag != 0)
  780
+                    break;
  781
+                append_format(stderr_buffer,
  782
+                              BUILTIN_ERR_UNKNOWN,
  783
+                              argv[0],
  784
+                              long_options[opt_index].name);
  785
+                builtin_print_help(parser, argv[0], stderr_buffer);
786 786
 
787  
-            return STATUS_BUILTIN_ERROR;
788  
-        case 'h':
789  
-            builtin_print_help(parser, argv[0], stdout_buffer);
790  
-            return STATUS_BUILTIN_OK;
  787
+                return STATUS_BUILTIN_ERROR;
  788
+            case 'h':
  789
+                builtin_print_help(parser, argv[0], stdout_buffer);
  790
+                return STATUS_BUILTIN_OK;
791 791
 
792  
-        case 'g':
793  
-            scope = GLOBAL;
794  
-            break;
  792
+            case 'g':
  793
+                scope = GLOBAL;
  794
+                break;
795 795
 
796  
-        case 'l':
797  
-            scope = LOCAL;
798  
-            break;
  796
+            case 'l':
  797
+                scope = LOCAL;
  798
+                break;
799 799
 
800  
-        case 'e':
801  
-            erase = 1;
802  
-            break;
  800
+            case 'e':
  801
+                erase = 1;
  802
+                break;
803 803
 
804  
-        case '?':
805  
-            builtin_unknown_option(parser, argv[0], argv[woptind-1]);
806  
-            return STATUS_BUILTIN_ERROR;
  804
+            case '?':
  805
+                builtin_unknown_option(parser, argv[0], argv[woptind-1]);
  806
+                return STATUS_BUILTIN_ERROR;
807 807
 
808 808
         }
809 809
 
@@ -833,23 +833,23 @@ static int builtin_block(parser_t &parser, wchar_t **argv)
833 833
 
834 834
         switch (scope)
835 835
         {
836  
-        case LOCAL:
837  
-        {
838  
-            if (!block->outer)
  836
+            case LOCAL:
  837
+            {
  838
+                if (!block->outer)
  839
+                    block=0;
  840
+                break;
  841
+            }
  842
+            case GLOBAL:
  843
+            {
839 844
                 block=0;
840  
-            break;
841  
-        }
842  
-        case GLOBAL:
843  
-        {
844  
-            block=0;
845  
-        }
846  
-        case UNSET:
847  
-        {
848  
-            while (block &&
849  
-                    block->type() != FUNCTION_CALL &&
850  
-                    block->type() != FUNCTION_CALL_NO_SHADOW)
851  
-                block = block->outer;
852  
-        }
  845
+            }
  846
+            case UNSET:
  847
+            {
  848
+                while (block &&
  849
+                        block->type() != FUNCTION_CALL &&
  850
+                        block->type() != FUNCTION_CALL_NO_SHADOW)
  851
+                    block = block->outer;
  852
+            }
853 853
         }
854 854
         if (block)
855 855
         {
@@ -909,28 +909,28 @@ static int builtin_builtin(parser_t &parser, wchar_t **argv)
909 909
 
910 910
         switch (opt)
911 911
         {
912  
-        case 0:
913  
-            if (long_options[opt_index].flag != 0)
914  
-                break;
915  
-            append_format(stderr_buffer,
916  
-                          BUILTIN_ERR_UNKNOWN,
917  
-                          argv[0],
918  
-                          long_options[opt_index].name);
919  
-            builtin_print_help(parser, argv[0], stderr_buffer);
  912
+            case 0:
  913
+                if (long_options[opt_index].flag != 0)
  914
+                    break;
  915
+                append_format(stderr_buffer,
  916
+                              BUILTIN_ERR_UNKNOWN,
  917
+                              argv[0],
  918
+                              long_options[opt_index].name);
  919
+                builtin_print_help(parser, argv[0], stderr_buffer);
920 920
 
921 921
 
922  
-            return STATUS_BUILTIN_ERROR;
923  
-        case 'h':
924  
-            builtin_print_help(parser, argv[0], stdout_buffer);
925  
-            return STATUS_BUILTIN_OK;
  922
+                return STATUS_BUILTIN_ERROR;
  923
+            case 'h':
  924
+                builtin_print_help(parser, argv[0], stdout_buffer);
  925
+                return STATUS_BUILTIN_OK;
926 926
 
927  
-        case 'n':
928  
-            list=1;
929  
-            break;
  927
+            case 'n':
  928
+                list=1;
  929
+                break;
930 930
 
931  
-        case '?':
932  
-            builtin_unknown_option(parser, argv[0], argv[woptind-1]);
933  
-            return STATUS_BUILTIN_ERROR;
  931
+            case '?':
  932
+                builtin_unknown_option(parser, argv[0], argv[woptind-1]);
  933
+                return STATUS_BUILTIN_ERROR;
934 934
 
935 935
         }
936 936
 
@@ -988,23 +988,23 @@ static int builtin_emit(parser_t &parser, wchar_t **argv)
988 988
 
989 989
         switch (opt)
990 990
         {
991  
-        case 0:
992  
-            if (long_options[opt_index].flag != 0)
993  
-                break;
994  
-            append_format(stderr_buffer,
995  
-                          BUILTIN_ERR_UNKNOWN,
996  
-                          argv[0],
997  
-                          long_options[opt_index].name);
998  
-            builtin_print_help(parser, argv[0], stderr_buffer);
999  
-            return STATUS_BUILTIN_ERROR;
  991
+            case 0:
  992
+                if (long_options[opt_index].flag != 0)
  993
+                    break;
  994
+                append_format(stderr_buffer,
  995
+                              BUILTIN_ERR_UNKNOWN,
  996
+                              argv[0],
  997
+                              long_options[opt_index].name);
  998
+                builtin_print_help(parser, argv[0], stderr_buffer);
  999
+                return STATUS_BUILTIN_ERROR;
1000 1000
 
1001  
-        case 'h':
1002  
-            builtin_print_help(parser, argv[0], stdout_buffer);
1003  
-            return STATUS_BUILTIN_OK;
  1001
+            case 'h':
  1002
+                builtin_print_help(parser, argv[0], stdout_buffer);
  1003
+                return STATUS_BUILTIN_OK;
1004 1004
 
1005  
-        case '?':
1006  
-            builtin_unknown_option(parser, argv[0], argv[woptind-1]);
1007  
-            return STATUS_BUILTIN_ERROR;
  1005
+            case '?':
  1006
+                builtin_unknown_option(parser, argv[0], argv[woptind-1]);
  1007
+                return STATUS_BUILTIN_ERROR;
1008 1008
 
1009 1009
         }
1010 1010
 
@@ -1059,23 +1059,23 @@ static int builtin_generic(parser_t &parser, wchar_t **argv)
1059 1059
 
1060 1060
         switch (opt)
1061 1061
         {
1062  
-        case 0:
1063  
-            if (long_options[opt_index].flag != 0)
1064  
-                break;
1065  
-            append_format(stderr_buffer,
1066  
-                          BUILTIN_ERR_UNKNOWN,
1067  
-                          argv[0],
1068  
-                          long_options[opt_index].name);
1069  
-            builtin_print_help(parser, argv[0], stderr_buffer);
1070  
-            return STATUS_BUILTIN_ERROR;
  1062
+            case 0:
  1063
+                if (long_options[opt_index].flag != 0)
  1064
+                    break;
  1065
+                append_format(stderr_buffer,
  1066
+                              BUILTIN_ERR_UNKNOWN,
  1067
+                              argv[0],
  1068
+                              long_options[opt_index].name);
  1069
+                builtin_print_help(parser, argv[0], stderr_buffer);
  1070
+                return STATUS_BUILTIN_ERROR;
1071 1071
 
1072  
-        case 'h':
1073  
-            builtin_print_help(parser, argv[0], stdout_buffer);
1074  
-            return STATUS_BUILTIN_OK;
  1072
+            case 'h':
  1073
+                builtin_print_help(parser, argv[0], stdout_buffer);
  1074
+                return STATUS_BUILTIN_OK;
1075 1075
 
1076  
-        case '?':
1077  
-            builtin_unknown_option(parser, argv[0], argv[woptind-1]);
1078  
-            return STATUS_BUILTIN_ERROR;
  1076
+            case '?':
  1077
+                builtin_unknown_option(parser, argv[0], argv[woptind-1]);
  1078
+                return STATUS_BUILTIN_ERROR;
1079 1079
 
1080 1080
         }
1081 1081
 
@@ -1129,40 +1129,40 @@ static void functions_def(const wcstring &name, wcstring &out)
1129 1129
         event_t *next = ev.at(i);
1130 1130
         switch (next->type)
1131 1131
         {
1132  
-        case EVENT_SIGNAL:
1133  
-        {
1134  
-            append_format(out, L" --on-signal %ls", sig2wcs(next->param1.signal));
1135  
-            break;
1136  
-        }
  1132
+            case EVENT_SIGNAL:
  1133
+            {
  1134
+                append_format(out, L" --on-signal %ls", sig2wcs(next->param1.signal));
  1135
+                break;
  1136
+            }
1137 1137
 
1138  
-        case EVENT_VARIABLE:
1139  
-        {
1140  
-            append_format(out, L" --on-variable %ls", next->str_param1.c_str());
1141  
-            break;
1142  
-        }
  1138
+            case EVENT_VARIABLE:
  1139
+            {
  1140
+                append_format(out, L" --on-variable %ls", next->str_param1.c_str());
  1141
+                break;
  1142
+            }
1143 1143
 
1144  
-        case EVENT_EXIT:
1145  
-        {
1146  
-            if (next->param1.pid > 0)
1147  
-                append_format(out, L" --on-process-exit %d", next->param1.pid);
1148  
-            else
1149  
-                append_format(out, L" --on-job-exit %d", -next->param1.pid);
1150  
-            break;
1151  
-        }
  1144
+            case EVENT_EXIT:
  1145
+            {
  1146
+                if (next->param1.pid > 0)
  1147
+                    append_format(out, L" --on-process-exit %d", next->param1.pid);
  1148
+                else
  1149
+                    append_format(out, L" --on-job-exit %d", -next->param1.pid);
  1150
+                break;
  1151
+            }
1152 1152
 
1153  
-        case EVENT_JOB_ID:
1154  
-        {
1155  
-            const job_t *j = job_get(next->param1.job_id);
1156  
-            if (j)
1157  
-                append_format(out, L" --on-job-exit %d", j->pgid);
1158  
-            break;
1159  
-        }
  1153
+            case EVENT_JOB_ID:
  1154
+            {
  1155
+                const job_t *j = job_get(next->param1.job_id);
  1156
+                if (j)
  1157
+                    append_format(out, L" --on-job-exit %d", j->pgid);
  1158
+                break;
  1159
+            }
1160 1160
 
1161  
-        case EVENT_GENERIC:
1162  
-        {
1163  
-            append_format(out, L" --on-event %ls", next->str_param1.c_str());
1164  
-            break;
1165  
-        }
  1161
+            case EVENT_GENERIC:
  1162
+            {
  1163
+                append_format(out, L" --on-event %ls", next->str_param1.c_str());
  1164
+                break;
  1165
+            }
1166 1166
 
1167 1167
         }
1168 1168
 
@@ -1267,49 +1267,49 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
1267 1267
 
1268 1268
         switch (opt)
1269 1269
         {
1270  
-        case 0:
1271  
-            if (long_options[opt_index].flag != 0)
1272  
-                break;
1273  
-            append_format(stderr_buffer,
1274  
-                          BUILTIN_ERR_UNKNOWN,
1275  
-                          argv[0],
1276  
-                          long_options[opt_index].name);
1277  
-            builtin_print_help(parser, argv[0], stderr_buffer);
  1270
+            case 0:
  1271
+                if (long_options[opt_index].flag != 0)
  1272
+                    break;
  1273
+                append_format(stderr_buffer,
  1274
+                              BUILTIN_ERR_UNKNOWN,
  1275
+                              argv[0],
  1276
+                              long_options[opt_index].name);
  1277
+                builtin_print_help(parser, argv[0], stderr_buffer);
1278 1278
 
1279 1279
 
1280  
-            return STATUS_BUILTIN_ERROR;
  1280
+                return STATUS_BUILTIN_ERROR;
1281 1281
 
1282  
-        case 'e':
1283  
-            erase=1;
1284  
-            break;
  1282
+            case 'e':
  1283
+                erase=1;
  1284
+                break;
1285 1285
 
1286  
-        case 'd':
1287  
-            desc=woptarg;
1288  
-            break;
  1286
+            case 'd':
  1287
+                desc=woptarg;
  1288
+                break;
1289 1289
 
1290  
-        case 'n':
1291  
-            list=1;
1292  
-            break;
  1290
+            case 'n':
  1291
+                list=1;
  1292
+                break;
1293 1293
 
1294  
-        case 'a':
1295  
-            show_hidden=1;
1296  
-            break;
  1294
+            case 'a':
  1295
+                show_hidden=1;
  1296
+                break;
1297 1297
 
1298  
-        case 'h':
1299  
-            builtin_print_help(parser, argv[0], stdout_buffer);
1300  
-            return STATUS_BUILTIN_OK;
  1298
+            case 'h':
  1299
+                builtin_print_help(parser, argv[0], stdout_buffer);
  1300
+                return STATUS_BUILTIN_OK;
1301 1301
 
1302  
-        case 'q':
1303  
-            query = 1;
1304  
-            break;
  1302
+            case 'q':
  1303
+                query = 1;
  1304
+                break;
1305 1305
 
1306  
-        case 'c':
1307  
-            copy = 1;
1308  
-            break;
  1306
+            case 'c':
  1307
+                copy = 1;
  1308
+                break;
1309 1309
 
1310  
-        case '?':
1311  
-            builtin_unknown_option(parser, argv[0], argv[woptind-1]);
1312  
-            return STATUS_BUILTIN_ERROR;
  1310
+            case '?':
  1311
+                builtin_unknown_option(parser, argv[0], argv[woptind-1]);
  1312
+                return STATUS_BUILTIN_ERROR;
1313 1313
 
1314 1314
         }
1315 1315
 
@@ -1476,48 +1476,48 @@ static unsigned int builtin_echo_digit(wchar_t wc, unsigned int base)
1476 1476
     assert(base == 8 || base == 16);
1477 1477
     switch (wc)
1478 1478
     {
1479  
-    case L'0':
1480  
-        return 0;
1481  
-    case L'1':
1482  
-        return 1;
1483  
-    case L'2':
1484  
-        return 2;
1485  
-    case L'3':
1486  
-        return 3;
1487  
-    case L'4':
1488  
-        return 4;
1489  
-    case L'5':
1490  
-        return 5;
1491  
-    case L'6':
1492  
-        return 6;
1493  
-    case L'7':
1494  
-        return 7;
  1479
+        case L'0':
  1480
+            return 0;
  1481
+        case L'1':
  1482
+            return 1;
  1483
+        case L'2':
  1484
+            return 2;
  1485
+        case L'3':
  1486
+            return 3;
  1487
+        case L'4':
  1488
+            return 4;
  1489
+        case L'5':
  1490
+            return 5;
  1491
+        case L'6':
  1492
+            return 6;
  1493
+        case L'7':
  1494
+            return 7;
1495 1495
     }
1496 1496
 
1497 1497
     if (base == 16) switch (wc)
1498 1498
         {
1499  
-        case L'8':
1500  
-            return 8;
1501  
-        case L'9':
1502  
-            return 9;
1503  
-        case L'a':
1504  
-        case L'A':
1505  
-            return 10;
1506  
-        case L'b':
1507  
-        case L'B':
1508  
-            return 11;
1509  
-        case L'c':
1510  
-        case L'C':
1511  
-            return 12;
1512  
-        case L'd':
1513  
-        case L'D':
1514  
-            return 13;
1515  
-        case L'e':
1516  
-        case L'E':
1517  
-            return 14;
1518  
-        case L'f':
1519  
-        case L'F':
1520  
-            return 15;
  1499
+            case L'8':
  1500
+                return 8;
  1501
+            case L'9':
  1502
+                return 9;
  1503
+            case L'a':
  1504
+            case L'A':
  1505
+                return 10;
  1506
+            case L'b':
  1507
+            case L'B':
  1508
+                return 11;
  1509
+            case L'c':
  1510
+            case L'C':
  1511
+                return 12;
  1512
+            case L'd':
  1513
+            case L'D':
  1514
+                return 13;
  1515
+            case L'e':
  1516
+            case L'E':
  1517
+                return 14;
  1518
+            case L'f':
  1519
+            case L'F':
  1520
+                return 15;
1521 1521
         }
1522 1522
     return UINT_MAX;
1523 1523
 }
@@ -1639,56 +1639,56 @@ static int builtin_echo(parser_t &parser, wchar_t **argv)
1639 1639
                 size_t consumed = 1;
1640 1640
                 switch (str[j+1])
1641 1641
                 {
1642  
-                case L'a':
1643  
-                    wc = L'\a';
1644  
-                    break;
1645  
-                case L'b':
1646  
-                    wc = L'\b';
1647  
-                    break;
1648  
-                case L'e':
1649  
-                    wc = L'\e';
1650  
-                    break;
1651  
-                case L'f':
1652  
-                    wc = L'\f';
1653  
-                    break;
1654  
-                case L'n':
1655  
-                    wc = L'\n';
1656  
-                    break;
1657  
-                case L'r':
1658  
-                    wc = L'\r';
1659  
-                    break;
1660  
-                case L't':
1661  
-                    wc = L'\t';
1662  
-                    break;
1663  
-                case L'v':
1664  
-                    wc = L'\v';
1665  
-                    break;
1666  
-                case L'\\':
1667  
-                    wc = L'\\';
1668  
-                    break;
  1642
+                    case L'a':
  1643
+                        wc = L'\a';
  1644
+                        break;
  1645
+                    case L'b':
  1646
+                        wc = L'\b';
  1647
+                        break;
  1648
+                    case L'e':
  1649
+                        wc = L'\e';
  1650
+                        break;
  1651
+                    case L'f':
  1652
+                        wc = L'\f';
  1653
+                        break;
  1654
+                    case L'n':
  1655
+                        wc = L'\n';
  1656
+                        break;
  1657
+                    case L'r':
  1658
+                        wc = L'\r';
  1659
+                        break;
  1660
+                    case L't':
  1661
+                        wc = L'\t';
  1662
+                        break;
  1663
+                    case L'v':
  1664
+                        wc = L'\v';
  1665
+                        break;
  1666
+                    case L'\\':
  1667
+                        wc = L'\\';
  1668
+                        break;
1669 1669
 
1670  
-                case L'c':
1671  
-                    wc = 0;
1672  
-                    continue_output = false;
1673  
-                    break;
  1670
+                    case L'c':
  1671
+                        wc = 0;
  1672
+                        continue_output = false;
  1673
+                        break;
1674 1674
 
1675  
-                default:
1676  
-                {
1677  
-                    /* Octal and hex escape sequences */
1678  
-                    unsigned char narrow_val = 0;
1679  
-                    if (builtin_echo_parse_numeric_sequence(str + j + 1, &consumed, &narrow_val))
1680  
-                    {
1681  
-                        /* Here consumed must have been set to something */
1682  
-                        wc = narrow_val; //is this OK for conversion?
1683  
-                    }
1684  
-                    else
  1675
+                    default:
1685 1676
                     {
1686  
-                        /* Not a recognized escape. We consume only the backslash. */
1687  
-                        wc = L'\\';
1688  
-                        consumed = 0;
  1677
+                        /* Octal and hex escape sequences */
  1678
+                        unsigned char narrow_val = 0;
  1679
+                        if (builtin_echo_parse_numeric_sequence(str + j + 1, &consumed, &narrow_val))
  1680
+                        {
  1681
+                            /* Here consumed must have been set to something */
  1682
+                            wc = narrow_val; //is this OK for conversion?
  1683
+                        }
  1684
+                        else
  1685
+                        {
  1686
+                            /* Not a recognized escape. We consume only the backslash. */
  1687
+                            wc = L'\\';
  1688
+                            consumed = 0;
  1689
+                        }
  1690
+                        break;
1689 1691
                     }
1690  
-                    break;
1691  
-                }
1692 1692
                 }
1693 1693
 
1694 1694
                 /* Skip over characters that were part of this escape sequence (but not the backslash, which will be handled by the loop increment */
@@ -1801,152 +1801,152 @@ static int builtin_function(parser_t &parser, wchar_t **argv)
1801 1801
 
1802 1802
         switch (opt)
1803 1803
         {
1804  
-        case 0:
1805  
-            if (long_options[opt_index].flag != 0)
1806  
-                break;
1807  
-            append_format(stderr_buffer,
1808  
-                          BUILTIN_ERR_UNKNOWN,
1809  
-                          argv[0],
1810  
-                          long_options[opt_index].name);
1811  
-
1812  
-            res = 1;
1813  
-            break;
  1804
+            case 0:
  1805
+                if (long_options[opt_index].flag != 0)
  1806
+                    break;
  1807
+                append_format(stderr_buffer,
  1808
+                              BUILTIN_ERR_UNKNOWN,
  1809
+                              argv[0],
  1810
+                              long_options[opt_index].name);
1814 1811
 
1815  
-        case 'd':
1816  
-            desc=woptarg;
1817  
-            break;
  1812
+                res = 1;
  1813
+                break;
1818 1814
 
1819  
-        case 's':
1820  
-        {
1821  
-            int sig = wcs2sig(woptarg);
  1815
+            case 'd':
  1816
+                desc=woptarg;
  1817
+                break;
1822 1818
 
1823  
-            if (sig < 0)
  1819
+            case 's':
1824 1820
             {
1825  
-                append_format(stderr_buffer,
1826  
-                              _(L"%ls: Unknown signal '%ls'\n"),
1827  
-                              argv[0],
1828  
-                              woptarg);
1829  
-                res=1;
  1821
+                int sig = wcs2sig(woptarg);
  1822
+
  1823
+                if (sig < 0)
  1824
+                {
  1825
+                    append_format(stderr_buffer,
  1826
+                                  _(L"%ls: Unknown signal '%ls'\n"),
  1827
+                                  argv[0],
  1828
+                                  woptarg);
  1829
+                    res=1;
  1830
+                    break;
  1831
+                }
  1832
+                events.push_back(event_t::signal_event(sig));
1830 1833
                 break;
1831 1834
             }
1832  
-            events.push_back(event_t::signal_event(sig));
1833  
-            break;
1834  
-        }
1835 1835
 
1836  
-        case 'v':
1837  
-        {
1838  
-            if (wcsvarname(woptarg))
  1836
+            case 'v':
1839 1837
             {
1840  
-                append_format(stderr_buffer,
1841  
-                              _(L"%ls: Invalid variable name '%ls'\n"),
1842  
-                              argv[0],
1843  
-                              woptarg);
1844  
-                res=STATUS_BUILTIN_ERROR;
  1838
+                if (wcsvarname(woptarg))
  1839
+                {
  1840
+                    append_format(stderr_buffer,
  1841
+                                  _(L"%ls: Invalid variable name '%ls'\n"),
  1842
+                                  argv[0],
  1843
+                                  woptarg);
  1844
+                    res=STATUS_BUILTIN_ERROR;
  1845
+                    break;
  1846
+                }
  1847
+
  1848
+                events.push_back(event_t::variable_event(woptarg));
1845 1849
                 break;
1846 1850
             }
1847 1851
 
1848  
-            events.push_back(event_t::variable_event(woptarg));
1849  
-            break;
1850  
-        }
1851  
-
1852 1852
 
1853  
-        case 'e':
1854  
-        {
1855  
-            events.push_back(event_t::generic_event(woptarg));
1856  
-            break;
1857  
-        }
1858  
-
1859  
-        case 'j':
1860  
-        case 'p':
1861  
-        {
1862  
-            pid_t pid;
1863  
-            wchar_t *end;
1864  
-            event_t e(EVENT_ANY);
  1853
+            case 'e':
  1854
+            {
  1855
+                events.push_back(event_t::generic_event(woptarg));
  1856
+                break;
  1857
+            }
1865 1858
 
1866  
-            if ((opt == 'j') &&
1867  
-                    (wcscasecmp(woptarg, L"caller") == 0))
  1859
+            case 'j':
  1860
+            case 'p':
1868 1861
             {
1869  
-                int job_id = -1;
  1862
+                pid_t pid;
  1863
+                wchar_t *end;
  1864
+                event_t e(EVENT_ANY);
1870 1865
 
1871  
-                if (is_subshell)
  1866
+                if ((opt == 'j') &&
  1867
+                        (wcscasecmp(woptarg, L"caller") == 0))
1872 1868
                 {
1873  
-                    block_t *b = parser.current_block;
  1869
+                    int job_id = -1;
1874 1870
 
1875  
-                    while (b && (b->type() != SUBST))
1876  
-                        b = b->outer;
  1871
+                    if (is_subshell)
  1872
+                    {
  1873
+                        block_t *b = parser.current_block;
  1874
+
  1875
+                        while (b && (b->type() != SUBST))
  1876
+                            b = b->outer;
1877 1877
 
1878  
-                    if (b)
  1878
+                        if (b)
  1879
+                        {
  1880
+                            b=b->outer;
  1881
+                        }
  1882
+                        if (b->job)
  1883
+                        {
  1884
+                            job_id = b->job->job_id;
  1885
+                        }
  1886
+                    }
  1887
+
  1888
+                    if (job_id == -1)
1879 1889
                     {
1880  
-                        b=b->outer;
  1890
+                        append_format(stderr_buffer,
  1891
+                                      _(L"%ls: Cannot find calling job for event handler\n"),
  1892
+                                      argv[0]);
  1893
+                        res=1;
1881 1894
                     }
1882  
-                    if (b->job)
  1895
+                    else
1883 1896
                     {
1884  
-                        job_id = b->job->job_id;
  1897
+                        e.type = EVENT_JOB_ID;
  1898
+                        e.param1.job_id = job_id;
1885 1899
                     }
1886  
-                }
1887 1900
 
1888  
-                if (job_id == -1)
1889  
-                {
1890  
-                    append_format(stderr_buffer,
1891  
-                                  _(L"%ls: Cannot find calling job for event handler\n"),
1892  
-                                  argv[0]);
1893  
-                    res=1;
1894 1901
                 }
1895 1902
                 else
1896 1903
                 {
1897  
-                    e.type = EVENT_JOB_ID;
1898  
-                    e.param1.job_id = job_id;
1899  
-                }
  1904
+                    errno = 0;
  1905
+                    pid = fish_wcstoi(woptarg, &end, 10);
  1906
+                    if (errno || !end || *end)
  1907
+                    {
  1908
+                        append_format(stderr_buffer,
  1909
+                                      _(L"%ls: Invalid process id %ls\n"),
  1910
+                                      argv[0],
  1911
+                                      woptarg);
  1912
+                        res=1;
  1913
+                        break;
  1914
+                    }
1900 1915
 
1901  
-            }
1902  
-            else
1903  
-            {
1904  
-                errno = 0;
1905  
-                pid = fish_wcstoi(woptarg, &end, 10);
1906  
-                if (errno || !end || *end)
  1916
+
  1917
+                    e.type = EVENT_EXIT;
  1918
+                    e.param1.pid = (opt=='j'?-1:1)*abs(pid);
  1919
+                }
  1920
+                if (res)
1907 1921
                 {
1908  
-                    append_format(stderr_buffer,
1909  
-                                  _(L"%ls: Invalid process id %ls\n"),
1910  
-                                  argv[0],
1911  
-                                  woptarg);
1912  
-                    res=1;
1913  
-                    break;
  1922
+                    /* nothing */
1914 1923
                 }
1915  
-
1916  
-
1917  
-                e.type = EVENT_EXIT;
1918  
-                e.param1.pid = (opt=='j'?-1:1)*abs(pid);
1919  
-            }
1920  
-            if (res)
1921  
-            {
1922  
-                /* nothing */
1923  
-            }
1924  
-            else
1925  
-            {
1926  
-                events.push_back(e);
  1924
+                else
  1925
+                {
  1926
+                    events.push_back(e);
  1927
+                }
  1928
+                break;
1927 1929
             }
1928  
-            break;
1929  
-        }
1930 1930
 
1931  
-        case 'a':
1932  
-            if (named_arguments.get() == NULL)
1933  
-                named_arguments.reset(new wcstring_list_t);
1934  
-            break;
  1931
+            case 'a':
  1932
+                if (named_arguments.get() == NULL)
  1933
+                    named_arguments.reset(new wcstring_list_t);
  1934
+                break;
1935 1935
 
1936  
-        case 'S':
1937  
-            shadows = 0;
1938  
-            break;
  1936
+            case 'S':
  1937
+                shadows = 0;
  1938
+                break;
1939 1939
 
1940  
-        case 'h':
1941  
-            parser.pop_block();
1942  
-            parser.push_block(new fake_block_t());
1943  
-            builtin_print_help(parser, argv[0], stdout_buffer);
1944  
-            return STATUS_BUILTIN_OK;
  1940
+            case 'h':
  1941
+                parser.pop_block();
  1942
+                parser.push_block(new fake_block_t());
  1943
+                builtin_print_help(parser, argv[0], stdout_buffer);
  1944
+                return STATUS_BUILTIN_OK;
1945 1945
 
1946  
-        case '?':
1947  
-            builtin_unknown_option(parser, argv[0], argv[woptind-1]);
1948  
-            res = 1;
1949  
-            break;
  1946
+            case '?':
  1947
+                builtin_unknown_option(parser, argv[0], argv[woptind-1]);
  1948
+                res = 1;
  1949
+                break;
1950 1950
 
1951 1951
         }
1952 1952
 
@@ -2111,24 +2111,24 @@ static int builtin_random(parser_t &parser, wchar_t **argv)
2111 2111
 
2112 2112
         switch (opt)
2113 2113
         {
2114  
-        case 0:
2115  
-            if (long_options[opt_index].flag != 0)
2116  
-                break;
2117  
-            append_format(stderr_buffer,
2118  
-                          BUILTIN_ERR_UNKNOWN,
2119  
-                          argv[0],
2120  
-                          long_options[opt_index].name);
2121  
-            builtin_print_help(parser, argv[0], stderr_buffer);
  2114
+            case 0:
  2115
+                if (long_options[opt_index].flag != 0)
  2116
+                    break;
  2117
+                append_format(stderr_buffer,
  2118
+                              BUILTIN_ERR_UNKNOWN,
  2119
+                              argv[0],
  2120
+                              long_options[opt_index].name);
  2121
+                builtin_print_help(parser, argv[0], stderr_buffer);
2122 2122
 
2123  
-            return STATUS_BUILTIN_ERROR;
  2123
+                return STATUS_BUILTIN_ERROR;
2124 2124
 
2125  
-        case 'h':
2126  
-            builtin_print_help(parser, argv[0], stdout_buffer);
2127  
-            break;
  2125
+            case 'h':
  2126
+                builtin_print_help(parser, argv[0], stdout_buffer);
  2127
+                break;
2128 2128
 
2129  
-        case '?':
2130  
-            builtin_unknown_option(parser, argv[0], argv[woptind-1]);
2131  
-            return STATUS_BUILTIN_ERROR;
  2129
+            case '?':
  2130
+                builtin_unknown_option(parser, argv[0], argv[woptind-1]);
  2131
+                return STATUS_BUILTIN_ERROR;
2132 2132
 
2133 2133
         }
2134 2134
 
@@ -2137,51 +2137,51 @@ static int builtin_random(parser_t &parser, wchar_t **argv)
2137 2137
     switch (argc-woptind)
2138 2138
     {
2139 2139
 
2140  
-    case 0:
2141  
-    {
2142  
-        long res;
2143  
-
2144  
-        if (!seeded)
  2140
+        case 0:
2145 2141
         {
2146  
-            seeded=1;
2147  
-            srand48_r(time(0), &seed_buffer);
  2142
+            long res;
  2143
+
  2144
+            if (!seeded)
  2145
+            {
  2146
+                seeded=1;
  2147
+                srand48_r(time(0), &seed_buffer);
  2148
+            }
  2149
+            lrand48_r(&seed_buffer, &res);
  2150
+
  2151
+            append_format(stdout_buffer, L"%ld\n", labs(res%32767));
  2152
+            break;
2148 2153
         }
2149  
-        lrand48_r(&seed_buffer, &res);
2150 2154
 
2151  
-        append_format(stdout_buffer, L"%ld\n", labs(res%32767));
2152  
-        break;
2153  
-    }
  2155
+        case 1:
  2156
+        {
  2157
+            long foo;
  2158
+            wchar_t *end=0;
2154 2159
 
2155  
-    case 1:
2156  
-    {
2157  
-        long foo;
2158  
-        wchar_t *end=0;
  2160
+            errno=0;
  2161
+            foo = wcstol(argv[woptind], &end, 10);
  2162
+            if (errno || *end)
  2163
+            {
  2164
+                append_format(stderr_buffer,
  2165
+                              _(L"%ls: Seed value '%ls' is not a valid number\n"),
  2166
+                              argv[0],
  2167
+                              argv[woptind]);
2159 2168
 
2160  
-        errno=0;
2161  
-        foo = wcstol(argv[woptind], &end, 10);
2162  
-        if (errno || *end)
  2169
+                return STATUS_BUILTIN_ERROR;
  2170
+            }
  2171
+            seeded=1;
  2172
+            srand48_r(foo, &seed_buffer);
  2173
+            break;
  2174
+        }
  2175
+
  2176
+        default:
2163 2177
         {
2164 2178
             append_format(stderr_buffer,
2165  
-                          _(L"%ls: Seed value '%ls' is not a valid number\n"),
  2179
+                          _(L"%ls: Expected zero or one argument, got %d\n"),
2166 2180
                           argv[0],
2167  
-                          argv[woptind]);
2168  
-
  2181
+                          argc-woptind);
  2182
+            builtin_print_help(parser, argv[0], stderr_buffer);
2169 2183
             return STATUS_BUILTIN_ERROR;
2170 2184
         }
2171  
-        seeded=1;
2172  
-        srand48_r(foo, &seed_buffer);
2173  
-        break;
2174  
-    }
2175  
-
2176  
-    default:
2177  
-    {
2178  
-        append_format(stderr_buffer,
2179  
-                      _(L"%ls: Expected zero or one argument, got %d\n"),
2180  
-                      argv[0],
2181  
-                      argc-woptind);
2182  
-        builtin_print_help(parser, argv[0], stderr_buffer);
2183  
-        return STATUS_BUILTIN_ERROR;
2184  
-    }
2185 2185
     }
2186 2186
     return STATUS_BUILTIN_OK;
2187 2187
 }
@@ -2267,60 +2267,60 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
2267 2267
 
2268 2268
         switch (opt)
2269 2269
         {
2270  
-        case 0:
2271  
-            if (long_options[opt_index].flag != 0)
2272  
-                break;
2273  
-            append_format(stderr_buffer,
2274  
-                          BUILTIN_ERR_UNKNOWN,
2275  
-                          argv[0],
2276  
-                          long_options[opt_index].name);
2277  
-            builtin_print_help(parser, argv[0], stderr_buffer);
  2270
+            case 0:
  2271
+                if (long_options[opt_index].flag != 0)
  2272
+                    break;
  2273
+                append_format(stderr_buffer,
  2274
+                              BUILTIN_ERR_UNKNOWN,
  2275
+                              argv[0],
  2276
+                              long_options[opt_index].name);
  2277
+                builtin_print_help(parser, argv[0], stderr_buffer);