ref: b223905e67e323771c798d33a0641193da58e26f
parent: 157fda2bc85b54a608bdb0cf5149c8a01046c51a
author: bentley <[email protected]>
date: Thu Jan 14 19:33:46 EST 2010
xlink: use some proper return values
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sysexits.h>
#include <unistd.h>
#include "asmotor.h"
@@ -45,7 +46,7 @@
printf("usage: xlink [m mapfile] [-n symfile] [-s symbol] [-tg | -ts | -tp]\n");
printf("\t [-z pad_value] linkfile\n");
- exit(0);
+ exit(EX_USAGE);
}
/*
* Parse the linkfile and load all the objectfiles
@@ -60,7 +61,7 @@
pLinkfile = fopen(tzLinkfile, "rt");
if (!pLinkfile) {
- errx(5, "Unable to find linkfile '%s'", tzLinkfile);
+ errx(EX_NOINPUT, "Unable to find linkfile '%s'", tzLinkfile);
}
while (!feof(pLinkfile)) {
char tzLine[256];
@@ -147,7 +148,7 @@
outputtype = OUTPUT_PSION2;
break;
default:
- errx(5, "Invalid argument to option t");
+ errx(EX_USAGE, "Invalid argument to option t");
break;
}
break;
@@ -157,9 +158,9 @@
else {
fillchar = strtoul(optarg, &ep, 0);
if (optarg[0] == '\0' || *ep != '\0')
- errx(5, "Invalid argument for option 'z'");
+ errx(EX_USAGE, "Invalid argument for option 'z'");
if (fillchar < 0 || fillchar > 0xFF)
- errx(5, "Argument for option 'z' must be between 0 and 0xFF");
+ errx(EX_USAGE, "Argument for option 'z' must be between 0 and 0xFF");
}
break;
default: