summaryrefslogtreecommitdiffstats
path: root/arch/alpha/lib/srm_puts.c
blob: 87b1d11559a461c762ee4795f34bbda70d6e4f6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 *	arch/alpha/lib/srm_puts.c
 */

#include <linux/string.h>
#include <asm/console.h>

void
srm_puts(const char *str)
{
	/* Expand \n to \r\n as we go.  */

	while (*str) {
		long len;
		const char *e = str;

		if (*str == '\n') {
			if (srm_dispatch(CCB_PUTS, 0, "\r", 1) < 0)
				return;
			++e;
		}

		e = strchr(e, '\n') ? : strchr(e, '\0');
		len = e - str;

		while (len > 0) {
			long written = srm_dispatch(CCB_PUTS, 0, str, len);
			if (written < 0)
				return;
			len -= written & 0xffffffff;
			str += written & 0xffffffff;
		}
	}
}