Esempio n. 1
0
bool menu_start() {
	if (!menu_load()) {
		return false;
	}
	scene.unload = &menu_unload;
	scene.update = &menu_update;
	scene.draw = &menu_draw;
	scene.showLetterbox = true;
	
	selection = 0;
	animTempo = 0;
	
	return true;
}
Esempio n. 2
0
void start_client(void)
{
	extern char currmaildir[];

	initialize_mdb();
#ifndef ENABLE_SSH
	initialize_db();
#endif

	initialize_convert_env();
	system_init();

	if (setjmp(byebye)) {
		system_abort();
	}

	strlcpy(BoardName, BBSNAME, sizeof(BoardName));

	if (login_query() == -1) {
		terminal_flush();
		sleep(3);
		exit(1);
	}
#ifndef ENABLE_SSH
	screen_negotiate_size();
#endif // ENABLE_SSH
	screen_init(0);

	user_login();

	setmdir(currmaildir, currentuser.userid);
	RMSG = NA;
	screen_clear();
	editor_restore();
#ifdef TALK_LOG
	tlog_recover();
#endif

	if (strcmp(currentuser.userid, "guest")) {
		if (check_maxmail())
			pressanykey();
		screen_move(9, 0);
		screen_clrtobot();
		if (!DEFINE(DEF_NOLOGINSEND))
			if (session_visible())
				login_msg();
		screen_clear();
		set_numofsig();
	}

	active_board_init(false);
	fill_date();

	if (DEFINE(DEF_LOGFRIEND)
			&& session_count_online_followed(!HAS_PERM(PERM_SEECLOAK)) > 0)
		show_online_followings();

	menu_load("menu.img");
	while (1) {
		if (DEFINE(DEF_NORMALSCR))
			menu_loop("TOPMENU");
		else
			menu_loop("TOPMENU2");
		Goodbye();
	}
}
Esempio n. 3
0
void load_menu (void)
{
    char    menu_filename[1024], *language;

    // find out what language user wants
    if (options.english_menu || cmdline.english)
    {
        language = "english";
    }
    else
    {
        language = cfg_get_string (CONFIG_NFTP, fl_opt.platform_nick, "language");
        str_strip (language, " ");
    }

Rescan:

    // Try $user_libpath directory
    strcpy (menu_filename, paths.user_libpath);
    str_cats (menu_filename, language);
    strcat (menu_filename, ".mnu");
    if (access (menu_filename, R_OK) == 0) goto Found;

    // Try $user_libpath/nls directory
    strcpy (menu_filename, paths.user_libpath);
    str_cats (menu_filename, "nls");
    str_cats (menu_filename, language);
    strcat (menu_filename, ".mnu");
    if (access (menu_filename, R_OK) == 0) goto Found;

    // Try $system_libpath directory
    strcpy (menu_filename, paths.system_libpath);
    str_cats (menu_filename, language);
    strcat (menu_filename, ".mnu");
    if (access (menu_filename, R_OK) == 0) goto Found;

    // Try $system_libpath/nls directory
    strcpy (menu_filename, paths.system_libpath);
    str_cats (menu_filename, "nls");
    str_cats (menu_filename, language);
    strcat (menu_filename, ".mnu");
    if (access (menu_filename, R_OK) == 0) goto Found;

    // Try ../nls
    strcpy (menu_filename, "../nls");
    str_cats (menu_filename, language);
    strcat (menu_filename, ".mnu");
    if (access (menu_filename, R_OK) == 0) goto Found;

    if (strcmp (language, "english") != 0)
    {
        if (fl_opt.has_console && !fl_opt.initialized)
            fly_ask_ok (0, "Failed to load \"%s.mnu\", trying English.\n", language);
        language = "english";
        goto Rescan;
    }
    else
        fly_error ("Failed to load \"%s.mnu\".", language);

Found:

    if (main_menu != NULL)
    {
        menu_unload (main_menu);
    }

    if (fl_opt.has_console && !fl_opt.initialized)
        fly_ask_ok (0, "loading %s......\n", menu_filename);
    main_menu = menu_load (menu_filename, options.keytable,
                           sizeof(options.keytable)/sizeof(options.keytable[0]));
}
Esempio n. 4
0
/*{{{  main*/
int main(int argc, char *argv[])
{
  /*{{{  variables*/
  enum { NOTHING, LOCAL, REMOTE } in=NOTHING;
  int c;
  int x,y;
  int mouse_x,mouse_y;
  int image_width,image_height;
  int image_xoffset=0,image_yoffset=0;
  int my_width,my_height;
  int err=0,usage=0;
  BITMAP *bp;
  FILE *input;
  static struct menu_entry menu[] = { { "quit","q" } };
  char file[_POSIX_PATH_MAX];
  /*}}}  */

  /*{{{  parse arguments*/
  while ((c=getopt(argc,argv,"l:r:"))!=EOF)
  {
    switch (c)
    {
      /*{{{  l file*/
      case 'l':
      {
        if ((input=fopen(optarg,"r"))==(FILE*)0)
        {
          fprintf(stderr,"%s: Can't open %s\r\n",argv[0],optarg);
          err=1;
        }
        else in=LOCAL;
        break;
      }
      /*}}}  */
      /*{{{  r file*/
      case 'r':
      {
        char *cwd;

        in=REMOTE;
        if (*optarg!='/' && *optarg!='.')
        {
          if ((cwd=getcwd((char*)0,(size_t)0))!=(char*)0) { strcpy(file,cwd); strcat(file,"/"); strcat(file,optarg); }
          else { fprintf(stderr,"%s: Can't get current directory\r\n",argv[0]); err=1; }
        }
        else strcpy(file,optarg);
        break;
      }
      /*}}}  */
      /*{{{  default*/
      default:
      {
        usage=1;
        break;
      }
      /*}}}  */
    }
  }
  if (err) exit(err);
  if (usage || optind!=argc)
  {
    fprintf(stderr,"Usage: mgrview [-l file | -r file]\n");
    exit(1);
  }
  if (in==NOTHING) { in=LOCAL; input=stdin; }
  /*}}}  */
  /*{{{  setup*/
  ckmgrterm(argv[0]);
  m_setup(M_MODEOK);
  signal(SIGINT,clean);
  signal(SIGTERM,clean);
  signal(SIGPIPE,clean);
  m_ttyset();
  m_push(P_MENU|P_EVENT|P_FLAGS);
  m_setmode(M_ABS);
  m_setcursor(CS_INVIS);
  menu_load(1,1,menu);
  m_setevent(REDRAW, "R");
  m_setevent(RESHAPE, "R");
  m_setevent(BUTTON_1,"[%p]");
  m_setevent(BUTTON_2,"m");
  m_flush();
  /*}}}  */
  if (in==LOCAL)
  {
    /*{{{  load bitmap to client space*/
    if ((bp=bitmapread(input))==(BITMAP*)0)
    {
      fprintf(stderr,"%s: No MGR bitmap.\r\n",argv[0]);
      clean(1);
    }
    image_width=BIT_WIDE(bp);
    image_height=BIT_HIGH(bp);
    /*}}}  */
    /*{{{  transfer bitmap to server space*/
    m_func(BIT_SRC);
    m_bitcreate(IMAGE_BITMAP,image_width,image_height);
    m_bitldto(image_width,image_height,0,0,IMAGE_BITMAP,bit_size(image_width,image_height,BIT_DEPTH(bp)));
    fwrite(BIT_DATA(bp),bit_size(image_width,image_height,BIT_DEPTH(bp)),1,m_termout);
    m_flush();
    bit_destroy(bp);
    /*}}}  */
  }
  else if (in==REMOTE)
  {
    /*{{{  transfer bitmap from server fs to server space*/
    m_bitfromfile(IMAGE_BITMAP,file);
    m_get();
    if (sscanf(m_linebuf,"%d %d",&image_width,&image_height)<2)
    {
      fprintf(stderr,"%s: No MGR bitmap.\r\n",argv[0]);
      clean(1);
    }
    /*}}}  */
  }
  /*{{{  user interaction*/
  get_size((int*)0,(int*)0,&my_width,&my_height);
  display(image_xoffset,image_yoffset,my_width,my_height,image_width,image_height);
  m_flush();
  while ((c=getc(m_termin))!='q') switch (c)
  {
    /*{{{  m -- left button displays menu*/
    case 'm':
    {
      m_selectmenu(1);
      m_flush();
      break;
    }
    /*}}}  */
    /*{{{  [%d %d] -- right button*/
    case '[':
    {
      fscanf(m_termin,"%d %d]",&mouse_x,&mouse_y);
      /*{{{  compute new x start*/
      if (my_width>image_width) image_xoffset=0;
      else if (mouse_x<=0) image_xoffset=0;
      else if (mouse_x>=my_width) image_xoffset=my_width-image_width;
      else
      {
        /*{{{  move x start by difference from mouse and middle*/
        image_xoffset=image_xoffset-(mouse_x-my_width/2);
        /*}}}  */
        /*{{{  check and corrent range of x start*/
        if (image_xoffset<my_width-image_width) image_xoffset=my_width-image_width;
        else if (image_xoffset>0) image_xoffset=0;
        /*}}}  */
      }
      /*}}}  */
      /*{{{  compute new y start*/
      if (my_height>image_height) image_yoffset=0;
      else if (mouse_y<=0) image_yoffset=0;
      else if (mouse_y>=my_height) image_yoffset=my_height-image_height;
      else
      {
        /*{{{  move y start by difference from mouse and middle*/
        image_yoffset=image_yoffset-(mouse_y-my_height/2);
        /*}}}  */
        /*{{{  check and corrent range of y start*/
        if (image_yoffset<my_height-image_height) image_yoffset=my_height-image_height;
        else if (image_yoffset>0) image_yoffset=0;
        /*}}}  */
      }
      /*}}}  */
      display(image_xoffset,image_yoffset,my_width,my_height,image_width,image_height);
      m_flush();
      break;
    }
    /*}}}  */
    /*{{{  R -- redraw*/
    case 'R':
    {
      get_size((int*)0,(int*)0,&my_width,&my_height);
      /*{{{  compute new x offset*/
      if (my_width<image_width)
      {
        if (image_xoffset<my_width-image_width) image_xoffset=my_width-image_width;
      }
      else image_xoffset=0;
      /*}}}  */
      /*{{{  compute new y offset*/
      if (my_height<image_height)
      {
        if (image_yoffset<my_height-image_height) image_yoffset=my_height-image_height;
      }
      else image_yoffset=0;
      /*}}}  */
      m_func(BIT_CLR);
      m_bitwrite(0,0,my_width,my_height);
      m_func(BIT_SRC);
      m_bitcopyto(image_xoffset,image_yoffset,image_width,image_height,0,0,WINDOW_BITMAP,IMAGE_BITMAP);
      m_flush();
      break;
    }
    /*}}}  */
  }
  /*}}}  */
  /*{{{  exit*/
  m_bitdestroy(IMAGE_BITMAP);
  get_colrow(&x,&y);
  m_move(0,y-1);
  clean(0);
  /* NOTREACHED */
  return 255;
  /*}}}  */
}
Esempio n. 5
0
static void menu(void)
{   int failed = 0, readoption = 1, alwaysstop = 0, showhidden = 0;
    char prmptbuf[80];
    char *tmpstr, *option, *version_id;
    char *terms = " \n";

    strcpy( buffer, schemamenu_init );
    tmpstr = strtok( buffer, " " );
    tmpstr = strtok( NULL, " " );
    tmpstr = strtok( NULL, " " );
    version_id = heapstr( tmpstr );

    while( readoption )
    {  NewScreen();
       failed = 0;

       printf( "%s    Schema Mapping Environment. V%s\n",
               FORMAT_LINE, version_id);
       printf( "%s    ---------------------------------\n\n", FORMAT_LINE);

       printf( "%sl ......... load file [filename [language]]\n",
               FORMAT_LINE);
       printf( "%sb ......... browse\n", FORMAT_LINE);
       printf( "%sudtoum .... UDINST_UMINST mapper\n", FORMAT_LINE);
       printf( "%setov ...... ELLA_VHDL mapper\n", FORMAT_LINE);
       printf( "%setol ...... ELLA_LAYOUT mapper\n", FORMAT_LINE);
       printf( "%svtol ...... VHDL_LAYOUT mapper\n", FORMAT_LINE);
       printf( "%slp ........ LAYOUT_PRINT\n", FORMAT_LINE);
       printf( "%slw ........ LAYOUT_WRITE [filename]\n", FORMAT_LINE);
       printf( "%swpk ....... write packed dump [filename [language]]\n",
               FORMAT_LINE);
       printf( "%swup ....... write unpacked dump [filename [language]]\n",
               FORMAT_LINE);
       printf( "%sq ......... quit\n", FORMAT_LINE);
       if( showhidden )
       {
          printf( "%sids ....... print ids table\n", FORMAT_LINE);
          printf( "%spause ..... toggle the pause state\n", FORMAT_LINE);
          printf( "%shidden .... toggle the hidden state\n", FORMAT_LINE);
          printf( "%sdiag ...... print diagnostics [filename] \n",
                  FORMAT_LINE);

       }

       sprintf( prmptbuf, "\n%s> ", FORMAT_LINE);
       while(( tmpstr = prompt( prmptbuf, buffer )) == NULL ||
               *tmpstr == NULL ){};

       option = strtok( tmpstr, terms );     
       Capitalise( option);

       if( equal(option, "L") )
       {  theclosure = menu_load( strtok( NULL, terms ), strtok( NULL, terms ));
          if( ExternalclosureClosure( theclosure) == NULL ) failed = 1;
       }
       else if ( equal(option, "B") )
       {  failed = menu_browse();
       }
       else if ( equal(option, "WPK") )
       {  failed = menu_write( strtok( NULL, terms ),
                               strtok( NULL, terms ), 1 ); 
       }
       else if ( equal(option, "WUP") )
       {  failed = menu_write( strtok( NULL, terms ),
                               strtok( NULL, terms ), 0 ); 
       }
       else if (equal(option, "UDTOUM"))
       {  Transformer *udinst_uminst;

          imgtable = ELLA_InitTable();
          udinst_uminst=
          Make_udinst_uminst( MakeNullTransformer( objtable, imgtable));
          update_closure( Transform( ExternalclosureClosure( theclosure),
                                      udinst_uminst));
          objtable = imgtable;
       }
       else if (equal(option, "ETOV"))
       {  Transformer *ella_vif;

          imgtable = VIF_InitTable();
          ella_vif = make_ella_vif( MakeNullTransformer( objtable, imgtable));
          update_closure( Transform( ExternalclosureClosure( theclosure),
                                     ella_vif));
          objtable = imgtable;
       }
       else if (equal(option, "ETOL"))
       {  Transformer *ella_layout;

          imgtable = LAY_InitTable();
          ella_layout = 
                   make_ella_layout( MakeNullTransformer( objtable, imgtable));
          update_closure( Transform( ExternalclosureClosure( theclosure),
                                     ella_layout));
               objtable = imgtable;
       }
       else if (equal(option, "VTOL"))
       {  Transformer *vif_layout;

          imgtable = LAY_InitTable();
          vif_layout = 
                   make_vif_layout( MakeNullTransformer( objtable, imgtable));
          update_closure( Transform( ExternalclosureClosure( theclosure),
                                     vif_layout));
          objtable = imgtable;
       }
       else if (equal(option, "LP"))
       {  menu_layout( stdout );
          failed = 1; /* We have not really failed, but need to hold the screen
                      */
       }
       else if (equal(option, "LW"))
       {  failed = write_file( strtok( NULL, terms ));
       }
       else if (equal(option, "Q"))
       {  readoption = 0;
          alwaysstop = 0;
       }
       else if ( equal(option, "IDS") )
       {  print_idstable();
          failed = 1; /* We have not really failed, but need to hold the screen
                      */
       }
       else if ( equal(option, "HIDDEN") )
       {  showhidden = 1 - showhidden;
       }
       else if ( equal(option, "PAUSE") )
       {  alwaysstop = 1 - alwaysstop;
       }
       else if ( equal(option, "DIAG") )
       {  tmpstr = strtok( NULL, terms );
          if( tmpstr == NULL )
          {  assemdiagfile = stdout;
             alwaysstop = 1;
          }
          else
          {  assemdiagfile = fopen( tmpstr, "w" );
          }
       }
       else
       {  printf( "Option %s not recognised.\n", option );
          failed = 1;
       }

       if( failed || alwaysstop )
       {  prompt( "Press RETURN to continue > ", buffer );
       }
    }
}
Esempio n. 6
0
/*{{{  main*/
int main(int argc, char *argv[])
{
  /*{{{  variables*/
  enum { NOTHING, OTHER_FS, SAME_FS } in=NOTHING;
  int c;
  int mouse_x,mouse_y;
  int image_width,image_height;
  int image_xoffset=0,image_yoffset=0;
  int my_width,my_height;
  int image_depth,image_size;
  int err=0,usage=0;
  FILE *input=(FILE*)0;
  static struct menu_entry menu[] =
  {
    { "Normal","|n\n" },
    { "Reverse","|r\n" },
    { "-------", "" },
    { "Quit","|q\n" }
  };
  char file[_POSIX_PATH_MAX];
  char event[20];
  /*}}}  */

  /*{{{  parse arguments*/
  while ((c=getopt(argc,argv,"ro:s:"))!=EOF)
  {
    switch (c)
    {
      /*{{{  r*/
      case 'r': display_op=BIT_NOT(BIT_SRC); break;
      /*}}}  */
      /*{{{  o file*/
      case 'o':
      {
        if ((input=fopen(optarg,"r"))==(FILE*)0)
        {
          fprintf(stderr,"%s: Can't open %s\r\n",argv[0],optarg);
          err=1;
        }
        else in=OTHER_FS;
        break;
      }
      /*}}}  */
      /*{{{  s file*/
      case 's':
      {
        char *cwd;

        in=SAME_FS;
        if (*optarg!='/' && *optarg!='.')
        {
          if ((cwd=getcwd((char*)0,(size_t)0))!=(char*)0) { strcpy(file,cwd); strcat(file,"/"); strcat(file,optarg); }
          else { fprintf(stderr,"%s: Can't get current directory\r\n",argv[0]); err=1; }
        }
        else strcpy(file,optarg);
        break;
      }
      /*}}}  */
      /*{{{  default*/
      default:
      {
        usage=1;
        break;
      }
      /*}}}  */
    }
  }
  if (err) exit(err);
  if (usage || optind!=argc)
  {
    fprintf(stderr,"Usage: mgrview [-o file | -s file]\n");
    exit(1);
  }
  if (in==NOTHING) { in=OTHER_FS; input=stdin; }
  /*}}}  */
  /*{{{  setup*/
  ckmgrterm(argv[0]);
  m_setup(M_MODEOK);
  signal(SIGINT,clean);
  signal(SIGTERM,clean);
  signal(SIGPIPE,clean);
  m_ttyset();
  m_push(P_ALL);
  m_setmode(M_ABS);
  m_setcursor(CS_INVIS);
  menu_load(1,4,menu);
  m_setevent(REDRAW, "|R\n");
  m_setevent(RESHAPE, "|R\n");
  m_setevent(BUTTON_1,"|!%p!\n");
  m_setevent(BUTTON_2,"|m\n");
  m_flush();
  /*}}}  */
  if (in==OTHER_FS)
  {
    /*{{{  variables*/
    struct b_header bh;
    void *bp;
    /*}}}  */

    /*{{{  load bitmap to client space*/
    if (fread(&bh,sizeof(struct b_header),1,input)!=1)
    {
      fprintf(stderr,"%s: Can't read header of bitmap.\r\n",argv[0]);
      clean(1);
    }
    if (!B_ISHDR8(&bh))
    {
      fprintf(stderr,"%s: No MGR bitmap or old format.\r\n",argv[0]);
      clean(1);
    }
    B_GETHDR8(&bh,image_width,image_height,image_depth);
    image_size=B_SIZE8(image_width,image_height,image_depth);
    /*}}}  */
    /*{{{  transfer bitmap to server space*/
    m_func(BIT_SRC);
    m_bitcreate(IMAGE_BITMAP,image_width,image_height);
    m_bitldto(image_width,image_height,0,0,IMAGE_BITMAP,image_size);
    bp=malloc(image_size);
    fread(bp,image_size,1,input);
    fwrite(bp,image_size,1,m_termout);
    free(bp);
    /*}}}  */
  }
  else if (in==SAME_FS)
  /*{{{  transfer bitmap from server fs to server space*/
  {
  m_bitfromfile(IMAGE_BITMAP,file);
  m_get();
  if (sscanf(m_linebuf,"%d %d",&image_width,&image_height)<2)
  {
    fprintf(stderr,"%s: MGR server can't load MGR bitmap.\r\n",argv[0]);
    clean(1);
  }
  }
  /*}}}  */
  /*{{{  user interaction*/
  m_getwindowsize(&my_width,&my_height);
  display(image_xoffset,image_yoffset,my_width,my_height,image_width,image_height);
  m_flush();
  do
  {
    if (m_getevent(10000,&c,event,sizeof(event))==EV_EVENTSTR) switch (event[0])
    {
      /*{{{  n,r*/
      case 'n':
      case 'r':
      {
        display_op=(c=='n' ? BIT_SRC : BIT_NOT(BIT_SRC));
        m_func(display_op);
        m_bitcopyto(image_xoffset,image_yoffset,image_width,image_height,0,0,WINDOW_BITMAP,IMAGE_BITMAP);
        m_flush();
        break;
      }
      /*}}}  */
      /*{{{  m -- left button displays menu*/
      case 'm':
      {
        m_selectmenu(1);
        m_flush();
        break;
      }
      /*}}}  */
      /*{{{  !%d %d! -- right button*/
      case '!':
      {
        sscanf(event,"!%d %d!",&mouse_x,&mouse_y);
        /*{{{  compute new x start*/
        if (my_width>image_width) image_xoffset=0;
        else if (mouse_x<=0) image_xoffset=0;
        else if (mouse_x>=my_width) image_xoffset=my_width-image_width;
        else
        {
          /*{{{  move x start by difference from mouse and middle*/
          image_xoffset=image_xoffset-(mouse_x-my_width/2);
          /*}}}  */
          /*{{{  check and corrent range of x start*/
          if (image_xoffset<my_width-image_width) image_xoffset=my_width-image_width;
          else if (image_xoffset>0) image_xoffset=0;
          /*}}}  */
        }
        /*}}}  */
        /*{{{  compute new y start*/
        if (my_height>image_height) image_yoffset=0;
        else if (mouse_y<=0) image_yoffset=0;
        else if (mouse_y>=my_height) image_yoffset=my_height-image_height;
        else
        {
          /*{{{  move y start by difference from mouse and middle*/
          image_yoffset=image_yoffset-(mouse_y-my_height/2);
          /*}}}  */
          /*{{{  check and corrent range of y start*/
          if (image_yoffset<my_height-image_height) image_yoffset=my_height-image_height;
          else if (image_yoffset>0) image_yoffset=0;
          /*}}}  */
        }
        /*}}}  */
        display(image_xoffset,image_yoffset,my_width,my_height,image_width,image_height);
        m_flush();
        break;
      }
      /*}}}  */
      /*{{{  R -- redraw*/
      case 'R':
      {
        m_getwindowsize(&my_width,&my_height);
        /*{{{  compute new x offset*/
        if (my_width<image_width)
        {
          if (image_xoffset<my_width-image_width) image_xoffset=my_width-image_width;
        }
        else image_xoffset=0;
        /*}}}  */
        /*{{{  compute new y offset*/
        if (my_height<image_height)
        {
          if (image_yoffset<my_height-image_height) image_yoffset=my_height-image_height;
        }
        else image_yoffset=0;
        /*}}}  */
        m_func(BIT_CLR);
        m_bitwrite(0,0,my_width,my_height);
        m_func(display_op);
        m_bitcopyto(image_xoffset,image_yoffset,image_width,image_height,0,0,WINDOW_BITMAP,IMAGE_BITMAP);
        m_flush();
        break;
      }
      /*}}}  */
    }
  } while (event[0]!='q');
  /*}}}  */
  /*{{{  exit*/
  m_bitdestroy(IMAGE_BITMAP);
  clean(0);
  /*}}}  */
  return 255;
}
Esempio n. 7
0
int main(int argc, char *argv[])
   {
   register int i;
   int xpos = XPOS;
   int ypos = YPOS;
   int font = -1;
   int shape = 1;

   char *getenv();
   char *home = getenv("HOME");
   int clean(), update();

   /* make sure we have a valid environment to run in */

   ckmgrterm( *argv );

   if (home==NULL || *home=='\0') {
      fprintf(stderr,"%s: Can't find your home directory\n",argv[0]);
      exit(1);
      }

   if ((bounds = fopen(BOUNDS,"r")) == NULL) {
      fprintf(stderr,"%s: Can't find a bounds file\n",argv[0]);
      exit(2);
      }

   sprintf(line,"%s/%s",home,RC);
   
   if ((rc = fopen(line,"r")) == NULL) {
      fprintf(stderr,"%s: Can't find %s\n",argv[0],line);
      exit(3);
      }

   /* process arguments */

   for(i=1;i<argc;i++) {
      if (Isflag(argv[i],"-s"))
         shape = 0;
      else if (Isflag(argv[i],"-x"))
         xpos = atoi(argv[i]+2);
      else if (Isflag(argv[i],"-y"))
         ypos = atoi(argv[i]+2);
      else if (Isflag(argv[i],"-f"))
         font = atoi(argv[i]+2);
      else if (Isflag(argv[i],"-p"))
         poll  = Max(atoi(argv[i]+2),10);
      else
         usage(argv[0],argv[i]);
      }

   /* setup mgr stuff */

   m_setup(M_FLUSH);
   m_push(P_MENU|P_EVENT|P_FLAGS);
   m_setmode(M_NOWRAP);
   m_ttyset();

   signal(SIGTERM,clean);
   signal(SIGINT,clean);
   signal(SIGALRM,update);

   menu_load(1,MENU_COUNT,menu);
   m_selectmenu(1);

   old_msg_cnt = MSGS();
   get_msg(line,old_msg_cnt);
   if (shape) {
      m_setmode(M_ACTIVATE);
      m_size(strlen(line)+2,1);
      }
   m_printstr(line);
   m_setevent(REDRAW,"R\n");
   m_setevent(ACTIVATED,"A\n");
   m_clearmode(M_ACTIVATE);
   alarm(poll);

   while(1) {
      char buff[80];
      m_gets(buff);
      alarm(0);

      /* read msgs */

      old_msg_cnt = msg_cnt;
      msg_cnt = MSGS();
      if (msg_cnt > 0 && *buff == 'A') {
         m_push(P_POSITION|P_EVENT|P_FLAGS|P_FONT);
         if (font != -1)
            m_font(font);
         m_sizeall(xpos,ypos,80,24);
         m_printstr("\freading msgs...\r");
         m_ttyreset();
         system(MSGSCMD);
         m_gets(buff);
         m_ttyset();
         m_pop();
         }

      /* wait for window to deactivate */

      else if (*buff == 'A') {
         m_setevent(DEACTIVATED,RESUME);
         do {
            m_printstr("\f Your msgs system here        ");
            m_gets(buff);
            } while(!SCMP(buff,RESUME));
         m_clearevent(DEACTIVATED);
         }
      old_msg_cnt = msg_cnt;
      msg_cnt = MSGS();
      get_msg(line,msg_cnt);
      m_printstr(line);
      m_clearmode(M_ACTIVATE);
      alarm(poll);
      }
      return 0;
   }