1570 |
print_obj (mach, mach->reg_num, &mach->reg_str); |
print_obj (mach, mach->reg_num, &mach->reg_str); |
1571 |
} |
} |
1572 |
|
|
1573 |
|
/* GNU extension: Strip leading whitespace and eventual Re: (or Re\[[0-9]+\]:) |
1574 |
|
prefix from the argument */ |
1575 |
|
static void |
1576 |
|
builtin_unre (struct mh_machine *mach) |
1577 |
|
{ |
1578 |
|
char *start, *p; |
1579 |
|
|
1580 |
|
for (p = strobj_ptr (&mach->arg_str); *p; p++) |
1581 |
|
if (!isspace (*p)) |
1582 |
|
break; |
1583 |
|
|
1584 |
|
start = p; |
1585 |
|
|
1586 |
|
if (strncasecmp (p, "re", 2) == 0) |
1587 |
|
{ |
1588 |
|
if (p[2] == ':') |
1589 |
|
p += 3; |
1590 |
|
else if (p[2] == '[') |
1591 |
|
{ |
1592 |
|
for (p += 3; *p; p++) |
1593 |
|
if (*p == ']' || !isdigit (*p)) |
1594 |
|
break; |
1595 |
|
if (*p == ']' && p[1] == ':') |
1596 |
|
p += 2; |
1597 |
|
else |
1598 |
|
p = start; |
1599 |
|
} |
1600 |
|
else |
1601 |
|
p = start; |
1602 |
|
} |
1603 |
|
|
1604 |
|
if (p != strobj_ptr (&mach->arg_str)) |
1605 |
|
{ |
1606 |
|
for (; *p && isspace (*p); p++) |
1607 |
|
; |
1608 |
|
|
1609 |
|
p = strdup (p); |
1610 |
|
strobj_free (&mach->arg_str); |
1611 |
|
strobj_create (&mach->arg_str, p); |
1612 |
|
free (p); |
1613 |
|
} |
1614 |
|
} |
1615 |
|
|
1616 |
/* Builtin function table */ |
/* Builtin function table */ |
1617 |
|
|
1618 |
mh_builtin_t builtin_tab[] = { |
mh_builtin_t builtin_tab[] = { |
1688 |
{ "gname", builtin_gname, mhtype_str, mhtype_str}, |
{ "gname", builtin_gname, mhtype_str, mhtype_str}, |
1689 |
{ "formataddr", builtin_formataddr, mhtype_none, mhtype_str, 1 }, |
{ "formataddr", builtin_formataddr, mhtype_none, mhtype_str, 1 }, |
1690 |
{ "putaddr", builtin_putaddr, mhtype_none, mhtype_str }, |
{ "putaddr", builtin_putaddr, mhtype_none, mhtype_str }, |
1691 |
|
{ "unre", builtin_unre, mhtype_str, mhtype_str }, |
1692 |
{ 0 } |
{ 0 } |
1693 |
}; |
}; |
1694 |
|
|