NUTSCAN_ADD_OPTION_T(3)
π NUTSCAN_ADD_OPTION_T π
okay bestie, pull up a chair, we're reading the NUT Manual page for nutscan_add_option_to_device and nutscan_add_commented_option_to_device and honestly? it's giving useful. π
β¨ NAME β¨
nutscan_add_option_to_device, nutscan_add_commented_option_to_device β add option data to the specified device, no cap π
πΈ SYNOPSIS πΈ
#include <nut-scan.h>
/* Add enabled option data to the specified device. */
void nutscan_add_option_to_device(
nutscan_device_t * device,
char * option_name,
char * value);
/* 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);
π¦ DESCRIPTION π¦
so first things first, the nutscan_device_t is carrying around these variables, periodt:
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;
it's a double linked list of devices, literally. every device gets described by its type, its driver name, its port, and then any number of optional data. main character energy tbh. π
nutscan_add_option_to_device() adds an optional data into the given device. optional data is made of an option_name and an associated value, and optionally a comment_tag. and here's the slay part: copies of the option_name, value and comment_tag get stored in the device, so the caller can safely free(3) all of the original strings they passed as arguments. no dangling, no drama. π«Ά
Note π a non-NULLvalue of thecomment_tagmakes 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"\0"may be passed to have no prefix). so like, your mileage varies by format, iykyk.
such options and their values may be further sanity-checked and reported as warnings by the nutscan_display_sanity_check() dispatcher and its related methods which implement the logic of particular checks. this is used for example when generating an ups.conf file content suggestions with the nutscan_display_ups_conf_with_sanity_check() method. so cute, so responsible. β¨
π NOTES π
technically, the function is currently defined in the nutscan-device.h file. just so you know where to look, bestie. π
π SEE ALSO π
nutscan_scan_usb(3)nutscan_scan_xml_http_range(3)nutscan_scan_nut(3)nutscan_scan_avahi(3)nutscan_scan_ipmi(3)nutscan_scan_snmp(3)nutscan_display_sanity_check(3)nutscan_display_sanity_check_serial(3)nutscan_display_ups_conf_with_sanity_check(3)nutscan_display_ups_conf(3)nutscan_display_parsable(3)nutscan_new_device(3)nutscan_free_device(3)nutscan_add_device_to_device(3)
and that's the whole vibe check, babe β this one's from Network UPS Tools 2.8.5, dated 10/07/2026, filed under NUTSCAN_ADD_OPTION_T(3). go forth and add your options, icon ππ§π
π¦ where this page comes from
- fedora 43: nut-devel 2.8.5-9.fc43 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 43: nut-devel 2.8.5-9.fc43 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: nut-devel 2.8.5-9.fc44 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: nut-devel 2.8.5-9.fc44 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms