Exemple #1
0
static int letter2()
{
    /* Prepare path */
    sprintf(mail600, "/tmp/#%dmail600", pid);
    if(lcreat(mail600) < 0) {
	if(write(1, "Can't write 601 letter\n", 23) == -1) {
	    exit(1);
	}
	
	return 0;
    }

    lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
    standout();
    lprcat("From:");
    standend();
    lprcat("  His Majesty King Wilfred of Larndom\n");
    standout();
    lprcat("\nSubject:");
    standend();
    lprcat("  A Noble Deed\n");
    lprcat("\n  I have heard of your magnificent feat, and I, King Wilfred,");
    lprcat("\nforthwith declare today to be a national holiday.  Furthermore,");
    lprcat("\nhence three days, Ye be invited to the castle to receive the");
    lprcat("\nhonour of Kinght of the Realm.  Upon thy name shall it be written...");
    lprcat("\nBravery and courage be yours.");
    lprcat("\nMay you live in happiness forever...\n");
    lwclose();

    return 1;
}
Exemple #2
0
static int letter3()
{
    /* Prepare path */
    sprintf(mail600, "/tmp#%dmail600", pid);
    if(lcreat(mail600) < 0) {
	if(write(1, "Can't write 602 letter\n", 23) == -1) {
	    exit(1);
	}

	return 0;
    }

    lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
    standout();
    lprcat("From:");
    standend();
    lprcat("  Count Endelford\n");
    standout();
    lprcat("\nSubject:");
    standend();
    lprcat("  You Bastard!\n");
    lprcat("\n  I heard (from sources) of your journey.  Congratulations!");
    lprcat("\nYou bastard!  With several attempts I have yet to endure the");
    lprcat(" caves,\nand you, a nobody, makes the journey!  From this time");
    lprcat(" onward, be warned\nupon our meeting you shall pay the price!\n");
    lwclose();

    return 1;
}
Exemple #3
0
static int letter5()
{
    /* Prepare path */
    sprintf(mail600, "/tmp/#%dmaill600", pid);
    if(lcreat(mail600) < 0) {
	if(write(1, "Can't write 604 letter\n", 23) == -1) {
	    exit(1);
	}

	return 0;
    }

    lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
    standout();
    lprcat("From:");
    standend();
    lprcat("  St. Mary's Children's Home\n");
    standout();
    lprcat("\nSubject:");
    standend();
    lprcat("  These Poor Children\n");
    lprcat("\n  News of your great conquests has spread to all of Larndom.");
    lprcat("\nMight I have a moment of a great man's time.  We here at St.");
    lprcat("\nMary's Children's Home are very poor, and many children are");
    lprcat("\nstarving.  Disease is widespread and very often fatal without");
    lprcat("\ngood food.  Could you possibly find it in your heart to help us");
    lprcat("\nin out plight?  Whatever you could give will help much.");
    lprcat("\n(your gift is tax deductible)\n");
    lwclose();

    return 1;
}
Exemple #4
0
static int letter6()
{
    /* Prepare path */
    sprintf(mail600, "/tmp#%dmail600", pid);
    if(lcreat(mail600) < 0) {
	if(write(1, "Can't write 605 letter\n", 23) == -1) {
	    exit(1);
	}

	return 0;
    }

    lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
    standout();
    lprcat("From:");
    standend();
    lprcat("  The National Cancer Society of Larn\n");
    standout();
    lprcat("\nSubject:");
    standend();
    lprcat("  Hope\n");
    lprcat("\n  Congratulations on your successful expedition.  We are sure much");
    lprcat("\ncourage and dtermination were needed on your quest.  There are");
    lprcat("\nmany though, that could never hope to undertake such a journey");
    lprcat("\ndue to an enfeebling disease -- cancer.  We at the National");
    lprcat("\nCancer Soceity of Larn wish to appeal to your philanthropy in");
    lprcat("\norder to save many good people -- possibly even yourself in a few");
    lprcat("\nyears from now.  Much work needs to be done in researching this");
    lprcat("\ndreaded disease, and you can help today.  Could you please see it");
    lprcat("\nin your heart to give generously?  Your continued good health");
    lprcat("\ncan be in your everlasting reward.\n");
    lwclose();

    return 1;
}
Exemple #5
0
static int letter4()
{
    /* Prepare path */
    sprintf(mail600, "/tmp/$%dmail600", pid);
    if(lcreat(mail600) < 0) {
	if(write(1, "Can't write 603 letter\n", 23) == -1) {
	    exit(1);
	}

	return 0;
    }

    lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
    standout();
    lprcat("From:");
    standend();
    lprcat("  Mainair, Duke of Larnty\n");
    standout();
    lprcat("\nSubject:");
    standend();
    lprcat("  High Praise\n");
    lprcat("\n  With a certainty a hero I declare to be amongst us!  A nod of");
    lprcat("\nfavour I send to thee.  Me thinks Count Endelford this day of");
    lprcat("\nright breath'eth fire as a dragon of whom ye are slayer.  I");
    lprcat("\nyearn to behold his anger and jealously.  Should ye choose to");
    lprcat("\nunleash some of they wealth upon those whoe be unfortunate, I,");
    lprcat("\nDuke Mainair, Shall equal thy gift also.\n");
    lwclose();

    return 1;
}
static int
dialog_switch_pos (dialog_t diag, dialog_pos_t new_pos)
{
  if (new_pos != diag->pos)
    {
      switch (diag->pos)
	{
	case DIALOG_POS_OK:
	  move (diag->ok_y, diag->ok_x);
	  addstr (diag->ok);
	  break;
	case DIALOG_POS_CANCEL:
          if (diag->cancel)
            {
              move (diag->cancel_y, diag->cancel_x);
              addstr (diag->cancel);
            }
	  break;
	default:
	  break;
	}
      diag->pos = new_pos;
      switch (diag->pos)
	{
	case DIALOG_POS_PIN:
	  move (diag->pin_y, diag->pin_x + diag->pin_loc);
	  set_cursor_state (1);
	  break;
	case DIALOG_POS_OK:
	  set_cursor_state (0);
	  move (diag->ok_y, diag->ok_x);
	  standout ();
	  addstr (diag->ok);
	  standend ();
	  move (diag->ok_y, diag->ok_x);
	  break;
	case DIALOG_POS_CANCEL:
          if (diag->cancel)
            {
              set_cursor_state (0);
              move (diag->cancel_y, diag->cancel_x);
              standout ();
              addstr (diag->cancel);
              standend ();
              move (diag->cancel_y, diag->cancel_x);
            }
	  break;
	case DIALOG_POS_NONE:
	  set_cursor_state (0);
	  break;
	}
      refresh ();
    }
  return 0;
}
Exemple #7
0
dndstore()
  {
  register int i;
  dnditm = 0;
  nosignal = 1; /* disable signals */
  clear();  dnd_2hed();
  if (outstanding_taxes>0)
	{
	lprcat("\n\nThe Larn Revenue Service has ordered us to not do business with tax evaders.\n"); beep();
	lprintf("They have also told us that you owe %d gp in back taxes, and as we must\n",(long)outstanding_taxes);
	lprcat("comply with the law, we cannot serve you at this time.  Soo Sorry.\n");
	cursors();	
	lprcat("\nPress "); standout("escape"); lprcat(" to leave: "); lflush();
	i=0;
	while (i!='\33') i=getchar();
	drawscreen();  nosignal = 0; /* enable signals */ return;
	}

  dnd_hed();
  while (1)
	{
	cursor(59,18); lprintf("%d gold pieces",(long)c[GOLD]);
	cltoeoln(); cl_dn(1,20);	/* erase to eod */
	lprcat("\nEnter your transaction ["); standout("space");
	lprcat(" for more, "); standout("escape");
	lprcat(" to leave]? ");
	i=0;
	while ((i<'a' || i>'z') && (i!=' ') && (i!='\33') && (i!=12))  i=getchar();
	if (i==12) { clear();  dnd_2hed();  dnd_hed(); }
	else if (i=='\33')
		{ drawscreen();  nosignal = 0; /* enable signals */ return; }
	else if (i==' ')
		{
		cl_dn(1,4);
		if ((dnditm += 26) >= maxitm) dnditm=0; dnd_hed();
		}
	else
		{  /* buy something */
		lprc(i);	/* echo the byte */
		i += dnditm - 'a';
		if (i>=maxitm) outofstock(); else
		if (itm[i].qty <= 0) outofstock(); else
		if (pocketfull()) handsfull(); else
		if (c[GOLD] < itm[i].price*10) nogold(); else
			{
			if (itm[i].mem != 0) *itm[i].mem[itm[i].arg] = ' ';
			c[GOLD] -= itm[i].price*10;
			itm[i].qty--;  take(itm[i].obj,itm[i].arg);
			if (itm[i].qty==0) dnditem(i);  nap(1001);
			}
		}

	}
  }
