diff options
Diffstat (limited to 'lib/netstring.cc')
-rw-r--r-- | lib/netstring.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/netstring.cc b/lib/netstring.cc new file mode 100644 index 0000000..784d941 --- /dev/null +++ b/lib/netstring.cc @@ -0,0 +1,13 @@ +#include "config.h" +#include "netstring.h" +#include "itoa.h" + +mystring str2net(const mystring& s) +{ + return mystringjoin(itoa(s.length())) + ":" + s + ","; +} + +mystring strnl2net(const mystring& s) +{ + return mystringjoin(itoa(s.length()+1)) + ":" + s + "\012,"; +} |