Ejemplo n.º 1
0
static int ioctl_scsiemu (int unitnum, uae_u8 *cmd)
{
	uae_u8 c = cmd[0];
	if (c == 0x1b) {
		int mode = cmd[4] & 3;
		if (mode == 2)
			eject (unitnum, true);
		else if (mode == 3)
			eject (unitnum, false);
		return 1;
	}
	return -1;
}
Ejemplo n.º 2
0
QStringList AudioCdRecord::arguments() const
{
    QStringList args;

/*! --------------------- Normal Arguments --------------------!*/
    args << "-v";

    if( publicRead()           )        args << "-r";
    if( dummy()                )        args << "-dummy";
    if( force()                )        args << "-force";
    if( sessionAtOnce()        )        args << "-sao";
    if( trackAtOnce()          )        args << "-tao";
    if( swab()                 )        args << "-swab";
    if( multiSession()         )        args << "-multi";
    if( pad()                  )        args << "-pad";
    if( pad() && padSize() > 0 )        args << QString::number( padSize() );
    if( eject()                )        args << "-eject";

    if( ringBuffer() > 0       )        args << "fs="     + QString::number( ringBuffer() );
    if( minimumBuffer() > 0    )        args << "minbuf=" + QString::number( minimumBuffer() );
    if( speed() > 0            )        args << "speed="  + QString::number( speed() );

    args << "dev=" + currentDevice().toQString();
    args << "-audio";
    args << files();
    /*! -----------------------------------------------------------!*/

    return args;
}
Ejemplo n.º 3
0
Archivo: n5.c Proyecto: aksr/heirloom
void
casebp(void)
{
	register int i;
	register struct s *savframe;

	if (dip != d)
		return;
	savframe = frame;
	if (skip(0))
		i = -1;
	else {
		if ((i = inumb(&numtab[PN].val)) < 0)
			i = 0;
		if (nonumb)
			i = -1;
	}
	tbreak();
	if (i >= 0) {
		npn = i;
		npnflg++;
	} else if (dip->nls && donef < 1)
		return;
	eject(savframe);
}
/*
 * Class:     com_joshlong_cdworld_utils_cdda_AudioCompactDisc
 * Method:    _ejectCompactDiscFromCompactDiscDrive
 * Signature: (Ljava/lang/String;)Z
 */
JNIEXPORT jboolean JNICALL Java_com_joshlong_cdworld_utils_cdda_AudioCompactDisc__1ejectCompactDiscFromCompactDiscDrive
  (JNIEnv * env, jobject cePtr, jstring deviceName)
{
	const char * drive =  (*env).GetStringUTFChars( deviceName, NULL) ; 
	int driveNo =atoi( drive);
	jint cnt = (jint)eject(driveNo) ;
	(*env).ReleaseStringUTFChars(deviceName,drive);
	return JNI_TRUE ;
}
Ejemplo n.º 5
0
int
main (int argc, char *argv[])
{
  GOptionContext *context;
  GError *error;
  GFile *file;

  setlocale (LC_ALL, "");

  g_type_init ();

  error = NULL;
  context = g_option_context_new (_("- mount <location>"));
  g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
  g_option_context_parse (context, &argc, &argv, &error);
  g_option_context_free (context);

  main_loop = g_main_loop_new (NULL, FALSE);

  if (mount_list)
    list_monitor_items ();
  else if (mount_device_file != NULL)
    {
      mount_with_device_file (mount_device_file);
    }
  else if (unmount_scheme != NULL)
    {
      unmount_all_with_scheme (unmount_scheme);
    }
  else if (mount_monitor)
    {
      monitor ();
    }
  else if (argc > 1)
    {
      int i;

      for (i = 1; i < argc; i++) {
        file = g_file_new_for_commandline_arg (argv[i]);
        if (mount_unmount)
          unmount (file);
        else if (mount_eject)
          eject (file);
        else
          mount (file);
        g_object_unref (file);
      }
    }

  if (outstanding_mounts > 0)
    g_main_loop_run (main_loop);

  return 0;
}
Ejemplo n.º 6
0
	~dequeueLIST()							//delete list
	{
		int k=0;
		while (tail!=0)
		{
			k=eject();
		//	cout<<k<<endl;
		}
		
		cout<<"@@ List Deleted @@"<<endl;

	}
