#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <locale.h>
#include <curses.h>

/************************************************************************/
/* NAME      :int inpmsg()*/ 
/* FUNCTION  :ユーザに入力を促すポップアップウインドウを表示する*/ 
/*            */ 
/*            */ 
/*            */ 
/* RETURN    :なし*/
/************************************************************************/

int main(int argc,char *argv[])
{
	WINDOW *mvs;
	char msg[80];
	char ename[80];
	char buff[257];
	char rbuff[257];

	if(argc == 3)
	{
		sprintf(msg,"%s",argv[1]);
		sprintf(ename,"%s",argv[2]);
	}
	else
	{
		exit(0);
	}
 	setlocale(LC_ALL,"");
	initscr();
	echo();

	mvs = newwin(5,64,LINES/2,4);
	wattroff(mvs,A_REVERSE);
	box(mvs,'|','-');
	mvwprintw(mvs,4,0,"+");
	mvwprintw(mvs,4,63,"+");
	mvwprintw(mvs,1,4,msg);
	wattron(mvs,A_REVERSE);
	mvwprintw(mvs,0,0,"-------------------CMS-INPUT--WINDOW----------------------------");

	mvwprintw(mvs,2,4,"                                                     ");
	wrefresh(mvs);

	mvwprintw(mvs,2,4,"                                                     ");
	echo();
	nocbreak();
	nl();

	mvwgetstr(mvs,2,4,buff);

	noecho();
	cbreak();
	/*
	nonl();
	*/


	wrefresh(mvs);

	wattroff(mvs,A_REVERSE);
	noecho();
	delwin(mvs);
	endwin();
	printf("%s=%s\n",ename,buff);
	sprintf(rbuff,"%s=%s",ename,buff);
	putenv(rbuff);
}
