diff simtool/select.c @ 87:2a0d1d5b9313

fc-simtool: symbolic file names implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 Jan 2021 03:43:01 +0000
parents 54c444eb084b
children fb75855a74a9
line wrap: on
line diff
--- a/simtool/select.c	Sun Jan 24 01:42:15 2021 +0000
+++ b/simtool/select.c	Sun Jan 24 03:43:01 2021 +0000
@@ -82,15 +82,16 @@
 cmd_select(argc, argv)
 	char **argv;
 {
-	unsigned file_id;
-	int rc;
+	int file_id, rc;
 
 	if (isxdigit(argv[1][0]) && isxdigit(argv[1][1]) &&
 	    isxdigit(argv[1][2]) && isxdigit(argv[1][3]) && !argv[1][4])
 		file_id = strtoul(argv[1], 0, 16);
-	else {
+	else
+		file_id = find_symbolic_file_name(argv[1]);
+	if (file_id < 0) {
 		fprintf(stderr,
-			"select: only hex file IDs are currently supported\n");
+"error: file ID argument is not a hex value or a recognized symbolic name\n");
 		return(-1);
 	}
 	rc = select_op(file_id);