Exemple #1
0
main(int argc, char *argv[])
{
    openlog("ibod", LOG_PID, LOG_DAEMON);

    channels_last = -1;

    /* Setup initial attributes */
    if (setattr() == -1) {
        closelog();
        exit(1);
    }

    setinterval();

    /* Setup handlig of signal SIGHUP and SIGPIPE */
    signal(SIGHUP, reread);
    signal(SIGPIPE, pipehndl);

    do {
        setinterval();

	usleep(timeout.tv_usec);

        /* Gate state of interface */
        get_if_state();

    } while (1);
}
Exemple #2
0
void Colour::check()
//checks if colour in range 0 to 1 and changes if not
{
	setinterval(Red);
	setinterval(Green);
	setinterval(Blue);
}
void
StereoHarm::changepar (int npar, int value)
{

    switch (npar) {
    case 0:
        setvolume (value);
        break;
    case 1:
        setgain (0,value);
        break;
    case 2:
        setinterval(0,value);
        break;
    case 3:
        setchrome(0, value);
        break;
    case 4:
        setgain (1,value);
        break;
    case 5:
        setinterval(1,value);
        break;
    case 6:
        setchrome(1, value);
        break;
    case 7:
        PSELECT = value;;
        break;
    case 8:
        Pnote = value;
        break;
    case 9:
        Ptype = value;
        if (Ptype==0) {
            setchrome(0, Pchromel);
            setchrome(1, Pchromer);
        }
        break;
    case 10:
        setMIDI (value);
        break;
    case 11:
        setlrcross(value);
        break;


    }


};
Exemple #4
0
static void reread(int sig)
{
    (void) setattr();

    setinterval();

    signal(SIGHUP, reread);
}
LocationWatcher::LocationWatcher(QObject *parent)
    : QObject(parent)
{
   openDB();
   source = QGeoPositionInfoSource::createDefaultSource(this);
   setinterval(getSetting("time"));
   setgpsmode(getSetting("usegps"));
}
Exemple #6
0
int Renderer::command(int argc, const char*const* argv)
{
	if (argc == 3) {
		if (strcmp(argv[1], "update-interval") == 0) {
			setinterval(atoi(argv[2]));
			return (TCL_OK);
		}
		if (strcmp(argv[1], "color") == 0) {
			setcolor(atoi(argv[2]));
			return (TCL_OK);
		}else if (strcmp(argv[1], "enable_xv") == 0) {
#ifdef HAVE_XVIDEO
			enable_xv = !strcmp(argv[2], "true");
#endif
			return (TCL_OK);
		}	
	}
	return (Module::command(argc, argv));
}
Exemple #7
0
int
main(int argc, char *argv[])
{
	int ch, iflag, flags;
	struct passwd *pw;
	time_t interval;
	struct stat sb;
	ALIAS *cur;

	opterr = iflag = 0;
	interval = -1;
	while ((ch = getopt(argc, argv, "a:Iir:")) != -1)
		switch ((char)ch) {
		case 'a':			/* alias */
			if (!(cur = (ALIAS *)malloc((u_int)sizeof(ALIAS))))
				break;
			cur->name = optarg;
			cur->next = names;
			names = cur;
			break;
		case 'I':			/* backward compatible */
		case 'i':			/* init the database */
			iflag = 1;
			break;
		case 'r':
			if (isdigit((unsigned char)*optarg)) {
				interval = atol(optarg) * SECSPERDAY;
				if (interval < 0)
					usage();
			} else
				interval = 0;	/* one time only */
			break;
		default:
			usage();
		}
	argc -= optind;
	argv += optind;

	if (argc != 1) {
		if (!iflag)
			usage();
		if (!(pw = getpwuid(getuid()))) {
			syslog(LOG_ERR,
			    "no such user uid %u.", getuid());
			exit(1);
		}
	} else if (!(pw = getpwnam(*argv))) {
		syslog(LOG_ERR, "no such user %s.", *argv);
		exit(1);
	}
	if (chdir(pw->pw_dir)) {
		syslog(LOG_NOTICE,
		    "no such directory %s.", pw->pw_dir);
		exit(1);
	}

	/*
	 * dbopen(3) can not deal with a zero-length file w/o O_TRUNC.
	 */
	if (iflag == 1 || (stat(VDB, &sb) == 0 && sb.st_size == (off_t)0))
		flags = O_CREAT|O_RDWR|O_TRUNC;
	else
		flags = O_CREAT|O_RDWR;

	db = dbopen(VDB, flags, S_IRUSR|S_IWUSR, DB_HASH, NULL);
	if (!db) {
		syslog(LOG_NOTICE, "%s: %m", VDB);
		exit(1);
	}

	if (interval != -1)
		setinterval(interval);

	if (iflag) {
		(void)(db->close)(db);
		exit(0);
	}

	if (!(cur = malloc((u_int)sizeof(ALIAS))))
		exit(1);
	cur->name = pw->pw_name;
	cur->next = names;
	names = cur;

	readheaders();
	if (!recent()) {
		setreply();
		(void)(db->close)(db);
		sendmessage(pw->pw_name);
	} else
		(void)(db->close)(db);
	exit(0);
	/* NOTREACHED */
}