About: Source:Hack 1.0/hack.rumors.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 hack.rumors.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.rumors.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:Hack 1.0/hack.rumors.c
rdfs:comment
  • Below is the full text to hack.rumors.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.rumors.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 hack.rumors.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.rumors.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */ 2. 3. #include 4. #include "config.h" 5. #define CHARSZ 8 /* number of bits in a char */ 6. #define RUMORFILE "rumors" 7. extern long *alloc(); 8. extern char *index(); 9. int n_rumors = 0; 10. int n_used_rumors = -1; 11. char *usedbits; 12. 13. init_rumors(rumf) register FILE *rumf; { 14. register int i; 15. n_used_rumors = 0; 16. while(skipline(rumf)) n_rumors++; 17. rewind(rumf); 18. i = n_rumors/CHARSZ; 19. usedbits = (char *) alloc((unsigned)(i+1)); 20. for( ; i>=0; i--) usedbits[i] = 0; 21. } 22. 23. skipline(rumf) register FILE *rumf; { 24. char line[COLNO]; 25. while(1) { 26. if(!fgets(line, sizeof(line), rumf)) return(0); 27. if(index(line, ' ')) return(1); 28. } 29. } 30. 31. outline(rumf) register FILE *rumf; { 32. char line[COLNO]; 33. register char *ep; 34. if(!fgets(line, sizeof(line), rumf)) return; 35. if((ep = index(line, ' ')) != 0) *ep = 0; 36. pline("This cookie has a scrap of paper inside! It reads: "); 37. pline(line); 38. } 39. 40. outrumor(){ 41. register int rn,i; 42. register FILE *rumf; 43. if(n_rumors <= n_used_rumors || 44. (rumf = fopen(RUMORFILE, "r")) == NULL) return; 45. if(n_used_rumors < 0) init_rumors(rumf); 46. if(!n_rumors) goto none; 47. rn = rn2(n_rumors - n_used_rumors); 48. i = 0; 49. while(rn || used(i)) { 50. (void) skipline(rumf); 51. if(!used(i)) rn--; 52. i++; 53. } 54. usedbits[i/CHARSZ] |= (1 << (i % CHARSZ)); 55. n_used_rumors++; 56. outline(rumf); 57. none: 58. (void) fclose(rumf); 59. } 60. 61. used(i) register int i; { 62. return(usedbits[i/CHARSZ] & (1 << (i % CHARSZ))); 63. }
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