Пример #1
0
int srm(s_dir *d, s_arg *a, char **argv)
{
	int c;
	while((d->rd = readdir(d->open)) != NULL)
	{
			if(d->rd->d_name[0] != '.')
			{
				stat(d->rd->d_name, d->info);
				ft_putstr(d->rd->d_name);
				ft_putchar('\n');
			}
	}
	closedir(d->open);	
//	d->open = opendir(argv[a->arc]);
	while((d->rd = readdir(d->open)) != NULL)
	{
			if(d->rd->d_name[0] != '.')
			{
				if(ft_is_dir(d->rd->d_name))
				{
					d->open = opendir(d->rd->d_name);
					srm(d, a, argv);
				}
			}
	}


	return (0);	
}
Пример #2
0
// メイン関数
int main(int argc, char* argv[])
{
	space::ProgramSystemMain sysmain;

	try{
		sysmain.initialize();
	    sysmain.mainloop();
		sysmain.finalize();
	}
	catch(char *msg){
		std::ofstream srm("gameerror.log",std::ios::out|std::ios::app);
		srm <<  msg << "::" << time(NULL) << std::endl;
	}

    return 0;
}
Пример #3
0
void
SrmDevice::cleanup(CommPortPtr dev)
{
    QString path, err;
    if (!dev2path(dev, path, err))
        assert(false);
    if (QMessageBox::question(0, "Powercontrol",
                              "Erase downloaded ride from device memory?",
                              "&Erase", "&Save Only", "", 1, 1) == 0) {
        SrmpcConn srm(path);
        if(!srm.d || (srmpc_clear_chunks(srm.d) < 0)) {
            QMessageBox::warning(0, "Error",
                                 "Error communicating with device.");
        }
    }
}
Пример #4
0
int	ft_dirread(s_dir *d, s_arg *a, char **argv) 
{
	int cd;

	d->open = opendir(argv[a->arc]);
	if (d->open == NULL)
		return (1);
	
	if(a->rm == 1)
		srm(d,a, argv);
	else
		sa(d,a);
	//cd = closedir(d->open);
	return (0);
	//	ft_putnbr(d->rd->d_type);// permet de connaitre le type de fichir, un fichier standard = 8 et un dossier = 4
	//	ft_putnbr(d->info->st_mode);
	//	ft_putnbr(d->info->st_mode);
	//	ft_putchar('\n');
}
Пример #5
0
bool
SrmDevice::download(CommPortPtr dev, const QDir &tmpdir,
                    QString &tmpname, QString &filename,
                    StatusCallback statusCallback, QString &err)
{
    // Totally ghetto, proof-of-concept integration with srmio.
    cb = statusCallback;
    QString path;
    if (!dev2path(dev, path, err))
        return false;
    if (!get_tmpname(tmpdir, tmpname, err))
        return false;
    SrmpcConn srm(path, logfunc);
    if (!srm.d) {
        err = "Couldn't open device " + path + ": " + strerror(errno);
        return false;
    }
    int opt_all = 0; // XXX: what does this do?
    int opt_fixup = 1; // fix bad data like srmwin.exe does
    SrmioData srmdata(srmpc_get_data(srm.d, opt_all, opt_fixup));
    if (!srmdata.d) {
        err = "srmpc_get_data failed";
        return false;
    }
    if (srm_data_write_srm7(srmdata.d, tmpname.toAscii().constData()) < 0) {
        err = "Couldn't write to file " + tmpname + ": " + strerror(errno);
        return false;
    }
    // Read it back in to get the ride start time.
    SrmFileReader reader;
    QStringList errs;
    QFile file(tmpname);
    QStringList errors;
    boost::scoped_ptr<RideFile> ride(
        RideFileFactory::instance().openRideFile(file, errors));
    BOOST_FOREACH(QString err, errors)
        fprintf(stderr, "error: %s\n", err.toAscii().constData());
    filename = ride->startTime().toString("yyyy_MM_dd_hh_mm_ss") + ".srm";
    return true;
}