Skip to content

Commit

Permalink
Updated the argument parser, /K/M arguments did not work correctly if…
Browse files Browse the repository at this point in the history
… last in a line with regular arguments.
  • Loading branch information
Thomas Richter authored and cnvogelg committed Apr 20, 2017
1 parent fdc4d32 commit c722b20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion amitools/vamos/lib/DosLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def FPuts(self, ctx):
# write to stdout
fh = self.file_mgr.get_by_b_addr(fh_b_addr,True)
ok = fh.write(str_dat)
log_dos.info("FPuts(%s,'%s')", (fh, str_dat))
log_dos.info("FPuts(%s,'%s')" % (fh, str_dat))
return 0 # ok

def UnGetC(self, ctx):
Expand Down
2 changes: 2 additions & 0 deletions amitools/vamos/lib/UtilityLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def Stricmp(self, ctx):
str2_addr = ctx.cpu.r_reg(REG_A1)
str1 = ctx.mem.access.r_cstr(str1_addr)
str2 = ctx.mem.access.r_cstr(str2_addr)
log_utility.info("Stricmp(%08x=\"%s\",%08x=\"%s\")" % (str1_addr,str1,str2_addr,str2))
if str1.lower() < str2.lower():
return -1
elif str1.lower() > str2.lower():
Expand All @@ -58,6 +59,7 @@ def Strnicmp(self, ctx):
length = ctx.cpu.r_reg(REG_D0)
str1 = ctx.mem.access.r_cstr(str1_addr)[:length]
str2 = ctx.mem.access.r_cstr(str2_addr)[:length]
log_utility.info("Strnicmp(%08x=\"%s\",%08x=\"%s\")" % (str1_addr,str1,str2_addr,str2))
if str1.lower() < str2.lower():
return -1
elif str1.lower() > str2.lower():
Expand Down
9 changes: 6 additions & 3 deletions amitools/vamos/lib/dos/Args.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def parse_string(self, in_args):
return False

# keyword
elif targ['k']:
elif targ['k'] and not targ['m']:
val = self._find_remove_key(targ['keys'], args, True)
# keyword at end of line
if val == None:
Expand Down Expand Up @@ -246,9 +246,12 @@ def parse_string(self, in_args):
if targ['a'] and len(result[pos])==0:
self.error = ERROR_REQUIRED_ARG_MISSING
return False
pos = pos + 1

# normal entry
elif targ['x']:
pos = 0
for targ in targs:
# normal entry that is not yet filled
if targ['x'] and result[pos] == None:
# take from arraay
if len(args)>0:
val = self.unquote(args[0])
Expand Down

0 comments on commit c722b20

Please sign in to comment.