Example #1
0
void VlcControl::start()
{
    setlog("start " + QString().sprintf("%08p", this));
    libvlc_media_player_play(vlcPlayer);
#ifndef TESTCALLBACKPAINT
    setPrintType(VIDEO);
#endif
    setCallbacks(this->width(), this->height());
    startCheckScreen();
}
Example #2
0
VlcControl::~VlcControl()
{
    setlog("VlcControl destructor " + QString().sprintf("%08p", this));
    stop();
    libvlc_media_player_release(vlcPlayer);
    if(vlcMedia)
    {
        libvlc_media_release(vlcMedia);
    }
}
Example #3
0
void VlcControl::setVideo(QString source)
{
    setlog("set media " + source);
    if(vlcMedia)
    {
        libvlc_media_release(vlcMedia);
    }
    vlcMedia = libvlc_media_new_location(vlcInstance, source.toAscii());
    libvlc_media_player_set_media (vlcPlayer, vlcMedia);
}
Example #4
0
void VlcControl::stop()
{
    setlog("stop " + QString().sprintf("%08p", this));
#ifndef TESTCALLBACKPAINT
    setPrintType(NOTHING);
#endif
    stopCheckScreen();
    libvlc_media_player_stop(vlcPlayer);
    cleanCallbacks();
#ifndef TESTCALLBACKPAINT
    update();
#endif
}
Example #5
0
VlcControl::VlcControl(): vlcMedia(0)
{
    setlog("VlcControl constructor " + QString().sprintf("%08p", this));
    if(!vlcInstance)
    {
        for(int i = 0; i < numberVlcArgs; i++ )
        {
            if(strcmp(vlcArgs[i], "--video-title-show") == 0)
            {
                vlcArgs[i] = "--no-video-title-show";
            }
        }
        vlcInstance = libvlc_new(numberVlcArgs, vlcArgs);
        setStaticCallbacks();
    }
    if(!vlcInstance)
    {
        setlog("ERROR Create vlc instance. May be needs libvlc.dll" + QString().sprintf("%08p", this));
        exit(0);
    }
    vlcPlayer = libvlc_media_player_new(vlcInstance);
}
void
nextstate(struct con *cp)
{
	if (match(cp->ibuf, "QUIT") && cp->state < 99) {
		snprintf(cp->obuf, cp->osize, "221 %s\r\n", hostname);
		cp->op = cp->obuf;
		cp->ol = strlen(cp->op);
		cp->w = t + cp->stutter;
		cp->laststate = cp->state;
		cp->state = 99;
		return;
	}

	if (match(cp->ibuf, "RSET") && cp->state > 2 && cp->state < 50) {
		snprintf(cp->obuf, cp->osize,
		    "250 Ok to start over.\r\n");
		cp->op = cp->obuf;
		cp->ol = strlen(cp->op);
		cp->w = t + cp->stutter;
		cp->laststate = cp->state;
		cp->state = 2;
		return;
	}
	switch (cp->state) {
	case 0:
		/* banner sent; wait for input */
		cp->ip = cp->ibuf;
		cp->il = sizeof(cp->ibuf) - 1;
		cp->laststate = cp->state;
		cp->state = 1;
		cp->r = t;
		break;
	case 1:
		/* received input: parse, and select next state */
		if (match(cp->ibuf, "HELO") ||
		    match(cp->ibuf, "EHLO")) {
			int nextstate = 2;
			cp->helo[0] = '\0';
			gethelo(cp->helo, sizeof cp->helo, cp->ibuf);
			if (cp->helo[0] == '\0') {
				nextstate = 0;
				snprintf(cp->obuf, cp->osize,
				    "501 helo requires domain name.\r\n");
			} else {
				snprintf(cp->obuf, cp->osize,
				    "250 Hello, spam sender. "
				    "Pleased to be wasting your time.\r\n");
			}
			cp->op = cp->obuf;
			cp->ol = strlen(cp->op);
			cp->laststate = cp->state;
			cp->state = nextstate;
			cp->w = t + cp->stutter;
			break;
		}
		goto mail;
	case 2:
		/* sent 250 Hello, wait for input */
		cp->ip = cp->ibuf;
		cp->il = sizeof(cp->ibuf) - 1;
		cp->laststate = cp->state;
		cp->state = 3;
		cp->r = t;
		break;
	case 3:
	mail:
		if (match(cp->ibuf, "MAIL")) {
			setlog(cp->mail, sizeof cp->mail, cp->ibuf);
			snprintf(cp->obuf, cp->osize,
			    "250 You are about to try to deliver spam. "
			    "Your time will be spent, for nothing.\r\n");
			cp->op = cp->obuf;
			cp->ol = strlen(cp->op);
			cp->laststate = cp->state;
			cp->state = 4;
			cp->w = t + cp->stutter;
			break;
		}
		goto rcpt;
	case 4:
		/* sent 250 Sender ok */
		cp->ip = cp->ibuf;
		cp->il = sizeof(cp->ibuf) - 1;
		cp->laststate = cp->state;
		cp->state = 5;
		cp->r = t;
		break;
	case 5:
	rcpt:
		if (match(cp->ibuf, "RCPT")) {
			setlog(cp->rcpt, sizeof(cp->rcpt), cp->ibuf);
			snprintf(cp->obuf, cp->osize,
			    "250 This is hurting you more than it is "
			    "hurting me.\r\n");
			cp->op = cp->obuf;
			cp->ol = strlen(cp->op);
			cp->laststate = cp->state;
			cp->state = 6;
			cp->w = t + cp->stutter;
			if (cp->mail[0] && cp->rcpt[0]) {
				if (verbose)
					syslog_r(LOG_INFO, &sdata,
					    "(%s) %s: %s -> %s",
					    cp->blacklists ? "BLACK" : "GREY",
					    cp->addr, cp->mail,
					    cp->rcpt);
				if (debug)
					fprintf(stderr, "(%s) %s: %s -> %s\n",
					    cp->blacklists ? "BLACK" : "GREY",
					    cp->addr, cp->mail, cp->rcpt);
				if (greylist && cp->blacklists == NULL) {
					/* send this info to the greylister */
					getcaddr(cp);
					fprintf(grey,
					    "CO:%s\nHE:%s\nIP:%s\nFR:%s\nTO:%s\n",
					    cp->caddr, cp->helo, cp->addr,
					    cp->mail, cp->rcpt);
					fflush(grey);
				}
			}
			break;
		}
		goto spam;
	case 6:
		/* sent 250 blah */
		cp->ip = cp->ibuf;
		cp->il = sizeof(cp->ibuf) - 1;
		cp->laststate = cp->state;
		cp->state = 5;
		cp->r = t;
		break;

	case 50:
	spam:
		if (match(cp->ibuf, "DATA")) {
			snprintf(cp->obuf, cp->osize,
			    "354 Enter spam, end with \".\" on a line by "
			    "itself\r\n");
			cp->state = 60;
			if (window && setsockopt(cp->fd, SOL_SOCKET, SO_RCVBUF,
			    &window, sizeof(window)) == -1) {
				syslog_r(LOG_DEBUG, &sdata,"setsockopt: %m");
				/* don't fail if this doesn't work. */
			}
			cp->ip = cp->ibuf;
			cp->il = sizeof(cp->ibuf) - 1;
			cp->op = cp->obuf;
			cp->ol = strlen(cp->op);
			cp->w = t + cp->stutter;
			if (greylist && cp->blacklists == NULL) {
				cp->laststate = cp->state;
				cp->state = 98;
				goto done;
			}
		} else {
			if (match(cp->ibuf, "NOOP"))
				snprintf(cp->obuf, cp->osize,
				    "250 2.0.0 OK I did nothing\r\n");
			else {
                        	snprintf(cp->obuf, cp->osize,
				    "500 5.5.1 Command unrecognized\r\n");
				cp->badcmd++;
				if (cp->badcmd > 20) {
					cp->laststate = cp->state;
					cp->state = 98;
					goto done;
				}
			}
			cp->state = cp->laststate;
			cp->ip = cp->ibuf;
			cp->il = sizeof(cp->ibuf) - 1;
			cp->op = cp->obuf;
			cp->ol = strlen(cp->op);
			cp->w = t + cp->stutter;
		}
		break;
	case 60:
		/* sent 354 blah */
		cp->ip = cp->ibuf;
		cp->il = sizeof(cp->ibuf) - 1;
		cp->laststate = cp->state;
		cp->state = 70;
		cp->r = t;
		break;
	case 70: {
		char *p, *q;

		for (p = q = cp->ibuf; q <= cp->ip; ++q)
			if (*q == '\n' || q == cp->ip) {
				*q = 0;
				if (q > p && q[-1] == '\r')
					q[-1] = 0;
				if (!strcmp(p, ".") ||
				    (cp->data_body && ++cp->data_lines >= 10)) {
					cp->laststate = cp->state;
					cp->state = 98;
					goto done;
				}
				if (!cp->data_body && !*p)
					cp->data_body = 1;
				if (verbose && cp->data_body && *p)
					syslog_r(LOG_DEBUG, &sdata, "%s: "
					    "Body: %s", cp->addr, p);
				else if (verbose && (match(p, "FROM:") ||
				    match(p, "TO:") || match(p, "SUBJECT:")))
					syslog_r(LOG_INFO, &sdata, "%s: %s",
					    cp->addr, p);
				p = ++q;
			}
		cp->ip = cp->ibuf;
		cp->il = sizeof(cp->ibuf) - 1;
		cp->r = t;
		break;
	}
	case 98:
	done:
		doreply(cp);
		cp->op = cp->obuf;
		cp->ol = strlen(cp->op);
		cp->w = t + cp->stutter;
		cp->laststate = cp->state;
		cp->state = 99;
		break;
	case 99:
		closecon(cp);
		break;
	default:
		errx(1, "illegal state %d", cp->state);
		break;
	}
}
Example #7
0
TMOGUIAdjust::TMOGUIAdjust(QWidget* parent, const char * name):
	QFrame(parent, name)
{
	iMode = 0;
	pValues = 0;
	bLog = true;
	bUpdate = false;

	setFrameStyle( QFrame::Panel | QFrame::Sunken );
	QGridLayout *pLayout = new QGridLayout(this, 8, 4);
	pLayout->setColStretch(0,0);
	pLayout->setColStretch(1,1);
	pLayout->setColStretch(2,0);
	pLayout->setColStretch(3,0);
	pLayout->addColSpacing(2,20);
	
	QSlider *pSlider = new QSlider(this, "HistoSlider");
	pSlider->setFixedSize(16,64);
	pSlider->setRange(-50, 50);
	pSlider->setValue(0);
	pSlider->setOrientation(Vertical);
	pSlider->setTickmarks(QSlider::Right);
	pSlider->setTickInterval(10);
	pLayout->addMultiCellWidget(pSlider, 0, 3, 0, 0);

	pHisto = new TMOGUIHisto(this, "Histogram");
	pLayout->addMultiCellWidget(pHisto, 0, 3, 1, 1, AlignBottom);

	pLayout->addRowSpacing(4, 2);

	pToneSlider = new TMOGUIToneSlider(this, "ToneSlider");
	pLayout->addWidget(pToneSlider, 5, 1);

	pRed = new QPushButton(this, "RedButton");
	pRed->setFlat(true);
	pRed->setFixedSize(16,16);
	pRed->setPixmap(*TMOResource::pResource->IconRed->pixmap());
	QToolTip::add(pRed, "Select Red Channel");
	pLayout->addWidget(pRed, 0, 2, AlignCenter);
	
	pGreen = new QPushButton(this, "GreenButton");
	pGreen->setFlat(true);
	pGreen->setFixedSize(16,16);
	pGreen->setPixmap(*TMOResource::pResource->IconGreen->pixmap());
	QToolTip::add(pGreen, "Select Green Channel");
	pLayout->addWidget(pGreen, 1, 2, AlignCenter);

	pBlue = new QPushButton(this, "BlueButton");
	pBlue->setFlat(true);
	pBlue->setFixedSize(16,16);
	pBlue->setPixmap(*TMOResource::pResource->IconBlue->pixmap());
	QToolTip::add(pBlue, "Select Blue Channel");
	pLayout->addWidget(pBlue, 2, 2, AlignCenter);

	pLum = new QPushButton(this, "LumButton");
	pLum->setFlat(true);
	pLum->setFixedSize(16,16);
	pLum->setPixmap(*TMOResource::pResource->IconLumDown->pixmap());	
	QToolTip::add(pLum, "Select Luminance");
	pLayout->addWidget(pLum, 3, 2, AlignCenter);
	
	pLinear = new QPushButton(this, "LinearButton");
	pLinear->setFlat(true);
	pLinear->setFixedSize(32,32);
	pLinear->setPixmap(*TMOResource::pResource->IconLin->pixmap());
	QToolTip::add(pLinear, "View In Linear Distribution");
	pLayout->addMultiCellWidget(pLinear, 0, 1, 3, 3, AlignCenter);

	pLog = new QPushButton(this, "LogarithmicButton");
	pLog->setFlat(true);
	pLog->setFixedSize(32,32);
	pLog->setPixmap(*TMOResource::pResource->IconLogDown->pixmap());
	QToolTip::add(pLog, "View In Logarithmic Distribution");
	pLayout->addMultiCellWidget(pLog, 2, 3, 3, 3, AlignCenter);
	
	pLayout->addRowSpacing(6, 2);

	QHBoxLayout* hbox = new QHBoxLayout();
	QLabel* pLabel = new QLabel(this, "BlackLabel");
	pLabel->setPixmap(*TMOResource::pResource->IconBlack->pixmap());
	pLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
	hbox->addWidget(pLabel);
	pBlack = new QLineEdit(this, "EditBlack");
	pBlack->setAlignment(Qt::AlignRight);
	pBlack->setFixedWidth(72);
	hbox->addWidget(pBlack);
	hbox->insertStretch(-1,1);
	pLabel = new QLabel(this, "GammaLabel");
	pLabel->setPixmap(*TMOResource::pResource->IconGamma->pixmap());
	pLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
	hbox->addWidget(pLabel);
	pGamma = new QLineEdit(this, "EditGamma");
	pGamma->setAlignment(Qt::AlignRight);
	pGamma->setFixedWidth(72);
	hbox->addWidget(pGamma);
	hbox->insertStretch(-1,1);
	pLabel = new QLabel(this, "WhiteLabel");
	pLabel->setPixmap(*TMOResource::pResource->IconWhite->pixmap());
	pLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
	hbox->addWidget(pLabel);
	pWhite = new QLineEdit(this, "EditWhite");
	pWhite->setAlignment(Qt::AlignRight);
	pWhite->setFixedWidth(72);
	hbox->addWidget(pWhite);
	pLayout->addLayout(hbox, 7, 1);


	connect (pSlider, SIGNAL(sliderMoved(int)), this, SLOT(scalechanged(int)));
	connect (pLinear, SIGNAL(clicked()), pHisto, SLOT(setlinear()));
	connect (pLog, SIGNAL(clicked()), pHisto, SLOT(setlog()));
	connect (pRed, SIGNAL(clicked()), pHisto, SLOT(setr()));
	connect (pGreen, SIGNAL(clicked()), pHisto, SLOT(setg()));
	connect (pBlue, SIGNAL(clicked()), pHisto, SLOT(setb()));
	connect (pLum, SIGNAL(clicked()), pHisto, SLOT(setl()));
	connect (pLinear, SIGNAL(clicked()), pToneSlider, SLOT(setlinear()));
	connect (pLog, SIGNAL(clicked()), pToneSlider, SLOT(setlog()));
	connect (pRed, SIGNAL(clicked()), pToneSlider, SLOT(setr()));
	connect (pGreen, SIGNAL(clicked()), pToneSlider, SLOT(setg()));
	connect (pBlue, SIGNAL(clicked()), pToneSlider, SLOT(setb()));
	connect (pLum, SIGNAL(clicked()), pToneSlider, SLOT(setl()));
	connect (pRed, SIGNAL(clicked()), this, SLOT(setr()));
	connect (pGreen, SIGNAL(clicked()), this, SLOT(setg()));
	connect (pBlue, SIGNAL(clicked()), this, SLOT(setb()));
	connect (pLum, SIGNAL(clicked()), this, SLOT(setl()));
	connect (pBlack, SIGNAL(textChanged(const QString &)), this, SLOT(setblack(const QString &)));
	connect (pWhite, SIGNAL(textChanged(const QString &)), this, SLOT(setwhite(const QString &)));
	connect (pGamma, SIGNAL(textChanged(const QString &)), this, SLOT(setgamma(const QString &)));
	connect (pBlack, SIGNAL(returnPressed()), this, SLOT(updateall()));
	connect (pWhite, SIGNAL(returnPressed()), this, SLOT(updateall()));
	connect (pGamma, SIGNAL(returnPressed()), this, SLOT(updateall()));
	connect (pLinear, SIGNAL(clicked()), this, SLOT(setlinear()));
	connect (pLog, SIGNAL(clicked()), this, SLOT(setlog()));
}
Example #8
0
void VlcControl::restart()
{
    setlog("restart " + QString().sprintf("%08p", this));
    stop();
    start();
}
Example #9
0
static void
exec_method(const restarter_inst_t *inst, int type, const char *method,
    struct method_context *mcp, uint8_t need_session)
{
	char *cmd;
	const char *errf;
	char **nenv;

