Porting Escape Sequences

Andrey Danilevich adanilev@rdstasks.com
Mon Mar 13 14:15:00 GMT 2000


Can somebody please help? I am porting unix application on NT4. My code
uses
escape sequences to manipulate cursor movements, to set and use
scrolling area,
to clean lines etc. printf("\033[ .... doesn't work on NT properly.
How can I make it working?

This is a sample of the code:

#define CLEARSCR    "\033[2J\033[H" /* on AIX, need to position cursor
so */
                              /* printf()'s don't get cleared (flush
output?) */
#define BOLD        "\033[1m"
#define NORMAL          "\033[m"
#define HOME        "\033[H"
#define LINE            "--------------------"  /* 20- */
...................................................................................

..........................................................................

   printf( "%s%s",BOLD,CLEARSCR);
   printf( "\t     INTER PROCESS COMMUNICATIONS TEST FACILITY
(LenSize=%d)\n\n",MsgLenSize);
   printf( " 1) Change IPC key parameters  7) View Shared Memory\n");
   printf( " 2) Create Shared Memory       8) Write Message Queue\n");
   printf( " 3) Create Message Queue       9) Read  Message Queue\n");
   printf( " 4) Remove Shared Memory       10) Load file into Message
Queue\n");
   printf( " 5) Remove Message Queue       11) Copy Message Queue to
File\n");
   printf( " 6) Write to Shared Memory     12) Message Queue Stats\n");
   printf( "99) Quit\n");
   printf( "%s%s%s%s",LINE,LINE,LINE,LINE);

   keep_running=TRUE;
   while( keep_running)
   {
      show_ipc_key_parameters();
      cmd_number=0;
      printf( "\033[13H\033[K");  /* Place cursor after menu; clear line
*/
      printf( "SELECTION ?>");
      gets( cmd_buffer);

      printf( "\033[14H\033[J\033[14H");  /* clear below SELECTION ?> */

      rc=sscanf( cmd_buffer,"%02d",&cmd_number);
      if( !memcmp( cmd_buffer,"Q",1))cmd_number=99;
      if( !memcmp( cmd_buffer,"q",1))cmd_number=99;
      switch( cmd_number)
      {
         case 1:  /* Change IPC key parameters */
           puts( "ok");
           get_ipc_key_parameters();
           break;
           .........................................
        default:
            puts( "Invalid choice number entered \007");
            break;
      }
   } /* ( keep_running) */

   printf("%s",NORMAL);


Thank you
Andrew


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list