NUTSCAN_ADD_DEVICE_T(3)

πŸ’– NUTSCAN_ADD_DEVICE_T(3) πŸ’–

okay bestie, welcome to the NUT Manual ✨ today we're learning about nutscan_add_device_to_device, which is literally the "and they were roommates" of device structs. sit down, grab a strawberry πŸ“, let's go.


🌸 NAME 🌸

nutscan_add_device_to_device β€” concatenate two devices structure 🫢


✨ SYNOPSIS ✨

#include <nut-scan.h>

nutscan_device_t * nutscan_add_device_to_device(
        nutscan_device_t * first,
        nutscan_device_t * second);

no cap, that's the whole vibe. two pointers in, one pointer out πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so the nutscan_device_t is carrying these variables around like it's got main character energy:

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 giving double linked list of device. every single device is described by its type, its driver name, its port, and then any number of optional data on top. iconic honestly.

and what does nutscan_add_device_to_device() actually do? it concatenates first and second devices into one unique device. and the way that it does this… okay so listen. no new device is created. none. zero. the two linked lists are simply linked to each other. that's it, that's the whole trick πŸŽ€

which means first and second devices are likely to be modified by this function. yes fr fr, it's touching your stuff. not a copy situation. not a clone situation. it's rearranging the actual originals. be aware πŸ‘€


πŸ’€ RETURN VALUE πŸ’€

nutscan_add_device_to_device() returns a pointer to a device containing both passed devices. but bestie β€” heads up β€” it's not a new device. so what you get back is either first or second which is returned. one of them. no third mystery device. sorry to disappoint πŸ’œ


🌈 NOTES 🌈

technically (iykyk), the function is currently defined in nutscan-device.h file. yeah, not where you'd expect. it's fine. we move.


πŸ‘‘ SEE ALSO πŸ‘‘

go read those next, they're all bangers πŸ”₯


and that's the whole page bestie, you ate πŸ’…βœ¨ this was Network UPS Tools 2.8.5, dated 10/07/2026 β€” go forth and link those lists, mwah πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from