Exemple #8
0
int curs_hilite(int mode)
{
    if(mode)
        standout();
    else
        standend();
}
Exemple #9
0
/*
 * Update the number-of-files-tagged display in the given viewport header
 */
static void
show_what(VIEW * vp)
{
    RING *gbl = vp->gbl;
    char buffer[80];
    static char datechr[] = "acm";
    int y, x;

    move((int) vp->base_row, 0);
    if (gbl->tag_count)
	(void) standout();

    buffer[0] = EOS;
    if (gbl->tag_opt) {
	sprintf(buffer, "(%d files, %ld %s) ",
		gbl->tag_count,
		(long) ((gbl->tag_opt > 1) ? gbl->tag_bytes : gbl->tag_blocks),
		(gbl->tag_opt > 1) ? "bytes" : "blocks");
    }
    sprintf(buffer + strlen(buffer), "%u of %u [%ctime]",
	    gbl->curfile + 1,
	    gbl->numfiles,
	    datechr[gbl->dateopt]);
    showpath(gbl->new_wd, 999, -1, (int) strlen(buffer) + 3);
    getyx(stdscr, y, x);
    (void) y;
    x = COLS - (int) strlen(buffer) - x;
    while (x-- > 0)
	addch(' ');

    addstr(buffer);
    if (gbl->tag_count)
	(void) standend();
}
Exemple #10
0
void stand_title(char* title)
{
    clear();
    standout();
    prints("%s",title);
    standend();
}
Exemple #11
0
/*
 * relocate:
 *	Make the monster's new location be the specified one, updating
 *	all the relevant state.
 */
