Ejemplo n.º 1
0
static int
display_menu(void)
{
	int	ret=0;
	int	maxx,maxy;
	int	curr;

	do_init_dialog();
	getmaxyx(stdscr, maxy, maxx);
	dialog_vars.help_button=1;
	dialog_vars.item_help=1;
loop:
	switch(ret=dlg_checklist("Welcome to pkg_cleanup.", "These are the leaf packages installed on your system\nChose the packages to deinstall. Help will display the package description.", maxy-1, maxx, maxy-9, menulen, menu, " X", FLAG_CHECK, &curr)) {
		case DLG_EXIT_HELP: {
			char *p = read_desc(menu[curr].ITEM_PROMPT);
			if(p) {
				dialog_vars.help_button=0;
				dialog_msgbox(menu[curr].ITEM_DATA, p, maxy-4, maxx-4, TRUE);
				dialog_vars.help_button=1;
				free(p);
			}
			goto loop;
		}
		case 0:
			ret=0;
			break;
		default:
			ret=-1;
			break;
	}
	dialog_vars.help_button=0;
	dialog_vars.item_help=0;
	end_dialog();
	return(ret);
}
Ejemplo n.º 2
0
int main()
{
	/* Descripción textual del L-system */
	char lsystem_desc[MAX_DESC+1] = {"F(2)[-F[-F]F]/(137.5)F(1.5)[-F]F"};
	
	/* Punto inicial */
	double P[DIM] = {0.0, 0.0, 0.0};
	
	read_desc(lsystem_desc, P);
	
	return 0;
}
Ejemplo n.º 3
0
int
main(int argc, char **argv) {
	size_t l = 0;
	u_char *buf = NULL;

	if(argv[1] && !strcmp(argv[1], "-h")) {
		fmt_eprint("cat | hexify [+] ; # convert binary stdin to ASCII hex stdout\n");
		exit(1);
	}

	if((buf = read_desc(fileno(stdin), &l))) { 
		if(argv[1] && argv[1][0] == '+') {
			int i = 0;
			char *s = shexify(buf, l);
			int l = strlen(s);

			while(i < l) {
				fputc(s[i++], stdout);
				fputc(s[i++], stdout);
				fputc(' ', stdout);
				if(!(i % 16)) {
					fputc(' ', stdout);			
					fputc(' ', stdout);			
					fputc(' ', stdout);			
				}

				if(!(i % 32)) {
					fputc('\\', stdout);
					fputc('\n', stdout);
				}
			}

			fputc('\n', stdout);
		} else 
			fputs(shexify(buf, l), stdout);
	}

	exit(0);
}