#ifdef HAVE_CONFIG_H
# include "config.h"
# define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "cdio_assert.h"
#include <cdio/cdio.h>
#include <cdio/util.h>
#include "cdio_private.h"
const char *
cdio_get_arg (const CdIo *obj, const char key[])
{
if (obj == NULL) return NULL;
if (obj->op.get_arg) {
return obj->op.get_arg (obj->env, key);
} else {
return NULL;
}
}
CdIo_t *
cdio_new (generic_img_private_t *p_env, cdio_funcs_t *p_funcs)
{
CdIo_t *p_new_cdio = calloc(1, sizeof (CdIo_t));
if (NULL == p_new_cdio) return NULL;
p_new_cdio->env = p_env;
p_new_cdio->op = *p_funcs;
p_env->cdio = p_new_cdio;
return p_new_cdio;
}
driver_return_code_t
cdio_set_arg (CdIo_t *p_cdio, const char key[], const char value[])
{
if (!p_cdio) return DRIVER_OP_UNINIT;
if (!p_cdio->op.set_arg) return DRIVER_OP_UNSUPPORTED;
if (!key) return DRIVER_OP_ERROR;
return p_cdio->op.set_arg (p_cdio->env, key, value);
}