Simplify the error handling for missing actions.
This commit is contained in:
parent
dc830434bf
commit
c5cc730fb8
15
p1load.c
15
p1load.c
@ -168,7 +168,13 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file || terminalMode) {
|
/* complain about nothing to do */
|
||||||
|
if (!file && !terminalMode) {
|
||||||
|
printf("error: must specify either a file to load or -t\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open the serial port */
|
||||||
switch (InitPort(&state, PORT_PREFIX, port, baudRate, verbose, actualPort)) {
|
switch (InitPort(&state, PORT_PREFIX, port, baudRate, verbose, actualPort)) {
|
||||||
case CHECK_PORT_OK:
|
case CHECK_PORT_OK:
|
||||||
printf("Found propeller version %d on %s\n", state.version, actualPort);
|
printf("Found propeller version %d on %s\n", state.version, actualPort);
|
||||||
@ -184,13 +190,6 @@ int main(int argc, char *argv[])
|
|||||||
printf("error: can't find a port with a propeller chip\n");
|
printf("error: can't find a port with a propeller chip\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* complain about nothing to do */
|
|
||||||
else {
|
|
||||||
printf("error: must specify either a file to load or -t\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check for a file to load */
|
/* check for a file to load */
|
||||||
if (file) {
|
if (file) {
|
||||||
|
Loading…
Reference in New Issue
Block a user