OPTSTR(9) BSD Kernel Developer's Manual OPTSTR(9)NAME
optstr_get -- Options string management
SYNOPSIS
#include <sys/optstr.h>
bool
optstr_get(const char *optstr, const char *key, char *buf, size_t bufsize);
DESCRIPTION
An options string is a list of key/value pairs represented in textual form. Each pair is expressed as ''key=value'' and is separated from
other pairs by one or more spaces. For example:
key1=value1 key2=value2 key3=value3
Options strings are used to pass information between userland programs and the kernel in a binary-agnostic way. This makes them endianness
and ABI independent.
FUNCTIONS
The following functions are provided to manage options strings:
optstr_get(optstr, key, buf, bufsize)
Scans the optstr options string looking for the key key and stores its value in the buffer pointed to by buf copying a maximum of
bufsize bytes. Returns 'true' if the key was found or 'false' otherwise, in which case buf is left unmodified.
CODE REFERENCES
The options string management functions are implemented within the files sys/kern/subr_optstr.c and sys/sys/optstr.h.
HISTORY
Options strings appeared in NetBSD 4.0.
BSD August 11, 2007 BSD
Check Out this Related Man Page
GETVFSSTAT(2) BSD System Calls Manual GETVFSSTAT(2)NAME
getvfsstat -- get list of all mounted file systems
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/types.h>
#include <sys/statvfs.h>
int
getvfsstat(struct statvfs *buf, size_t bufsize, int flags);
DESCRIPTION
getvfsstat() returns information about all mounted file systems. buf is a pointer to an array of statvfs structures defined in statvfs(5).
The buffer is filled with an array of statvfs structures, one for each mounted file system up to the size specified by bufsize.
If buf is given as NULL, getvfsstat() returns just the number of mounted file systems.
Normally flags should be specified as ST_WAIT. If flags is set to ST_NOWAIT, getvfsstat() will return the information it has available with-
out requesting an update from each file system. Thus, some of the information will be out of date, but getvfsstat() will not block waiting
for information from a file system that is unable to respond.
RETURN VALUES
Upon successful completion, the number of statvfs structures is returned. Otherwise, -1 is returned and the global variable errno is set to
indicate the error.
ERRORS
getvfsstat() fails if one or more of the following are true:
[EFAULT] buf points to an invalid address.
[EIO] An I/O error occurred while reading from or writing to the file system.
SEE ALSO statvfs(2), getmntinfo(3), fstab(5), mount(8)HISTORY
The getvfsstat() function first appeared in NetBSD 3.0 to replace getfsstat() which appeared in 4.4BSD.
BSD May 19, 2006 BSD
I have a .sh script which was running fine on all the UNIX Servers (AIX, SunSolaris). The script requires two mandatory parameters and many optional parameters. Now at a different client place who are on a Windows Server, when I try to execute the script through MKS Toolkit, there are couple of... (5 Replies)
anybody know a nice way to parse long input parameters such as --path /dir1/dir2/ (see below). Now I have more than 10 input parameters and it's confusing having parameters like -q something, I would prefer longer ones
case $OPTKEY in
--path) M_PATH=$OPTARG ;;
-s) ... (3 Replies)
Hi ,
running solaris 10 on t5120 and i see ILOM and ALOM (SC) interfaces working fine earlier and suddenly they are responding strangely,
First thing , I can connect fine to ILOM or ALOM but then console -f just hangs..
resetsc error :
I do not really want to poweroff and poweron... (13 Replies)
Hi,
i need to implement a command that looks like other linux/unix commands with proper parameter validation.I saw the usage of getopt but i dont know how to use it to support both short and long options in my script.
for example , commandname -f filename -db database
... (6 Replies)
If I call my function with grouped options: "logm -TDIWEFO 'message' ", then only the "T" gets parsed correctly. The subsequent values returned have underscores prefixed to the value: "_D", "_I", etc. If I "logm -T -DIWEFO 'message' ", the "T" and the "D" are OK, but "I" through "O" get the... (2 Replies)
Hi everyone
I want to know how can we pass multiple argument in getopts
suppose
PARAMS="abcd"
while getopts ${PARMS} FLAG
do
case ${FLAG} in
(a)
(b)
(c)
(d)
esac (6 Replies)
I have a file which looks like this:
/* ----------------- EDW$MOC139_R_NNA_BR_SUM_FACT2 ----------------- */
insert_job: EDW$MOC139_R_NNA_BR_SUM_FACT2 job_type: c
command: /home/btchproc/load_process/batch_files/batch_nna_brn_split_sum_fact2.sh m
machine: edwprod02.dsm.pwj.com
#owner:... (29 Replies)
Hello all :-)
i'm not sure if its a beginner or advanced question but i have the following problem - now for some months
after building a kernel from source (2.6.36 and now 2.6.38) the /dev/sd* entries are not removed if a remove the corresponding usb disk, sd card, what ever. i'm pretty sure... (0 Replies)
I am taking over the responsibilties of maintaing a web page for the Mainframe Computer. This web page was designed using rexx. How can I debug this web page. I have tried using TRACE IR, but this does not work and displays the web page incorrectly. I want to be able to step through the web page... (3 Replies)
I am trying to code for the addition of a new argument to the command line, the option D to a code that already has ABC (below). When I use make to compile it, it displays: invalid option --D. I did define the global d variable, as well as initialized it inside the main function of the C code. I... (9 Replies)
Hi,
Could anyone help me to understand the use of below two statements.
I found similar statements in rescan-scsi-bus.sh
fun1()
{
: fun2 # what is the use of this statement?
command1
command2
....
}
fun2 ()
{
VAR1=1
VAR2="some string" (3 Replies)
Heyas
Just recently there was a thread about parsing arguments, where i read the first time about getopts.
This said, i'd like to 'provide' a list function that can be 'trigered' using an 'option'(?).
The regarding code snippets are:
while getopts... (7 Replies)
There are many places where I can see the syntax description for optargs, which, usually boils down to this:
getopts OPTSTRING VARNAME
where:
OPTSTRING tells getopts which options to expect and where to expect arguments
VARNAME tells getopts which shell-variable to use for option reporting... (2 Replies)