'\" t
.\" Title: nutscan_add_option_to_device
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 11/20/2024
.\" Manual: NUT Manual
.\" Source: Network UPS Tools 2.8.2
.\" Language: English
.\"
.TH "NUTSCAN_ADD_OPTION_T" "3" "11/20/2024" "Network UPS Tools 2\&.8\&.2" "NUT Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
nutscan_add_option_to_device, nutscan_add_commented_option_to_device \- Add option data to the specified device\&.
.SH "SYNOPSIS"
.sp
.nf
#include
.fi
.sp
.nf
/* Add enabled option data to the specified device\&. */
void nutscan_add_option_to_device(
nutscan_device_t * device,
char * option_name,
char * value);
.fi
.sp
.nf
/* Since libnutscan version 2\&.5\&.0:
* Add option data to the specified device with an optional comment tag
* for options suggested, but not currently enabled for actual use\&. */
void nutscan_add_commented_option_to_device(
nutscan_device_t * device,
char * option_name,
char * value,
char * comment_tag);
.fi
.SH "DESCRIPTION"
.sp
The nutscan_device_t contains the following variables:
.sp
.if n \{\
.RS 4
.\}
.nf
nutscan_device_type_t type;
char * driver;
char * alt_driver_names;
char * port;
nutscan_options_t opt;
struct nutscan_device * prev;
struct nutscan_device * next;
.fi
.if n \{\
.RE
.\}
.sp
This is a double linked list of device\&. Each device is described by its type, its driver name, its port and any number of optional data\&.
.sp
The \fBnutscan_add_option_to_device()\fR adds an optional data in the given device\&. Optional data are made of an \fIoption_name\fR and an associated \fIvalue\fR, and optionally a \fIcomment_tag\fR\&. Copies of the \fIoption_name\fR, \fIvalue\fR and \fIcomment_tag\fR are stored in the device, so the caller can safely free all of the original strings used as arguments\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.sp
A non\-NULL value of the \fIcomment_tag\fR makes the option not\-enabled for current use\&. Depending on the output format, it may be either completely ignored, or rendered as a comment with this value as a prefix (a zero\-length string "\e0" may be passed to have no prefix)\&.
.sp .5v
.RE
.sp
Such options and their values may be further sanity\-checked and reported as warnings by \fBnutscan_display_sanity_check()\fR dispatcher and its related methods which implement the logic of particular checks\&. This is used for example when generating \fIups\&.conf\fR file content suggestions with \fBnutscan_display_ups_conf_with_sanity_check()\fR method\&.
.SH "NOTES"
.sp
Technically, the function is currently defined in \fInutscan\-device\&.h\fR file\&.
.SH "SEE ALSO"
.sp
\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_sanity_check\fR(3), \fBnutscan_display_sanity_check_serial\fR(3), \fBnutscan_display_ups_conf_with_sanity_check\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_device_to_device\fR(3)