Beispiel #1
0
int chdir_cmd(int argc, char **argv)
{
  UCHAR   achDirName[256]     = "";          /* Directory name for queries */
  ULONG   cbDirPathLen    = 0;               /* Length of directory path   */
  APIRET  rc           = NO_ERROR;      /* Return code                     */
  UCHAR   chDisk;
  ULONG   ulDriveNum   = 0;      /* Drive number (A=1, B=2, C=3, ...)    */
  ULONG   ulDriveMap   = 0;      /* Mapping of valid drives              */
  ULONG   i            = 0;      /* A loop index                         */

  if (argc==1)
  {
  rc = DosQueryCurrentDisk (&ulDriveNum, &ulDriveMap);
  chDisk=(UCHAR)(ulDriveNum+'A'-1);

  cbDirPathLen = 0;
  rc = DosQueryCurrentDir(0, achDirName, &cbDirPathLen);
  rc = DosQueryCurrentDir(0, achDirName, &cbDirPathLen);

  VioWrtTTY(&chDisk, 1, 0);
  VioWrtTTY(":\\", 2, 0);
  VioWrtTTY(achDirName, cbDirPathLen-1, 0);
  VioWrtTTY("\n\r", 2, 0);
  } else {
    DosSetCurrentDir(argv[1]);
  };


  return 0;
}
Beispiel #2
0
int main(void)
{
    APIRET16 apiret;
    char *str1 = "First string";
    char *str2 = "Second string";

    printf(__FILE__ " main function invoked\n");
    printf("Test VIO functions\n");
    DosSleep(2000);

    /* move the cursor around some */
    apiret = VioSetCurPos(0, 0, 0);
    DosSleep(1000);
    apiret = VioSetCurPos(1, 0, 0);
    DosSleep(1000);
    apiret = VioSetCurPos(2, 0, 0);
    DosSleep(1000);
    apiret = VioSetCurPos(3, 0, 0);
    DosSleep(1000);
    apiret = VioSetCurPos(4, 0, 0);
    DosSleep(1000);
    apiret = VioSetCurPos(5, 0, 0);
    DosSleep(1000);

    /* write some strings */
    VioWrtTTY(str1, strlen(str1), 0);
    DosSleep(2000);
    apiret = VioSetCurPos(6, 0, 0);
    VioWrtTTY(str2, strlen(str2), 0);
    DosSleep(2000);

    return 0;
}
Beispiel #3
0
int cmds_cmd(int argc, char **argv)
{
  unsigned int i;

  VioWrtTTY("Commands:\r\n", 11, 0);
  for (i=0;i<6;i++)
  {
    VioWrtTTY(commands[i].cmdname, strlen(commands[i].cmdname), 0);
    VioWrtTTY("\x9", 1, 0);
  }
  VioWrtTTY("\r\n", 2, 0);
  return 0;
}
Beispiel #4
0
void main(void)
{
    char *str1 = "VioWrtTTY test";

    /* write some strings */
    VioWrtTTY(str1, strlen(str1), 0);
}
Beispiel #5
0
void read_cmd(char *cmd)
{
  STRINGINBUF sin;
  sin.cb=255;
  KbdStringIn(cmd, &sin, 0, 0);
  cmd[sin.cchIn]='\0';
  VioWrtTTY("\r\n", 2, 0);
}
Beispiel #6
0
VOID ClearScreen(THREAD *pstThd)
  {
  VIOCELL Cell;
  VIOPS *pVio = &pstThd->stVio;
  BYTE byBackground;
  BYTE byForeground;


  byBackground = ClrTable[pVio->wBackground].PSClr;
  byForeground = ClrTable[pVio->wForeground].PSClr;


  /*
  ** Set foreground and background colors in ANSI, so that the
  ** VioWrtTTY function will pick up the correct colors.
  */
  chAnsi[ANSI_FORE] = QueryAnsiClr(byForeground);
  chAnsi[ANSI_BACK] = QueryAnsiClr(byBackground);
  VioSetAnsi (ANSI_ON,pVio->hpsVio);
  VioWrtTTY( (PCH)chAnsi,sizeof(chAnsi),pVio->hpsVio);
  if (!pstThd->stCfg.bEnableAnsi)
    VioSetAnsi (ANSI_OFF,pVio->hpsVio);

  /*
  ** Set Presentation Space to a known state - full of spaces.
  */
  Cell.vc      = ' ';
  Cell.ExtAttr = Cell.Spare = 0;
  Cell.Attr    =  (byBackground << 4) | byForeground;
  VioWrtNCell((PBYTE)&Cell,pVio->usPsWidth * pVio->usPsDepth,0,0,pVio->hpsVio);
  VioSetOrg(0,0,pVio->hpsVio);
  VioSetCurPos(0,0,pVio->hpsVio);

  /*
  ** Zero the scroll bars.
  */
  WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_VERTSCROLL),
             SBM_SETPOS,
             MPFROMSHORT(0),
             MPFROMSHORT(0));

  WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_HORZSCROLL),
             SBM_SETPOS,
             MPFROMSHORT(0),
             MPFROMSHORT(0));

  WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_VERTSCROLL),
              SBM_SETTHUMBSIZE,
              MPFROM2SHORT(pVio->usWndWidth,pVio->usPsWidth),
              (MPARAM)NULL);

  WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_HORZSCROLL),
              SBM_SETTHUMBSIZE,
              MPFROM2SHORT(pVio->usWndDepth,pVio->usPsDepth),
              (MPARAM)NULL);

  }
