- Fix segfault on empty output (bug was in XS code) - Still better end-of-URL detection - Recognize a few common multicharacter sections in man references
28 lines
576 B
Text
28 lines
576 B
Text
#include "EXTERN.h"
|
|
#include "perl.h"
|
|
#include "XSUB.h"
|
|
|
|
struct StringWrap {
|
|
char *buf;
|
|
unsigned long long len, cap;
|
|
};
|
|
|
|
struct StringWrap grotty2html_wrap(const char *, unsigned long long);
|
|
void grotty2html_free(struct StringWrap);
|
|
|
|
|
|
MODULE = ManUtils PACKAGE = ManUtils
|
|
|
|
SV *
|
|
html(str)
|
|
SV *str
|
|
CODE:
|
|
STRLEN len;
|
|
char *inbuf = SvPV(str, len);
|
|
struct StringWrap buf = grotty2html_wrap(inbuf, len);
|
|
SV *dest = buf.len ? newSVpv(buf.buf, buf.len) : newSVpv("", 0);
|
|
grotty2html_free(buf);
|
|
SvUTF8_on(dest);
|
|
RETVAL = dest;
|
|
OUTPUT:
|
|
RETVAL
|