]> git.saurik.com Git - apple/xnu.git/blame - bsd/dev/ppc/machdep.c
xnu-792.10.96.tar.gz
[apple/xnu.git] / bsd / dev / ppc / machdep.c
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
37839358
A
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
1c79356b 11 *
37839358
A
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * Copyright (c) 1997 Apple Computer, Inc. All rights reserved.
24 * Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
25 *
26 *
27 * Machine dependent cruft.
28 *
29 * 27-Apr-1997 A.Ramesh at Apple
30 *
31 *
32 */
33
34#include <mach/mach_types.h>
35#include <mach/machine.h>
36#include <sys/reboot.h>
37
38int reboot_how;
39extern struct tty cons;
40extern struct tty *constty; /* current console device */
41
42extern int getchar();
43
44#define putchar cnputc
45
46void
47gets(buf)
48 char *buf;
49{
50 register char *lp;
51 register c;
52
53 lp = buf;
54 for (;;) {
55 c = getchar() & 0177;
56 switch(c) {
57 case '\n':
58 case '\r':
59 *lp++ = '\0';
60 return;
61 case '\b':
62 if (lp > buf) {
63 lp--;
64 putchar(' ');
65 putchar('\b');
66 }
67 continue;
68 case '#':
69 case '\177':
70 lp--;
71 if (lp < buf)
72 lp = buf;
73 continue;
74 case '@':
75 case 'u'&037:
76 lp = buf;
77 putchar('\n'); /* XXX calls 'cnputc' on mips */
78 continue;
79 default:
80 *lp++ = c;
81 }
82 }
83}
84
85int
86getchar()
87{
88 int c;
89
90 c = cngetc();
91#if 0
92 if (c == 0x1b) /* ESC ? */
93 call_kdp();
94#endif 0
95
96 if (c == '\r')
97 c = '\n';
98 cnputc(c);
99 return c;
100}
101