home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / clib / fputc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  1.2 KB  |  77 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: fputc.c,v 1.4 1997/01/01 03:41:10 ldp Exp $
  4.  
  5.     Desc: ANSI C function fputc()
  6.     Lang: english
  7. */
  8. #include <errno.h>
  9. #include <dos/dos.h>
  10. #include <dos/dosextens.h>
  11. #include <proto/exec.h>
  12. #include <proto/dos.h>
  13.  
  14. /*****************************************************************************
  15.  
  16.     NAME */
  17. #include <stdio.h>
  18.  
  19.     int fputc (
  20.  
  21. /*  SYNOPSIS */
  22.     int    c,
  23.     FILE * stream)
  24.  
  25. /*  FUNCTION
  26.     Write one character to the specified stream.
  27.  
  28.     INPUTS
  29.     c - The character to output
  30.     stream - The character is written to this stream
  31.  
  32.     RESULT
  33.     The character written or EOF on error.
  34.  
  35.     NOTES
  36.  
  37.     EXAMPLE
  38.  
  39.     BUGS
  40.  
  41.     SEE ALSO
  42.  
  43.     INTERNALS
  44.  
  45.     HISTORY
  46.     06.12.1996 digulla created
  47.  
  48. ******************************************************************************/
  49. {
  50.     BPTR fh;
  51.  
  52.     switch ((IPTR)stream)
  53.     {
  54.     case 0:
  55.     case 1: /* Stdin */
  56.     errno = EINVAL;
  57.     return EOF;
  58.  
  59.     case 2: /* Stdout */
  60.     fh = Output();
  61.  
  62.     case 3: {
  63.     struct Process * me = (struct Process *)FindTask (NULL);
  64.  
  65.     fh = me->pr_CES ? me->pr_CES : me->pr_COS;
  66.  
  67.     break; }
  68.  
  69.     default:
  70.     fh = stream->fh;
  71.     break;
  72.     }
  73.  
  74.     return FPutC (fh, c);
  75. } /* fputc */
  76.  
  77.