summaryrefslogtreecommitdiffstats
path: root/sys/dev/aic7xxx/aicasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/aic7xxx/aicasm.c')
-rw-r--r--sys/dev/aic7xxx/aicasm.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/sys/dev/aic7xxx/aicasm.c b/sys/dev/aic7xxx/aicasm.c
index 9e3e4e1..63908ce 100644
--- a/sys/dev/aic7xxx/aicasm.c
+++ b/sys/dev/aic7xxx/aicasm.c
@@ -8,8 +8,8 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aic7xxx_asm.c,v 1.16 1997/03/18 19:18:39 gibbs Exp $
+ * $Id: aic7xxx_asm.c,v 1.17 1997/04/10 19:13:07 gibbs Exp $
*/
#include <sys/types.h>
#include <sys/mman.h>
@@ -56,6 +56,10 @@ int includes_search_curdir;
char *appname;
FILE *ofile;
char *ofilename;
+char *regfilename;
+FILE *regfile;
+char *listfilename;
+FILE *listfile;
static STAILQ_HEAD(,instruction) seq_program;
static STAILQ_HEAD(, patch) patch_list;
@@ -78,10 +82,6 @@ main(argc, argv)
int ch;
int retval;
char *inputfilename;
- char *regfilename;
- FILE *regfile;
- char *listfilename;
- FILE *listfile;
char *options;
SLIST_INIT(&search_path);
@@ -100,10 +100,15 @@ main(argc, argv)
switch(ch) {
case 'd':
#if DEBUG
- if (strcmp(optarg, "s") == 0)
+ if (strcmp(optarg, "s") == 0) {
yy_flex_debug = 1;
- else if (strcmp(optarg, "p") == 0)
+ } else if (strcmp(optarg, "p") == 0) {
yydebug = 1;
+ } else {
+ fprintf(stderr, "%s: -d Requires either an "
+ "'s' or 'p' argument\n", appname);
+ usage();
+ }
#else
stop("-d: Assembler not built with debugging "
"information", EX_SOFTWARE);
@@ -448,6 +453,24 @@ stop(string, err_code)
}
}
+ if (regfile != NULL) {
+ fclose(regfile);
+ if (err_code != 0) {
+ fprintf(stderr, "%s: Removing %s due to error\n",
+ appname, regfilename);
+ unlink(regfilename);
+ }
+ }
+
+ if (listfile != NULL) {
+ fclose(listfile);
+ if (err_code != 0) {
+ fprintf(stderr, "%s: Removing %s due to error\n",
+ appname, listfilename);
+ unlink(listfilename);
+ }
+ }
+
symlist_free(&patch_options);
symtable_close();
OpenPOWER on IntegriCloud