2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
6 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley Software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
19 void p2dig_ull(unsigned long long);
30 psecs_ull(unsigned long long l
)
42 printf("%llu", i
/ 60);
70 p2dig_ull(unsigned long long i
)
72 printf("%llu%llu", i
/ 10, i
% 10);
78 printf("%d%d", i
/ 10, i
% 10);
87 * putbyte() send a byte to SHOUT. No interpretation is done
88 * except an un-QUOTE'd control character, which is displayed
95 if ((c
& QUOTE
) == 0 && (c
== 0177 || c
< ' ' && c
!= '\t' &&
107 if (c
== '\n' || linp
>= &linbuf
[sizeof (linbuf
) - 1 - MB_CUR_MAX
]) {
108 /* 'cause the next Putchar() call may overflow the buffer. */
114 * Putchar(tc) does what putbyte(c) do for a byte c.
115 * Note that putbyte(c) just send the byte c (provided c is not
116 * a control character) as it is, while Putchar(tc) may expand the
117 * character tc to some byte sequnce that represents the character
125 if (isascii(tc
&TRIM
)) {
130 n
= wctomb(linp
, tc
);
135 if (linp
>= &linbuf
[sizeof (linbuf
) - 1 - MB_CUR_MAX
]) {
143 * putbyte() send a byte to SHOUT. No interpretation is done
144 * except an un-QUOTE'd control character, which is displayed
151 if ((c
& QUOTE
) == 0 && (c
== 0177 || c
< ' ' && c
!= '\t' &&
162 if (c
== '\n' || linp
>= &linbuf
[sizeof (linbuf
) - 2]) {
168 * Putchar(tc) does what putbyte(c) do for a byte c.
169 * For single-byte character only environment, there is no
170 * difference between Putchar() and putbyte() though.
192 if (linp
== linbuf
) {
196 unit
= didfds
? 2 : SHDIAG
;
198 unit
= didfds
? 1 : SHOUT
;
201 if (didfds
== 0 && ioctl(unit
, TIOCLGET
, (char *)&lmode
) == 0 &&
204 (void) ioctl(unit
, TIOCLBIC
, (char *)&lmode
);
205 (void) write(unit
, "\n", 1);
208 (void) write(unit
, linbuf
, linp
- linbuf
);
213 * Should not be needed.
216 write_string(char *s
)
220 * First let's make it sure to flush out things.
225 unit
= didfds
? 2 : SHDIAG
;
227 unit
= didfds
? 1 : SHOUT
;
230 (void) write(unit
, s
, strlen(s
));