void
relocate(THING *th, const coord *new_loc)
{
    struct room *oroom;

    if (!ce(*new_loc, th->t_pos))
    {
	mvaddch2(th->t_pos.y, th->t_pos.x, th->t_oldch);
	th->t_room = roomin(new_loc);
	set_oldch(th, new_loc);
	oroom = th->t_room;
	moat(th->t_pos.y, th->t_pos.x) = NULL;

	if (oroom != th->t_room)
	    th->t_dest = find_dest(th);
	th->t_pos = *new_loc;
	moat(new_loc->y, new_loc->x) = th;
    }
    move(new_loc->y, new_loc->x);
    if (see_monst(th))
	addch2(th->t_disguise);
    else if (on(player, SEEMONST))
    {
	standout();
	addch2(th->t_type);
	standend2();
    }
}
Exemple #12
0
void drawmenu(int highlight)
{
	clear();
	int numitems = 4;
	int mLines = (LINES - (numitems * 2)) / 2; // Center height 
        int mCols;
        int i, largest = 0;

        char *menuitems[] = {
                "X    Send           -- Send chat requests to new users",
                "R    Requests       -- View outstanding / unresolved requests",
                "C    Conversations  -- View all conversations",
                "Q    Quit           -- Exit the program. Bye!"
        };

        for(i = 0; i < numitems; i++) {
                // Find length of longest menu item
                if(strlen(menuitems[i]) > largest) largest = strlen(menuitems[i]);
        }

        mCols = (COLS - largest) / 2; // Center the items based on longest item

        for(i = 0; i < numitems; i++) {
		//if(highlight == i) attron(COLOR_PAIR(1));
		if(highlight == i) standout();
                move(mLines + (i * 2), mCols);
                addstr(menuitems[i]);
		//if(highlight == i) attroff(COLOR_PAIR(1));
		if(highlight == i) standend();
        }
	move(LINES - 1, COLS - 1);
        refresh();
}
Exemple #13
0
printchatline(char *str)
{
  int linelen = t_columns-1, len = strlen(str);
#if COLOR
  int color = 0;
#endif
  if (!g_you_have_mail && bbs_check_mail()) {
    int i;
    move(g_echatwin, 0);
    prints("---(You have mail.)");
    for (i=19; i<t_columns; i++) prints("-");
    g_you_have_mail++;
  }  
#if COLOR
    if (*str == '*') 
      color = (strncmp(str, "***", 3) ? COLOR_GREEN : COLOR_LIGHTBLUE);
#endif
  while (len) {
    move(g_currline, 0);
    clrtoeol();
    if (linelen < t_columns-1) move(g_currline, CHATID_MAX+2);
    if (len >= linelen) {
      int eoln;
      char c;
      for (eoln = linelen-1; eoln >= t_columns/4; eoln--)
	if (isspace(str[eoln])) break;
      if (!isspace(str[eoln])) eoln = linelen-1;
      c = str[eoln];
      str[eoln] = '\0';
#if COLOR
      if (color) colorstart(color);
#endif
      prints("%s", str);
#if COLOR
      if (color) colorend();
#endif
      str[eoln] = c;
      if (isspace(c)) eoln++;
      len -= eoln;
      str += eoln;
      if (linelen == t_columns-1) linelen -= (CHATID_MAX+2);
    }
    else {
#if COLOR
      if (color) colorstart(color);
#endif
      prints("%s", str);
#if COLOR
      if (color) colorend();
#endif
      len = 0;
    }
    if (++g_currline == g_echatwin) g_currline = 0;
    move(g_currline, 0);
    standout();
    prints(CHAT_PROMPT);
    standend();
    clrtoeol();
  }
}
Exemple #14
0
int select_menu( Menu *menu, int mselect )
{
  int eax;
  if ( mselect < 0 || menu->nitem <= mselect )
  {
    return menu->select;
  }
  else
  {
    if ( mselect < menu->offset )
      up_menu( menu, menu->offset - mselect );
    else
    if ( menu->offset + menu->height <= mselect )
      down_menu( menu, ( mselect - menu->offset - menu->height ) + 1 );
    if ( menu->offset <= menu->select && menu->select < menu->offset + menu->height )
      draw_menu_item( menu, menu->select );
    menu->select = mselect;
    standout( );
    draw_menu_item( menu, menu->select );
    standend( );
    move( ( menu->y + mselect ) - menu->offset, menu->x );
    toggle_stand( );
    refresh( );
    menu->select/*error:'i'*/ = menu->select;
    return menu->select;
  }
}
Exemple #15
0
/*ARGSUSED*/
AllUsersFunc( int indx, ACCOUNT *acct, struct enum_info *info )
{
  if (info->topline == info->currline) {
    move(info->topline-1, 0);
    prints("%-14s %-30s   %s\n","User Id", "User Name", "Last Login");
  }

  prints("%-14s %-30s %c %s", acct->userid, acct->username,
   BITISSET(acct->flags, FLG_EXEMPT) ? 'X': ' ',
   (acct->lastlogin == 0) ? "\n":ctime((time_t *)&acct->lastlogin));

  info->currline++;
  info->count++;

  if (info->currline > info->bottomline) {
    int ch;
    standout();
    prints("--MORE--");
    standend();
    clrtoeol();
    while((ch = igetch()) != EOF) {
      if(ch == '\n' || ch == '\r' || ch == ' ')
	break;
      if(toupper(ch) == 'Q') {
	move(info->currline, 0);
	clrtoeol();
	return ENUM_QUIT;
      }
      else bell();
    }
    info->currline = info->topline;
  }
  return S_OK;
}
Exemple #16
0
static int
typeline(int y, int skip)
{
    int found;

    if ((found = (UsePattern && GOT_REGEX(ToFind, Text))) != 0)
	HadPattern = TRUE;

    if (!skip) {
	move(y, 0);
	Tlen -= Shift;
	if (Tlen > COLS)
	    Tlen = COLS;

	if (found) {
	    (void) standout();
	    if (Tlen > 0)
		PRINTW("%.*s", Tlen, Text + Shift);
	    else
		addstr(" ");
	    (void) standend();
	} else if (Tlen > 0) {
	    int now = Shift, j;

	    while (Tlen > 0) {
		for (j = now; j < now + Tlen; j++) {
		    if (Over[j] != Over[now])
			break;
		}
		if (Over[now])
		    (void) standout();
		PRINTW("%.*s", (j - now), Text + now);
		if (Over[now])
		    (void) standend();
		Tlen -= (j - now);
		now = j;
	    }
	}
	clrtoeol();
    }
    typeinit();
    return (++y);
}
Exemple #17
0
/*
 *	help function to display the help info
 *
 *	format of the .larn.help file
 *
 *	1st character of file:	# of pages of help available (ascii digit)
 *	page (23 lines) for the introductory message (not counted in above)
 *	pages of help text (23 lines per page)
 */
