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