aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index de53dbda8..f3af01f44 100644
--- a/utility.c
+++ b/utility.c
@@ -1617,6 +1617,51 @@ extern char *get_line_from_file(FILE *file)
1617 return linebuf; 1617 return linebuf;
1618} 1618}
1619 1619
1620#if defined BB_ECHO || defined BB_TR
1621char process_escape_sequence(char **ptr)
1622{
1623 char c;
1624
1625 switch (c = *(*ptr)++) {
1626 case 'a':
1627 c = '\a';
1628 break;
1629 case 'b':
1630 c = '\b';
1631 break;
1632 case 'f':
1633 c = '\f';
1634 break;
1635 case 'n':
1636 c = '\n';
1637 break;
1638 case 't':
1639 c = '\t';
1640 break;
1641 case 'v':
1642 c = '\v';
1643 break;
1644 case '\\':
1645 c = '\\';
1646 break;
1647 case '0': case '1': case '2': case '3':
1648 case '4': case '5': case '6': case '7':
1649 c -= '0';
1650 if ('0' <= **ptr && **ptr <= '7') {
1651 c = c * 8 + (*(*ptr)++ - '0');
1652 if ('0' <= **ptr && **ptr <= '7')
1653 c = c * 8 + (*(*ptr)++ - '0');
1654 }
1655 break;
1656 default:
1657 (*ptr)--;
1658 c = '\\';
1659 break;
1660 }
1661 return c;
1662}
1663#endif
1664
1620/* END CODE */ 1665/* END CODE */
1621/* 1666/*
1622Local Variables: 1667Local Variables: