FreeCalypso > hg > freecalypso-hwlab
comparison 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 |
comparison
equal
deleted
inserted
replaced
86:54c444eb084b | 87:2a0d1d5b9313 |
---|---|
80 } | 80 } |
81 | 81 |
82 cmd_select(argc, argv) | 82 cmd_select(argc, argv) |
83 char **argv; | 83 char **argv; |
84 { | 84 { |
85 unsigned file_id; | 85 int file_id, rc; |
86 int rc; | |
87 | 86 |
88 if (isxdigit(argv[1][0]) && isxdigit(argv[1][1]) && | 87 if (isxdigit(argv[1][0]) && isxdigit(argv[1][1]) && |
89 isxdigit(argv[1][2]) && isxdigit(argv[1][3]) && !argv[1][4]) | 88 isxdigit(argv[1][2]) && isxdigit(argv[1][3]) && !argv[1][4]) |
90 file_id = strtoul(argv[1], 0, 16); | 89 file_id = strtoul(argv[1], 0, 16); |
91 else { | 90 else |
91 file_id = find_symbolic_file_name(argv[1]); | |
92 if (file_id < 0) { | |
92 fprintf(stderr, | 93 fprintf(stderr, |
93 "select: only hex file IDs are currently supported\n"); | 94 "error: file ID argument is not a hex value or a recognized symbolic name\n"); |
94 return(-1); | 95 return(-1); |
95 } | 96 } |
96 rc = select_op(file_id); | 97 rc = select_op(file_id); |
97 if (rc < 0) | 98 if (rc < 0) |
98 return(rc); | 99 return(rc); |