void
help(void)
{
	int i, j;
#ifndef VT100
	char tmbuf[128];		/* intermediate translation buffer when not a VT100 */
#endif /* VT100 */
	if ((j = openhelp()) < 0)	/* open the help file and get # pages */
		return;
	for (i = 0; i < 23; i++)	/* skip over intro message */
		lgetl();
	for (; j > 0; j--) {
		clear();
		for (i = 0; i < 23; i++)
#ifdef VT100
			lprcat(lgetl());	/* print out each line that we read in */
#else /* VT100 */
		{
			tmcapcnv(tmbuf, lgetl());
			lprcat(tmbuf);
		}		/* intercept \33's */
#endif /* VT100 */
		if (j > 1) {
			lprcat("    ---- Press ");
			standout("return");
			lprcat(" to exit, ");
			standout("space");
			lprcat(" for more help ---- ");
			i = 0;
			while ((i != ' ') && (i != '\n') && (i != '\33'))
				i = getchr();
			if ((i == '\n') || (i == '\33')) {
				lrclose();
				setscroll();
				drawscreen();
				return;
			}
		}
	}
	lrclose();
	retcont();
	drawscreen();
}
Exemple #18
0
static WINDOW *
show_cmd(const char *scmd, struct winsize *win)
{
	int n, m;
	WINDOW *actionwin;
	int nrow;

	wclear(stdscr);
	clearok(stdscr, 1);
	touchwin(stdscr);
	refresh();

	mvaddstr(0, 4, msg_string(MSG_Status));
	standout();
	addstr(msg_string(MSG_Running));
	standend();
	mvaddstr(1, 4, msg_string(MSG_Command));
	standout();
	printw("%s", scmd);
	standend();
	addstr("\n\n");
	for (n = win->ws_col; (m = min(n, 30)) > 0; n -= m)
		addstr( "------------------------------" + 30 - m);
	refresh();

	nrow = getcury(stdscr) + 1;

	actionwin = subwin(stdscr, win->ws_row - nrow, win->ws_col, nrow, 0);
	if (actionwin == NULL) {
		fprintf(stderr, "sysinst: failed to allocate output window.\n");
		exit(1);
	}
	scrollok(actionwin, TRUE);
	if (has_colors()) {
		wbkgd(actionwin, getbkgd(stdscr));
		wattrset(actionwin, getattrs(stdscr));
	}

	wmove(actionwin, 0, 0);
	wrefresh(actionwin);

	return actionwin;
}
Exemple #19
0
/*
 * Display the given line.  If it is tagged, highlight the name.
 */
