1.\" # 2.\" # Copyright (c) 2014, Juniper Networks, Inc. 3.\" # All rights reserved. 4.\" # This SOFTWARE is licensed under the LICENSE provided in the 5.\" # ../Copyright file. By downloading, installing, copying, or 6.\" # using the SOFTWARE, you agree to be bound by the terms of that 7.\" # LICENSE. 8.\" # Phil Shafer, July 2014 9.\" 10.Dd November 17, 2020 11.Dt LIBXO 3 12.Os 13.Sh NAME 14.Nm xo_parse_args , xo_set_program 15.Nd detect, parse, and remove arguments for libxo 16.Sh LIBRARY 17.Lb libxo 18.Sh SYNOPSIS 19.In libxo/xo.h 20.Ft int 21.Fn xo_parse_args "int argc" "char **argv" 22.Ft int 23.Fn xo_set_program "const char *name" 24.Sh DESCRIPTION 25The 26.Fn xo_parse_args 27function is used to process command-line arguments, which are 28described in 29.Xr xo_options 7 . 30.Nm libxo 31specific 32options are processed and removed 33from the argument list so the calling application does not 34need to process them. 35If successful, a new value for argc is returned. 36On failure, a message it emitted and -1 is returned. 37.Bd -literal -offset indent 38 argc = xo_parse_args(argc, argv); 39 if (argc < 0) 40 exit(EXIT_FAILURE); 41.Ed 42.Pp 43Following the call to 44.Fn xo_parse_args , 45the application can process the remaining arguments in a normal manner. 46.Pp 47The 48.Fn xo_set_program 49function sets name of the program as reported by 50functions like 51.Fn xo_failure , 52.Fn xo_warn , 53.Fn xo_err , 54etc. 55The program name is initialized by 56.Fn xo_parse_args , 57but subsequent calls to 58.Fn xo_set_program 59can override this value. 60.Pp 61Note that the value is not copied, so the memory passed to 62.Fn xo_set_program 63(and 64.Fn xo_parse_args ) 65must be maintained by the caller. 66.Pp 67.Sh SEE ALSO 68.Xr xo_emit 3 , 69.Xr xo_options 7, 70.Xr libxo 3 71.Sh HISTORY 72The 73.Nm libxo 74library first appeared in 75.Fx 11.0 . 76.Sh AUTHORS 77.Nm libxo 78was written by 79.An Phil Shafer Aq Mt phil@freebsd.org . 80 81