	cmd = uu_msprintf("exec %s", method);

	if (inst->ri_utmpx_prefix[0] != '\0' && inst->ri_utmpx_prefix != NULL)
		(void) utmpx_mark_init(getpid(), inst->ri_utmpx_prefix);

	setlog(inst->ri_logstem);
	log_instance(inst, B_FALSE, "Executing %s method (\"%s\")",
	    method_names[type], method);

	if (need_session)
		(void) setpgrp();

	/* Set credentials. */
	errno = restarter_set_method_context(mcp, &errf);
	if (errno != 0) {
		(void) fputs("svc.startd could not set context for method: ",
		    stderr);

		if (errno == -1) {
			if (strcmp(errf, "core_set_process_path") == 0) {
				(void) fputs("Could not set corefile path.\n",
				    stderr);
			} else if (strcmp(errf, "setproject") == 0) {
				(void) fprintf(stderr, "%s: a resource control "
				    "assignment failed\n", errf);
			} else if (strcmp(errf, "pool_set_binding") == 0) {
				(void) fprintf(stderr, "%s: a system error "
				    "occurred\n", errf);
			} else {
#ifndef NDEBUG
				uu_warn("%s:%d: Bad function name \"%s\" for "
				    "error %d from "
				    "restarter_set_method_context().\n",
				    __FILE__, __LINE__, errf, errno);
#endif
				abort();
			}

			exit(1);
		}

		if (errf != NULL && strcmp(errf, "pool_set_binding") == 0) {
			switch (errno) {
			case ENOENT:
				(void) fprintf(stderr, "%s: the pool could not "
				    "be found\n", errf);
				break;

			case EBADF:
				(void) fprintf(stderr, "%s: the configuration "
				    "is invalid\n", errf);
				break;

			case EINVAL:
				(void) fprintf(stderr, "%s: pool name \"%s\" "
				    "is invalid\n", errf, mcp->resource_pool);
				break;

			default:
#ifndef NDEBUG
				uu_warn("%s:%d: Bad error %d for function %s "
				    "in restarter_set_method_context().\n",
				    __FILE__, __LINE__, errno, errf);
#endif
				abort();
			}

			exit(SMF_EXIT_ERR_CONFIG);
		}

		if (errf != NULL) {
			perror(errf);

			switch (errno) {
			case EINVAL:
			case EPERM:
			case ENOENT:
			case ENAMETOOLONG:
			case ERANGE:
			case ESRCH:
				exit(SMF_EXIT_ERR_CONFIG);
				/* NOTREACHED */

			default:
				exit(1);
			}
		}

		switch (errno) {
		case ENOMEM:
			(void) fputs("Out of memory.\n", stderr);
			exit(1);
			/* NOTREACHED */

		case ENOENT:
			(void) fputs("Missing passwd entry for user.\n",
			    stderr);
			exit(SMF_EXIT_ERR_CONFIG);
			/* NOTREACHED */

		default:
#ifndef NDEBUG
			uu_warn("%s:%d: Bad miscellaneous error %d from "
			    "restarter_set_method_context().\n", __FILE__,
			    __LINE__, errno);
#endif
			abort();
		}
	}

