From: branimir.maksimovic@icloud.com   
      
   On 2021-10-13, muta...@gmail.com wrote:   
   > On Wednesday, October 13, 2021 at 12:23:46 PM UTC+11, Branimir Maksimovic   
   wrote:   
   >   
   >> > cp->reader = fdopen(cp->sd, "rb");   
   >> > if (cp->reader == NULL){   
   >> > fprintf(stderr, "%s: Unable to reopen file: %s\n",   
   >> > myname, strerror(errno));   
   >> > close(cp->sd);   
   >> > return NULL;   
   >> > }   
   >> >   
   >> > cp->writer = fdopen(cp->sd, "wb");   
   >> > if (cp->writer == NULL){   
   >> > fprintf(stderr, "%s: Unable to reopen file: %s\n",   
   >> > myname, strerror(errno));   
   >> > close(cp->sd);   
   >> > return NULL;   
   >> > }   
   >> > setvbuf(cp->writer, (char *)NULL, _IOLBF, 0);   
   >> >   
   >> I think he thinks about reading, not writing.   
   >   
   > Scott posted code for reading earlier:   
   >   
   > bp = fgets(buffer, sizeof(buffer), conp->reader);   
   > if (buffer[0] != '2') {   
   > fprintf(stderr, "auth pass returns %s\n", buffer);   
   > }   
   >   
   >> You read character at time and stop when line ending   
   >> is hit... all in all input is buffered anyway, fact   
   >> that you do getc is just adjusting pointer in buffer :P   
   >   
   > My question is about what system call the C library should   
   > be doing. Not just for Unix/Windows/MVS, but an operating   
   > system in general.   
   >   
   > I think a C library fopen() should really result in an fopen()   
   > syscall. Why do we have an open() syscall instead of an   
   > fopen() syscall?   
   >   
   > Now that I have control over all the components (editor,   
   > news reader, C library, OS), I'd like to rationalize C90.   
   > E.g. maybe I need a #include that defines   
   > things like:   
   > ESC_CHAR '\x1b'   
   > ESC_STR "\x1b"   
   > so that I don't need that value hardcoded in micro-emacs.   
   >   
   I beleive that you have to do that by yourself.   
   define that things as C does not defines exact represantation   
   of characters. So you can't match on \r\n rather   
   on \x0d\x0a ...   
   Greets, Branimir.   
      
      
   --   
      
   7-77-777   
   Evil Sinner!   
   with software, you repeat same experiment, expecting different results...   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|