File: sdump.h

package info (click to toggle)
fetchmail 6.5.6-2
  • links: PTS
  • area: main
  • in suites: forky
  • size: 7,596 kB
  • sloc: ansic: 19,190; sh: 7,108; python: 2,395; perl: 564; yacc: 447; lex: 286; makefile: 260; awk: 124; lisp: 84; exp: 43; sed: 17
file content (20 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef SDUMP_H
#define SDUMP_H

#include <stdlib.h>  // for size_t
#include <string.h>  // for strlen

/** returns freshly malloc()d string of input string with all non-printable
 * characters rendered as hex escape.
 * Also see env.c's visbuf() which uses some default C escape sequences instead
 * and caches its buffer.
 * CalLer must free() buffer,
 * and possibly safely erase it if used for printing passwords. */
char *sdump(const char *in, size_t len);

/** Convenience macro, same as sdump, but for C string inputs in \a in.
 * CalLer must free() buffer,
 * and possibly safely erase it if used for printing passwords. */
#define sdump_c(in) (sdump(in, strlen(in)))

#endif