Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Data Structures | Macros | Typedefs | Functions
cmdopt.cpp File Reference
#include <rw_cmdopt.h>
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for cmdopt.cpp:

Go to the source code of this file.

Data Structures

struct  cmdopts_t
 

Macros

#define _RWSTD_TEST_SRC
 
#define EINVAL   22 /* e.g., HP-UX, Linux, Solaris */
 
#define RW_VA_LIST_ARG_PTR   va_list
 
#define RW_VA_LIST_ARG_TO_PTR(va)   va
 
#define RW_VA_LIST_PTR_ARG_TO_VA_LIST(va)   va
 

Typedefs

typedef int() optcallback_t(int, char *[])
 

Functions

_TEST_EXPORT int rw_vsetopts (const char *opts, va_list va)
 
_TEST_EXPORT int rw_setopts (const char *opts,...)
 
_TEST_EXPORT int rw_runopts (int argc, char *argv[])
 
_TEST_EXPORT int rw_runopts (const char *str)
 

Macro Definition Documentation

◆ _RWSTD_TEST_SRC

#define _RWSTD_TEST_SRC

$Id$

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2005-2008 Rogue Wave Software, Inc.

Definition at line 28 of file cmdopt.cpp.

◆ EINVAL

#define EINVAL   22 /* e.g., HP-UX, Linux, Solaris */

Definition at line 40 of file cmdopt.cpp.

◆ RW_VA_LIST_ARG_PTR

#define RW_VA_LIST_ARG_PTR   va_list

Definition at line 319 of file cmdopt.cpp.

◆ RW_VA_LIST_ARG_TO_PTR

#define RW_VA_LIST_ARG_TO_PTR (   va)    va

Definition at line 320 of file cmdopt.cpp.

◆ RW_VA_LIST_PTR_ARG_TO_VA_LIST

#define RW_VA_LIST_PTR_ARG_TO_VA_LIST (   va)    va

Definition at line 321 of file cmdopt.cpp.

Typedef Documentation

◆ optcallback_t

typedef int() optcallback_t(int, char *[])

Definition at line 45 of file cmdopt.cpp.

Function Documentation

◆ rw_runopts() [1/2]

_TEST_EXPORT int rw_runopts ( const char *  argvstr)

Processes the set of command line options and arguments specified by the function argument (usually the value of an environment variable).

Parameters
argvstrA character string of command line options and arguments separated by one or more spaces.
Returns
Returns the status of last evaluated command line option handler.

Definition at line 1088 of file cmdopt.cpp.

◆ rw_runopts() [2/2]

_TEST_EXPORT int rw_runopts ( int  argc,
char *  argv[] 
)

Processes the set of command line options and arguments specified by the function arguments (usually the same arguments as those passed to main()).

Parameters
argcThe number of non-zero elements of the argv vector.
argvAn array of pointers to command line options and arguments whose the last element, argv [argc], has the value 0.
Returns
Returns the status of last evaluated command line option handler.

Definition at line 875 of file cmdopt.cpp.

◆ rw_setopts()

_TEST_EXPORT int rw_setopts ( const char *  optspec,
  ... 
)

cmdopt.h - declarations of helper functions for the processing of command line options

$Id$

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 1994-2006 Rogue Wave Software. Appends a set of command line options and their handlers to the global list of command line option handlers for the current process.

Parameters
optspecA string of command line option specifiers describing the names and parameters of the command line options and their handlers. The string has the following syntax:

<optspec> ::= <opt> [ ':' | '=' | '#' ] [ @N | @* | '!' ] [ <opts> ] <opt> ::= <sopt> [ '|' <lopt>] ::= '|' <lopt> <sopt> ::= char <lopt> ::= '-' char char* <char> ::= 'A' - 'Z', 'a'-'z', '0' - '9', '_'

Each command line option may have a short name, a long name, or both. When referenced (either on the command line or in the environment), the name of command line option is introduced by a hyphen ('-').

A short option name (<sopt>) consits of a single alphanumeric character or an underscore ('_').

A long name (<lopt>) starts with a hyphen ('-') followed by one or more aphanumeric characters or underscores.

The name of the command line option is followd by one or more special characters with the following meaning:

':' the option takes an optional argument '=' the option takes a required argument that must immediately follow the equals sign '#' the handler for this option is not a function but rather a pointer to an signed integer that rw_runopts() sets to a non-zero value if the option appears on the command line @N the option handler will be invoked for the first N occurrences of the option name on the command line @* the option handler will be invoked for every occurrence of the option name on the command line ! the option handler will be invoked only if the option name does not appear on the command line

Parameters
...A list of zero or more command line option handlers whose type is either int (*)(int, char**) or int*, the latter corresponding to options denoted with the '#' special character.
Returns
On success, returns the number of command line options currently defined for the process, negative value on error.

Definition at line 652 of file cmdopt.cpp.

◆ rw_vsetopts()

_TEST_EXPORT int rw_vsetopts ( const char *  opts,
va_list  va 
)

Definition at line 450 of file cmdopt.cpp.