Deleted Added
full compact
ttyin.c (161475) ttyin.c (170256)
1/*
1/*
2 * Copyright (C) 1984-2004 Mark Nudelman
2 * Copyright (C) 1984-2007 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.
9 */
10

--- 86 unchanged lines hidden (view full) ---

97/*
98 * Get a character from the keyboard.
99 */
100 public int
101getchr()
102{
103 char c;
104 int result;
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.
9 */
10

--- 86 unchanged lines hidden (view full) ---

97/*
98 * Get a character from the keyboard.
99 */
100 public int
101getchr()
102{
103 char c;
104 int result;
105 int hex_in = 0;
106 int hex_value = 0;
107
108 do
109 {
110#if MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC
111 /*
112 * In raw read, we don't see ^C so look here for it.
113 */
114 flush();

--- 17 unchanged lines hidden (view full) ---

132 * Don't call error() here,
133 * because error calls getchr!
134 */
135 quit(QUIT_ERROR);
136 }
137#endif
138#if 0 /* allow entering arbitrary hex chars for testing */
139 /* ctrl-A followed by two hex chars makes a byte */
105
106 do
107 {
108#if MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC
109 /*
110 * In raw read, we don't see ^C so look here for it.
111 */
112 flush();

--- 17 unchanged lines hidden (view full) ---

130 * Don't call error() here,
131 * because error calls getchr!
132 */
133 quit(QUIT_ERROR);
134 }
135#endif
136#if 0 /* allow entering arbitrary hex chars for testing */
137 /* ctrl-A followed by two hex chars makes a byte */
138 {
139 int hex_in = 0;
140 int hex_value = 0;
140 if (c == CONTROL('A'))
141 {
142 hex_in = 2;
143 result = 0;
144 continue;
145 }
146 if (hex_in > 0)
147 {

--- 9 unchanged lines hidden (view full) ---

157 hex_value = (hex_value << 4) | v;
158 if (--hex_in > 0)
159 {
160 result = 0;
161 continue;
162 }
163 c = hex_value;
164 }
141 if (c == CONTROL('A'))
142 {
143 hex_in = 2;
144 result = 0;
145 continue;
146 }
147 if (hex_in > 0)
148 {

--- 9 unchanged lines hidden (view full) ---

158 hex_value = (hex_value << 4) | v;
159 if (--hex_in > 0)
160 {
161 result = 0;
162 continue;
163 }
164 c = hex_value;
165 }
166 }
165#endif
166 /*
167 * Various parts of the program cannot handle
168 * an input character of '\0'.
169 * If a '\0' was actually typed, convert it to '\340' here.
170 */
171 if (c == '\0')
172 c = '\340';
173 } while (result != 1);
174
175 return (c & 0xFF);
176}
167#endif
168 /*
169 * Various parts of the program cannot handle
170 * an input character of '\0'.
171 * If a '\0' was actually typed, convert it to '\340' here.
172 */
173 if (c == '\0')
174 c = '\340';
175 } while (result != 1);
176
177 return (c & 0xFF);
178}