About: Source:NetHack 2.2a/pctty.c   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

Below is the full text to pctty.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/pctty.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code

AttributesValues
rdfs:label
  • Source:NetHack 2.2a/pctty.c
rdfs:comment
  • Below is the full text to pctty.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/pctty.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code
dcterms:subject
dbkwik:nethack/pro...iPageUsesTemplate
abstract
  • Below is the full text to pctty.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/pctty.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)pctty.c 2.1 87/11/09 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* tty.c - (PC) version */ 4. 5. /* With thanks to the people who sent code for SYSV - hpscdi!jon, 6. * arnold@ucsf-cgl, wcs@bo95b, cbcephus!pds and others. 7. */ 8. 9. #include 10. #include "hack.h" 11. #include "func_tab.h" 12. 13. static char erase_char, kill_char; 14. 15. /* 16. * Get initial state of terminal, set ospeed (for termcap routines) 17. * and switch off tab expansion if necessary. 18. * Called by startup() in termcap.c and after returning from ! or ^Z 19. */ 20. gettty(){ 21. erase_char = '\b'; 22. kill_char = 21; /* cntl-U */ 23. flags.cbreak = TRUE; 24. #ifdef DGK 25. disable_ctrlP(); /* turn off ^P processing */ 26. #endif 27. } 28. 29. /* reset terminal to original state */ 30. settty(s) char *s; { 31. end_screen(); 32. if(s) printf(s); 33. (void) fflush(stdout); 34. #ifdef DGK 35. enable_ctrlP(); /* turn on ^P processing */ 36. #endif 37. } 38. 39. 40. /* fatal error */ 41. /*VARARGS1*/ 42. error(s,x,y) char *s; { 43. end_screen(); 44. putchar(' '); 45. printf(s,x,y); 46. putchar(' '); 47. exit(1); 48. } 49. 50. /* 51. * Read a line closed with ' ' into the array char bufp[BUFSZ]. 52. * (The ' ' is not stored. The string is closed with a '\0'.) 53. * Reading can be interrupted by an escape ('\033') - now the 54. * resulting string is "\033". 55. */ 56. getlin(bufp) 57. register char *bufp; 58. { 59. register char *obufp = bufp; 60. register int c; 61. 62. flags.toplin = 2; /* nonempty, no --More-- required */ 63. for(;;) { 64. (void) fflush(stdout); 65. if((c = getchar()) == EOF) { 66. *bufp = 0; 67. return; 68. } 69. if(c == '\033') { 70. *obufp = c; 71. obufp[1] = 0; 72. return; 73. } 74. if(c == erase_char || c == '\b') { 75. if(bufp != obufp) { 76. bufp--; 77. putstr("\b \b"); /* putsym converts \b */ 78. } else bell(); 79. } else if(c == ' ') { 80. *bufp = 0; 81. return; 82. } else if(' ' <= c && c < '\177') { 83. /* avoid isprint() - some people don't have it 84. ' ' is not always a printing char */ 85. *bufp = c; 86. bufp[1] = 0; 87. putstr(bufp); 88. if(bufp-obufp < BUFSZ-1 && bufp-obufp < COLNO) 89. bufp++; 90. } else if(c == kill_char || c == '\177') { /* Robert Viduya */ 91. /* this test last - @ might be the kill_char */ 92. while(bufp != obufp) { 93. bufp--; 94. putstr("\b \b"); 95. } 96. } else 97. bell(); 98. } 99. } 100. 101. getret() { 102. cgetret(""); 103. } 104. 105. cgetret(s) 106. register char *s; 107. { 108. putsym(' '); 109. if(flags.standout) 110. standoutbeg(); 111. putstr("Hit "); 112. putstr(flags.cbreak ? "space" : "return"); 113. putstr(" to continue: "); 114. if(flags.standout) 115. standoutend(); 116. xwaitforspace(s); 117. } 118. 119. char morc; /* tell the outside world what char he used */ 120. 121. xwaitforspace(s) 122. register char *s; /* chars allowed besides space or return */ 123. { 124. register int c; 125. 126. morc = 0; 127. while((c = readchar()) != ' ') { 128. if(flags.cbreak) { 129. if(c == ' ') break; 130. if(s && index(s,c)) { 131. morc = c; 132. break; 133. } 134. bell(); 135. } 136. } 137. } 138. 139. static int last_multi; 140. 141. char * 142. parse() 143. { 144. static char inline[COLNO]; 145. register foo; 146. 147. flags.move = 1; 148. if(!Invisible) curs_on_u(); else home(); 149. multi = 0; 150. #ifdef DGK 151. while((foo = readchar()) >= '0' && foo <= '9') { 152. multi = 10*multi+foo-'0'; 153. if (multi < 0 || multi > LARGEST_INT) 154. multi = LARGEST_INT; 155. if (multi > 9) { 156. remember_topl(); 157. home(); 158. cl_end(); 159. printf("Count: %d", multi); 160. } 161. last_multi = multi; 162. } 163. # ifdef REDO 164. if (foo == DOAGAIN || in_doagain) 165. multi = last_multi; 166. else { 167. savech(0); /* reset input queue */ 168. savech(foo); 169. } 170. # endif 171. 172. #else /* DGK */ 173. 174. while((foo = readchar()) >= '0' && foo <= '9') 175. multi = 10*multi+foo-'0'; 176. 177. #endif /* DGK */ 178. 179. if(multi) { 180. multi--; 181. save_cm = inline; 182. } 183. inline[0] = foo; 184. inline[1] = 0; 185. if(foo == 'g' || foo == 'G'){ 186. inline[1] = getchar(); 187. #ifdef REDO 188. savech(inline[1]); 189. #endif 190. inline[2] = 0; 191. } 192. if(foo == 'm' || foo == 'M'){ 193. inline[1] = getchar(); 194. #ifdef REDO 195. savech(inline[1]); 196. #endif 197. inline[2] = 0; 198. } 199. clrlin(); 200. return(inline); 201. } 202. 203. char 204. readchar() { 205. register int sym; 206. 207. (void) fflush(stdout); 208. sym = getchar(); 209. if(flags.toplin == 1) 210. flags.toplin = 2; 211. return((char) sym); 212. } 213. #ifdef COM_COMPL 214. /* Read in an extended command - doing command line completion for 215. * when enough character have been entered to make a unique command. 216. * This is just a modified getlin(). -jsb 217. */ 218. get_ext_cmd(bufp) 219. register char *bufp; 220. { 221. register char *obufp = bufp; 222. register int c; 223. int com_index, index; 224. 225. flags.toplin = 2; /* nonempty, no --More-- required */ 226. 227. for(;;) { 228. (void) fflush(stdout); 229. if((c = readchar()) == EOF) { 230. *bufp = 0; 231. return; 232. } 233. if(c == '\033') { 234. *obufp = c; 235. obufp[1] = 0; 236. return; 237. } 238. if(c == erase_char || c == '\b') { 239. if(bufp != obufp) { 240. bufp--; 241. putstr("\b \b"); /* putsym converts \b */ 242. } else bell(); 243. } else if(c == ' ') { 244. *bufp = 0; 245. return; 246. } else if(' ' <= c && c < '\177') { 247. /* avoid isprint() - some people don't have it 248. ' ' is not always a printing char */ 249. *bufp = c; 250. bufp[1] = 0; 251. index = 0; 252. com_index = -1; 253. 254. while(extcmdlist[index].ef_txt != (char *) 0){ 255. if(!strncmp(obufp, extcmdlist[index].ef_txt, 256. strlen(obufp))) 257. if(com_index == -1) /* No matches yet*/ 258. com_index = index; 259. else /* More than 1 match */ 260. com_index = -2; 261. index++; 262. } 263. if(com_index >= 0){ 264. strcpy(obufp, 265. extcmdlist[com_index].ef_txt); 266. /* finish print our string */ 267. putstr(bufp); 268. bufp = obufp; /* reset it */ 269. if(strlen(obufp) < BUFSIZ-1 && 270. strlen(obufp) < COLNO) 271. /* set bufp at the end of our 272. * string 273. */ 274. bufp += strlen(obufp); 275. } else { 276. putstr(bufp); 277. if(bufp-obufp < BUFSZ-1 && bufp-obufp < COLNO) 278. bufp++; 279. } 280. } else if(c == kill_char || c == '\177') { /* Robert Viduya */ 281. /* this test last - @ might be the kill_char */ 282. while(bufp != obufp) { 283. bufp--; 284. putstr("\b \b"); 285. } 286. } else 287. bell(); 288. } 289. 290. } 291. #endif COM_COMPL
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software