/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
#include <libintl.h>
#include <locale.h>
#include "msgs.h"
#include "device.h"
#include "util.h"
#include "main.h"
#include "options.h"
#include "mmc.h"
#include "misc_scsi.h"
/*
* global flags
*/
int debug = 0;
int keep_disc_open = 0;
int requested_speed = 0;
int simulation = 0;
int verbose = 0;
int extract_track_no = 0;
int vol_running = 0;
int cflag = 0;
int tflag = 0;
/*
* global variables
*/
static void
print_usage(void)
{
gettext("\tcdrw -b [ -v ] [ -d device ] all | session | fast\n"));
exit(2);
}
static void
{
int ret;
gettext("Option %c is not defined for this operation.\n"),
(char)ret);
print_usage();
}
}
attach_to_hald(void)
{
/* Initialize the dbus error states */
return (NULL);
}
/* Allocate a new hal context to work with the dbus */
return (NULL);
state = HAL_CONTEXT;
/* Pair up the context with the connection */
goto fail;
state = HAL_PAIRED;
/* If libhal_ctx_init fails hald is not present */
goto fail;
}
return (ctx);
fail:
if (dbus_error_is_set(&error))
return (NULL);
}
void
{
switch (state) {
case HAL_INITIALIZED:
if (dbus_error_is_set(&error))
/*FALLTHROUGH*/
case HAL_PAIRED:
(void) libhal_ctx_free(ctx);
break;
case HAL_CONTEXT:
(void) libhal_ctx_free(ctx);
break;
case DBUS_CONNECTION:
default:
break;
}
}
/*
* This function returns one if hald is running and
* zero if hald is not running
*/
int
hald_running(void)
{
return (0);
return (1);
}
int
{
char *devpath;
}
return (0);
}
return (1);
}
}
int
{
int c;
int operations;
int ret;
#if !defined(TEXT_DOMAIN)
#endif
(void) textdomain(TEXT_DOMAIN);
"Authorization failed, Cannot access disks.\n"));
exit(1);
}
priv_change_needed = 1;
lower_priv();
}
vol_running = hald_running();
operations = 0;
add_option(&specified_ops, c);
switch (c) {
case 'a':
aflag = 1;
operations++;
break;
case 'b':
bflag = 1;
operations++;
break;
case 'c':
cflag = 1;
operations++;
break;
case 'C':
/*
* cdrw now attempts to use the stated medium capacity
* by default, so this option no longer has any effect.
* It remains in the interface for backwards
* compatibility only.
*/
break;
case 'd':
break;
case 'h':
print_usage(); /* will not return */
break;
case 'i':
iflag = 1;
operations++;
break;
case 'L':
Lflag = 1;
operations++;
break;
case 'l':
lflag = 1;
operations++;
break;
case 'm':
break;
case 'M':
Mflag = 1;
operations++;
break;
case 'O':
keep_disc_open = 1;
break;
case 'p':
break;
case 's':
break;
case 'S':
simulation++;
break;
case 'T':
if (audio_type == -1) {
optarg);
exit(1);
}
break;
case 'v':
verbose++;
break;
case 'V':
/*
* more verbose. this will print out debug comments
*/
debug++;
break;
case 'x':
xflag++;
operations++;
break;
default:
print_usage();
}
}
if (operations == 0) {
exit(1);
}
if (operations != 1) {
exit(1);
}
if (lflag) {
list();
}
/*
* we'll allow the user to specify the source device (-s) when
* extracting audio.
*/
/*
* This will scan for all CD devices when xflag or Mflag
* (extract audio, list toc) commands are used, providing
* no CD-RW devices are found. Since these commands can
* be used without a CD writer.
*/
} else {
}
if (ret == 0) {
"Cannot find device %s.\n"), tgtdev);
}
if (vol_running) {
"No CD writers found or no media in the drive.\n"));
} else {
if (cur_uid != 0) {
"Volume manager is not running.\n"));
"Please start volume manager or run cdrw as root to access all devices.\n"));
} else {
"No CD writers found.\n"));
}
}
exit(1);
} else if (ret != 1) {
"Or use -l option to list all the CD devices found\n"));
exit(1);
}
int retry;
break;
(void) sleep(3);
}
}
if (aflag) {
exit(1);
}
}
if (Mflag) {
info();
}
if (iflag) {
write_image();
}
write_image();
exit(1);
}
if (bflag) {
print_usage();
}
blank();
}
if (xflag) {
print_usage();
}
}
if (cflag) {
copy_cd();
}
/*
* Open a closed disk, we do this by erasing the track tail
* and then re-finalizing with an open leadout.
*/
if (Lflag) {
/* no need to erase blank media */
exit(0);
blanking_type = "leadout";
blank();
exit(0);
}
return (0);
}