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