OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [libgloss/] [rs6000/] [mvme-print.c] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
/* mvme-print.c -- print a string on the output device.
/* mvme-print.c -- print a string on the output device.
 *
 *
 * Copyright (c) 1996 Cygnus Support
 * Copyright (c) 1996 Cygnus Support
 *
 *
 * The authors hereby grant permission to use, copy, modify, distribute,
 * The authors hereby grant permission to use, copy, modify, distribute,
 * and license this software and its documentation for any purpose, provided
 * and license this software and its documentation for any purpose, provided
 * that existing copyright notices are retained in all copies and that this
 * that existing copyright notices are retained in all copies and that this
 * notice is included verbatim in any distributions. No written agreement,
 * notice is included verbatim in any distributions. No written agreement,
 * license, or royalty fee is required for any of the authorized uses.
 * license, or royalty fee is required for any of the authorized uses.
 * Modifications to this software may be copyrighted by their authors
 * Modifications to this software may be copyrighted by their authors
 * and need not follow the licensing terms described here, provided that
 * and need not follow the licensing terms described here, provided that
 * the new terms are clearly indicated on the first page of each file where
 * the new terms are clearly indicated on the first page of each file where
 * they apply.
 * they apply.
 */
 */
 
 
/*
/*
 * write -- write some bytes to the output device.
 * write -- write some bytes to the output device.
 */
 */
 
 
int
int
write (fd, ptr, len)
write (fd, ptr, len)
     int fd;
     int fd;
     char *ptr;
     char *ptr;
     unsigned len;
     unsigned len;
{
{
  char *done = ptr + len;
  char *done = ptr + len;
  char *q;
  char *q;
  unsigned len2;
  unsigned len2;
 
 
  while (ptr < done)
  while (ptr < done)
    {
    {
      if (*ptr == '\n')
      if (*ptr == '\n')
        {
        {
          __pcrlf ();
          __pcrlf ();
          ptr++;
          ptr++;
        }
        }
      else
      else
        {
        {
          q = ptr;
          q = ptr;
          while ( (q < done) && ((ptr - q) < 254))
          while ( (q < done) && ((ptr - q) < 254))
            {
            {
              if (*q == '\n')
              if (*q == '\n')
                {
                {
                  __outln (ptr, q);
                  __outln (ptr, q);
                  ptr = ++q;
                  ptr = ++q;
                }
                }
              else
              else
                q++;
                q++;
            }
            }
 
 
          if (ptr != q)
          if (ptr != q)
            {
            {
              __outstr (ptr, q);
              __outstr (ptr, q);
              ptr = q;
              ptr = q;
            }
            }
        }
        }
    }
    }
  return len;
  return len;
}
}
 
 
/*
/*
 * print -- do a raw print of a string
 * print -- do a raw print of a string
 */
 */
 
 
void
void
print (ptr)
print (ptr)
     char *ptr;
     char *ptr;
{
{
  int len = 0;
  int len = 0;
  char *p = ptr;
  char *p = ptr;
 
 
  while (*p != '\0')
  while (*p != '\0')
    p++;
    p++;
 
 
  write (1, ptr, p-ptr);
  write (1, ptr, p-ptr);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.