# 2.11BSD#431 - /usr/src/lib/libc/pdp/stdio/fputc.s

##### Functions

    _fputc            X

       1: /*
       2:  * Copyright (c) 1987 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  */
       6:
       7: #ifdef LIBC_SCCS
       8:         <@(#)fputc.s	1.1 (Berkeley) 2/4/87\0>
       9:         .even
      10: #endif LIBC_SCCS
      11:
      12: #include "DEFS.h"
      13: #include "STDIO.h"
      14:
      15: .globl  __flsbuf
      16:
      17: /*
      18:  * fputc(c, iop)
      19:  *	char	c;
      20:  *	FILE	*iop;
      21:  *
      22:  * Output c to stream iop and return c.  For unbuffered streams iop->cnt is
      23:  * always zero.  For normally buffered streams iop->cnt is the amount of space
      24:  * left in the buffer.  For line buffered streams, -(iop->cnt) is the number
      25:  * of characters in the buffer.
      26:  */
      27: ENTRY(fputc)
      28:         mov     4(sp),r1                / grab iop
      29:         dec     _CNT(r1)                / less room in buffer
      30:         blt     2f
      31:         mov     2(sp),r0                / grab the character (for return)
      32: 1:
      33:         movb    r0,*_PTR(r1)            / push character into the buffer,
      34:         inc     _PTR(r1)                /   increment the pointer,
      35:         bic     $!0377,r0               /   cast to u_char - just in case ...
      36:         rts     pc                      /   and return
      37: 2:
      38:         bit     $_IOLBF,_FLAG(r1)       / iop-cnt < 0: are we line buffered?
      39:         beq     3f                      / (nope, flush output)
      40:         mov     _CNT(r1),r0             / -(iop->cnt) < iop->bufsiz?
      41:         add     _BUFSIZ(r1),r0          / (same as 0 < iop->bufsiz + iop->cnt)
      42:         ble     3f                      / (nope, flush output)
      43:         mov     2(sp),r0                / grab the character
      44:         cmpb    r0,$NL                  / a newline?
      45:         bne     1b                      / no, just put it into the buffer
      46: 3:
      47:         jmp     __flsbuf

#### Defined functions

_fputc defined in line 27; used 152 times

- in /usr/src/bin/chflags/chflags.c line 174
- in /usr/src/bin/ld/ld.c line 1565, 1589, 1597
- in /usr/src/bin/stty/stty.c line 429, 438, 461, 471, 479-495(6)
- in /usr/src/games/hack/hack.termcap.c line 172
- in /usr/src/games/hunt/playit.c line 78, 137
- in /usr/src/lib/ccom/c04.c line 375-381(4), 393-408(7)
- in /usr/src/lib/libc/gen/err.c line 85, 118, 155, 185, 207-208(2)
- in /usr/src/libexec/popper/pop_send.c line 99
- in /usr/src/new/PORT/B/src/bed/getc.c line 538
- in /usr/src/new/PORT/B/src/bed/save.c line 188
- in /usr/src/new/PORT/B/src/bed/unix.c line 407
- in /usr/src/new/PORT/B/src/bed/vtrm.c line 1644-1660(8)
- in /usr/src/new/PORT/B/src/bint/b1nuC.c line 314
- in /usr/src/new/PORT/B/src/bint/b3sou.c line 348
- in /usr/src/new/PORT/B/src/bsmall/B1num.c line 238, 245-250(2)
- in /usr/src/new/jove/recover.c line 510
- in /usr/src/new/nntp/inews/inews.c line 105
- in /usr/src/new/nntp/server/newnews.c line 213
- in /usr/src/new/pathalias/mapaux.c line 161
- in /usr/src/new/rcs/src/rcs.c line 1003
- in /usr/src/new/vmsbackup/vmsbackup.c line 466, 498-502(2), 508, 527, 533-535(2)
- in /usr/src/sbin/shutdown/shutdown.c line 231-232(2)
- in /usr/src/ucb/PORT/pascal/eyacc/ey2.c line 166, 435-439(3), 458, 488-489(2), 495, 501, 507-513(3), 526-534(3), 546
- in /usr/src/ucb/PORT/pascal/pdx/tree/prtree.c line 142-149(3)
- in /usr/src/ucb/PORT/pascal/px/interp.c line 1436, 1462, 1470
- in /usr/src/ucb/PORT/pascal/px/utilities.c line 89, 111-112(2)
- in /usr/src/ucb/PORT/pascal/utilities/pmerge.c line 203, 242
- in /usr/src/ucb/gcore.c line 202, 226
- in /usr/src/ucb/pascal/eyacc/ey2.c line 155, 424-428(3), 447, 477-478(2), 484, 490, 496-502(3), 515-523(3), 535
- in /usr/src/ucb/ul.c line 488-489(2)
- in /usr/src/usr.bin/at/at.c line 477-479(3), 491-494(2), 502-503(2)
- in /usr/src/usr.bin/at/atrun.c line 433-437(3)
- in /usr/src/usr.bin/f77/error.c line 51
- in /usr/src/usr.bin/f77/putdmr.c line 1216-1217(2), 1226-1227(2), 1237
- in /usr/src/usr.lib/libF77/abort_.c line 22-24(2)
- in /usr/src/usr.lib/libF77/mkindx.c line 56
- in /usr/src/usr.lib/libF77/mkvers.c line 38
- in /usr/src/usr.lib/libF77/trapov_.c line 197
- in /usr/src/usr.lib/libF77/trpfpe_.c line 382
- in /usr/src/usr.lib/libI77/err.c line 109-111(2), 120-122(2), 142-146(2), 157-160(2)
- in /usr/src/usr.lib/libI77/mkindx.c line 56
- in /usr/src/usr.lib/libI77/mkvers.c line 38
- in /usr/src/usr.lib/libU77/mkindx.c line 56
- in /usr/src/usr.lib/libU77/mkvers.c line 38
- in /usr/src/usr.lib/libU77/perror_.c line 43
- in /usr/src/usr.sbin/named/tools/nslookup/main.c line 219
- in /usr/src/usr.sbin/sendmail.MX/aux/mconnect.c line 120-121(2)
- in /usr/src/usr.sbin/sendmail/aux/mconnect.c line 132-133(2)

Last modified: 1987-02-11 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 472 |