-------------------------------------------------------------------------*\ * Takes one byte and stuff it if needed. \*-------------------------------------------------------------------------*/
| 811 | * Takes one byte and stuff it if needed. |
| 812 | \*-------------------------------------------------------------------------*/ |
| 813 | static size_t dot(int c, size_t state, luaL_Buffer *buffer) |
| 814 | { |
| 815 | luaL_addchar(buffer, (char) c); |
| 816 | switch (c) { |
| 817 | case '\r': |
| 818 | return 1; |
| 819 | case '\n': |
| 820 | return (state == 1)? 2: 0; |
| 821 | case '.': |
| 822 | if (state == 2) |
| 823 | luaL_addchar(buffer, '.'); |
| 824 | /* Falls through. */ |
| 825 | default: |
| 826 | return 0; |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | /*-------------------------------------------------------------------------*\ |
| 831 | * Incrementally applies smtp stuffing to a string |