Return specific values from main() in the various programs.

Previously, there were bare "return;" statements in some places, even though main() was declared as returning int. This is disallowed by C99 and later, and ORCA/C now complains about it when using full lint checks.
This commit is contained in:
Stephen Heumann 2020-02-06 17:28:55 -06:00
parent fde8a3255b
commit 527483b03b
3 changed files with 11 additions and 12 deletions

View File

@ -144,11 +144,10 @@ int main(void) {
PatchAttentionVector(); PatchAttentionVector();
return; return 0;
error: error:
setUnloadFlag(); setUnloadFlag();
return;
} }
/* /*

View File

@ -44,7 +44,7 @@ int main(int argc, char **argv) {
if (argc < 4 || argc > 5) { if (argc < 4 || argc > 5) {
fprintf(stderr, "Usage: afpmounter name zone volume [volPassword]\n"); fprintf(stderr, "Usage: afpmounter name zone volume [volPassword]\n");
return; return EXIT_FAILURE;
} }
object = argv[1]; object = argv[1];
@ -52,13 +52,13 @@ int main(int argc, char **argv) {
zone = argv[2]; zone = argv[2];
if (strlen(object) > ENTITY_FIELD_MAX || strlen(zone) > ENTITY_FIELD_MAX) { if (strlen(object) > ENTITY_FIELD_MAX || strlen(zone) > ENTITY_FIELD_MAX) {
fprintf(stderr, "Entity name too long (max 32 chars)\n"); fprintf(stderr, "Entity name too long (max 32 chars)\n");
return; return EXIT_FAILURE;
} }
count = strlen(argv[3]); count = strlen(argv[3]);
if (count > VOL_NAME_MAX) { if (count > VOL_NAME_MAX) {
fprintf(stderr, "Volume name too long\n"); fprintf(stderr, "Volume name too long\n");
return; return EXIT_FAILURE;
} }
volName[0] = count; volName[0] = count;
strncpy(volName+1, argv[3], count); strncpy(volName+1, argv[3], count);
@ -67,7 +67,7 @@ int main(int argc, char **argv) {
count = strlen(argv[4]); count = strlen(argv[4]);
if (count > VOL_PASSWORD_MAX) { if (count > VOL_PASSWORD_MAX) {
fprintf(stderr, "Volume password too long\n"); fprintf(stderr, "Volume password too long\n");
return; return EXIT_FAILURE;
} }
strncpy(volPassword, argv[4], count); strncpy(volPassword, argv[4], count);
} }
@ -104,12 +104,12 @@ int main(int argc, char **argv) {
atRetCode = _CALLAT(&lookupNameRec); atRetCode = _CALLAT(&lookupNameRec);
if (atRetCode != 0) { if (atRetCode != 0) {
fprintf(stderr, "NBP lookup error: %04x\n", lookupNameRec.result); fprintf(stderr, "NBP lookup error: %04x\n", lookupNameRec.result);
return; return EXIT_FAILURE;
} }
if (lookupNameRec.actualMatch == 0) { if (lookupNameRec.actualMatch == 0) {
fprintf(stderr, "The specified server could not be found\n"); fprintf(stderr, "The specified server could not be found\n");
return; return EXIT_FAILURE;
} }
#if 0 #if 0
@ -154,7 +154,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Login failure: %04x\n", login2Rec.result); fprintf(stderr, "Login failure: %04x\n", login2Rec.result);
if (login2Rec.result == pfiLoginContErr) if (login2Rec.result == pfiLoginContErr)
goto logout_and_exit; goto logout_and_exit;
return; return EXIT_FAILURE;
} }
mountVolRec.async = 0; mountVolRec.async = 0;
@ -171,7 +171,7 @@ int main(int argc, char **argv) {
} }
/* success - leave the volume mounted */ /* success - leave the volume mounted */
return; return EXIT_SUCCESS;
logout_and_exit: logout_and_exit:
logoutRec.async = 0; logoutRec.async = 0;
@ -179,5 +179,5 @@ logout_and_exit:
logoutRec.sessRefID = login2Rec.sessRefID; logoutRec.sessRefID = login2Rec.sessRefID;
_CALLAT(&logoutRec); _CALLAT(&logoutRec);
return; return EXIT_FAILURE;
} }

View File

@ -24,7 +24,7 @@ int main(void)
i = _CALLAT(&listSessions2Rec); i = _CALLAT(&listSessions2Rec);
if (i != 0) { if (i != 0) {
fprintf(stderr, "Error %04x\n", listSessions2Rec.result); fprintf(stderr, "Error %04x\n", listSessions2Rec.result);
return; return 1;
} }
for (i = 0; i < listSessions2Rec.entriesRtn; i++) { for (i = 0; i < listSessions2Rec.entriesRtn; i++) {