Add new fparseln() function

Taken from NetBSD.

[guillem@hadrons.org:
 - Import from NetBSD instead of FreeBSD to get a 3-clause BSD license,
   instead of a 4-clause one.
 - Define compatibility macros.
 - Change library from libc to libbsd and header in man page.
 - Add copyright information to COPYING.
 - Add symbol to map file. ]

Signed-off-by: Guillem Jover <guillem@hadrons.org>
This commit is contained in:
Strake
2012-08-07 08:44:30 -05:00
committed by Guillem Jover
parent cb7bc0d85e
commit ee0489eb2b
7 changed files with 399 additions and 0 deletions

View File

@@ -40,8 +40,10 @@
#define _LIBUTIL_H_
#include <features.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
/* for pidfile.c */
struct pidfh {
@@ -62,6 +64,8 @@ struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
int pidfile_write(struct pidfh *pfh);
int pidfile_close(struct pidfh *pfh);
int pidfile_remove(struct pidfh *pfh);
char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
__END_DECLS
/* humanize_number(3) */
@@ -73,4 +77,13 @@ __END_DECLS
#define HN_GETSCALE 0x10
#define HN_AUTOSCALE 0x20
/*
* fparseln() specific operation flags.
*/
#define FPARSELN_UNESCESC 0x01
#define FPARSELN_UNESCCONT 0x02
#define FPARSELN_UNESCCOMM 0x04
#define FPARSELN_UNESCREST 0x08
#define FPARSELN_UNESCALL 0x0f
#endif /* !_LIBUTIL_H_ */