Пример #1
0
/* ********************************
 * ***** DISPLAY BUTTON PANEL *****
 * ********************************
 */
void display_panel()
{
    struct elyapp shutdown;
    struct elyapp reboot;
    struct elyapp refresh;
    setup_app_settings(&shutdown, PANEL_SHUT_CONFIG, PANEL_SHUT_STYLE, "Shutdown");
    setup_app_settings(&reboot,   PANEL_REB_CONFIG,  PANEL_REB_STYLE,  "Reboot");
    setup_app_settings(&refresh,  PANEL_REF_CONFIG,  PANEL_REF_STYLE,  "Refresh");
    display_item(&shutdown, system_shutdown);
    display_item(&reboot,   system_reboot);
    display_item(&refresh,  display_dialog);
}
Пример #2
0
int	main(int argc, char *argv[]) {
	int		c;
	scep_t		scep;	/* mainly used to hold configuration	*/
	char		*notbefore = NULL, *notafter = NULL;
	char		workdir[1024];
	int		items = 0;
	scepitem_t	**itemlist = NULL;
	scepitem_t	**ip;
	DIR		*dir;
	struct dirent	*d;

	/* parse command line						*/
	while (EOF != (c = getopt(argc, argv, "abcdghnprstvx")))
		switch (c) {
		case 'a':
			sortorder = SORT_NOTAFTER;
			compare = cmp_string;
			break;
		case 'b':
			sortorder = SORT_NOTBEFORE;
			compare = cmp_string;
			break;
		case 'c':
			ctimeformat = 1;
			break;
		case 'd':
			debug++;
			break;
		case 'g':
			itemselect = SELECT_GRANTED;
			break;
		case 'h':
			html = 1;
			break;
		case 'n':
			sortorder = SORT_NAME;
			compare = cmp_string;
			break;
		case 'p':
			itemselect = SELECT_PENDING;
			break;
		case 'r':
			itemselect = SELECT_REJECTED;
			break;
		case 's':
			sortorder = SORT_SERIAL;
			compare = cmp_asn1_integer;
			break;
		case 't':
			sortorder = SORT_TRANSID;
			compare = cmp_string;
			break;
		case 'v':
			itemselect = SELECT_REVOKED;
			break;
		case 'x':
			reverse *= -1;
			break;
		}

	/* remaining arguments are range types				*/
	if (argc > optind) {
		notbefore = argv[optind++];
	}
	if (argc > optind) {
		notafter = argv[optind];
	}

	/* perform OpenSCEP initialization				*/
	scepinit();
	scep_config(&scep, OPENSCEPDIR "/openscep.cnf");

	/* select the working directory based on the command line args	*/
	snprintf(workdir, sizeof(workdir), OPENSCEPDIR "/%s",
		selectname[itemselect]);
	

	/* retrieve all matching items from that directory, put them 	*/
	/* in an array of pointers					*/
	snprintf(workdir, sizeof(workdir), "%s/%s", OPENSCEPDIR,
		selectname[itemselect]);
	if (NULL == (dir = opendir(workdir))) {
		fprintf(stderr, "%s:%d: cannot open directory %s: %s (%d)\n",
			__FILE__, __LINE__, workdir, strerror(errno), errno);
		exit(EXIT_FAILURE);
	}
	while ((d = readdir(dir))) {
		/* look for der files only				*/
		if (0 == strcmp(d->d_name + 32, ".der")) {
			items++;
			itemlist = (scepitem_t **)realloc(itemlist,
				sizeof(scepitem_t *) * (items + 1));
			itemlist[items - 1] = readitem(d->d_name);
			itemlist[items] = NULL;
		}
	}

	/* perform a sort						*/
	if (debug) {
		BIO_printf(bio_err, "%s:%d: sorting %d items in array at %p\n",
			__FILE__, __LINE__, items, itemlist);
	}
	qsort(itemlist, items, sizeof(scepitem_t *),
		(int (*)(const void *, const void *))compare);

	/* display the result						*/
	if (itemlist)
		for (ip = itemlist; *ip; ip++) {
			/* display this item				*/
			display_item(*ip);
		}

	/* that's it							*/
	exit(EXIT_SUCCESS);
}