diff --git a/example/cdchange.c b/example/cdchange.c index 380b8a62..4ed449a9 100644 --- a/example/cdchange.c +++ b/example/cdchange.c @@ -20,6 +20,10 @@ /* Test media changed */ #include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #ifdef HAVE_LIMITS_H #include #endif @@ -32,6 +36,10 @@ # include #endif +#ifdef HAVE_UNISTD_H +# include +#endif + #ifdef HAVE_ERRNO_H # include #endif diff --git a/example/paranoia.c b/example/paranoia.c index f3cdad33..d20b3a02 100644 --- a/example/paranoia.c +++ b/example/paranoia.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2005, 2006, 2008, 2009 Rocky Bernstein + Copyright (C) 2005, 2006, 2008, 2009, 2010 Rocky Bernstein This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,10 @@ #include #include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #ifdef HAVE_STDLIB_H #include #endif diff --git a/lib/driver/aix.c b/lib/driver/aix.c index 387f9354..ae6f506a 100644 --- a/lib/driver/aix.c +++ b/lib/driver/aix.c @@ -1,7 +1,7 @@ /* $Id: aix.c,v 1.3 2008/04/22 15:29:11 karl Exp $ - Copyright (C) 2004, 2005, 2006, 2008 Rocky Bernstein + Copyright (C) 2004, 2005, 2006, 2008, 2010 Rocky Bernstein This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -679,6 +679,13 @@ _cdio_malloc_and_zero(size_t size) { } #endif +static bool +is_mmc_supported(void *user_data) +{ + _img_private_t *env = user_data; + return (_AM_NONE == env->access_mode) ? false : true; +} + /*! Return the value associated with the key "arg". */ @@ -696,6 +703,8 @@ get_arg_aix (void *p_user_data, const char key[]) case _AM_NONE: return "no access method"; } + } else if (!strcmp (key, "mmc-supported?")) { + return is_mmc_supported(env) ? "true" : "false"; } return NULL; } diff --git a/lib/driver/image_common.c b/lib/driver/image_common.c index 301b08dc..146bf155 100644 --- a/lib/driver/image_common.c +++ b/lib/driver/image_common.c @@ -1,7 +1,5 @@ /* - $Id: image_common.c,v 1.15 2008/04/22 15:29:12 karl Exp $ - - Copyright (C) 2004, 2005, 2008 Rocky Bernstein + Copyright (C) 2004, 2005, 2008, 2010 Rocky Bernstein This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,6 +89,8 @@ _get_arg_image (void *user_data, const char key[]) return p_env->psz_cue_name; } else if (!strcmp(key, "access-mode")) { return "image"; + } else if (!strcmp (key, "mmc-supported?")) { + return "false"; } return NULL; } diff --git a/lib/driver/netbsd.c b/lib/driver/netbsd.c index 35fb7f34..1fd87ec9 100644 --- a/lib/driver/netbsd.c +++ b/lib/driver/netbsd.c @@ -1,7 +1,5 @@ /* - $Id: netbsd.c,v 1.4 2008/04/22 15:29:12 karl Exp $ - - Copyright (C) 2008 Rocky Bernstein + Copyright (C) 2008, 2010 Rocky Bernstein This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -372,6 +370,8 @@ get_arg_netbsd(void *user_data, const char key[]) return _obj->gen.source_name; } else if (!strcmp(key, "access-mode")) { return "READ_CD"; + } else if (!strcmp (key, "mmc-supported?")) { + return "true" ; } return NULL; diff --git a/test/driver/gnu_linux.c b/test/driver/gnu_linux.c index bb414a39..9e226cd8 100644 --- a/test/driver/gnu_linux.c +++ b/test/driver/gnu_linux.c @@ -64,6 +64,18 @@ main(int argc, const char *argv[]) } } + { + const char *psz_response = cdio_get_arg(p_cdio, "mmc-supported?"); + if ( psz_response == NULL || + ((0 != strncmp("true", psz_response, sizeof("true"))) && + (0 != strncmp("false", psz_response, sizeof("false")))) ) { + fprintf(stderr, + "cdio_get_arg(\"mmc-supported?\") should return \"true\" or \"false\"; got: %s.\n", + psz_response); + exit(2); + } + } + { const char *psz_source = NULL, *scsi_tuple; @@ -86,7 +98,7 @@ main(int argc, const char *argv[]) fprintf(stderr, "Got %s; Should get back %s, the access mode requested.\n", psz_access_mode, "MMC_RDWR"); - exit(2); + exit(4); } }