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