libisoburn/test/xorrisoburn.c

82 lines
2.1 KiB
C

/* Adapter to libisoburn, libisofs and libburn for xorriso,
a command line oriented batch and dialog tool which creates, loads,
manipulates and burns ISO 9660 filesystem images.
Copyright 2007 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2.
*/
#include <ctype.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
/* ------------------------------------------------------------------------ */
/* The library which does the ISO 9660 / RockRidge manipulations */
#include <libisofs/libisofs.h>
/* The library which does MMC optical drive operations */
#include <libburn/libburn.h>
/* The library which enhances overwriteable media with ISO 9660 multi-session
capabilities via the method invented by Andy Polyakov for growisofs */
#include <libisoburn/libisoburn.h>
/* The inner description of XorrisO */
#include "xorriso_private.h"
/* The inner isofs- and burn-library interface */
#include "xorrisoburn.h"
/* ------------------------------------------------------------------------ */
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
{
int ret;
char *handler_prefix= NULL;
/* >>> rather send this to msg system of xorriso */;
fprintf(stderr, "starting up libraries ...\n");
handler_prefix= calloc(strlen(xorriso->progname)+3+1, 1);
if(handler_prefix==NULL) {
/* >>> rather send this to msg system of xorriso */;
fprintf(stderr, "--- Cannot allocate memory for initializing libraries\n");
return(-1);
}
ret= isoburn_initialize();
if(ret==0) {
/* >>> rather send this to msg system of xorriso */;
fprintf(stderr, "--- Cannot initialize libraries\n");
free(handler_prefix);
return(0);
}
/* >>> need option for controlling this in XorrisO */
iso_msgs_set_severities("NEVER", "DEBUG", "libisofs : ");
burn_msgs_set_severities("NEVER", "DEBUG", "libburn : ");
sprintf(handler_prefix, "%s : ", xorriso->progname);
burn_set_signal_handling("%s : ", NULL, 0);
fprintf(stderr,"Library startup done.\n");
free(handler_prefix);
return(1);
}