static void
show_line(VIEW * vp, unsigned j)
{
    RING *gbl = vp->gbl;
    char bfr[BUFSIZ];

    if (FILE_VISIBLE(vp, j)) {
	int line = (int) FILE2ROW(vp, j);
	int trimmed = FALSE;

	move(line, 0);
	ded2s(gbl, (int) j, bfr, sizeof(bfr));
	if (gbl->Xbase < (int) strlen(bfr)) {
	    int adj = gbl->cmdcol[CCOL_NAME];
	    int col = adj - gbl->Xbase;
	    int len = COLS - col;
#if defined(HAVE_HAS_COLORS)
	    int end = gbl->cmdcol[CCOL_NAME] + gENTRY(j).z_namlen;
#endif

	    if (col < 0) {
		adj -= col;
		col = 0;
		len = COLS;
	    }
#if defined(HAVE_HAS_COLORS)
	    if (end > COLS + gbl->Xbase)
		end = COLS + gbl->Xbase;
#endif

	    PRINTW("%.*s", COLS, &bfr[gbl->Xbase]);
	    if (len > 0) {	/* filename is visible */
		if (gFLAG(j)) {
		    trimmed = trim_at(line);
		    move(line, col);
		    (void) standout();
		    PRINTW("%.*s", len, &bfr[adj]);
		    (void) standend();
		}
#if defined(HAVE_HAS_COLORS)
		else if (has_colors()
			 && end > adj) {
		    trimmed = trim_at(line);
		    move(line, col);
		    dedcolor(&(gENTRY(j)));
		    PRINTW("%.*s", end - adj, &bfr[adj]);
		    dedcolor((FLIST *) 0);
		}
#endif /* HAVE_HAS_COLORS */
	    }
	}
	if (!trimmed)
	    (void) trim_at(line);
    }
}
Exemple #20
0
static int
FinishPage(RING * gbl,
	   int inlist,
	   int infile,
	   int y)
{
    int shown = FALSE;
    int foo;
    off_t length = 0;

    while (y < LINES - 1)
	y = typeline(y, FALSE);

    move(LINES - 1, 0);
    (void) standout();
    PRINTW("---lines %d to %d", TopOfPage(infile, &foo) + 1, infile);
    if (inlist >= 0) {
	int oldy, oldx;
	int save = gbl->AT_opt;

	getyx(stdscr, oldy, oldx);
	(void) standend();
	gbl->AT_opt = TRUE;
	shown = reshow(gbl, (unsigned) inlist);
	gbl->AT_opt = save;
	gbl->mrkfile = -1;
	markC(gbl, TRUE);
	(void) standout();
	move(oldy, oldx);
    }

    if ((length = MaxP()) != 0) {
	off_t num = ftell(InFile);
	PRINTW(": %.1f%%", ((double) num * 100.) / (double) length);
    }
    PRINTW("---");
    (void) standend();
    PRINTW(" ");
    clrtoeol();

    return shown;
}
Exemple #21
0
static letter1()
  {
  sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  if (lcreat(mail600) < 0) { write(1,"can't write 600 letter\n",23); return(0);}
  lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
  standout("From:"); lprcat("  the LRS (Larn Revenue Service)\n");
  standout("\nSubject:"); lprcat("  undeclared income\n");
  lprcat("\n   We heard you survived the caverns of Larn.  Let me be the");
  lprcat("\nfirst to congratulate you on your success.  It is quite a feat.");
  lprcat("\nIt must also have been very profitable for you.");
  lprcat("\n\n   The Dungeon Master has informed us that you brought");
  lprintf("\n%d gold pieces back with you from your journey.  As the",(long)c[GOLD]);
  lprcat("\ncounty of Larn is in dire need of funds, we have spared no time");
  lprintf("\nin preparing your tax bill.  You owe %d gold pieces as",
	(long)c[GOLD]*TAXRATE);
  lprcat("\nof this notice, and is due within 5 days.  Failure to pay will");
  lprcat("\nmean penalties.  Once again, congratulations, We look forward");
  lprcat("\nto your future successful expeditions.\n");
  lwclose(); return(1);
  }
