From 2573006b1d934ebe2287cfba98ac31381981766e Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 5 Apr 2024 19:56:14 -0700 Subject: nng_opts_parse and nng_socket_pair --- docs/man/nng_opts_parse.3supp.adoc | 185 ------------------------------------ docs/man/nng_socket_pair.3supp.adoc | 53 ----------- docs/ref/util/nng_opts_parse.adoc | 143 ++++++++++++++++++++++++++++ docs/ref/util/nng_socket_pair.adoc | 37 ++++++++ 4 files changed, 180 insertions(+), 238 deletions(-) delete mode 100644 docs/man/nng_opts_parse.3supp.adoc delete mode 100644 docs/man/nng_socket_pair.3supp.adoc create mode 100644 docs/ref/util/nng_opts_parse.adoc create mode 100644 docs/ref/util/nng_socket_pair.adoc diff --git a/docs/man/nng_opts_parse.3supp.adoc b/docs/man/nng_opts_parse.3supp.adoc deleted file mode 100644 index beb9e1bf..00000000 --- a/docs/man/nng_opts_parse.3supp.adoc +++ /dev/null @@ -1,185 +0,0 @@ -= nng_opts_parse(3supp) -// -// Copyright 2018 Staysail Systems, Inc. -// Copyright 2018 Capitar IT Group BV -// -// This document is supplied under the terms of the MIT License, a -// copy of which should be located in the distribution where this -// file was obtained (LICENSE.txt). A copy of the license may also be -// found online at https://opensource.org/licenses/MIT. -// - -== NAME - -nng_opts_parse - parse command line options - -== SYNOPSIS - -[source, c] ----- -#include -#include - -typedef struct nng_optspec { - const char *o_name; // Long style name (may be NULL for short only) - int o_short; // Short option (no clustering!) - int o_val; // Value stored on a good parse (>0) - bool o_arg; // Option takes an argument if true -} nng_optspec; - -int nng_opts_parse(int argc, char *const *argv, const nng_optspec *spec, int *val, char **arg, int *idx); ----- - -== DESCRIPTION - -The `nng_opts_parse()` is function is a supplemental function intended to -facilitate parsing command line arguments. -This function exists largely to stand in for `getopt()` from POSIX -systems, but it is available everywhere that _NNG_ is, and it includes -some capabilities missing from `getopt()`. - -The function parses arguments from `main()` (using _argc_ and _argv_), -starting at the index referenced by _idx_. -(New invocations typically set the value pointed to by _idx_ to 1.) - -Options are parsed as specified by _spec_ (see <