	nenv = set_smf_env(mcp->env, mcp->env_sz, NULL, inst, method);

	log_preexec();

	(void) execle(SBIN_SH, SBIN_SH, "-c", cmd, NULL, nenv);

	exit(10);
}
Example #10
0
procinit()
{
	register struct Labelblock *lp;
	struct Chain *cp;
	int i;
	extern struct memblock *curmemblock, *firstmemblock;
	extern char *mem_first, *mem_next, *mem_last, *mem0_last;
	extern void frexchain();

	curmemblock = firstmemblock;
	mem_next = mem_first;
	mem_last = mem0_last;
	iob_list = 0;
	for(i = 0; i < 9; i++)
		io_structs[i] = 0;

	parstate = OUTSIDE;
	headerdone = NO;
	blklevel = 1;
	saveall = NO;
	substars = NO;
	nwarn = 0;
	thislabel = NULL;
	needkwd = 0;

	++procno;
	proctype = TYUNKNOWN;
	procname = "MAIN_";
	procclass = CLUNKNOWN;
	nentry = 0;
	nallargs = nallchargs = 0;
	multitype = NO;
	retslot = NULL;
	for(i = 0; i < NTYPES0; i++) {
		frexpr(retslotx[i]);
		retslotx[i] = 0;
		}
	cxslot = -1;
	chslot = -1;
	chlgslot = -1;
	procleng = 0;
	blklevel = 1;
	lastargslot = 0;

	for(lp = labeltab ; lp < labtabend ; ++lp)
		lp->stateno = 0;

	hashclear();

/* Clear the list of newly generated identifiers from the previous
   function */

	frexchain(&new_vars);
	frexchain(&used_builtins);
	frchain(&io_blocks);
	frchain(&assigned_fmts);
	frchain(&allargs);

	nintnames = 0;
	highlabtab = labeltab;

	ctlstack = ctls - 1;
	for(i = TYADDR; i < TYVOID; i++) {
		for(cp = templist[i]; cp ; cp = cp->nextp)
			free( (charptr) (cp->datap) );
		frchain(templist + i);
		autonum[i] = 0;
		}
	holdtemps = NULL;
	dorange = 0;
	nregvar = 0;
	highregvar = 0;
	entries = NULL;
	rpllist = NULL;
	inioctl = NO;
	eqvstart += nequiv;
	nequiv = 0;
	dcomplex_seen = 0;

	for(i = 0 ; i<NTYPES0 ; ++i)
		rtvlabel[i] = 0;
	fudgelabel = 0;

	if(undeftype)
		setimpl(TYUNKNOWN, (ftnint) 0, 'a', 'z');
	else
	{
		setimpl(tyreal, (ftnint) 0, 'a', 'z');
		setimpl(tyint,  (ftnint) 0, 'i', 'n');
	}
	setimpl(-STGBSS, (ftnint) 0, 'a', 'z');	/* set class */
	setlog();
}
Example #11
0
int cafe_mainX(int ac,const char *av[],FILE *out,FILE *log)
{	const char *arg;
	int ai;
	int period;
	CStr(cwd,1024);
	const char *Root = 0;
	IStr(Rtop,1024);
	const char *tops[1024]; /**/
	const char *top;
	int topx,tx;
	int cacheonly = 0,wonly = 0;
	CStr(ls_optsb,128);
	CStr(args,64*1024);
	refQStr(ap,args); /**/
	const char *ax = &args[sizeof(args)-1];
	const char *pp;
	int fnot = 0;

	minit_icache();

	topx = 0;
	LOG = out;

	if( ac == 1 ){
		put_usage(LOG,av[0]);
		exit(0);
	}

	NOW = time(0);

	for( ai = 1; ai < ac; ai++ ){
		arg = av[ai];
		pp = ap;
		ap = catarg1(args,AVStr(ap),arg);
		if( ax <= ap ){
			break;
		}

		if( strncmp(arg,"-root=",6) == 0 ){
			Root = arg+6;
		}else
		if( strcmp(arg,"-not") == 0 ){
			fnot = ai+1;
		}else
		if( strcmp(arg,"-ign") == 0 ){
			++ai;
			ap = (char*)pp;
		}else
		if( strcmp(arg,"-log") == 0 || strcmp(arg,"-err") == 0 ){
			if( ++ai < ac ){
				LOG = setlog(av[ai]);
				ap = (char*)pp;
			}
		}else
		if( strcmp(arg,"-utime") == 0 ){
			F_UATIME = 1;
		}else
		if( strcmp(arg,"-atime") == 0 ){
			if( ++ai < ac ){
				ap = catarg1(args,AVStr(ap),av[ai]);
				period = get_period(av[ai]);
				if( period < 0 )
					A_FROM = NOW + period;
				else	A_TILL = NOW - period;
			}
		}else
		if( strcmp(arg,"-mtime") == 0 ){
			if( ++ai < ac ){
				ap = catarg1(args,AVStr(ap),av[ai]);
				period = get_period(av[ai]);
				if( period < 0 )
					M_FROM = NOW + period;
				else	M_TILL = NOW - period;
			}
		}else
		if( strcmp(arg,"-asize") == 0 ){
			if( ++ai < ac ){
				ap = catarg1(args,AVStr(ap),av[ai]);
				REM_SIZE = atoi(av[ai]);
			}
		}else
		if( strcmp(arg,"-name") == 0 ){
			if( ++ai < ac ){
				F_NAME_NOT = (fnot == ai-1);
				F_NAME = av[ai];
			}
		}else
		if( strcmp(arg,"-type") == 0 ){
			if( ++ai < ac ){
				F_TYPE = av[ai];
			}
		}else
		if( strncmp(arg,"-ls",3) == 0 ){
			F_LSFORM = 1;
			if( arg[3] == 0 )
				strcpy(ls_optsb,"dl");
			else	sprintf(ls_optsb,"d%s",&arg[3]);
			ls_opts = ls_optsb;
		}else
		if( strncmp(arg,"-du",3) == 0 ){
			F_DU = 1;
			if( strchr(&arg[3],'s') == 0 )
				F_DIR = 1;
			if( strchr(&arg[3],'a') != 0 )
				F_PRINT = 1;
		}else
		if( strcmp(arg,"-s") == 0 ){
			F_DIR = 0;
		}else
		if( strncmp(arg,"-ic",3) == 0
		 || strncmp(arg,"-iw",3) == 0
		 || strncmp(arg,"-ir",3) == 0
		){
			if( arg[3] )
				icachedir = &arg[3];
			else	icachedir = "/tmp/cafe";
			if( strncmp(arg,"-ir",3) == 0 )
				cacheonly = 1;
			if( strncmp(arg,"-iw",3) == 0 )
				wonly = 1;
		}else
		if( strncmp(arg,"-mv",3) == 0 ){
			F_MOVE = 1;
		}else
		if( strcmp(arg,"-h") == 0 ){ F_FOLLOW_SYMLINK = 1; }else
		if( strcmp(arg,"-m") == 0 ){ F_FOLLOW_MOUNT = 1; }else
		if( strcmp(arg,"-v") == 0 ){ F_VERBOSE = 1; }else
		if( strcmp(arg,"-a") == 0 ){ /* ignore */ }else
		if( strncmp(arg,"-p",2) == 0 ){ F_PRINT = 1; }else
		if( strcmp(arg,"-sum") == 0 ){ F_SUMMARY = 1; }else
		if( strcmp(arg,"-rm") == 0 ){ F_REMOVE = 1; }else
		if( arg[0] == '-' ){
			if( atoi(&arg[1]) )
				N_LIST = atoi(&arg[1]);
		}else{
			if( elnumof(tops)-2 <= topx ){
				continue;
			}
			tops[topx++] = arg;
			tops[topx] = 0;
			ap = (char*)pp;
		}
	}
	XsetVStrEnd(AVStr(ap),0);

	if( topx == 0 ){
		tops[topx++] = ".";
		tops[topx] = 0;
	}

	if( !F_PRINT && !F_LSFORM && !F_DU && !F_SUMMARY ){
		F_DU = 1;
	}

	if( icachedir != NULL && !fileIsdir(icachedir) ){
		if( mkdir(icachedir,0755) != 0 ){
			errlog("%s: can't make inode cache directory: %s\n",
				av[0],icachedir);
			exit(1);
		}
	}

	IGNRETS getcwd(cwd,sizeof(cwd));
	CWD = cwd;

	for( tx = 0; tx < topx; tx++ ){
		top = tops[tx];
		if( Root ){
			IStr(tmp,1024);
			strcpy(tmp,"");
			chdir_cwd(AVStr(tmp),top,0);
			strcpy(Rtop,Root);
			if( *tmp == '/' )
				ovstrcpy(tmp,tmp+1);
			if( *tmp ){
				if( strtailchr(Rtop) != '/' )
					strcat(Rtop,"/");
				strcat(Rtop,tmp);
			}
			top = Rtop;
		}

		if( LOG != stdout )
		if( LOG != out )
		errlog("%s %s\n",top,args);

		if( !icachedir || !cacheonly )
			find0(LOG,Root,top);
			/*
			find0(LOG,top);
			*/

		if( icachedir != NULL )
		if( !wonly )
			find_icache(LOG,top,N_LIST);

		if( F_SUMMARY )
			summary(LOG,top);
	}

	if( LOG != out )
	fclose(LOG);
	return 0;
}