int PutcPopUp(int c)
{
    char *s = " ";

    if (DebugFlag & DB_ECHO_LINE)
	fputc(c, stdout);
    else {
	switch (c) {
	case '\n':
	    VioWrtTTY("\r\n", 2, 0);
	    break;
	default:
	    s[0] = c;
	    VioWrtTTY(s, 1, 0);
	    break;
	}
    }
    return(0);
}
void EndPopUp()
{
    if (DebugFlag & DB_ECHO_LINE)
	return;
    if (OS2MODE) {
      VioWrtTTY(pszPressAny, strlen(pszPressAny), 0);
      KbdCharIn(&kbci, IO_WAIT, hkbd);
      VioEndPopUp(0);
    }
}
int PutlPopUp(char *s)
{
    StartPopUp();
    PutsPopUp(s);
    if (DebugFlag & DB_ECHO_LINE)
	fputc('\n', stdout);
    else
	VioWrtTTY("\r\n", 2, 0);
    EndPopUp();
    return(0);
}
Beispiel #10
0
void showpath(void)
{
  UCHAR   chDisk;
  UCHAR   achDirName[256]     = "";          /* Directory name for queries */
  ULONG   cbDirPathLen    = 0;               /* Length of directory path   */
  APIRET  rc           = NO_ERROR;      /* Return code                     */
  ULONG   ulDriveNum   = 0;      /* Drive number (A=1, B=2, C=3, ...)    */
  ULONG   ulDriveMap   = 0;      /* Mapping of valid drives              */
  ULONG   i            = 0;      /* A loop index                         */

  rc = DosQueryCurrentDisk (&ulDriveNum, &ulDriveMap);
  chDisk=(UCHAR)(ulDriveNum+'A'-1);

  cbDirPathLen = 0;
  rc = DosQueryCurrentDir(0, achDirName, &cbDirPathLen);
  rc = DosQueryCurrentDir(0, achDirName, &cbDirPathLen);

  VioWrtTTY("[", 1, 0);
  VioWrtTTY(&chDisk, 1, 0);
  VioWrtTTY(":\\", 2, 0);
  VioWrtTTY(achDirName, cbDirPathLen-1, 0);
  VioWrtTTY("]", 1, 0);
}
Beispiel #11
0
int PutsPopUp(char *s)
{
    char c, *os = VioSubstBuffer;

    if (DebugFlag & DB_ECHO_LINE)
	printf("%s", s);
    else {
	do {
	    /* Convert \n to \r\n in auxiliary buffer for VIO */
	    if ((c= *s++) == '\n')
		*os++ = '\r';
	    *os++ = c;
	} while (c > 0);
	VioWrtTTY(VioSubstBuffer, strlen(VioSubstBuffer), 0);
    }
    return(0);
}
Beispiel #12
0
/* After running a program, resume curses and redraw all screens */
static int
vio_prgclose (void)
{
  int  status;

  /* wait for the program to terminate */
  status = prgclose ();

  /* resume curses */
  if (!isfilter)
    {
      vio_resume (ElvTrue);

      /* If the program left the cursor anywhere but the first
       * column of the last line of the screen, move the cursor
       * there and scroll to the next line, for good measure.
       */
      if (c_row != o_ttyrows - 1 || c_col != 0)
        {
          vio_CM (o_ttyrows - 1, 0);
          VioWrtTTY ("\n", 1, 0);
        }
      vio_CE (vc_current);

      /* Okay, now we're in a weird sort of situation.  The screen is
       * about to be forced to display "Hit <Enter> to continue" on
       * the bottom of the window in open mode, and then wait for a
       * keystroke.  That's a Good Thing.  But there are two problems
       * we need to address:
       *    * We want that prompt to appear at the bottom of the
       *  screen, not the bottom of the window.
       *    * After the user hits a key, we want to redraw all
       *  windows.
       *
       * We'll set a flag indicating this situation.  The movecurs()
       * function will test for that flag, and merely pretend to move
       * the cursor when it is set.  The loop() function will test
       * that flag after each keystroke, and expose all windows if
       * it is set.
       */
      afterprg = 2;
      afterscrl = 0;
    }

  return status;
}
Beispiel #13
0
/* This function writes the contents of 'ttybuf' to the screen */
static void 
do_flush (void)
{
  if (ttycount > 0)
    {
      if (raw_mode)
        {
          VioWrtCellStr (ttybuf, ttycount, c_row, c_col, 0);
          if ((c_col += ttycount / 2) >= o_ttycolumns)
            {
              c_col -= o_ttycolumns;
              c_row++;
            }
        }
      else
        {
          VioWrtTTY (ttybuf, ttycount, 0);
        }
      ttycount = 0;
    }
}
Beispiel #14
0
void execute_external(int argc, char **argv)
{
  UCHAR       LoadError[255];
  PSZ         Args;
  PSZ         Envs;
  RESULTCODES ChildRC;
  APIRET      rc;  /* Return code */
  char        *env;
  int         i;

  log("execute_external():\n");
  log("argc=%d\n", argc);

  for (i = 0; i < argc; i++)
    log("argv[%d]=%s\n", i, argv[i]);

  env = env_get();

  rc = DosExecPgm(LoadError,           /* Object name buffer           */
                  sizeof(LoadError),   /* Length of object name buffer */
                  EXEC_SYNC,           /* Asynchronous/Trace flags     */
                  argv[0],             /* Argument string              */
                  env,                 /* Environment string           */
                  &ChildRC,            /* Termination codes            */
                  argv[0]);            /* Program file name            */

  env_free(env);

  if (rc != NO_ERROR) {
//     printf("DosExecPgm error: return code = %u\n",rc);
     VioWrtTTY("DosExecPgm error\r\n", 18, 0); //: return code = %u\n",rc);
     return ;
  } else {
//     printf("DosExecPgm complete.  Termination Code: %u  Return Code: %u\n",
//             ChildRC.codeTerminate,
//             ChildRC.codeResult);  /* This is explicitly set by other pgm */
  } /* endif */
}
Beispiel #15
0
USHORT __pascal VIOWRTTTY(const PCHAR Str, const USHORT Count, const HVIO Handle)
{
  return VioWrtTTY(Str, Count, Handle);
}
Beispiel #16
0
void hello(void)
{
  VioWrtTTY(greeting, strlen(greeting), 0);
}