@@ -953,7 +953,7 @@ static struct option _longOptions[] =
953953 {NULL , no_argument , NULL , 0 }
954954};
955955// ====================================================================================================
956- bool _processOptions ( int argc , char * argv [] )
956+ errcode _processOptions ( int argc , char * argv [] )
957957
958958{
959959 int c , optionIndex = 0 ;
@@ -1053,7 +1053,7 @@ bool _processOptions( int argc, char *argv[] )
10531053 if ( options .protocol == PROT_UNKNOWN )
10541054 {
10551055 genericsReport ( V_ERROR , "Unrecognised protocol type" EOL );
1056- return false ;
1056+ return ERR ;
10571057 }
10581058
10591059 break ;
@@ -1066,7 +1066,7 @@ bool _processOptions( int argc, char *argv[] )
10661066 if ( options .paceDelay <= 0 )
10671067 {
10681068 genericsReport ( V_ERROR , "paceDelay is out of range" EOL );
1069- return false ;
1069+ return ERR ;
10701070 }
10711071
10721072 break ;
@@ -1082,7 +1082,7 @@ bool _processOptions( int argc, char *argv[] )
10821082 if ( !isdigit ( * optarg ) )
10831083 {
10841084 genericsReport ( V_ERROR , "-v requires a numeric argument." EOL );
1085- return false;
1085+ return ERR ;
10861086 }
10871087
10881088 genericsSetReportLevel ( atoi ( optarg ) );
@@ -1132,7 +1132,7 @@ bool _processOptions( int argc, char *argv[] )
11321132 // ------------------------------------
11331133 case 'V' :
11341134 _printVersion ();
1135- return - EINVAL ;
1135+ return ERR ;
11361136
11371137 // ------------------------------------
11381138 case '?' :
@@ -1145,25 +1145,26 @@ bool _processOptions( int argc, char *argv[] )
11451145 genericsReport ( V_ERROR , "Unknown option character `\\x%x'." EOL , optopt );
11461146 }
11471147
1148- return - EINVAL ;
1148+ return ERR ;
11491149
11501150 // ------------------------------------
11511151 default :
11521152 genericsReport ( V_ERROR , "Unknown option %c" EOL , optopt );
1153- return - EINVAL ;
1153+ return ERR ;
11541154 // ------------------------------------
11551155 }
11561156
11571157 /* If we set an explicit server and port and didn't set a protocol chances are we want ITM, not OFLOW */
11581158 if ( serverExplicit && !protExplicit )
11591159 {
1160- options .protocol = PROT_ITM ;
1160+ genericsReport ( V_ERROR , "Protocol must be explicit when server is explicit" EOL );
1161+ return ERR ;
11611162 }
11621163
11631164 if ( !options .elffile )
11641165 {
11651166 genericsReport ( V_ERROR , "Elf File not specified" EOL );
1166- exit ( - EBADF ) ;
1167+ return ERR ;
11671168 }
11681169
11691170 genericsReport ( V_INFO , "orbtop version " GIT_DESCRIBE EOL );
@@ -1197,14 +1198,14 @@ bool _processOptions( int argc, char *argv[] )
11971198 break ;
11981199
11991200 default :
1200- genericsReport ( V_INFO , "Decoding unknown" EOL );
1201- return false ;
1201+ genericsReport ( V_ERROR , "Decoding unknown" EOL );
1202+ return ERR ;
12021203 }
12031204
12041205 if ( ( options .paceDelay ) && ( !options .file ) )
12051206 {
12061207 genericsReport ( V_ERROR , "Pace Delay only makes sense when input is from a file" EOL );
1207- return false ;
1208+ return ERR ;
12081209 }
12091210
12101211 return OK ;
0 commit comments