config_get mdns_mfg "$section" mdns_mfg
config_get mdns_mdl "$section" mdns_mdl
config_get mdns_cmd "$section" mdns_cmd
- procd_add_mdns "pdl-datastream" "tcp" "$((port+9100))" "note=$mdns_note" "ty=$mdns_ty" "product=$mdns_product" "usb_MFG=$mdns_mfg" "usb_MDL=$mdns_mdl" "usb_CMD=$mdns_cmd"
+
+ # Set initial arguments
+ set -- "pdl-datastream" "tcp" "$((port+9100))"
+ # bonjourprinting-1.2.1.pdf spec mandates (at least) MFG, MDL, CMD for Socket type
+ [ -n "$mdns_note" ] && set -- "$@" "note=$mdns_note"
+ [ -n "$mdns_ty" ] && set -- "$@" "ty=$mdns_ty"
+ [ -n "$mdns_product" ] && set -- "$@" "product=$mdns_product"
+ [ -n "$mdns_mfg" ] && set -- "$@" "usb_MFG=$mdns_mfg"
+ [ -n "$mdns_mdl" ] && set -- "$@" "usb_MDL=$mdns_mdl"
+ [ -n "$mdns_cmd" ] && set -- "$@" "usb_CMD=$mdns_cmd"
+
+ # Call procd_add_mdns with the positional parameters
+ procd_add_mdns "$@"
fi
procd_close_instance
fi