Skip to content

Commit e193a17

Browse files
FozzTexxtschak909
authored andcommitted
DOS 2.10 changes the first space character to a NUL byte.
1 parent 7d263cc commit e193a17

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sys/init.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ uint8_t get_set_time(uint8_t set_flag)
129129
uint16_t year_wcen;
130130

131131

132-
consolef("Getting FujiNet time\n");
133132
cmd.device = DEVICEID_APETIME;
134133
cmd.comnd = CMD_APETIME_GETTZTIME;
135134

@@ -200,7 +199,7 @@ void check_uart()
200199
}
201200

202201
/* Parse CONFIG.SYS command line, returns number of bytes remaining in config_env */
203-
#define IS_CONFIG_EOL(c) (!c || c == '\r' || c == '\n')
202+
#define IS_CONFIG_EOL(c) (c == '\r' || c == '\n')
204203
uint16_t parse_config(const uint8_t far *config_sys)
205204
{
206205
int idx, count;
@@ -210,25 +209,29 @@ uint16_t parse_config(const uint8_t far *config_sys)
210209
uint8_t eq_flag;
211210

212211

212+
#ifdef CONFIG_SYS_DEBUG
213213
consolef("CONFIG.SYS: ");
214214
for (cfg = config_sys; cfg && !IS_CONFIG_EOL(*cfg); cfg++)
215215
printChar(*cfg);
216216
consolef("\n");
217+
dumpHex(config_sys, 64);
218+
#endif /* CONFIG_SYS_DEBUG */
217219
*cfg_env = NULL;
218220
buf = (char *) &cfg_env[1];
219221
buf_max = (char *) cfg_env + ((uint16_t) &driver_end - (uint16_t) &config_env);
220222

221223
// Driver filename is everything before the first space
222-
for (cfg = config_sys; cfg && *cfg != ' ' && !IS_CONFIG_EOL(*cfg); cfg++)
224+
for (cfg = config_sys; cfg && *cfg > ' ' && !IS_CONFIG_EOL(*cfg); cfg++)
223225
;
224226

225-
if (*cfg != ' ')
227+
if (*cfg && *cfg != ' ')
226228
goto done;
227229

228-
// Skip any trailing spaces
230+
cfg++;
231+
// Skip any extra spaces
229232
while (*cfg == ' ')
230233
cfg++;
231-
if (!*cfg || *cfg == '\r' || *cfg == '\n')
234+
if (IS_CONFIG_EOL(*cfg))
232235
goto done;
233236

234237
bcfg = cfg;

0 commit comments

Comments
 (0)