Index: roard/roard.c
===================================================================
--- roard/roard.c	(revision 5837)
+++ roard/roard.c	(revision 5945)
@@ -1303,9 +1303,4 @@
 // MAIN:
 
-#define _CKHAVEARGS(x) if ( (i + (x)) >= argc ) { \
-                        ROAR_ERR("Option %s requires more arguments. See --help for more details.", k); \
-                        return 70; \
-                       }
-
 #ifdef ROAR_HAVE_MAIN_ARGS
 int main (int argc, char * argv[]) {
@@ -1595,5 +1590,5 @@
 
   } else if ( strcmp(k, "--print-format") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 
   } else if ( strcmp(k, "--terminate") == 0 ) {
@@ -1604,5 +1599,5 @@
    realtime++;
   } else if ( strcmp(k, "--memlock") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    g_config->memlock_level = memlock_str2level(argv[++i]);
   } else if ( strcmp(k, "--watchdog") == 0 ) {
@@ -1610,8 +1605,8 @@
     watchdog_time = -1;
   } else if ( strcmp(k, "--watchdog-time") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
     watchdog_time = atoi(argv[++i]);
   } else if ( strcmp(k, "--chroot") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_HAVE_CHROOT
    chrootdir = argv[++i];
@@ -1633,20 +1628,20 @@
 #endif
   } else if ( strcmp(k, "--location") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    g_config->location = argv[++i];
   } else if ( strcmp(k, "--description") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    g_config->description = argv[++i];
   } else if ( strcmp(k, "--contact") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    g_config->contact = argv[++i];
   } else if ( strcmp(k, "--serial") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    g_config->serial = argv[++i];
   } else if ( strcmp(k, "--uiurl") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    g_config->uiurl = argv[++i];
   } else if ( strcmp(k, "--pidfile") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef SUPPORT_PIDFILE
    pidfile = argv[++i];
@@ -1662,5 +1657,5 @@
 #endif
   } else if ( strcmp(k, "--script-postdown") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_HAVE_SYSTEM
    g_config->scripts.post_shutdown = argv[++i];
@@ -1672,5 +1667,5 @@
 
   } else if ( strcmp(k, "--plugin-load") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    if ( plugins_load(argv[++i], plugin_args) == -1 ) {
     ROAR_ERR("Can not load plugin");
@@ -1678,5 +1673,5 @@
    plugin_args = NULL;
   } else if ( strcmp(k, "--plugin-args") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    plugin_args = argv[++i];
   } else if ( strcmp(k, "--list-plugins") == 0 ) {
@@ -1684,5 +1679,5 @@
 
   } else if ( strcmp(k, "--guest-acclev") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    none_acclev = clients_str2acclev(argv[++i]);
    if ( none_acclev == -1 ) {
@@ -1691,5 +1686,5 @@
    }
   } else if ( strcmp(k, "--trust-acclev") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    trust_acclev = clients_str2acclev(argv[++i]);
    if ( trust_acclev == -1 ) {
@@ -1703,16 +1698,16 @@
 
   } else if ( strcmp(k, "--authfile-gen") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    af_file = argv[++i];
    af_mode = AF_MODE_GEN;
   } else if ( strcmp(k, "--authfile-load") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    af_file = argv[++i];
    af_mode = AF_MODE_LOAD;
   } else if ( strcmp(k, "--authfile-type") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    af_type = argv[++i];
   } else if ( strcmp(k, "--authfile-acclev") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    af_acclev = clients_str2acclev(argv[++i]);
   } else if ( strcmp(k, "--new-authfile") == 0 ) {
@@ -1732,15 +1727,15 @@
 
   } else if ( strcmp(k, "-R") == 0 || strcmp(k, "--rate") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    sa.rate = atoi(argv[++i]);
   } else if ( strcmp(k, "-B") == 0 || strcmp(k, "--bits") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    sa.bits = atoi(argv[++i]);
   } else if ( strcmp(k, "-C") == 0 || strcmp(k, "--chans") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    sa.channels = atoi(argv[++i]);
 
   } else if ( strcmp(k, "--aiprofile") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    if ( roar_profile2info(&sa, argv[++i]) == -1 ) {
     ROAR_ERR("Unknown audio profile: %s", argv[i]);
@@ -1750,5 +1745,5 @@
 
   } else if ( strcmp(k, "--stream-flags") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    if ( update_stream_flags(argv[++i]) == -1 ) {
     ROAR_ERR("Can not set stream flags");
@@ -1760,5 +1755,5 @@
    return 0;
   } else if ( strcmp(k, "--rolestack-push") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
   if ( (rolestack = rolestack_parse(argv[++i])) == NULL ) {
    ROAR_ERR("Can not parse rolestack request: %s", roar_error2str(roar_error));
@@ -1778,11 +1773,11 @@
 
   } else if ( strcmp(k, "-o") == 0 || strcmp(k, "--odriver") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    o_drv  = argv[++i];
   } else if ( strcmp(k, "-O") == 0 || strcmp(k, "--odevice") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    o_dev  = argv[++i];
   } else if ( strcmp(k, "-oO") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    o_opts = argv[++i];
   } else if ( strcmp(k, "-oP") == 0 ) {
@@ -1798,5 +1793,5 @@
 
   } else if ( strcmp(k, "-s") == 0 || strcmp(k, "--source") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_SOURCES
    s_drv = argv[++i];
@@ -1806,5 +1801,5 @@
 #endif
   } else if ( strcmp(k, "-S") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_SOURCES
    s_dev = argv[++i];
@@ -1814,5 +1809,5 @@
 #endif
   } else if ( strcmp(k, "-sO") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_SOURCES
    s_opt = argv[++i];
@@ -1822,5 +1817,5 @@
 #endif
   } else if ( strcmp(k, "-sC") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_SOURCES
    s_con = argv[++i];
@@ -1856,5 +1851,5 @@
 
   } else if ( strcmp(k, "-m") == 0 || strcmp(k, "--mixer") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_MIXER
    m_drv  = argv[++i];
@@ -1864,5 +1859,5 @@
 #endif
   } else if ( strcmp(k, "-M") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_MIXER
    m_dev  = argv[++i];
@@ -1872,5 +1867,5 @@
 #endif
   } else if ( strcmp(k, "-mO") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_MIXER
    m_opts = argv[++i];
@@ -1907,5 +1902,5 @@
 
   } else if ( strcmp(k, "--light-channels") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_LIGHT
    light_channels = atoi(argv[++i]);
@@ -1916,5 +1911,5 @@
 
   } else if ( strcmp(k, "--rds-pi") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_RDTCS
    g_rdtcs.rds.pi = atoi(argv[++i]);
@@ -1924,5 +1919,5 @@
 #endif
   } else if ( strcmp(k, "--rds-ps") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_RDTCS
    if ( rdtcs_rds_set_ps(argv[++i]) == -1 ) {
@@ -1935,5 +1930,5 @@
 #endif
   } else if ( strcmp(k, "--rds-pty") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_RDTCS
    if ( rdtcs_rds_set_pty(argv[++i]) == -1 ) {
@@ -1978,5 +1973,5 @@
 #endif
   } else if ( strcmp(k, "--midi-console") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifndef ROAR_WITHOUT_DCOMP_CB
    midi_config.console_dev = argv[++i];
@@ -2001,5 +1996,5 @@
 
   } else if ( strcmp(k, "--x11-display") == 0 || strcmp(k, "--display") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_HAVE_LIBX11
    x11display = argv[++i];
@@ -2011,5 +2006,5 @@
 
   } else if ( strcmp(k, "-p") == 0 || strcmp(k, "--port") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    // This is only useful in INET not UNIX mode.
 #ifdef ROAR_SUPPORT_LISTEN
@@ -2035,5 +2030,5 @@
 #endif
   } else if ( strcmp(k, "-b") == 0 || strcmp(k, "--bind") == 0 || strcmp(k, "--sock") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_SUPPORT_LISTEN
    sock_addr = argv[++i];
@@ -2050,5 +2045,5 @@
 #endif
   } else if ( strcmp(k, "--proto-dir") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_SUPPORT_LISTEN
    if ( (sock_dir = roar_str2dir(argv[++i])) == -1 ) {
@@ -2060,5 +2055,5 @@
 #endif
   } else if ( strcmp(k, "--proto-rate") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_SUPPORT_LISTEN
    sock_info.rate = atoi(argv[++i]);
@@ -2067,5 +2062,5 @@
 #endif
   } else if ( strcmp(k, "--proto-bits") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_SUPPORT_LISTEN
    sock_info.bits = atoi(argv[++i]);
@@ -2074,5 +2069,5 @@
 #endif
   } else if ( strcmp(k, "--proto-chans") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_SUPPORT_LISTEN
    sock_info.channels = atoi(argv[++i]);
@@ -2081,5 +2076,5 @@
 #endif
   } else if ( strcmp(k, "--proto-codec") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_SUPPORT_LISTEN
    if ( (sock_info.codec = roar_str2codec(argv[++i])) == -1 ) {
@@ -2091,5 +2086,5 @@
 #endif
   } else if ( strcmp(k, "--proto-aiprofile") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_SUPPORT_LISTEN
    if ( roar_profile2info(&sock_info, argv[++i]) == -1 ) {
@@ -2106,5 +2101,5 @@
 #endif
   } else if ( strcmp(k, "--proto-profile") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_SUPPORT_LISTEN
    if ( get_listen_profile(argv[++i], &port, &sock_addr, &sock_type, &sock_proto, &sock_dir, &sock_info) == -1 ) {
@@ -2193,12 +2188,12 @@
 
   } else if ( strcmp(k, "--jumbo-mtu") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    g_config->jumbo_mtu = atoi(argv[++i]);
 
   } else if ( strcmp(k, "-G") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    sock_grp  = argv[++i];
   } else if ( strcmp(k, "-U") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    sock_user = argv[++i];
 
@@ -2210,5 +2205,5 @@
 #endif
   } else if ( strcmp(k, "--client-fh") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
    if ( clients_new_from_fh(atoi(argv[++i]), ROAR_PROTO_ROARAUDIO, ROAR_BYTEORDER_NETWORK, 1) == -1 ) {
     ROAR_ERR("main(*): Can not set client's fh");
@@ -2216,5 +2211,5 @@
    }
   } else if ( strcmp(k, "--close-fh") == 0 ) {
-   _CKHAVEARGS(1);
+   ROAR_CKHAVEARGS(1);
 #ifdef ROAR_HAVE_IO_POSIX
    close(atoi(argv[++i]));
