TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: all
from: David Breeding 72330,2051
date: 1994-11-19 16:08:13
subject: #_gs_rdy() question

#: 20568 S3/Languages
    19-Nov-94  16:08:13
Sb: #_gs_rdy() question
Fm: David Breeding 72330,2051
To: all

Hey, Gang,  I have a question.  Why doesn't the following work?

I have tried this both on my OSK and CoCo, and get similar results. The program
as written will continue to loop, keeping getting the "AT" and "OK", with some
other gibberish.  It seems to keep writing and reading the modem.

If the while{} statement is not used, and The Alternate Method, commented out,
here, is used, if you write something to the modem, then you keep getting a
positive value returned from _gs_rdy().  If you do the for loop without writing
to the modem, you keep getting a -1 returned, which is correct.  But if
something has been written, it looks like the pointer is not getting updated,
and, in fact, it seems that it keeps getting rewritten to the serial port..
strange.. or am I overlooking something?

Note: this is the coco version, but, as I said, OSK seems to act the same way.
This here is just a test program.. but it still looks like it SHOULD work.
I've also tried time loop delays between reads, etc, but still no luck.. I
can't see why it keeps sending to the modem..

          #include 
          #include 

          int mdm;
          char buf[30];
          char cmd[10] = "AT\x0d";   /* try something else, too */


          main()
          {
           int count, state;

            if ( (mdm=open("/t2",UPDATE)) == -1)
              exit(1);

            write( mdm,cmd,3);

            while ((state=_gs_rdy(mdm)) > 0 ) {
              printf("\x0a_gs_rdy()=%d  Read()=%d   ",
                       state, read( mdm,buf,state ) );
              fflush(stdout);
              write( 1,buf,state );
            }

          /* Alternate method */
          /* if you delete all the above after the open(), -1 is
             always returned.. if the write() is left in, it goes crazy */
            for (count=1;count<10;count++ ) {
              printf("_gs_rdy()=%d\n",_gs_rdy(mdm) );
            }    /* End Alternate method */

            close(mdm);
          }

                   -- David Breeding --
                 CompuServe :  72330,2051
                     Delphi :  DBREEDING

         ***  Sent via CoCo-InfoXpress V1.01 ***
                       ^^^^ ^^^^^^^^^^

There is 1 Reply.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.