Exemple #22
0
static void show_help_msg()
{
	move(b_line, 0);
	clrtoeol();
	move(b_line - 1, 0);
	clrtoeol();
	move(b_line, 10);
	standout();
	outs(_msg_edit_9);
	standend();
}
int main(void)
{
	int i;
	
	initscr();
	clear();
	for(i = 0; i< LINES; i++)
	{
		move(i, i + 1);
		if(i % 2 == 1)
			standout();
		addstr("hello, word");
		if(i % 2 == 1)
			standout();
	}
		refresh();
		getch();
		endwin();
	return 0;
}
Exemple #24
0
/*
 *	function to say press return to continue and reset scroll when done
 */
static void
retcont(void)
{
	cursor(1, 24);
	lprcat("Press ");
	standout("return");
	lprcat(" to continue: ");
	while (getchr() != '\n')
		; /* nothing */
	setscroll();
}
Exemple #25
0
main()
{
	int i, j, c;
	size_t len;
	char id[100];
	FILE *fp;
	char *s;

	initscr();			/* Always call initscr() first */
	signal(SIGINT, quit);		/* Make sure wou have a 'cleanup' fn */
	crmode();			/* We want cbreak mode */
	noecho();			/* We want to have control of chars */
	delwin(stdscr);			/* Create our own stdscr */
	stdscr = newwin(YSIZE, XSIZE, 10, 35); 
	flushok(stdscr, TRUE);		/* Enable flushing of stdout */
	scrollok(stdscr, TRUE);		/* Enable scrolling */
	erase();			/* Initially, clear the screen */

	standout();
	move(0,0);
	while (1) {
		c = getchar();
		switch(c) {
		case 'q':		/* Quit on 'q' */
			quit();
			break;
		case 's':		/* Go into standout mode on 's' */
			standout();
			break;
		case 'e':		/* Exit standout mode on 'e' */
			standend();
			break;
		case 'r':		/* Force a refresh on 'r' */
			wrefresh(curscr);
			break;
		default:		/* By default output the character */
			addch(c);
			refresh();
		}
	}
}
Exemple #26
0
int main()
{
	int i;

	initscr();
	clear();

	for (i=0; i<LINES; i++)
	{
		move(i, i+i);
		if (i % 2 == 1) standout();
		addstr("Hello, Young!");
		if (i % 2 == 1) standout();

		sleep(1);
		refresh();
	}

	endwin();

}
Exemple #27
0
int main(){
    initscr();
    
    clear();
    move(10, 20);
    addstr("Hello, world");
    move(LINES - 1, 0);
    standout();
    refresh();
    getch();
    endwin();
    return 0;
}
Exemple #28
0
/**********************************************
*               function helpme               *
***********************************************/
void helpme(int htype)          /* routine to show help menu. */
                         /* htype 0 == editor          */
{
    int i = 0, i2 = 0;          /* loop counters      */
    char *ptr;                  /* pointer in array.. */
    char ch;
    char **helplist;

    if (htype)
        helplist = help;
    else
        helplist = edhelp;

    /* clear board - fullscreen mode is too big to overlay */
    for (i = 0; i < 18; i++)
    {
        move(i, 0);
        printw("%43s", "");
    }

    while (helplist[i2])        /* times to show loop. */
    {
        for (i = 0; i < 16; i++)        /* show one menu. */
        {
            ptr = helplist[i2++];
            move(i, 0);         /* move to start of line. */
            addstr(ptr);
        }
        move(i, 0);             /* move to start of line. */
#ifdef TVI
        addstr(TVI);
#else
        standout();
#endif
        if (helplist[i2])
            addstr("Press any key to continue, <q> to exit");
        else
            addstr("End of help. Press any key to exit    ");
#ifdef NOTVI
        addstr(NOTVI);
#else
        standend();
#endif
        refresh();              /* show on screen. */
        ch = (char) getchar();  /* just for now, get anything. */
        if (ch == 'q')          /* if return or what ever.. */
            break;              /* exit routine now. */
    }
    move(i, 0);                 /* move to start of line. */
    printw("%40s", "");
}
Exemple #29
0
void
prboard()
{
	PLAY	*pp;
	int	i, j, k, temp;

	for (k = 0; k < 2; k++) {
		pp = &Player[k];
		temp = k * COMP_STRT + CARD_STRT;
		for (i = 0; i < NUM_SAFE; i++)
			if (pp->safety[i] == S_PLAYED && !pp->sh_safety[i]) {
				mvaddstr(i, temp, C_name[i + S_CONV]);
				if (pp->coups[i])
					mvaddch(i, temp - CARD_STRT, '*');
				pp->sh_safety[i] = TRUE;
			}
		show_card(14, temp, pp->battle, &pp->sh_battle);
		show_card(16, temp, pp->speed, &pp->sh_speed);
		for (i = C_25; i <= C_200; i++) {
			const char	*name;
			int	end;

			if (pp->nummiles[i] == pp->sh_nummiles[i])
				continue;

			name = C_name[i];
			temp = k * 40;
			end = pp->nummiles[i];
			for (j = pp->sh_nummiles[i]; j < end; j++)
				mvwaddstr(Miles, i + 1, (j << 2) + temp, name);
			pp->sh_nummiles[i] = end;
		}
	}
	prscore(TRUE);
	temp = CARD_STRT;
	pp = &Player[PLAYER];
	for (i = 0; i < HAND_SZ; i++)
		show_card(i + 6, temp, pp->hand[i], &pp->sh_hand[i]);
	mvprintw(6, COMP_STRT + CARD_STRT, "%2d", Topcard - Deck);
	show_card(8, COMP_STRT + CARD_STRT, Discard, &Sh_discard);
	if (End == 1000) {
		move(EXT_Y, EXT_X);
		standout();
		addstr("Extension");
		standend();
	}
	wrefresh(Board);
	wrefresh(Miles);
	wrefresh(Score);
}
Exemple #30
0
void printchatline2(const char *str)
{
	int i = 0;
	int wrap = 0;
	int y, x;

	move(chat_line, i);
	clrtoeol();

	while (*str)
	{
		getyx(&y, &x);
		if (y == 79 || *str == '\n')
		{
			chat_line++;
			if (chat_line == ECHATWIN)
				chat_line = 0;
			i = 0;
			move(chat_line, i);
			clrtoeol();
#if 1
			wrap = 1;
			refresh();
#endif
		}
		else
		{
			if (y == 0 && wrap)
				outs("  ");
			outc(*str);
		}
		str++;
	}
	chat_line++;
	if (chat_line == ECHATWIN)
		chat_line = 0;
	else if (chat_line < ECHATWIN - 1)	/* lthuang */
	{
		move(chat_line + 1, 0);
		clrtoeol();
	}
	move(chat_line, 0);
	clrtoeol();
	standout();
	outs("-->");
	standend();
#if 1
	refresh();
#endif
}