library: re-arrange escape commands

escaped_copy(): only appears in ps, moved to ps/output.c
escape_strlist() only used in escape.c made static
escape_command() used in library, made internal
procps.h no longer includes escape.h

escape_str() used by library and ps so needs to be exported
definition put into procps.h including the odd define required.
Far from ideal to have it this way, will look at it another time
to have it all in, all out or split nicer so its not in the API;
perhaps a lib/ file?
This commit is contained in:
Craig Small
2016-04-17 14:45:19 +10:00
parent 887bb51016
commit d916d5db86
5 changed files with 21 additions and 32 deletions

View File

@ -1,21 +1,18 @@
#ifndef PROCPS_PROC_ESCAPE_H
#define PROCPS_PROC_ESCAPE_H
#include <proc/readproc.h>
#include <features.h>
#include "readproc.h"
__BEGIN_DECLS
#define ESC_STRETCH 1 // since we mangle to '?' this is 1 (would be 4 for octal escapes)
#define ESC_ARGS 0x1 // try to use cmdline instead of cmd
#define ESC_BRACKETS 0x2 // if using cmd, put '[' and ']' around it
#define ESC_DEFUNCT 0x4 // mark zombies with " <defunct>"
extern int escape_strlist(char *__restrict dst, char *__restrict const *__restrict src, size_t n, int *cells);
extern int escape_str(char *__restrict dst, const char *__restrict src, int bufsize, int *maxcells);
extern int escape_command(char *__restrict const outbuf, const proc_t *__restrict const pp, int bytes, int *cells, unsigned flags);
extern int escaped_copy(char *__restrict dst, const char *__restrict src, int bufsize, int *maxroom);
int escape_command(char *__restrict const outbuf, const proc_t *__restrict const pp, int bytes, int *cells, unsigned flags);
__END_DECLS
#endif