source: trunk/libs/newlib/src/libgloss/rs6000/mvme-print.c @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.4 KB
Line 
1/* mvme-print.c -- print a string on the output device.
2 *
3 * Copyright (c) 1996 Cygnus Support
4 *
5 * The authors hereby grant permission to use, copy, modify, distribute,
6 * and license this software and its documentation for any purpose, provided
7 * that existing copyright notices are retained in all copies and that this
8 * notice is included verbatim in any distributions. No written agreement,
9 * license, or royalty fee is required for any of the authorized uses.
10 * Modifications to this software may be copyrighted by their authors
11 * and need not follow the licensing terms described here, provided that
12 * the new terms are clearly indicated on the first page of each file where
13 * they apply.
14 */
15
16/*
17 * write -- write some bytes to the output device.
18 */
19
20int
21write (fd, ptr, len)
22     int fd;
23     char *ptr;
24     unsigned len;
25{
26  char *done = ptr + len;
27  char *q;
28  unsigned len2;
29
30  while (ptr < done)
31    {
32      if (*ptr == '\n')
33        {
34          __pcrlf ();
35          ptr++;
36        }
37      else
38        {
39          q = ptr;
40          while ( (q < done) && ((ptr - q) < 254))
41            {
42              if (*q == '\n')
43                {
44                  __outln (ptr, q);
45                  ptr = ++q;
46                }
47              else
48                q++;
49            }
50
51          if (ptr != q)
52            {
53              __outstr (ptr, q);
54              ptr = q;
55            }
56        }
57    }
58  return len;
59}
60
61/*
62 * print -- do a raw print of a string
63 */
64
65void
66print (ptr)
67     char *ptr;
68{
69  int len = 0;
70  char *p = ptr;
71
72  while (*p != '\0')
73    p++;
74
75  write (1, ptr, p-ptr);
76}
Note: See TracBrowser for help on using the repository browser.