예제 #1
0
파일: mouse.c 프로젝트: badwtg1111/cscope
static void
loadmenu(MENU *menu)
{
	int	i;

	if (emacsviterm == YES) {
		mousereinit();
		(void) printf("\033V1");	/* display the scrollbar */
		(void) printf("\033M0@%s@%s@", menu[0].text, menu[0].value);
		for (i = 1; menu[i].text != NULL; ++i) {
			(void) printf("\033M@%s@%s@", menu[i].text, menu[i].value);
		}
	}
	else {	/* myx */
		int	len;
		
		mousecleanup();
		(void) printf("\033[6;1X\033[9;1X");
		for (i = 0; menu[i].text != NULL; ++i) {
			len = strlen(menu[i].text);
			(void) printf("\033[%d;%dx%s%s", len,
				      (int) (len + strlen(menu[i].value)), 
				      menu[i].text, menu[i].value);
		}
		loaded = menu;
	}
	(void) fflush(stdout);
}
예제 #2
0
/*VARARGS1*/
int
execute(char *a, ...)	/* note: "exec" is already defined on u370 */
{
	va_list	ap;
	int	exitcode = -1;	/* initialize, to avoid warning */
	char	*argv[BUFSIZ];
	pid_t	p;

	/* fork and exec the program or shell script */
	endwin();	/* restore the terminal modes */
	mousecleanup();
	fflush(stdout);
	va_start(ap, a);
	for (p = 0; (argv[p] = va_arg(ap, char *)) != 0; p++)
		;
#if !HAVE_FORK
	/* HBB 20010313: in MSDOG, everything is completely different.
	 * No fork()/exec()/wait(), but rather a single libc call: */
        exitcode = spawnvp(P_WAIT, a, argv);
#else
	if ((p = myfork()) == 0) {
		myexecvp(a, argv);	/* child */
	}
	else {
		exitcode = join(p);	/* parent */
	}
#endif /* MSDOS */
	
	/* the menu and scrollbar may be changed by the command executed */
#if UNIXPC || !TERMINFO
# ifndef __DJGPP__ /* leave CRLF handling as is */      
	nonl();
# endif
	raw();	/* endwin() turns off cbreak mode so restore it */
	noecho();
#endif
	mousemenu();
	drawscrollbar(topline, nextline);
	va_end(ap);
	return(exitcode);
}