getargv-sys 0.2.0

The first and only library to provide a correct interface to the KERN_PROCARGS2 sysctl.
Documentation
#ifndef LIBGETARGV_H_
#define LIBGETARGV_H_

/*-
 * Copyright: see LICENSE file
 */

#include <sys/types.h>
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
  #include <stdbool.h>
#else
typedef enum { false, true } bool;
#endif

struct GetArgvOptions {
  uint  skip;
  pid_t pid;
  bool  nuls;
};
struct ArgvArgcResult {
  char*  buffer;
  uint   argc;
  char** argv;
};
struct ArgvResult {
  char* buffer;
  char* start_pointer;
  char* end_pointer;
};

bool print_argv_of_pid(char* start_pointer, char* end_pointer);
bool get_argv_of_pid(const struct GetArgvOptions* options, struct ArgvResult* result);
bool get_argv_and_argc_of_pid(pid_t pid, struct ArgvArgcResult* result);

#endif