'Handle alias expansion and \';;\' separator.'

def precmd(self, line):

    self.curline = line
    if (not line):
        return line
    args = line.split()
    while self.aliases.has_key(args[0]):
        line = self.aliases[args[0]]
        if ('%' in line):
            ii = 1
            for tmpArg in args[1:]:
                line = line.replace(('%' + str(ii)), tmpArg)
                line = line.replace(('%>=' + str(ii)), '    '.join(args[ii:]))
                ii = (ii + 1)
            line = line.replace('%*', '    '.join(args[1:]))
        else:
            line = ((line + '    ') + '    '.join(args[1:]))
        args = line.split()
    if (args[0] != 'alias'):
        marker = line.find(';;')
        if (marker >= 0):
            next = line[(marker + 2):].lstrip()
            self.cmdqueue.append(next)
            line = line[:marker].rstrip()
    return line
