comparison simtool/writecmd.c @ 83:3055d5c9e7a3

fc-simtool update-rec* commands: check curfile_record_len and error out if it is not set
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 11 Apr 2021 02:38:31 +0000
parents ddd767f6e15b
children
comparison
equal deleted inserted replaced
82:28fae57b3e29 83:3055d5c9e7a3
48 { 48 {
49 unsigned recno, mode; 49 unsigned recno, mode;
50 u_char data[255]; 50 u_char data[255];
51 int rc; 51 int rc;
52 52
53 if (!curfile_record_len) {
54 fprintf(stderr, "error: no record-based file selected\n");
55 return(-1);
56 }
53 if (!strcmp(argv[1], "prev")) { 57 if (!strcmp(argv[1], "prev")) {
54 recno = 0; 58 recno = 0;
55 mode = 0x03; 59 mode = 0x03;
56 } else { 60 } else {
57 recno = strtoul(argv[1], 0, 0); 61 recno = strtoul(argv[1], 0, 0);
77 { 81 {
78 unsigned recno, mode; 82 unsigned recno, mode;
79 u_char data[255]; 83 u_char data[255];
80 int rc; 84 int rc;
81 85
86 if (!curfile_record_len) {
87 fprintf(stderr, "error: no record-based file selected\n");
88 return(-1);
89 }
82 if (!strcmp(argv[1], "prev")) { 90 if (!strcmp(argv[1], "prev")) {
83 recno = 0; 91 recno = 0;
84 mode = 0x03; 92 mode = 0x03;
85 } else { 93 } else {
86 recno = strtoul(argv[1], 0, 0); 94 recno = strtoul(argv[1], 0, 0);
105 char **argv; 113 char **argv;
106 { 114 {
107 unsigned recno, mode, fill_byte; 115 unsigned recno, mode, fill_byte;
108 u_char data[255]; 116 u_char data[255];
109 117
118 if (!curfile_record_len) {
119 fprintf(stderr, "error: no record-based file selected\n");
120 return(-1);
121 }
110 if (!strcmp(argv[1], "prev")) { 122 if (!strcmp(argv[1], "prev")) {
111 recno = 0; 123 recno = 0;
112 mode = 0x03; 124 mode = 0x03;
113 } else { 125 } else {
114 recno = strtoul(argv[1], 0, 0); 126 recno = strtoul(argv[1], 0, 0);