|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
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.
11: *
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
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
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: #import <mach/mach_types.h>
35: #import <mach/machine.h>
36: #import <sys/reboot.h>
37:
38: int reboot_how;
39: extern struct tty cons;
40: extern struct tty *constty; /* current console device */
41:
42: extern int getchar();
43:
44:
45:
46:
47:
48:
49:
50: #define putchar cnputc
51:
52: void
53: gets(buf)
54: char *buf;
55: {
56: register char *lp;
57: register c;
58:
59: lp = buf;
60: for (;;) {
61: c = getchar() & 0177;
62: switch(c) {
63: case '\n':
64: case '\r':
65: *lp++ = '\0';
66: return;
67: case '\b':
68: if (lp > buf) {
69: lp--;
70: putchar(' ');
71: putchar('\b');
72: }
73: continue;
74: case '#':
75: case '\177':
76: lp--;
77: if (lp < buf)
78: lp = buf;
79: continue;
80: case '@':
81: case 'u'&037:
82: lp = buf;
83: putchar('\n'); /* XXX calls 'cnputc' on mips */
84: continue;
85: default:
86: *lp++ = c;
87: }
88: }
89: }
90:
91: int
92: getchar()
93: {
94: int c;
95:
96: c = cngetc();
97: #if 0
98: if (c == 0x1b) /* ESC ? */
99: call_kdp();
100: #endif 0
101:
102: if (c == '\r')
103: c = '\n';
104: cnputc(c);
105: return c;
106: }
107:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.