Esempio n. 1
0
/********** Main **********/
int main(int argc, char **argv) {
	unsigned long to_allocate, allocated = 0, dot = 1024;

	switch (argc) {
	case 3:
		if (!strcmp(argv[1], "-w")) {
			++argv;
			/* FALL THROUGH */
	case 2:
			to_allocate = parse_arg(argv[1]);
			if (to_allocate) {
				break;
			}
		}
	default:
		usage();
		return 2;
	}

	handle_all(signal_handler);

	if (to_allocate < dot) {
		dot = 4;
	}

	progress(0, to_allocate);
	while (!signum &&
	       allocated < to_allocate &&
	       alloc(min(dot, to_allocate - allocated))) {
		allocated += min(dot, to_allocate - allocated);
		progress(allocated, to_allocate);
	}
	putchar('\n');

	handle_all(SIG_DFL);

	if (argc == 3) {
		char buffer[1024];
		while (fgets(buffer, sizeof buffer, stdin) && !strchr(buffer, '\n'))
			/* nop */;
	}

	return signum ? -signum : (allocated < to_allocate ? 1 : 0);
}
Esempio n. 2
0
void user_event_filter_t::add(user_event_meta_t&& evt)
{
	if(handle_all(user_event_meta_t(evt)))
	{
		return;
	}
	if(get_meta(evt.kind()) == m_list.end())
	{
		m_list.emplace(std::move(evt));
	}
}
Esempio n. 3
0
void user_event_filter_t::add(const user_event_meta_t& evt)
{
	if(handle_all(user_event_meta_t(evt)))
	{
		return;
	}
	if(get_meta(evt.kind()) == m_list.end())
	{
		m_list.insert(evt);
	}
}
Esempio n. 4
0
/** Handler for multiselect questions.
 *
 * @param fe cdebconf frontend
 * @param question handled question
 * @param question_box container for handler widgets
 * @return DC_NOTOK if something went wrong, DC_OK otherwise
 */
int cdebconf_gtk_handle_multiselect(struct frontend * fe,
                                    struct question * question,
                                    GtkWidget * question_box)
{
    return handle_all(fe, question, question_box, TRUE /* multiselect */);
}
Esempio n. 5
0
/** Handler for select questions.
 *
 * @param fe cdebconf frontend
 * @param question handled question
 * @param question_box container for handler widgets
 * @return DC_NOTOK if something went wrong, DC_OK otherwise
 */
int cdebconf_gtk_handle_select(struct frontend * fe,
                               struct question * question,
                               GtkWidget * question_box)
{
    return handle_all(fe, question, question_box, FALSE /* simple select */);
}