Ejemplo n.º 7
0
int install_pkgs_discs(GList *pkgs, char *srcdev)
{
	int i, first = 1, ret;

	while(pkgs) {
		GList *list = NULL;
		struct stat buf;
		char *ptr;

		if(first) {
			// for the first time the volume is already loaded
			first = 0;
		} else {
			eject(srcdev, SOURCEDIR);
			ret = fwife_question(_("Please insert the next Frugalware install disc and press "
								"ENTER to continue installing packages. If you don't "
								"have more discs, choose NO, and then you can finish  "
								"the installation. Have you inserted the next disc?"));
			if(ret == GTK_RESPONSE_NO)
				return 0;

            ptr = g_strdup_printf("mount -o ro -t iso9660 /dev/%s %s",
				srcdev,
				SOURCEDIR);
			fw_system(ptr);
            free(ptr);
        }

		// see what packages can be useful from this volume
		for(i = 0; i < g_list_length(pkgs); i++) {
			ptr = g_strdup_printf("%s/frugalware-%s/%s-%s.fpm", SOURCEDIR, ARCH,
				(char*)g_list_nth_data(pkgs, i), ARCH);
			if(!stat(ptr, &buf))
				list = g_list_append(list, strdup((char*)g_list_nth_data(pkgs, i)));
			free(ptr);
		}

		// remove them from the full list
		for(i = 0; i < g_list_length(list); i++)
			pkgs = g_list_strremove(pkgs, (char*)g_list_nth_data(list, i));

		// install them
		if(install_pkgs(list) == -1)
			return -1;
	}

	return 0;
}
Ejemplo n.º 8
0
int DiscOpenPanel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = OpenPanel::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: updateMRL(); break;
        case 1: browseDevice(); break;
        case 2: updateButtons(); break;
        case 3: eject(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Ejemplo n.º 9
0
void
done1(int x) 
{
	error |= x;
	if (numtab[NL].val) {
		trap = 0;
		eject((struct s *)0);
		longjmp(sjbuf, 1);
	}
	if (nofeed) {
		ptlead();
		flusho();
		done3(0);
	} else {
		pttrailer();
		done2(0);
	}
}
Ejemplo n.º 10
0
void Shooter::update() {
	//for certain cases, will not automatically switch case, waits for timer
	switch (state) {
		// M FOR MANUAL
		case M_FIRE:
			startShooterVics(1.0);
		break;
		case M_LOAD:
			loaderVic.Set(LOAD_SPEED);
		break;
		case IDLE:
			setAllVics(0);
		break;
			//Prepares AND Aligns simultaneously
		case PREPARING:
			if (!shootTimer.HasPeriodPassed(3.0)) {
				std::printf("preparing\n");
				startShooterVics(1.0);
				loaderVic.Set(0.0);
			} else {
				std::printf("fire\n");
				state = FIRING;
				shootTimer.Reset();
			}
		break;
		case FIRING:
			if (!shootTimer.HasPeriodPassed(3.0)) {
				loaderVic.Set(LOAD_SPEED);
			} else {
				state = IDLE;
			}
		break;
		case EJECT:
			eject();
		break;
		case FLUSH:
			setAllVics(-0.4);
		break;
		case OUT_FLUSH:
			setAllVics(0.4);
		break;
	}
}
Ejemplo n.º 11
0
int FormSetup::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: ApplyB(); break;
        case 1: addCD(); break;
        case 2: FsetupTimer(); break;
        case 3: eject(); break;
        case 4: closeTB(); break;
        case 5: setDrive(); break;
        case 6: CHKENABLED(); break;
        case 7: driveE((*reinterpret_cast< QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 8;
    }
    return _id;
}
Ejemplo n.º 12
0
void
done(int x)
{
	register int i;

	error |= x;
	dl = app = ds = lgf = 0;
	if (pgchars && !pglines) {
		donep = 1;
		tbreak();
		donep = 0;
	}
	if ((i = em)) {
		donef = -1;
		em = 0;
		if (control(i, 0))
			longjmp(sjbuf, 1);
	}
	if (!nfo)
		done3(0);
	mflg = 0;
	dip = &d[0];
	if (woff)
		wbt((tchar)0);
	if (pendw)
		getword(1);
	pendnf = 0;
	if (donef == 1)
		done1(0);
	donef = 1;
	ip = 0;
	frame = stk;
	nxf = calloc(1, sizeof *nxf);
	if (!ejf)
		tbreak();
	nflush++;
	eject((struct s *)0);
	longjmp(sjbuf, 1);
}
Ejemplo n.º 13
0
int
clip___EJECT(ClipMachine * ClipMachineMemory)
{
   eject(ClipMachineMemory);
   return 0;
}
Ejemplo n.º 14
0
bool Solid::OpticalDrive::eject()
{
    Q_D(OpticalDrive);
    return_SOLID_CALL(Ifaces::OpticalDrive *, d->backendObject(), false, eject());
}
Ejemplo n.º 15
0
Archivo: n1.c Proyecto: 99years/plan9
main(int argc, char *argv[])
{
	char *p;
	int j;
	Tchar i;
	char buf[100];

	buf[0] = '\0';		/* make sure it's empty (silly 3b2) */
	progname = argv[0];
	if ((p = strrchr(progname, '/')) == NULL)
		p = progname;
	else
		p++;
	DWBinit(progname, dwbpaths);
	if (strcmp(p, "nroff") == 0)
		TROFF = 0;
#ifdef UNICODE
	alphabet = 128;	/* unicode for plan 9 */
#endif	/*UNICODE*/
	mnspace();
	nnspace();
	mrehash();
	nrehash();
	numtabp[NL].val = -1;

	while (--argc > 0 && (++argv)[0][0] == '-')
		switch (argv[0][1]) {

		case 'N':	/* ought to be used first... */
			TROFF = 0;
			break;
		case 'd':
			fprintf(stderr, "troff/nroff version %s\n", Version);
			break;
		case 'F':	/* switch font tables from default */
			if (argv[0][2] != '\0') {
				strcpy(termtab, &argv[0][2]);
				strcpy(fontdir, &argv[0][2]);
			} else {
				argv++; argc--;
				strcpy(termtab, argv[0]);
				strcpy(fontdir, argv[0]);
			}
			break;
		case 0:
			goto start;
		case 'i':
			stdi++;
			break;
		case 'n':
			npn = atoi(&argv[0][2]);
			break;
		case 'u':	/* set emboldening amount */
			bdtab[3] = atoi(&argv[0][2]);
			if (bdtab[3] < 0 || bdtab[3] > 50)
				bdtab[3] = 0;
			break;
		case 's':
			if (!(stop = atoi(&argv[0][2])))
				stop++;
			break;
		case 'r':
			sprintf(buf + strlen(buf), ".nr %c %s\n",
				argv[0][2], &argv[0][3]);
			/* not yet cpushback(buf);*/
			/* dotnr(&argv[0][2], &argv[0][3]); */
			break;
		case 'm':
			if (mflg++ >= NMF) {
				ERROR "Too many macro packages: %s", argv[0] WARN;
				break;
			}
			strcpy(mfiles[nmfi], nextf);
			strcat(mfiles[nmfi++], &argv[0][2]);
			break;
		case 'o':
			getpn(&argv[0][2]);
			break;
		case 'T':
			strcpy(devname, &argv[0][2]);
			dotT++;
			break;
		case 'a':
			ascii = 1;
			break;
		case 'h':
			hflg++;
			break;
		case 'e':
			eqflg++;
			break;
		case 'q':
			quiet++;
			save_tty();
			break;
		case 'V':
			fprintf(stdout, "%croff: DWB %s\n", 
					TROFF ? 't' : 'n', DWBVERSION);
			exit(0);
		case 't':
			if (argv[0][2] != '\0')
				trace = trace1 = argv[0][2];
			break;		/* for the sake of compatibility */
		default:
			ERROR "unknown option %s", argv[0] WARN;
			done(02);
		}

start:
	/*
	 * cpushback maintains a LIFO, so push pack the -r arguments
	 * in reverse order to maintain a FIFO in case someone did -rC1 -rC3
	 */
	if (buf[0]) {
		char *p = buf;
		while(*p++)
			;
		while(p > buf) {
			while(strncmp(p, ".nr", 3) != 0)
				p--;
			cpushback(p);
			*p-- = '\0';
		}
	}
	argp = argv;
	rargc = argc;
	nmfi = 0;
	init2();
	setjmp(sjbuf);
loop:
	copyf = lgf = nb = nflush = nlflg = 0;
	if (ip && rbf0(ip) == 0 && ejf && frame->pframe <= ejl && dip == d) {
		nflush++;
		trap = 0;
		eject((Stack *)0);
		goto loop;
	}
	i = getch();
	if (pendt)
		goto Lt;
	if ((j = cbits(i)) == XPAR) {
		copyf++;
		tflg++;
		while (cbits(i) != '\n')
			pchar(i = getch());
		tflg = 0;
		copyf--;			/* pointless */
		goto loop;
	}
	if (j == cc || j == c2) {
		if (j == c2)
			nb++;
		copyf++;
		while ((j = cbits(i = getch())) == ' ' || j == '\t')
			;
		ch = i;
		copyf--;
		control(getrq(), 1);
		flushi();
		goto loop;
	}
Lt:
	ch = i;
	text();
	if (nlflg)
		numtabp[HP].val = 0;
	goto loop;
}
Ejemplo n.º 16
0
/**
 * Constructor. Connect all of the object and the job control.
 */
KAudioCreator::KAudioCreator( QWidget* parent, const char* name) :
       KMainWindow(parent, name)
{
    janusWidget = new KJanusWidget(this, name, KJanusWidget::Tabbed);
    setCentralWidget(janusWidget);

    QVBox *frame = janusWidget->addVBoxPage(i18n("&CD Tracks"), QString::null, SmallIcon("cdaudio_unmount", 32));
    tracks = new TracksImp(frame, "Tracks");

    ripper  = new Ripper ( frame, "Rip" );
    encoder = new Encoder( frame, "Encoder" );

    frame = janusWidget->addVBoxPage( i18n("&Jobs"), QString::null, SmallIcon( "run", 32 ) );
    jobQue = new JobQueImp( frame, "Que" );

    resize(500, 440);

    /*KAction *eject = */new KAction( i18n("&Eject CD"), 0, tracks,
                                  SLOT( eject() ), actionCollection(), "eject" );

    (void)new KAction( i18n("&Configure KAudioCreator..."), 0, this,
                       SLOT( showSettings() ), actionCollection(), "configure_kaudiocreator" );

    KAction *selectAll   = new KAction( i18n( "Select &All Tracks"), 0, tracks,
                                        SLOT( selectAllTracks()   ), actionCollection(), "select_all" ) ;
    KAction *deselectAll = new KAction( i18n( "Deselect &All Tracks"), 0, tracks,
                                        SLOT( deselectAllTracks() ), actionCollection(), "deselect_all" );
    selectAll->setEnabled( false );
    deselectAll->setEnabled( false );

    KActionMenu *actActionMenu = new KActionMenu( i18n("Rip &Selection"), "rip", actionCollection(), "rip" );
    actActionMenu->setDelayed(true); //needed for checking "all accounts"
    actActionMenu->setEnabled( false );   
    connect( actActionMenu, SIGNAL( activated() ), tracks, SLOT( startSession() ) );

    ripMenu = actActionMenu->popupMenu();
    connect( ripMenu, SIGNAL( activated(int) ), this, SLOT( slotRipSelection(int)) );
    connect( ripMenu, SIGNAL( aboutToShow() ),  this, SLOT( getRipMenu()) );

    KAction *rip = new KAction( i18n( "Rip &Selection" ), 0, tracks,
                                SLOT( startSession() ), actionCollection(), "rip_selected" );
    rip->setEnabled( false );

    connect( jobQue, SIGNAL( removeJob(int) ), this,    SLOT( updateStatus() ) );
    connect( jobQue, SIGNAL( removeJob(int) ), ripper,  SLOT( removeJob(int) ) );
    connect( jobQue, SIGNAL( removeJob(int) ), encoder, SLOT( removeJob(int)) );

    connect( ripper, SIGNAL( updateProgress(int, int) )     , jobQue,  SLOT( updateProgress(int,int) ) );
    connect( ripper, SIGNAL( addJob(Job*, const QString &) ), jobQue,  SLOT( addJob(Job*, const QString &)) );
    connect( ripper, SIGNAL( eject(const QString &) )       , tracks,  SLOT( ejectDevice(const QString &)) );
    connect( ripper, SIGNAL( encodeWav(Job *) )             , encoder, SLOT( encodeWav(Job *)) );
    connect( ripper, SIGNAL( jobsChanged() )                , this,    SLOT( updateStatus() ) );   

    connect( encoder, SIGNAL( updateProgress(int, int) )   , jobQue,  SLOT( updateProgress(int,int)) );
    connect( encoder, SIGNAL( addJob(Job*, const QString&)), jobQue,  SLOT( addJob(Job*, const QString &)) );
    connect( encoder, SIGNAL( jobsChanged() )              , this,    SLOT( updateStatus() ) );

    connect( tracks, SIGNAL( hasCD(bool) )    , this,          SLOT( hasCD(bool) ) );
    connect( tracks, SIGNAL( ripTrack(Job *) ), ripper,        SLOT( ripTrack(Job *)) );
    connect( tracks, SIGNAL( hasTracks(bool) ), rip,           SLOT( setEnabled(bool)) );
    connect( tracks, SIGNAL( hasTracks(bool) ), actActionMenu, SLOT( setEnabled(bool)) );
    connect( tracks, SIGNAL( hasTracks(bool) ), deselectAll,   SLOT( setEnabled(bool)) );
    connect( tracks, SIGNAL( hasTracks(bool) ), selectAll,     SLOT( setEnabled(bool)) );

    (void)new KAction(i18n("Remove &Completed Jobs"), 0, jobQue,
          SLOT(clearDoneJobs()), actionCollection(), "clear_done_jobs" );

    KAction *edit = new KAction(i18n("&Edit Album..."), 0, tracks,
          SLOT(editInformation()), actionCollection(), "edit_cd");
    connect(tracks, SIGNAL(hasCD(bool)), edit, SLOT(setEnabled(bool)));
    edit->setEnabled( false );

    (void)new KAction(i18n("Encode &File..."), 0, this,
          SLOT(encodeFile()), actionCollection(), "encode_file");

    KAction *cddb = new KAction(i18n("&CDDB Lookup"), 0, tracks,
          SLOT(performCDDB()), actionCollection(), "cddb_now");
    connect(tracks, SIGNAL(hasCD(bool)), cddb, SLOT(setEnabled(bool)));
    cddb->setEnabled( false );

    KStdAction::configureNotifications(this, SLOT(configureNotifications()),
          actionCollection());
    KStdAction::quit( this, SLOT(close()), actionCollection(), "quit" );

    // Init statusbar
    statusBar()->insertItem(i18n("No Audio CD detected"), 0 );
    hasCD(tracks->hasCD());

    setupGUI();
}
Ejemplo n.º 17
0
int
handle_mount (int argc, char *argv[], gboolean do_help)
{
  GOptionContext *context;
  gchar *param;
  GError *error = NULL;
  GFile *file;
  int i;

  g_set_prgname ("gio mount");

  /* Translators: commandline placeholder */
  param = g_strdup_printf ("[%s...]", _("LOCATION"));
  context = g_option_context_new (param);
  g_free (param);
  g_option_context_set_help_enabled (context, FALSE);
  g_option_context_set_summary (context, _("Mount or unmount the locations."));
  g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);

  if (do_help)
    {
      show_help (context, NULL);
      g_option_context_free (context);
      return 0;
    }

  if (!g_option_context_parse (context, &argc, &argv, &error))
    {
      show_help (context, error->message);
      g_error_free (error);
      g_option_context_free (context);
      return 1;
    }

  g_option_context_free (context);

  main_loop = g_main_loop_new (NULL, FALSE);

  if (mount_list)
    list_monitor_items ();
  else if (mount_device_file != NULL)
    mount_with_device_file (mount_device_file);
  else if (unmount_scheme != NULL)
    unmount_all_with_scheme (unmount_scheme);
  else if (mount_monitor)
    monitor ();
  else if (argc > 1)
    {
      for (i = 1; i < argc; i++)
        {
          file = g_file_new_for_commandline_arg (argv[i]);
          if (mount_unmount)
            unmount (file);
          else if (mount_eject)
            eject (file);
          else
            mount (file);
          g_object_unref (file);
        }
    }

  if (outstanding_mounts > 0)
    g_main_loop_run (main_loop);

  return success ? 0 : 2;
}
Ejemplo n.º 18
0
void FileTable::gc()
{
    if (m_closed.size() >= NUM_EJECT)
        eject();
}
Ejemplo n.º 19
0
int
main (int argc, char *argv[])
{
  GOptionContext *context;
  GError *error;
  GFile *file;
  gchar *param;
  gchar *summary;

  setlocale (LC_ALL, "");

  bindtextdomain (GETTEXT_PACKAGE, GVFS_LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  error = NULL;
  param = g_strdup_printf ("[%s...]", _("LOCATION"));
  summary = _("Mount the locations.");

  context = g_option_context_new (param);
  g_option_context_set_summary (context, summary);
  g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
  g_option_context_parse (context, &argc, &argv, &error);
  g_option_context_free (context);
  g_free (param);

  if (error != NULL)
    {
      g_printerr (_("Error parsing commandline options: %s\n"), error->message);
      g_printerr ("\n");
      g_printerr (_("Try \"%s --help\" for more information."), g_get_prgname ());
      g_printerr ("\n");
      g_error_free (error);
      return 1;
    }

  if (show_version)
    {
      g_print (PACKAGE_STRING "\n");
      return 0;
    }

  main_loop = g_main_loop_new (NULL, FALSE);

  if (mount_list)
    list_monitor_items ();
  else if (mount_device_file != NULL)
    {
      mount_with_device_file (mount_device_file);
    }
  else if (unmount_scheme != NULL)
    {
      unmount_all_with_scheme (unmount_scheme);
    }
  else if (mount_monitor)
    {
      monitor ();
    }
  else if (argc > 1)
    {
      int i;

      for (i = 1; i < argc; i++) {
        file = g_file_new_for_commandline_arg (argv[i]);
        if (mount_unmount)
          unmount (file);
        else if (mount_eject)
          eject (file);
        else
          mount (file);
        g_object_unref (file);
      }
    }

  if (outstanding_mounts > 0)
    g_main_loop_run (main_loop);

  return success ? 0 : 2;
}