home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.development      Operating system development chatter      4,255 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,858 of 4,255   
   mutazilah@gmail.com to Branimir Maksimovic   
   Re: news galore   
   12 Oct 21 18:41:14   
   
   From: muta...@gmail.com   
      
   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'm inclined to say that setvbuf NBF of stdin switches off   
   character echo. That will allow micro-emacs to work   
   without extensions.   
      
   And setvbuf of non-(stdin/stdout/stderr) needs to be done   
   for NBF or LBF otherwise you get FBF.   
      
   BFN. Paul.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca