/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<sys/param.h>#include<vm/vm.h>#include<machine/db_machdep.h>#include<ddb/db_sym.h>#include<ddb/db_extern.h>#include<dev/cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineISALPHA(c)(('a' <=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getline}{print$$1+$$2}'`-gt1024];*then*echo'hangmanistoobig!!!'*fi**/static__inlinesize_tdb_random__P((size_t));static__inlinechar*db_randomsym__P((size_t*));voiddb_hang__P((int,char*,char*));intdb_hangon__P((void));stat icintskill;static__inlinesize_tdb_random(mod)registersize_tmod;{returnarc4random()%mod;}static__inlinechar*db_randomsym(lenp)size_t*lenp;{registerchar*p,*q;/*chooserandomsymtab*/registerdb_symtab_tstab=db_istab(db_random(db_nsymtabs));/*chooserandomsymbolfromthetable*/q=db_qualify(X_db_isym(s tab,db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymtabnameiftherearelessthan3of'em*/if(db_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ignoringunderscoresandcolons*/for((*lenp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}staticcharhangpic[]="

88888\r

""976\r

""975\r

""9423\r

""92\ r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tries,word,abc)inttries;registerchar*word;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p<='9'){if(tries<=(*p)-'0')cnputc(substchar[(*p)-'0']);elsecnputc('');}elsecnputc(*p);}for(p=word;*p;p++)if(IS ALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('(');for(p=abc;*p;p++)if(*p=='_')cnputc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){staticsize_tlen;staticsize_ttries;staticchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if(word==NULL){registerchar*p;for(p=a bc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db_randomsym(&len);}{registercharc,c1;db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']=='-'){registerchar*p;registersize_tn;/*strchr(word,c)*/for(n=0,p=word;*p;p++)if(*p==c)n++;if(n){abc[c-'a']=c1; len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tries&&skill>2){registerchar*p=word;for(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc('

');word=NULL;return!tries;}voiddb_hangman(addr,haddr,count,modif)db_expr_taddr;inthaddr;db_expr_tcount;cha r*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[1]-'0';elseskill=5;while(db_hangon());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<sys/param.h>#include<vm/vm.h>#include<machine/db_machdep.h>#include<ddb/db_sym.h>#include<ddb/db_extern.h>#include<dev /cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineISALPHA(c)(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getline}{print$$1+$$2}'`-gt1024];*then*echo'hangmanistoobig!!!'*fi**/static__inlinesize_tdb_random__P((size_t));s tatic__inlinechar*db_randomsym__P((size_t*));voiddb_hang__P((int,char*,char*));intdb_hangon__P((void));staticintskill;static__inlinesize_tdb_random(mod)registersize_tmod;{returnarc4random()%mod;}static__inlinechar*db_randomsym(lenp)size_t*lenp;{registerchar*p,*q;/*chooserandomsymtab*/register db_symtab_tstab=db_istab(db_random(db_nsymtabs));/*chooserandomsymbolfromthetable*/q=db_qualify(X_db_isym(stab,db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymtabnameiftherearelessthan3of'em*/if(db_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ignoringunderscoresandcolons*/for((*lenp)=0,p=q ;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}staticcharhangpic[]="

88888\r

""976\r

""975\r

""9423\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tries,word,abc)inttries;registerchar*word;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p<= '9'){if(tries<=(*p)-'0')cnputc(substchar[(*p)-'0']);elsecnputc('');}elsecnputc(*p);}for(p=word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);e l se c nputc(* p ); c n putc('');cnputc('(');for(p=abc;*p;p++)if(*p=='_')cnputc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){staticsize_tlen; staticsize_ttries;staticchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if(word==NULL){registerchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-' ; * p = '\0';tries=2*(1+sk i ll/ 3 );word=db_randomsym(&len);}{registercharc,c1;db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']=='- '){registerchar*p;registersize_tn;/*strchr(word,c)*/for(n=0,p=word;*p;p++)if(*p==c)n++;if(n){abc[c-'a']=c1;len-=n;}else{ab c [c-'a']='_';trie s - - ;}}}if(tries&&len)return1;if ( ! t r ies&&skill>2){registerchar*p=word;for(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc('\ n');word=NULL;return!tries;}voiddb_hangman(addr,haddr,count,modif)db_expr_taddr;inthaddr;db_expr_tcount;char*modif;{i f ( m odi f [0]=='s'&&'0' < = modif[1]&&modif[1]<='9')skill=modif [ 1 ] -'0';elseskill=5;while(db_hangon());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<sys/param.h >#include<vm/vm.h>#include<machine/db_machdep.h>#include<ddb/db_sym.h>#include<ddb/db_extern.h>#include<dev/cons.h > #in clud e< dev/rndvar. h > #defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c ) - ' A'+'a':(c))#defineISALPHA(c)(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getlin e}{print$$1+$$2}'`-gt1024];*then*echo'hangmanistoobig!!!'*fi**/static__inlinesize_tdb_random__P((size_t));stati c __i nline ch ar *db_random s ym__P((size_t*));voiddb_hang__P((int,char*,cha r * ));intdb_hangon__P((void));staticintskill;static__inlinesize_tdb_random(mod)registersize_tmod;{returnarc4rando m()%mod;}static__inlinechar*db_randomsym(lenp)size_t*lenp;{registerchar*p,*q;/*chooserandomsymtab*/registerdb _ symt ab_t sta b = d b_istab(d b _random(db_nsymtabs));/*chooserandomsymbolfromthet a b le*/q=db_qualify(X_db_isym(stab,db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymtabnameifthereareles sthan3of'em*/if(db_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ignoringunderscoresandcolons*/for((*lenp)=0,p=q ; *p;p+ +)i f(IS A L P HA(*p))(* l enp)++;returnq;}staticcharhangpic[]="

88888\r

""976\ r \ n""975\r

""9423\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tries, word,abc)inttries;registerchar*word;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p < ='9') {if( tri es <= (*p)-'0') c nputc(subst char[(*p)-'0']);elsec nputc('');}elsecnputc(*p) ; } for(p=word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('(');fo r(p=abc;*p;p++)if(*p=='_')cnputc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){staticsize_t l en;st atic size _ tt r i es;stati c char*wo r d=NU LL;staticcharabc[26+ 1];/* for'\0'*/if(word==NULL) { r egisterchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db_randoms ym(&len);}{registercharc,c1;db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a ' ]=='- '){r egist e rcha r*p;regi s tersiz e_t n;/* str c hr(w ord, c)*/for(n =0, p=word ; *p;p++)if(*p==c)n++; i f(n){abc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tries&&skill>2 ){registerchar*p=word;for(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);c n putc( '

') ;word = NULL ; return!t r ies; }vo id db_han g m a n(a ddr, h ad d r , c o un t,m odif )db_e xpr_taddr;inthaddr; d b_expr_tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[1]-'0';else skill=5;while(db_hangon());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<s y s/par am.h> #inclu d e<v m / vm.h>#in c lud e< mac hine/ d b _ machdep.h>#include< d db / d b_sy m.h >#incl ude<ddb/db_exter n .h>#include<dev/cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a ':(c))#defineISALPHA(c)(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk' B EGIN{g etlin e}{pri nt $$1 + $$2}'`-gt 1 02 4] ; *then* e c ho'hangmanistoobig!!!'*fi** / s t at ic __in linesi ze_tdb_random_ _ P((size_t));static__inlinechar*db_randomsym__P((size_t*));voiddb_hang__P((int,char*,char*)); intdb_hangon__P((void));staticintskill;static__inlinesize_tdb_random(mod)registersize_tmod;{r e turnar c4ran dom()%m od ;}st atic__inli n e ch a r *db_ r a ndomsym(lenp)size_t*lenp;{registe r c h ar*p ,*q; /*choo serandoms y m t a b*/registerdb_symtab_tstab=db_istab(db_random(db_nsymtabs));/*chooserandomsymbolfromthetab le*/q=db_qualify(X_db_isym(stab,db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymtabn a meifth ereare lesstha n3 of'em */if(db_ns y mt a bs<3)w h ile(*q++!=':');/*strlen(q)&&ignoringu n d e r sco res andcolon s* / fo r ((* l enp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}staticcharhangpic[]="

88888\r

""976 \r

""975\r

""9423\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";v o iddb_h ang( tries,wor d, abc) i nttries;re g i s t erchar * word;registerchar*abc;{registerchar*p;for ( p = h an gpic ;*p;p++){if(*p> = ' 0'&&*p<='9'){if(tries<=(*p)-'0')cnputc(substchar[(*p)-'0']);elsecnputc('');}elsecnputc( *p);}for(p=word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc ( '');cn putc( '(');for( p=a bc ; * p;p++)if(*p = = '_ ')cnp u t c('a'+(p-abc));cnputc(')');cnputc('\r');}intd b _ han gon( void){staticsi z e_tlen;staticsize_ttries;staticchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if(word== NULL){registerchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skil l /3);w ord=db_ randomsy m(& len ) ;}{registerc h a r c,c1;d b _ hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1); i f (ISA LPHA (c)&&abc[c-' a ' ]=='-'){registerchar*p;registersize_tn;/*strchr(word,c)*/for(n=0,p=word;*p;p++)if(*p ==c)n++;if(n){abc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len)retu r n1;if (!tries &&skill>2 ){r egis terchar*p=wor d ; f or(;*p; p ++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_han g ( trie s,word ,abc);cnpu t c('

');word=NULL;return!tries;}voiddb_hangman(addr,haddr,count,modif)db_expr_taddr ;inthaddr;db_expr_tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9') s kill= modif[1 ]-'0';els esk ill= 5 ;while(db_han g o n());}/* $ OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyE x p $*/# include <sys/pa r a m.h>#include<vm/vm.h>#include<machine/db_machdep.h>#include<ddb/db_sym.h>#include< ddb/db_extern.h>#include<dev/cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<= ( c)&&(c )<='Z')? (c)-'A'+' a' :(c) ) #defineISALPHA ( c )(('a'< = ( c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_han g m an.o |awk'BEGIN{get l i ne}{print$$1+$$2}'`-gt1024];*then*echo'hangmanistoobig!!!'*fi**/static__inlinesi ze_tdb_random__P((size_t));static__inlinechar*db_randomsym__P((size_t*));voiddb_h a ng__P ((int,cha r*,char*)) ; intd b _hangon__P((void ) );static i ntskill;static__inlinesize_tdb_random(mod)registersize_ t m od;{r eturnarc4ran d o m()%mod;}static__inlinechar*db_randomsym(lenp)size_t*lenp;{registerchar*p,*q;/* chooserandomsymtab*/registerdb_symtab_tstab=db_istab(db_random(db_nsymtabs));/* c hooser ando m sym bolfromthe tab le* / q=db_qualify(X_db _ isym(stab , db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymt a b namei ftherearele s s than3of'em*/if(db_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ignoringunderscores andcolons*/for((*lenp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}staticch a rhangp ic[] ="

88 888\r

"" 97 6\r\ n"" 9 75 \ r \ n " " 9 4 23\r \ n ""92\r

" "910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";v o i ddb_h ang(tries,w o rd,abc)inttries;registerchar*word;regis t e rchar*abc;{registerchar*p;for(p=hang pic;*p;p++){if(*p>='0'&&*p<='9'){if(tries<=(*p)-'0')cnputc(substchar[(*p)-'0' ]);else cnput c (''); }elsecnp ut c(*p ) ; }for(p=w o r d;*p ; p + + ) i f(ISALPH A (*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('' ) ; cnputc(' (');for( p =abc;*p;p++)if(*p=='_')cnputc('a'+(p - abc ) );cnputc(')');cnputc('\r');}intdb_h angon(void){staticsize_tlen;staticsize_ttries;staticchar*word=NULL;staticch a rabc[26 +1];/*for'\ 0'*/if(wo rd ==N U LL){register char * p ; fo r ( p=abc;p< & abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);w o r d=db_rando m sym ( & len);}{registercharc,c1;db_hang(tri es,wor d,abc);c1=cngetc();c=TOLOWER(c1);i f(ISALPHA(c)&&abc[c-'a']=='-'){registerchar*p;registersize_tn;/*strchr(wor d ,c)*/for (n=0,p=word; *p;p++) if (* p ==c)n++;if(n) { a bc[c - 'a' ]=c 1 ; len-= n ; }else{abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!t r i es&&skill>2){r e g isterchar*p=word;for(;*p;p++)if(I S ALPHA( * p ))abc[TOLOWER(*p)-'a']=*p;}db_ha ng(tries,word,abc);cnputc('

');word=NULL;return!tries;}voiddb_hangman(ad d r,haddr ,count,modif )db_expr_ ta d d r;inthaddr;db_ e x pr_tc o unt;c ha r* m odi f ;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[ 1 ]-'0';elseskil l = 5;while(db_hangon());}/*$OpenBSD : db_hang m a n.c,v1.142000/04/0521:54:48mick eyExp$*/#include<sys/param.h>#include<vm/vm.h>#include<machine/db_machde p.h>#incl ude<ddb/db_s ym.h>#in cl u de<ddb/db_extern. h>#incl u d e<dev /c o n s . h > #include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')? ( c )-'A'+'a':(c) ) #defineISALPHA(c)(('a'<=(c)&&(c) < ='z')|| (' A '<=(c)&&(c)<='Z'))/**if[`sized b_hangman.o|awk'BEGIN{getline}{print$$1+$$2}'`-gt1024];*then*echo'hang m anistoobig! !!'*fi**/sta tic__in l inesize_tdb_ran d om __P((size_ t )); stat ic _ _ i n linecha r *db_r andomsym__P((size_t*));voiddb_hang__P((int,char* , c har*));intdb_ h angon__P((void));staticintskill ; static__ i n l inesize_tdb_random(mod)regist ersize_tmod;{returnarc4random()%mod;}static__inlinechar*db_randomsym( l enp)size_t * l enp;{registe rchar * p,*q;/*chooseran d om symtab*/regi ste rd b_sym t ab _ ts t a b=db_ istab( d b_random(db_nsymtabs));/*chooserandomsymbolfro m thetable*/q=d b _qualify(X_db_isym(stab,db_ran d om(X_db_n s y m s(stab))),stab->name);/*don' tshowsymtabnameiftherearelessthan3of'em*/if(db_nsymtabs<3)while(*q++ ! =':');/*strl en(q)&&ignor in gu nderscoresandcolons*/ for((*lenp)=0 ,p=q; *p; p++)i f( ISALPHA(*p) )(*len p )++;returnq;}staticcharhangpic[]="

88888\r\ n ""976\r

""97 5 \r

""9423\r

""92\r

""910\r \ n""9\r

" "9 " ;staticcharsubstchar[]="\\/| \\/O|/-|";voiddb_hang(tries,word,abc)inttries;registerchar*word;reg i sterchar*abc;{re gisterchar *p;for(p=hangpic;*p;p++ ){if(*p>='0'&& *p<='9') {if(tr ies<=(*p)-'0' )cnpu t c ( substchar[(*p)-'0']);elsecnputc('');}elsecn p utc(*p);}for ( p=word;*p;p++)if(ISALPHA(*p)) c nputc(abc[ TO L OWER(*p)-'a']);elsecnputc(* p);cnputc('');cnputc('(');for(p=abc;*p;p++)if(*p=='_')cnputc('a'+( p-abc));cnputc(')' );cnput c('\r');}intdb_hangon(voi d){staticsize_t len;staticsize_ttries;stat icchar *wo r d=NULL;staticcharabc[26+1];/*for'\0'*/if(wo r d==NULL){reg i sterchar*p;for(p=abc;p<&abc[ s izeof(abc) -1 ] ; p++)*p='-';*p='\0';tries=2 *(1+skill/3);word=db_randomsym(&len);}{registercharc,c1;db_hang(t r ies,word,abc);c1=cng etc ();c=TOLOWER(c1);if(ISALP HA(c)&&abc[c-'a'] =='-'){registerchar*p;regi stersi ze_tn ; /*strchr(word,c)*/for(n=0,p=word;*p;p++)if ( * p==c)n++;i f (n){abc[c-'a']=c1;len-=n;}el s e {abc[c-'a ']= ' _ ';tries--;}}}if(tries&&le n)return1;if(!tries&&skill>2){registerchar*p=word;for(;*p;p++)if ( ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(trie s,word,abc);cnput c('

');word=NULL;return!t ries;}v oiddb _ hangman(addr,haddr,count,modif)db_expr_tad d r;inthaddr; d b_expr_tcount;char*modif;{i f (modif[0]== 's' & &'0'<=modif[1]&&modif[1]< ='9')skill=modif[1]-'0';elseskill=5;while(db_hangon());}/*$Open B SD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$ */#include<sys/pa ram.h>#include<vm/vm.h>#in clude<m achine/d b _machdep.h>#include<ddb/db_sym.h>#include < ddb/db_ext e rn.h>#include<dev/cons.h>#i n clude<dev/rn dv ar .h>#defineTOLOWER(c)(('A '<=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineISALPHA(c)(('a'<=(c)& & (c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangm an.o|awk'BEGIN{g etline}{print$$1+$$2}'`-gt 1024]; *then*echo ' hangmanistoobig!!!'*fi**/static__inlines i ze_tdb_rand o m__P((size_t));static__inl i nechar*db_ra ndo m s ym__P((size_t*));voiddb _hang__P((int,char*,char*));intdb_hangon__P((void));staticint s kill;static__inlinesize_tdb_random(mod)registersize _tmod;{returnarc4 random()%mod;}static__inli nechar* db_randomsy m (lenp)size_t*lenp;{registerchar*p,*q;/* c hooserando m symtab*/registerdb_symtab_ t s tab=db_ista b(d b_ r andom(db_nsymtabs));/* chooserandomsymbolfromthetable*/q=db_qualify(X_db_isym(stab,d b_random(X_db_nsyms(stab))),stab->name);/*don'tshow symtabnameifthere arelessthan3of'em*/if(db_n symtabs<3 )while(*q+ + ! =':');/*strlen(q)&&ignoringunderscoresa n dcolons*/ f or((*lenp)=0,p=q;*p;p++)if ( I SALPHA(*p))( *le np )++;returnq;}staticcha rhangpic[]="

88888\r

""976\r

""975\r

""9423\r

""92\r

" "910\r

""9\r

""9";staticch ar s ubstc har[]="\\/|\\/O| /-|";voiddb_hang (tries,word,abc)inttries;r egisterchar *word;regi s t erchar*abc;{registerchar*p;for(p=hangp i c;*p;p++ ) { i f(*p>='0'&&*p<='9'){if(tri e s<=(*p)-'0') cnpu tc (substchar[(*p)-'0']) ;elsecnputc('');}elsecnputc(*p);}for(p=word;*p;p++)if(ISALP H A(*p))cnputc(abc[TOLOWER(*p )-'a']);e lsecnputc(*p);c nputc('');cnputc( '(');for(p=abc;*p;p++)if(* p=='_')cnputc( 'a'+(p-a b c ));cnputc(')');cnputc('\r');}intdb_han g on(void){ s taticsize_tlen;staticsize_ t tries;static char *w o rd=NULL;staticcharab c[26+1];/*for'\0'*/if(word==NULL){registerchar*p;for(p=abc; p<&abc[sizeof(abc)-1];p++)* p='-';*p='\ 0';tries=2*(1+ skill/3);word=db_ randomsym(&len);}{regist e r charc , c 1 ;db_ha ng(tries ,wo r d,abc);c1=cngetc();c=TOLOWER(c1);if( I SALPHA(c) & &abc[c-'a']=='-'){register c har*p;registe rsiz e_ tn;/*strchr(word,c)* /for(n=0,p=word;*p;p++)if(*p==c)n++;if(n){abc[c-'a']=c1;le n -=n;}else{abc[c-'a']='_';t ries--;}}}if (tries&&len)r eturn1;if(!tries& &skill>2){registerchar*p=w ord;fo r( ; * p;p++)i f(ISAL PHA( * p))abc[TOLOWER(*p)-'a']=*p;}db_hang ( tries,wor d ,abc);cnputc('

');word=NU L L;return!trie s;}v oi d db_hangman(addr,had dr,count,modif)db_expr_taddr;inthaddr;db_expr_tcount;char* modif;{if(modif[0]=='s'&& '0'<=modif[1]& &m o dif[1]<='9 ')skill=modif[1]- '0';elseskill=5;while(db_ hangon()); }/ *$OpenBS D:db _hang m an.c,v1.142000/04/0521:54:48mickey E x p$*/#inc l ude<sys/param.h>#include<v m /vm.h>#includ e<mac hi ne/db_machdep.h>#in clude<ddb/db_sym.h>#include<ddb/db_extern.h>#include<dev/ c ons.h>#include<dev/rndv ar.h>#def i n e TO L OW ER(c)(('A'< =(c)&&(c)<='Z')?( c)-'A'+'a':(c))#defineIS ALPHA(c)((' a'<=( c )& &(c) <='z ')||(' A '<=(c)&&(c)<='Z'))/**if[`sizedb_ h a ngman.o| a wk'BEGIN{getline}{print$$1 + $$2}'`-gt1024] ;*th en* echo'hangmanistoob ig!!!'*fi**/static__inlinesize_tdb_random__P((size_t));s t atic__inlinechar*db_ran domsym__ P ((size_ t * ) );voiddb_ha ng__P((int,char*, char*));intdb_hangon__P ((void));stat icintsk ill; stat ic__in l i nesize_tdb_random(mod)register s i ze_tmod; { returnarc4random()%mod;}st a tic__inlinecha r*db _r a n domsym(lenp)size_ t*lenp;{registerchar*p,*q;/*chooserandomsymtab*/registe r db_symtab_tstab=db_ista b(db_ran d om(db_nsym t a bs));/*cho oserandomsymbol f r omthetable*/q=db_qual ify(X_db_isym(sta b,db_ r a ndo m(X_ db_nsym s ( stab))),stab->name);/*don't s h o wsymtab n ameiftherearelessthan3of'em * /if(db_nsymtab s<3)w hil e(*q++!=':');/*st rlen(q)&&ignoringunderscoresandcolons*/for((*lenp)=0,p= q ;*p;p++)if(ISALPHA(*p ))(*len p ) ++;returnq;}s t a ticcharh angpic[]="

88 88 8 \r

""976\r

""975\r\ n""9423\r

""92\r

" " 9 1 0 \ r

"" 9\r

""9"; s t aticcharsubstchar[]="\\/|\ \ / O |/-|"; v o iddb_hang(tries,word,abc)in t tries;registerc har*w or d ;registerchar*ab c;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p< ='9'){if(tries<=(*p)- '0')cnp u t c(substchar[(* p ) -'0']);e lsecnputc('') ;}elsecnputc(*p);}for(p=w ord;*p;p++)if(ISALPHA(*p )) cnputc (a bc[TOLO WE R (*p)-'a']);elsecnputc( * p) ; c nputc(' ' );cnputc('(');for(p=abc;*p; p ++)if(*p=='_')c nputc ('a '+(p-abc));cnput c(')');cnputc('\r');}intdb_hangon(void){staticsize_tlen ;staticsize_ttries;st aticch a r *word=NULL;stat i ccharabc[ 26+1];/*for' \ 0 '*/if(word==NULL){regis tercha r *p;for(p=abc;p<&abc[ si zeof( ab c)-1];p+ + ) *p='-';*p='\0';trie s =2*( 1 + skill/ 3 );word=db_randomsym(&len);}{ registercharc,c1; db_h an g ( tries,word,abc) ;c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']==' -'){registerchar*p;r egister s ize_tn;/*strchr(w o r d,c)*/f or(n=0,p=wo rd;*p;p++)if(*p==c)n++;if( n){ab c[c-'a' ] = c1;len-=n;}els e{a bc[c -' a']='_' ;t r i es--;}}}if(tr i es & &len) r e turn1; i f(!tries&&skill>2){registerc har*p=word;for(; *p;p+ +)if (ISALPHA(*p))ab c[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc( '

');word=NULL;retur n!tries ; }voiddb_hangman(a d dr,haddr ,count,modi f)db_expr_taddr;inthaddr; db_e xpr_tcount;c har*modif;{if( mo dif[0 ]== 's'&&' 0' < = mo dif[1] && m odif[1]<= '9 ' )ski l l =modif[1]-'0';elseskill=5;wh i le(db_hangon()); }/*$Op en B S D:db_hangman.c ,v1.142000/04/0521:54:48mickeyExp$*/#include<sys/param . h>#include<vm/vm.h> #includ e <machine/db_machde p . h>#incl ude<ddb/db_ sym.h>#include<ddb/db_ex tern .h>#include<dev/ cons.h>#includ e <dev /rn dvar.h > #d e f ineTOLOWER(c)(('A' < = (c)&& ( c )<='Z')?(c)-'A'+'a':(c))#def i neISALPHA(c)(('a '<=(c)& &( c )<='z')||('A'< =(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getl ine}{print$$1+$$2}' `-gt102 4 ];*then*echo'hangma n i stoobi g!!!'*fi**/ static__inlinesize_tdb_ra ndom __P((size_t));static __inlinechar*db_r an domsy m_ _ P ( ( size_t*));voiddb _ h ang__P ( (int,char*,char*));intdb_hang o n__P((void));stat icints ki l l ;static__inli nesize_tdb_random(mod)registersize_tmod;{returnarc4ran dom()%mod;}static__ inline c har*db_randomsym(lenp )size_t *lenp;{reg isterchar*p,*q;/*choosera ndom symtab*/registerdb_sym tab_tstab=db_ista b( db_r a n d o m(d b _nsymtabs)); /* ch ooser a ndomsymbolfromthetable*/q=db_q u alify(X_db_isym(s tab,db _ra n d om(X_db_nsym s(stab))),stab->name);/*don'tshowsymtabnameifthereare l essthan3of'em*/if(d b_nsy m tabs<3)while(*q++!=':' ) ;/*str len(q)&&ig noringunderscoresandcolon s*/ for((*lenp)=0,p=q;*p;p++) if(ISALPHA(*p))( *l enp)+ + ; r etur n q;}static ch ar hang p i c[]="

88888\r

""976\r

""975\ r

""9423\r

""92\ r

""9 10\ r\ n""9\r

""9" ;staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tri e s,word,abc)inttrie s;regi s terchar*word;registerc h ar*abc ;{register char*p;for(p=hangpic;*p; p++ ){if(*p>='0'&&*p<='9'){if( tries<=(*p)-'0') cn putc(s u bs tchar [( *p)- '0 '] );el s e cnputc('');}elsecnputc(*p);}for(p =word;*p;p++)if(IS ALPHA(* p)) c nputc(abc[TO LOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('(') ; for(p=abc;*p;p++) if(*p= = '_')cnputc('a'+(p-abc)) ; cnputc (')');cnp utc('\r');}intdb_hangon( voi d){staticsize_tlen;staticsi ze_ttries;staticc ha r*word = N UL L;sta tic c ha ra b c [ 2 6 +1];/*for'\0'*/if(word==NULL){reg i sterchar*p;for(p= abc;p<&a bc[ s i zeof(abc)-1 ];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db_rand o msym(&len);}{regi sterc h arc,c1;db_hang(tries,wor d ,abc); c1=cngetc ();c=TOLOWER(c1);if(ISAL PH A(c)&&abc[c-'a' ] =='-') { regist erchar*p;register si ze_tn; / * s tr chr(word , c) * / for(n=0,p=word;*p;p++)if(*p==c)n++;i f (n){abc[c-'a']=c1; len-=n; }el se {abc[c-'a'] ='_';tries--;}}}if(tries&&len)return1;if(!tries&&skil l >2){registerchar* p=wor d ;for(;*p;p++)if(ISALPHA( * p))ab c[TOLOWER( *p)-'a']=*p;}db_hang(tr ie s,word, abc);cnpu t c ( ' \ n' ); wo r d =NU LL;return!tries ;}v oid d b_ ha ng m an( addr,ha d d r ,count,modif)db_expr_taddr;inthadd r ;db_expr_tcount;cha r*modif ;{if ( m odif[0]==' s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[1]-'0';e l seskill=5;while( db_ha n gon());}/*$OpenBSD:db_han g man.c ,v1.1420 00/04/0521:54:48mickeyExp $* /#incl ude<sys/p a r am.h>#includ e < vm /vm.h>#include <ma chi ne /d b_m achd ep.h>#inclu d e < ddb/db_sym.h>#include<ddb/db_e xtern.h>#include<dev /cons.h >#in c l ude<dev/rn dvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A' + 'a':(c))#defineI SALP H A(c)(('a'<=(c)&&(c)<='z')| | ('A'< =(c)&&(c )<='Z'))/**if[`sizedb_ha ng man.o| a wk 'BEGI N { getline}{print$$ 1 + $ $2}'`-gt1024]; *th e n*ec ho 'h angm an ist oobi g! !!'* f i * */static__inlinesize_tdb_ r andom__P((size_t)); static__i nli ne char*db_ra ndomsym__P((size_t*));voiddb_hang__P((int,char*,char* ) );intdb_hangon_ _P((v o id));staticintskill;static _ _inli nesize_t db_random(mod)registersi ze _tmo d;{return a r c4random()%mod;}st a t i c__inlinechar *db_ r andom s ym( lenp)si z e_t *l enp;{regist e r c har*p,*q;/*chooser andomsymtab*/register db_symta b_ts t a b=db_ista b(db_random(db_nsymtabs));/*chooserandomsymbolfromthe t able*/q=db_qual ify( X _db_isym(stab,db_random(X_d b _nsym s(stab)) ),stab->name);/*don'tsh ow symt abnameif t h erearelessthan3of'em* / i f (db_nsymtabs <3)w hi le(* q+ +!= ':');/*strlen(q)&&ignoringund er s c o resandco l ons*/for((*lenp)=0,p=q ;*p;p++) if(I S A LPHA(*p)) (*lenp)++;returnq;}staticcharhangpic[]="

88888\r

"" 9 76\r

""975\r

""9 4 23\r

""92\r

""910\r

""9\r \ n""9 ";static charsubstchar[]="\\/|\\ /O| /-| "; v oiddb _ hang(tries,word,abc)int t r i es;registercha r*w o rd;r eg iste rchar*abc;{re gisterchar*p ;for(p=hangpic;*p ;p++){if(*p>='0'&&*p< ='9'){if( trie s < =(*p)-'0' )cnputc(substchar[(*p)-'0']);elsecnputc('');}elsecnpu t c(*p);}for(p=w ord; * p;p++)if(ISALPHA(*p))cnputc( a bc[T OLOWER(* p)-'a']);elsecnputc(*p) ;c nput c(''); c n putc('(');for(p=abc;*p;p ++) i f(*p=='_')cn put c(' a'+( p- abc ));cnputc(' )');cnpu t c(' \ r');} i ntdb_hangon(void){staticsize_tlen ;staticsi ze_tt r i es;stati cchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if(wor d ==NULL){regist erc h ar*p;for(p=abc;p<&abc[sizeof( a bc)- 1];p++) *p='-';*p='\0';tries=2* (1+ ski ll/3); w o rd=db_randomsym(&len);}{r egis t ercharc,c1;d b_h an g(tri es ,wo rd,abc);c1= cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']==' -'){regis terch ar *p;regis tersize_tn;/*strchr(word,c)*/for(n=0,p=word;*p;p++)if ( *p==c)n++;if(n ){ a bc[c-'a']=c1;len-=n;}else{abc[ c -'a' ]='_';t ries--;}}}if(tries&&len )r etu rn1;if ( ! tries&&skill>2){registerch ar*p = word;for(;*p ;p+ +) if(IS AL PHA (*p))abc[TOL OWER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc( '

');word =NULL ; r e turn!tr ies;}voiddb_hangman(addr,haddr,count,modif)db_expr_ta d dr;inthaddr;db _e x pr_tcount;char*modif;{if(modif [ 0]== 's'&&'0 '<=modif[1]&&modif[1]< =' 9')s kill= m o dif[1]-'0';elseskill=5;whil e(db_ h angon());}/* $Op e nBSD:d b_ han gman.c,v1.14 200 0/ 04/0521:54:48mickeyExp$*/#include<sys/param .h>#includ e<vm/ v m . h>#incl ude<machine/db_machdep.h>#include<ddb/db_sym.h>#inclu d e<ddb/db_exte rn . h>#include<dev/cons.h>#include< d ev/r ndvar. h>#defineTOLO W ER(c)(('A '< =(c )&&(c) < ='Z')?(c)-'A'+'a':(c))#defi neISALP H A(c)(('a'<= (c) && (c)<=' z ')|| ('A'<=(c)&&(c )<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{get line}{print$ $1+$ $2 } '`-gt10 24];*then*echo'hangmanistoobig!!!'*fi**/static__inline size_tdb_ran do m __P((size_t));static__inlinechar *db_ randoms ym__P((size_t * ));voiddb _ hang __P(( i nt,char*,char*));intdb_hango n__P((vo id));static int sk ill;st at ic_ _inlinesize_t db_random(mod)registersize_tmod;{returnarc4ra ndom()%mod; }stati c _ _inline char*db_randomsym(lenp)size_t*lenp;{registerchar*p,*q; /*chooserand om s ymtab*/registerdb_symtab_tstab= d b_ist ab(db_ random(db_ nsy mtabs));/ *c hoo seran d omsymbolfromthetable*/q=db_qu alify(X_ d b_isym(sta b,d b_r andom( X _db_ nsyms(stab)) ),stab->name);/*don'tshowsymtabnameifther e a relessthan3of 'em*/ if ( d b_nsym tabs<3)while(*q++!=':');/*strlen(q)&&ignoringunderscor esandcolons */ f or((*lenp)=0,p=q;*p;p++)if(ISALP H A(*p ))(*le np)++;retu rnq; }staticch a rhan gpic [ ]="

88888\r

""976\r

""975\r

""9423 \ r

""92\r\ n"" 91 0\r

"" 9\ r

""9";staticc h a rsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tr ies,word,abc )intt ri e s ;regis terchar*word;registerchar*abc;{registerchar*p;for(p=ha ngpic;*p;p+ + ) {if(*p>='0'&&*p<='9'){if(tries<=( * p)-'0 ')cn putc(substc har[ (*p)-'0' ]) ;el secnp u tc('');}elsecnputc(*p);}for(p= word;*p ; p+ +)if(ISAL PHA( *p ))cnput c (abc [TOLOWER(*p) -'a']); e lsecnputc(*p);cnputc('');c n put c ('( ');for(p=abc; *p;p++ ) i f (*p==' _')cnputc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb _hangon(vo id ) {staticsize_tlen;staticsize_ttrie s ;sta ticch ar*word=NUL L;st aticcha ra bc[ 26+1] ; /*for'\0'*/if(word==NULL){regis terchar* p; f or(p=abc ;p<& ab c[sizeo f( abc )-1];p++)*p=' -';*p='\0';tries=2*(1+skill/3);word=d b_ r andomsym(&len) ;}{re gi st erchar c,c1;db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1) ;if(ISALP HA ( c)&&abc[c-'a']=='-'){registerchar* p ;reg iste rsize_tn;/* strc hr(word, c) */f or(n = 0,p=word;*p;p++)if(*p==c)n++;if( n){abc[c -'a ']=c1;le n-=n ;} else{abc [ c-' a']='_';tries- -;}}}if(tries&&len)return1;if(! t ries& &skill>2){regist erchar * p= word;f or(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_ h ang(trie s , word,abc);cnputc('

');word=NULL;re t urn! trie s;}voiddb_ hangm an(addr, h add r,cou n t,modif)db_expr_taddr;inthaddr; db_expr_t cou n t;char* modi f; {if(modi f[ 0]= ='s'&&'0'<=mo dif[1]&&modif[1]<='9')skill=modi f [1] -'0';elseskill=5; while( d b_ h angon ());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mi ckeyExp$ */ # include<sys/param.h>#include<vm/vm. h >#in clu de<machine /db_ma chdep.h ># inc lude < ddb/db_sym.h>#include<ddb/db_exte rn.h>#in clud e<dev/c ons.h > #include <d ev/ rndvar.h>#defi neTOL O WER(c)(('A'<=(c)&&(c)<='Z ' )?( c)-'A'+'a':(c))#d efineI SA L P HA(c) (('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`si z edb_ha ngm a n.o|awk'BEGIN{getline}{print$$1+$$2} ' `-gt 102 4];*then*e cho'ha ngmanis to obi g!!! ' *fi**/static__inlinesize_tdb_rand om__P((s ize_ t ));sta tic__ in linechar * db_r andomsym__P(( size_t*));voiddb_hang__P((int,cha r*,char*));intdb_h angon__ P (( v oid)) ;staticintskill;static__inlinesize_tdb_random(mod)re g istersi ze _ tmod;{returnarc4random()%mod;}static_ _ inl ine char*db_ra ndomsym (lenp)s i ze_ t*le n p;{registerchar*p,*q;/*chooserand omsymtab* /regi sterdb_ symt ab _tstab=d b_ ist ab(db_random(d b _ nsymtabs));/*chooserandomsym bo l fromthetable*/q=d b_qual ify ( X _db_i sym(stab,db_random(X_db_nsyms(stab))),stab->name);/ * don'tsh ows ymtabnameiftherearelessthan3of'em*/if( d b_n sym tabs<3)whi le(*q++ !=':') ;/ *s trlen ( q)&&ignoringunderscoresandcolons*/ for((*le np)=0 ,p=q;*p ;p++ )i f(ISALPHA ( *p) )(*lenp)++;retu rnq;}static ch ar h angpic[]="

8 8888\r

""976\r

""97 5\r

""9 42 3\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[] = "\\/|\\/ O| / -|";voiddb_hang(tries,word,abc)inttri e s;re gi sterchar*w ord;regi sterch a r*a bc;{ r egisterchar*p;for(p=hangpic;*p;p++) {if(*p>= '0'&& * p<='9' ){if (t ries<=(*p )- '0' )cnputc(substcha r[(*p)-'0']);el s ecnputc( '');}elsecnputc(*p);}fo r(p=wo rd; *p ;p++) if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsec n putc(*p); c n putc('');cnputc ( '(') ; for(p=abc;*p;p++) i f(*p == '_')cnput c('a'+(p- abc)) ;c np utc(' )');cnputc('\r');}intdb_hangon(void) {statics ize_t l en;sta tics iz e_ttries; st ati cchar*word=NULL;stati c c harabc[26+ 1];/*for'\0'*/if(word==NULL){r egiste rc har *p;fo r(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0' ; tries=2*( 1+ skill/3);word = d b_rando m sym(&len);}{reg i s terc ha rc,c1;db_ han g( tri es,wor d ,ab c);c 1 =cngetc();c=TOLOWER(c1);if(ISALPHA( c)&&abc[c -'a']= ='-'){r egis t erchar*p; re gist ersize_tn;/*strchr(word,c )* /for(n=0,p=word;*p;p++)if(*p==c)n++ ;if(n) {a bc[ c-'a' ]=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if( t ries&&len )r e turn1;if(!t r i es&&skill> 2 ){registerchar * p =wor d ;for(;*p;p ++ )if( IS ALPHA (* p)) abc [ TOLOWER(*p)-'a']=*p;}db_hang(tries,w ord,abc); cnput c ( '

') ;wor d= NULL;retur n! trie s;}voiddb_hangman(addr,haddr,count,modif)db_expr_taddr;inthad dr;db_ ex pr_ tcoun t;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]& & modif[1]< =' 9 ')skill=mod i f[1]-'0';else s kill=5;while( d b _han g on());}/* $Op enBS D: db_ha n gma n.c , v 1.142000/04/0521:54:48mickeyExp$*/#in clude<sys /para m .h>#in clud e< vm/vm.h># in clud e<machine/db_machdep.h>#include<ddb/db_sym.h>#include<ddb/db _exter n. h>#i n clud e<dev/cons.h>#include<dev/rndvar.h>#defineTOL O WER(c)((' A' < =(c)&&(c)<= ' Z')?(c)-'A'+'a ' :(c))#defineI S A LPH A (c)(('a'< =(c )&&(c )< ='z') | |( 'A'< = (c)&&(c)<='Z'))/**if[`sizedb_hangman.o |awk'BEGI N{get l ine}{pr in t$$ 1+$$2}'`- gt 1024] ;*then*echo'hangmanistoobig!!!'*fi**/static__inlinesize_td b_rando m_ _P(( s ize_ t));static__inlinechar*db_randomsym__P((size _t*));voidd b _ h ang__P((in t ,ch a r*, c har*));i ntdb_hangon__ P ( (void));stati ci ntskil l; stat ic __ inli n esize_tdb_random(mod)registersize_tmod ;{returna rc4ran d om()%m od; }s tatic__in lin echar *db_randomsym(lenp)size_t*lenp;{registerchar*p,*q;/*choo serando msy mta b * /reg isterdb_symtab_tstab=db_istab(db_random(db_ nsymtabs));/* c hooserand o msymb o lf r o mthetabl e */q=db_qual i f y(X_db_isym(s tab ,db_ra nd om(X _ db_ nsym s(stab))),stab->name);/*don'tshowsymtab nameifthe rearel e ssthan 3of 'e m*/if(db_ nsy mtabs< 3)while(*q++!=':');/*strlen(q)&&ignoringunderscoresand colons*/ for ((*l e np)= 0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;retu rnq;}staticch a rhangpic[ ] ="

8 8 8 8 8 \ r \ n""976\ r

""975\r

" " 9423\r

""92\ r\ n""910\ r

"" 9\ r\ n""9 " ;staticcharsubstchar[]="\\/|\\/O|/-|";v oiddb_han g(tries ,word, abc )i nttries;re gi sterch ar*word;registerchar*abc;{registerchar*p;for(p=hangpic ;*p;p++) {i f(*p > = '0'& &*p<='9'){if(tries<=(*p)-'0')cnputc(subst char[(*p)-'0'] ) ;elsecnp u tc('') ; } e l s e c nputc(* p );}for(p=w or d ;*p;p++)if(I SA LPHA(*p) ) cnpu tc ( abc[T OLOWER(*p)-'a']);elsecnputc(*p);cnputc(' ');cnputc ('(');f o r(p=a bc;* p; p++)if(*p == '_')cn putc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_ha ngon(void ){s tatic s ize_ tlen;staticsize_ttries;staticchar*word=N ULL;staticchar a bc[26+1] ; /*for'\0 ' * / i f (word==N U LL){regis ter c har*p;for(p =ab c;p<&abc [ size o f( abc) - 1];p++)*p='-';*p='\0';tries=2*(1+skill/3 );word=db _random s ym(&le n); }{ registerc ha rc,c1;d b_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if (ISALPH A(c)& &abc[c -'a' ]=='-'){registerchar*p;registersize_tn; /*strchr(word, c )*/for(n = 0,p=word;* p;p ++)if(*p= = c)n++;if( n){ a bc[c-'a']=c 1;l en-=n;}e l se{ ab c[ c-'a ' ]='_';tries--;}}}if(tries&&len)return1;i f(!tries& &skill> 2 ) {regi ste rc har*p=wor d;f or(;*p ;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_ha ng(tries, wor d,abc) ;cnpu tc('

');word=NULL;return!tries;}voidd b_hangman(addr, h addr,co u nt,modif)db_expr_taddr; inthaddr; db_e x pr_tcount; cha r*mod i f; {i f(m o dif [0 ] = ='s'&&'0'<=modif[1]&&modif[1]<='9')skill= modif[1]-' 0';els e s kill=5 ;wh i le(db_han gon ());}/* $OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mi ckeyExp$*/# inc lude<s ys/pa ram.h>#include<vm/vm.h>#include<machi ne/db_machdep.h > #include < ddb/db_sym.h>#include< d db/db_ext ern . h >#include< de v/con s.h > # inc lu de <dev / rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c) <='Z')?(c) -'A'+'a' :(c))# def in eISALPHA (c) (('a'<= (c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`si zedb_hangm an.o |awk'B E GIN{g etline}{print$$1+$$2}'`-gt1024];*the n*echo'hangmani s toobig!! ! '*fi**/static__inlinesi z e_tdb_ra ndom _ _P((size_t )); stat ic__ i n lin ec h ar*d b _randomsym__P((size_t*));voiddb_hang__P((i nt,char*,c har*)) ; i ntdb_h ang on __P((voi d)) ;statici ntskill;static__inlinesize_tdb_random(mod) r e gistersize _tmo d;{ret u r narc4 random()%mod;}static__inlinechar*db _randomsym(lenp ) size_t*l e np;{registerchar*p,*q;/* chooseran doms y mtab*/reg ist erdb_ sym ta b _ts t ab =db_ i stab(db_random(db_nsymtabs));/*chooserando msymbolfro mthetab l e * /q=d b_q ual ify(X_ db_i sym(stab ,db_random(X_db_nsyms(stab))),stab->name) ;/*don'tshows ymt abnameif t herea relessthan3of'em*/if(db_nsymtabs< 3 )while(*q++!=':' ) ;/*strl e n(q)&&ignoringunderscore s andcolon s*/f o r ((*lenp)= 0, p=q; *p;p+ +) i f( IS AL PHA ( *p))(*lenp)++;returnq;}staticcharhangpic[]= "

88888\r

""976 \ r

""97 5\r

" "9423 \r\ n""92\r

" "910\r

""9\r

""9";staticcharsubstcha r[]="\\/|\\/O| /-| ";voiddb_ hang(t ries,word,abc)inttries;registerc h ar*word;register c har*abc ; {registerchar*p;for(p=han g pic;*p; p ++){ i f (*p>='0' &&* p<=' 9'){if ( t ri e s< =(*p ) -'0')cnputc(substchar[(*p)-'0']);elsecnputc ('');}else cnputc( * p ); }for (p= wor d;*p; p++ )if(ISALPHA (*p))cnputc(abc[TOLOWER(*p)-'a']);e lsecnputc(*p);c npu tc('');cn p utc('( ');for(p=abc;*p;p++)if(*p=='_') c nputc('a'+(p-abc) ) ;cnputc (')');cnputc('\r');}intdb _ hangon(v oid) {s t aticsiz e_tl en; static si z e _t tr ies ; staticchar*wor d = N ULL ; s t aticcharabc[26+1];/*f or'\0'*/if( word== N U L L ){reg ist er char* p;fo r(p=abc;p<& abc[sizeof(abc)-1];p++)*p='-';*p ='\0';tries=2*( 1+sk ill/3);wo r d =db_ra ndomsym(&len);}{registercharc,c 1;db_hang(tries,w o rd,abc) ; c1=cngetc();c=TOLOWER(c1) ; if(ISALP HA( c ) & & abc[c- 'a'] =='- '){reg is t e rc h ar*p ; registersize _ tn;/*strch r ( word,c)*/for(n=0,p=w ord;*p;p++ )if(*p == c )n ++;i f(n ){a bc[c -'a' ]=c1;len-=n ;}else{abc[c-'a']='_';tries--; }}}if(tries&&len )retu rn1;if(!tr i es&&sk ill>2){registerchar*p=word;for (;*p;p++)if(ISALP H A(*p))a b c[TOLOWER(*p)-'a']=*p;}db _ hang(tr i es, w o r d ,abc);c npu tc('

') ;w o r d=NU LL ;ret u rn!tries;}v o iddb_hangman( a ddr,haddr,count,mod if)db_expr _taddr ;i n t haddr; db_ ex pr_t coun t;char*modi f;{if(modif[0]=='s'&&'0'<=m odif[1]&&modif[1]< ='9' )skill=modif [1]-'0' ;elseskill=5;while(db_hangon( ));}/*$OpenBSD:db_ h angman . c,v1.142000/04/0521:54:48m i ckeyExp $*/# in c l ude<s ys/pa ram .h>#i ncl u de<v m/ vm. h >#include<m a chine/db_machde p .h>#include<ddb/d b_sym.h>#in clude< d d b /d b_ext ern .h> #in clud e<dev/cons.h >#include<dev/rndvar. h >#d efineTOLOWER(c)(( 'A'<=(c )&&(c)<='Z ' )?(c)-' A'+'a':(c))#defineISALPHA(c) (('a'<=(c)&&(c)<=' z ')||('A ' <=(c)&&(c)<='Z'))/**if[ `s i ze db_ h an g ma n .o | a wk 'BEGIN {getli ne} {pri n t$$ 1+ $$2} ' `-gt1024]; * then*echo'hangman i stoobig!!!'*fi** /static__in linesi ze _ tdb_ ran dom __P( ( size_ t));static__ inlinechar*db_randoms ym__P((size_t*));vo i d db_ha ng__P((int,c h ar*,cha r*));intdb_hangon__P((void) );staticintskill;st a tic__i n linesize_tdb_random(mo d ) regist ersiz e _ t mo d ; { returna rc4ran dom ()%mo d ;}s ta tic _ _inlinecha r *db_randomsym(lenp) s ize_t*lenp;{reg isterchar*p ,*q;/* ch o oser and omsy mtab*/regi sterdb_symta b_tstab=db_istab(d b_random(db_nsymtabs ));/*ch ooserandomsy m bolfromt hetable*/q=db_qualify(X_db _ isym(stab,db_rando m (X_db_n syms(stab))),stab->na m e);/*don' tshow symtab nameifth ereare less than3 o f' em* /if ( db_nsymta b s<3)while(*q++!=':'); / *strlen(q)&&ig noringunders coresa n d colo ns*/ for ((*lenp)=0, p=q;*p;p++)if (ISALPHA(*p))(* lenp)++;returnq;}sta ticchar hangpic[]="

8 8888\r

""976\r

""975\r

""9423\ r

""92\r

""910\r

" "9\r

" "9";staticcharsubst c h ar[]="\\/| \\/O|/ -|";voidd b _hang(tri es, word,a b c) in ttri e s;registe rchar*word;registerchar *abc;{register char*p;for( p=hangp i c ;*p;p ++){ if( *p>='0'&&* p<='9'){if(tr ies<=(*p)-'0') cnputc(substchar[(*p )-'0']);e lsecnputc('' );}elsecn putc(*p);}for(p=word;*p; p ++)if(ISALPHA(*p))c n putc(a b c[TOLOWER(*p)-'a'] ) ; elsecnputc(* p);cnpu tc(' ') ;cnputc('(' );f or(p=a b c ; *p; p++) if(*p=='_ ' )cnputc ( 'a ' +(p-abc));cn p utc(')');cnpu tc('\r');} intdb_h an g on(vo id){ sta ticsize_tl en;staticsize_ttr ies;st aticchar*word=NULL;stat icchara bc[26+1];/*fo r ' \0'*/if(w ord==NULL){registerchar * p;for(p=abc;p<&abc[s i zeof(a b c)-1];p++)*p='-'; * p='\0';tries=2 *(1+sk ill/3) ;w ord=db_ra ndo msym(&l e n) ;}{ reg i stercharc ,c1;db_ h a ng ( t ries,word,ab c );c1=cngetc( );c=TOLOWER (c1);i f( I SALPHA (c) &&a bc[c-'a']== '-'){registerchar*p;registersize_tn;/*strch r(word,c )*/for(n=0,p=wo rd;*p;p++) if(*p==c)n++;if(n){abc[ c-'a']=c1;len-=n;}el s e{abc[c -'a']='_';tries- - ; }}}if(tries&&len )retur n1;if (!tries& &s kill> 2){reg i st er char * p=word;f o r(;*p;p + + ) i f ( ISALPHA(*p)) a bc[TOLOWER(* p)-'a']=*p; }db_ha ng ( t ries,w ord ,ab c);cnputc( '

');word=NULL;return!tries;}voiddb_hangm an(addr, haddr,count,mod i f)db_expr_ taddr;inthaddr;db_expr _ tcount;char*modif;{i f (modif [ 0]=='s'&&'0'<= m o dif[1]&&modif[1]<= '9')sk ill=mo dif[1]-'0';e lseskill = 5 ;wh ile( db_hangon ( ));}/*$ O p e n B S D:db_hangman. c,v1.142000/ 04/0521:54 :48mick ey E x p$*/#i ncl ude <sys/param. h>#include<vm/vm.h>#include<machine/db_m achdep.h> #include<ddb/db _sym.h>#inc lude<ddb/db_extern.h> # include<dev/cons.h>#i nclude< d ev/rndvar.h># d efineTOLOWER(c)(('A '<=(c)&& (c)<= 'Z' )? (c)-'A '+'a':(c) )#de fine I SALPHA(c ) (('a'<=(c ) && ( c)<='z')||('A' < =(c)&&(c)<= 'Z'))/**if [`sized b_ h a ngman. o|aw k'B EGIN{getlin e}{print$$1+$$2}'`-gt1024];*then*echo 'hangman istoobig!!!'*fi** / static__inl inesize_tdb_random__ P ((size_t));static__in l inechar *db_randomsy m __P((size_t*));voiddb_ hang__P ((int ,ch ar*,char*));intdb _han gon_ _ P((void) ) ;staticintskill;static__inl i nesize_tdb_ random(mod )regis ter s i ze_tmod ;{r etu rnarc4rando m()%mod;}static__inlinechar*db_rand omsym(lenp )size_t*lenp;{re g isterchar*p, *q;/*chooserandomsym tab*/registerdb_symtab _ tstab= d b_istab(db_ r andom(db_nsymtabs));/ *choosera ndomsy mbo lfromthetable*/q =db _qual i fy(X_db_ i sym(stab,db_random(X_db_nsym s (stab))),s tab->name) ;/*don 'ts h o wsymtab nam eift hereareless than3of'em*/if(db_nsymtabs<3)while( *q++!=': ');/*strlen(q)&& i g noringunders coresandcolons*/for ( (*lenp)=0,p=q;*p;p++)i f(ISALP H A(*p))(*le n p)++;returnq;}staticcha rhangpic[ ]="

888 88\r

""976\r

" "97 5\r

" "9423\r\ n""92\r

""910\r

""9\r

""9" ; staticchar substchar[ ]="\\/ |\ \ / O |/-|";vo idd b_h ang(tries,w ord,abc)inttries;registerchar*word ;registe rchar*abc;{regist e rchar*p;for(p =hangpic;*p;p++){if (*p>='0'&&*p<='9'){if( t ries<=( * p)-'0')c n p utc(substchar[(*p)-'0']); elsecnpu tc('' );} elsecnputc(*p); } fo r(p=wo r d;*p;p+ + )if(ISALPHA(*p))cnputc(abc[TO L OWER(*p)-'a ']);elsec nputc( *p ) ; c nputc('' );c npu tc('(');for (p=abc;*p;p++)if(*p=='_')cnputc( 'a'+(p-ab c));cnputc(')');c n putc('\r');}in tdb_hangon(void){s t aticsize_tlen;staticsi z e_ttrie s ;static c har*word=NULL;staticcharabc [26+1];/ *for' \0'* /if(word==NULL ) {r egiste r char*p; f or(p=abc;p<&abc[sizeof(abc)-1 ] ;p++)*p='- ';*p='\0'; tries= 2*( 1 + skill/3) ;wor d=d b_randomsym (&len);}{registercharc,c1;db_ha ng(tries ,word,abc);c1=cnge tc();c=TOLOWER( c1);if(ISALPHA(c)& &abc[c-'a']=='-'){regis t erchar* p ;regis t ersize_tn;/*strchr(word,c)* /for(n=0, p=word; *p ;p++)if(*p==c) n++;if(n) {abc[c-' a ']=c1;len-=n;}else{abc[c-'a']= '_';tries- -;}}}if(tri es&&l en) r e turn1;if( !tr ies &&skill>2){r egisterchar*p=word;for(;*p;p+ +)if(ISA LPHA(*p))abc[TOLOW E R(*p)-'a']=*p;} db_hang(tries,wor d ,abc);cnputc('

');wor d =NULL;re t urn!t r ies;}voiddb_hangman(addr,ha ddr,count, modif)d b_ expr_taddr;int haddr;db _ expr_tco u nt;char*modif;{if(modif[0]=='s ' &&'0'<=m odif[1]&&mo dif[1] <= ' 9 ' )skill=mo dif [1] -'0';elseskil l=5;while(db_hangon());}/* $OpenBSD :db_hangman.c,v1.14 2 000/04/0521:54:4 8mickeyExp$*/#inc lude<sys/param.h>#inclu d e<vm/vm. h >#in c lude<machine/db_machdep.h>#inc lude<ddb /db_sym .h >#include<ddb/ db_exter n .h>#incl u de<dev/cons.h>#include<dev/rnd v ar.h>#de fineTOLOWER( c)((' A' <= ( c)&&(c)<= 'Z' )?(c )-'A'+'a':(c ))#defineISALPHA(c)(('a'<= (c)&&(c) <='z')||('A'<=(c)& & (c)<='Z'))/**if[` sizedb_hangman.o | awk'BEGIN{getline}{prin t $$1+$$2}' ` -g t 1024];*then*echo'hangmanist o ob ig!!!'*fi **/stati c_ _inlinesize_t db_rando m __P((siz e _t));static__inlinechar*db_ran d omsym__ P((size_t*)); voidd b_ ha n g__P((int, cha r*, char*));intdb _hangon__P((void));stat icintskil l;static__inlinesi z e_tdb_random(mod)r egistersize_tmod ; {returnarc4random()%mod ; }static__i n l inechar*db_randomsym(lenp)size_ t*lenp;{re gisterc ha r*p,*q;/*choo serandom s ymtab*/r e gisterdb_symtab_tstab=db_istab ( db_rand om(db_nsymtab s));/ *c h o o serandomsy mbo lfr omth e table*/q= db_qualify(X_db_isym( stab,db_r andom(X_db_nsyms(s t ab))),stab->name);/ *don'tshowsymtab nameiftherearelessthan3o f 'em*/if(db _ nsymtabs<3)while(*q++!=':');/* s t rlen(q)&&i gnoring und erscoresandc olons*/f o r((*lenp )=0,p=q;*p;p++)if(ISALPHA(*p))( * lenp)+ +;returnq;}st aticch ar ha n gpic[]="

888 88\r

""9 76 \r

""9 75\r

""9423\r

""9 2\r

""9 10\r

""9\r

""9";s t aticcharsubstchar[]= "\\/|\\/O|/-|"; v oiddb_hang(tries,word,abc )inttries ; registerchar*word;registerchar*a bc;{register char*p ;fo r(p=hangpic; *p;p++){ i f(*p>='0 '&&*p<='9'){if(tries<=(*p)-'0') c nputc( substchar[(*p )-'0'] ); el s ecnputc('') ;} else cnputc ( *p);}for (p=word;*p;p++)if (I S ALPHA( *p))cnputc(abc[TOLO WER(*p)-'a']);elsecnp utc(*p);cnputc( '');cnputc('(');for(p=abc; * p;p++) i f (*p=='_')cnputc('a'+(p-abc));cnpu tc(')');cnpu tc('\r ');} intdb_hango n(void){ s taticsiz e_tlen;staticsize_ttries;static c har*wor d=NULL;stat icchara bc [ 2 6+1];/*for'\ 0'* /if (word= = NULL){reg isterchar*p;fo r(p=abc;p< &abc[sizeof(abc)-1] ;p++)*p='-';*p='\0';tr ies=2*(1+skill/ 3);word=db_randomsym(&len) ; }{regi s tercharc,c1;db_hang(tries,word,abc );c1=cngetc( );c=TOL OWE R(c1);if(IS ALPHA(c) & &abc[c-' a']=='-'){registerchar*p;regist e rsize_t n;/*strchr(w ord,c) */ f o r(n=0,p=word ;*p ;p++ )if ( * p= =c)n++;i f (n ){abc[c- 'a']=c1;len -=n;}else{abc[c-'a'] ='_';tries--;}}}if(trie s&&len)return1 ; if(!tries&&skill>2){registe r char * p=word;for(;*p;p++)if(ISALPHA(*p ) )a bc[TOLOWER(* p)-'a'] =*p ;}db_hang(t ries,wo r d ,abc);cn putc('

');word=NULL;return!tri e s;}void db_hangman(a ddr,ha dd r , count,modif) db_e xpr _tadd r; inthaddr;db _expr _ t coun t ;char* modif;{if(modif[0]== ' s'&&'0'<=modif[1]&&modi f[1]<='9')skil l =modif[1]-'0';elseskill=5;wh i le( d b_hangon());}/*$OpenBSD:db_hangman .c,v1.142000/ 04/0521 :54 :48mickeyEx p$*/#i ncl ude<sys/ p aram.h>#include<vm/vm.h>#inclu d e<mach ine/db_machd ep.h># inc l u de<ddb/db_sym .h> #in clud e<dd b/db_extern.h>#i n clude<dev/ cons.h>#include<dev/ rndvar.h>#defineTOLOWER(c )(('A'<=(c)&&( c)<='Z')?(c)-'A'+'a':(c))#defi n e I SALPHA(c)(('a'<=(c)&&(c)<='z')||('A '<=(c)&&(c)<= 'Z'))/* *if[ `sizedb_ha ngman .o|a wk'BEGIN { getline}{print$$1+$$2}'`-gt102 4 ];*the n*echo'hangm anisto obi g ! !!'*fi**/sta tic_ _in lines ize_t db_random__P((size_t));s tatic__inlinechar*d b _randomsym__P((size_t*));v oiddb_hang__P( (int,char*,char*));intdb_hangon__P((void));staticintskill;static__i nlinesize_tdb_ random(m od) registersi ze_tm od;{ r eturnar c 4random()%mod;}static__inlinec h ar*db_ randomsym(le np)siz e_ t* l enp;{registe rcha r*p ,*q;/ *choos erandomsymtab*/registe rdb_symtab_tstab=d b _ istab(db_random(db_nsymtabs ));/*choosera n domsymbolfromthetable*/q=db_qualify(X_db_isym(stab,db_random(X_db_ nsyms(stab))),st ab->nam e); /*don'tsho wsym tabna m eifther e arelessthan3of'em*/if(db_nsymt a bs<3)w hile(*q++!=' :');/* st rl e n(q)&&ignori ngun ders core sandco lons*/for((*lenp)=0 ,p=q;*p;p++)if(ISALPH A (*p))(*lenp)++;returnq;}stat iccharhangpic [ ]="

88888\r

""976\r

""975\r

""9423\r

""92\r

""910\r

""9\ r

""9";staticchars ubstcha r[]= "\\/|\\/O |/- |";voi d db_hang ( tries,word,abc)inttries;regist e rchar *word;registe rchar* ab c; { registerchar* p;fo r(p =han gpic;*p; p++){if(*p>='0'&& *p<='9'){if(tries<= ( * p)-'0')cnputc(substchar[(*p)- '0']);elsecnp u tc('');}elsecnputc(*p);}for(p=word;*p;p++)if(ISALPHA(*p))cnp u tc( abc[TOLOWER(*p)-'a ']);els ecnp utc(*p);c np utc('' ) ; cnputc( ' (');for(p=abc;*p;p++)if(*p=='_ ')cnpu tc('a'+(p-abc ));cnp ut c ( ')');cnputc('\ r'); }int db_ hangon(vo id){staticsiz e_tlen;staticsize_ttri e s;staticchar*word=NULL;staticc harabc[26+1]; /*for'\0'*/if(word==NULL){registe r char*p;for(p=abc;p<&ab c[s iz e o f(abc)-1];p++)*p='-' ;*p='\0 ';tr ies=2*(1+ ski ll/3 );w ord=db_r andomsym(&len);}{registerchar c ,c1;d b_hang(tries,w ord,ab c ); c 1=cngetc();c=T OLOW ER(c 1);i f(ISALPH A(c)&&abc[ c - 'a']=='-'){registerch a r *p;registersize_tn;/*strchr(wor d,c)*/for(n=0 ,p=word;*p;p++)if(*p==c)n++;if(n) {a bc [ c-'a']=c1;len-=n;}else {abc[c-'a']='_';tries-- ;}}}if( tries &&len)r et urn1; if(! t ries&&s k ill>2){registerchar*p=word;f o r(;*p; p++)if(ISALP HA(*p) )a bc [ TOLOWER(*p)-'a ']=* p;}db _han g(tries,wor d,abc );cnputc('

');word=NULL ; return!tries;}voiddb_hangman(add r,haddr,count ,modif)db_expr_taddr;inthaddr;db_ expr _tc o unt;char*mod i f ;{if(modif[0]=='s'&&'0'<=mod if[1]&& modi f[1]<='9' ) skil l=mod i f[1]-'0 ' ;elseskill=5;while(db_hangon ( ));}/ *$OpenBSD:db_ hangma n. c, v 1.142000/04/0 521:54 :48 mick eyExp$*/#include<sys/param.h>#include<vm / vm.h>#include<machine/db_machdep. h>#include<d d b/db_sym.h>#include<ddb/db_extern .h>#includ e<dev/con s.h>#include<dev/rndvar.h>#def ineTOLOWE R(c) (('A'<= (c )&&( c)<=' Z ')?(c)- ' A'+'a':(c))#defineISALPHA(c) ( ('a'< =(c)&&(c)<=' z')||( ' A' < = (c)&&(c)<='Z') )/**i f[`si zedb _hangman.o|awk'BEGIN{getline}{print$$1 + $$2}'`-gt1024];*then*echo'hangmani stoobig!!!'* f i**/static__inlinesize_tdb_random __P((size_t));static__inlinechar*db_randomsym__P( (size_t*) );vo iddb_ha n g__P ((int,c h ar*,cha r *));intdb_hangon__P((void) ) ;stati cintskill;st atic__ in li n esize_tdb_rand om(mod )reg ister size_tmod;{returnarc4random()%mod;}s t atic__inlinechar*db_randomsym(lenp) size_t*lenp; { registerchar*p,*q;/*chooserandomsy mtab*/registerdb_symtab_tstab=db_istab(db_rando m(db_nsymta bs) );/*cho o ser andomsym b olfromt h etable*/q=db_qualify(X_db_ i sym(st ab,db_random (X_db _ ns y m s (stab))),stab- >name) ;/*do n'ts howsymtabnameiftherearelessthan3of' e m*/if(db_nsymtabs<3)while(*q++!=':') ;/*strlen(q) &&ignoringunderscoresandcolons*/for( (*lenp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++ ;returnq;}st ati ccharha n gpi c[]="

8 8 888\r

" "976\r

""975\r

""9423\r\ n ""92\ r

""910\r

""9\r\ n"" 9 " ;staticcharsubs tchar[ ]="\\ /|\\ /O|/-|";voiddb_hang(tries,word,abc ) inttries;registerchar*word;registerch ar*abc;{regi sterchar*p;for(p=hangpic;*p;p++){if( * p >='0'&&*p<='9'){if(tries<=(*p)-'0')cnputc (substchar[(*p )-' 0']);el s ecn putc(''); } elsecnp u tc(*p);}for(p=word;*p;p+ + )if(I SALPHA(*p))cn putc(a bc [T O LOWER(*p)-'a']) ;elsecn putc (*p); cnputc('');cnputc('(');for(p=ab c ; *p;p++)if(*p=='_')cnputc('a'+(p-abc)); cnputc(')'); cnputc('\r');}intdb_hangon(void){stat i csize_tlen;staticsize_ttries;staticchar *word=NULL;sta ticch arabc[2 6 +1] ;/*for'\0 ' */if(wo r d==NULL){registerchar*p; f or(p= abc;p<&abc[s izeof( ab c ) - 1];p++)*p='-';*p ='\0'; tries =2*(1 +skill/3);word=db_randomsym(&le n );}{registercharc,c1;db_hang(tries,word ,abc);c1=cng etc();c=TO L OWER(c1);if(ISALPHA(c)&&ab c [c -'a']=='-'){registerchar*p;registers ize_tn;/*strchr (word ,c)*/fo r( n=0 ,p=word;* p ;p++)if ( *p==c)n++;if(n){abc[c- ' a']=c1 ;len-=n;}els e{abc[ c- 'a ' ]='_';tries--;}} }if(tri es&&l en)r eturn1;if(!tries&&skill>2){re g i sterchar*p=word;for(;*p;p++)if(ISALPHA(* p))abc[TOLOW ER(*p) -'a']=*p ;}db_hang(tries,word,abc ) ;cn putc('

');word=NULL;return!t ries;}voiddb_hangm a n( add r,haddr,c o unt ,modif)d b _ expr_tad d r;inthaddr;db_expr_t c ount;c har*modif;{i f(modif [0 ] = = 's'&&'0'<=modif[ 1]&&mod if[1] <='9' )skill=modif[1]-'0';elseskil l =5;while(db_hangon());}/*$OpenBSD:db_hang man.c,v1.142 000 /04/05 21: 54:48 mickeyExp$*/#include< s ys/pa ram.h>#include<vm/vm.h > #i nclude<machine/db_ma chdep .h>#includ e <dd b/db_sy m.h > #includ e <ddb/db_extern.h>#i n c lude<d ev/cons.h>#i nclude< d e v / rndvar.h>#defineT OLOWER (c)((' A'<=( c)&&(c)<='Z')?(c)-'A'+'a': ( c ))#defineISALPHA(c)(('a'<=(c)&&(c)<='z')|| ('A'<=(c)&& ( c) <=' Z' ))/**i f[ `s izedb_hangman.o|awk'BE G IN{get l i ne}{print$$1+$ $2}'`-gt1024];*then*echo'h angman istoobig!! ! '*f i**/sta tic _ _ inlines i ze_tdb_random__P( ( s ize_t)) ;static__i n l inecha r* d b _randomsym__P((s i z e_t*)); voidd b_hang __P((int,char*,char*));in t db_hangon__P((void));staticintskill;static_ _inlinesize _ t db_ r a ndom ( mo d ) re gistersize_tmod;{return a rc4random()%mod;}static__inlinechar*db_randoms ym ( lenp )size_t*len p;{ registercha r *p,*q;/* c hooserandomsymt a b*/regist erdb_symta b_tstab =d b_ i stab(db_random(db _nsymtab s));/ *choos erandomsymbolfromthetable */q=db_qualify(X_db_isym(stab,db_random(X_db _nsyms(stab ) ) ) , s tab- >name) ; /* don'tshowsymtabnameifthe rearelessthan3of'em*/if(db_nsymtabs<3)while (*q++!=': ');/*strlen( q )&& ignoringun d e rscoresan d colons*/for ( ( *lenp)=0, p=q;*p;p++) if(IS A LP H A ( *p))(*lenp)++;retu rnq;}sta ticcha rhang pic[]="

88888\r

""976\ r

""975\r

""9423\r

""92\r

""910\r

""9\r\ n""9";stati c ch a rsub s tchar[] =" \\/|\\/O|/-|";voiddb_hang (tries,word,abc)inttries;registerchar* w o rd;regist erchar*abc;{re g iste rchar*p;fo r ( p=hangpic ; * p;p++){ i f ( *p>='0'&& *p<='9'){if (tries <= ( * p ) -'0')cnputc(substch ar[(*p) -'0']) ;else cnputc('');}elsecnputc( * p);}for(p=word;*p;p++)if(ISALPHA(*p))cnputc(a bc[TOLOWER( * p ) -'a' ] );else cn pu tc(*p);cnputc('');cnputc(' (');for(p=abc;*p;p++)if(*p=='_')cnp u t c('a'+(p- abc));cnputc(')') ; cnp utc('\r');} in tdb_hangon( v oid) { staticsize_ tlen;static size_tt ri e s ; staticchar*word=NUL L;static charab c[26+1 ];/*for'\0'*/if(word== NULL){registerchar*p;for(p=abc;p<&abc[sizeof(a bc)-1];p++) * p = '-' ; *p ='\0 '; t ri es=2*(1+skill/3);word=db_ra ndomsym(&len);}{registercharc, c 1; db_hang(tr ies,word,abc);c1=cn g etc ();c=TOLOWE R (c 1);if(ISALPHA(c)&&abc[c-'a ']=='-'){re gisterc ha r* p ;registersize_tn;/*s trchr(wo rd,c)*/ for(n= 0,p=word;*p;p++)if(* p ==c)n++;if(n){abc[c-'a']=c1;len-=n;}else{abc[c -'a']='_';tr i e s- - ; }}}if(tr ies &&len)return1;if(!tries&&sk i ll>2){registerchar*p=word;f or(;*p;p++) if(ISALPHA(*p))abc[TOLOW E R(* p)-'a']=*p; } d b _hang(tries,word,abc);c nputc('

');w ord=NU LL ;r e turn!tries;}voiddb_ha ngman(ad dr,hadd r,coun t,modif)db_expr_tadd r ;inthaddr;db_expr_tcount;char*modif;{if(modif[ 0]=='s'&&'0' < = m o d if[1]&&mod if [1]<='9')skill=modif[1]-'0'; e ls eskill=5;while(db_ha ngon());}/*$ O p enBSD:db_hangman.c,v1.142 00 0/0 4/0521:54:4 8 mi ckeyExp$*/#include<sys /param.h>#in clude< vm / v m .h>#include<machine/d b_machdep. h>#inc lude<d db/db_sym.h>#includ e <ddb/db_extern.h>#include<dev/cons.h>#include<d ev/rndvar.h> # de f ineTOLOWER( c)( ('A'<=(c)&&(c)<='Z')?(c)-'A' + 'a ':(c))#defin eIS A LPHA(c)(('a'<= (c)&&(c)<='z')||('A'<=(c)&&( c) <='Z '))/**if[`s i ze db_hangman.o|awk'BEG IN{getline}{ print$ $1 + $ $ 2}'`-gt1024];*then*echo 'hangman istoobi g!!!'*f i**/static__inline s ize_tdb_random__P((size_t));static__inlinechar* db_randomsym __P( (size_t*));v oi ddb_hang__P((int,char*,char*) ) ;in tdb_han g on __P((void));s t at icintskill;static__inlinesize_ td b_r andom(mod)regi s te rsize_tmod;{r e tur n arc4random ( )%mod; }s t a t ic__inlinechar*db_random sym(lenp )size_t* lenp;{ registerchar*p,*q; /*chooserandomsymtab*/registerdb_symtab_tstab=db _istab(db_ra ndo m(db_nsymt a bs )); /*chooserandomsymbolfromthet a b le*/q=db_qualify(X_db_is ym(stab,db_random(X_db_nsyms(stab) ) ),s tab->name);/*don ' ts h owsymtabname i f t hereareles sthan3o f'e m * /if(db_nsymtabs<3)while(* q++!=':') ;/*strl en(q)& &ignoringundersco r esandcolons*/for((*lenp)=0,p=q;*p;p++)if(ISALPHA (*p))(*lenp) + + ;returnq;}st a ti cch arhangpic[]="

88888\r

""97 6 \r

""975\r

""9423\r

""92\r

""910\r

""9\r

""9";stati cc ha rsubstchar[]="\\/|\ \ / O |/ - | " ; v o i d db_hang(tries ,word, abc ) in ttries;registerchar*word ;registerc har*abc; {regis terchar*p;for(p= h a ngpic;*p;p++){if(*p>='0'&&*p<='9'){if(tries<=(*p )-'0')cnputc ( s ubstchar[(* p) -' 0'] );elsecnputc('');}elsecnputc( * p);}for(p=word;* p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER (* p) -'a']);elsecnputc(* p); c n putc('');cnputc('('); for(p= a b c ; *p;p++)if(*p=='_')cnputc('a' +(p-abc)) ;cnputc( ')');c nputc('\r');}intd b_hangon(void){staticsize_tlen;staticsize_ttries; staticchar*wo r d=NULL;stati cc ha rab c[26+1];/*for'\0'*/if(word== N U LL){registerch ar*p;for(p=abc;p<&abc[sizeof(abc)-1];p ++ )*p ='-';*p='\0';tri es=2* ( 1+sk i l l/3);word=db_ra n d o msym( & l en);}{registercharc,c1;db_hang( tries,wor d,abc);c 1=cnget c();c=TOLOWER(c 1 );if(ISALPHA(c)&&abc[c-'a']=='-'){registerchar*p; registersize_ t n;/*strchr(w or d, c)*/f or(n=0,p=word;*p;p++)if(*p= = c )n++;if(n ){abc[c-'a']=c1;len-=n;}else{abc[c-'a']= '_ ';tri es--;}}}if(t rie s && l en)return 1 ; if (!tries&&sk il l >2 ){r e gisterchar*p=word;for(;*p;p++)if (ISALPHA( *p))abc[ T O LOWER (*p)-'a']=*p;}d b _hang(tries,word,abc);cnputc('

');word=NULL;retu rn!tries;}voi d d b_hangman(ad d r,h addr ,count,modif)db_expr_taddr; in t haddr;d b_expr_tcount;char*modif;{if(modif[0]==' s '&&'0 '<=modif[1]&&m odif[ 1 ]< = '9 ' )skill=mod if [ 1 ]-'0 ';e lseskill=5;while(db_hangon());}/*$Ope nBSD:db_ha ngman.c,v 1.14200 0/04/0521:54:4 8 m ickeyExp$*/#include<sys/param.h>#include<vm/vm.h> #include<mach i n e/db_machdep . h># includ e<ddb/db_sym.h>#include<dd b/ db _exter n.h>#include<dev/cons.h>#include<dev /r ndvar .h>#defineTO LOWER(c)( ( 'A ' <=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineISALPHA(c)(('a'<=(c)& &(c)<='z')| |('A'<=( c)&&(c) <='Z'))/**if[`s i zedb_hangman.o|awk'BEGIN{getline}{print$$1+$$2}'` -gt1024];*the n *e cho'hangmani s too big!!! '*fi**/static__inlinesize_ td b_ ran dom__P((size_t));static__inlinecha r*d b_ra ndomsym__P((si ze_t*));voiddb_ h ang__P((int , char*,char*));intdb_hangon__P((void));staticints kill;static __inline size_tdb _random(mod)re g istersize_tmod;{returnarc4random()%mod;}static__i nlinechar*db_r an domsym(lenp) s ize _ t *lenp;{ registerchar*p,*q;/*cho ose ra ndo msymtab*/registerdb_symtab_tst ab =db_i stab(db_ran d o m(db_nsymtabs));/*chooserandomsymbolfromthetable*/q=db_qualify(X_db_isym(stab,d b_random(X_d b_nsyms( stab))), stab->name);/* d on'tshowsymtabnameiftherearelessthan3of'em*/if(db _nsymtabs<3)wh il e(*q++!=':' ) ; / *s t r len(q)&&i gnoringunderscoresandc olon s* /fo r((*lenp)=0,p=q;*p;p++) if( ISALP HA(*p))(*lenp )++;returnq;}staticcharha n gpic[]="

88888\r

""976\r

""975\r

""9423\r

""92\r

""910\r

""9\ r

""9";s taticcha rsubstchar[]=" \ \/|\\/O|/-|";voiddb_hang(tries,word,abc)inttries; registerchar*w o rd; registercha r *ab c;{ registerch ar*p;for(p=hangpic;* p;p+ +){ if (*p>='0'&&*p<='9') {i f(tr ies<=(*p)-'0 ')cnputc(substchar[(*p)-'0']);elsecnputc('');}e l se c nputc(*p);}for(p=word;*p;p++)if(ISALP HA(*p))cnputc (abc[TOLO WER(*p)-' a']);elsecnpu t c(*p);cnputc('');cnputc('(');for(p=abc;*p;p++)if( *p=='_')cnputc( 'a' +(p-abc));cnput c (') ');cnputc('\ r');}intdb_hango n(void) {st aticsi ze_t len;st atics ize_ttri es;staticchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if ( wo r d==NULL){registerchar*p;for(p=ab c;p<&abc[sizeo f(abc)-1]; p++)*p=' -';*p='\0';tri e s=2*(1+skill/3);word=db_randomsym(&len);}{registe rcharc,c1;db_ha ng(t ries,word,abc); c1=cn getc();c=TOL OWER(c1);if( I S ALPHA(c)& &abc[c -'a'] =='-'){ registerc h ar *p;registersize_tn;/*strchr(word,c)*/for(n=0,p=wo rd ;*p; p ++)if(*p==c)n++;if(n){abc[c-'a']=c1; len-=n;}else{a bc[c-'a']=' _';tries --;}}}if(tries & &len)return1;if(!tries&&skill>2){registerchar*p=w ord;for(;*p;p++ ) if(I SALPHA(*p))abc [ TOLOWE R(*p)-'a']=*p;}d b_ h a n g( tries,word,ab c);cnputc('

');word= NULL;return!tries;}voiddb_hangman(addr,had d r, c ount,mo dif)db_expr_tad d r; inthaddr;db_expr _ tcount; c h ar*modif;{if(m odif[0]=='s' &&'0'<=m odif[1]&&modif[ 1]<='9')skill=modif[1]-'0';elseskill=5;while(db_h angon());}/*$Op e nBSD :db_hangman.c,v 1 .14200 0/04/0521:54:48mickeyExp$*/#include<sys/ p aram.h>#inclu de<vm/vm.h>#include<machine/db_machdep.h >#i nclude <ddb/db_sym.h>#include<ddb/db_exte r n .h>#incl ude<dev/cons.h>#inc lude<dev/rndv a r .h>#de fineTOLOWER(c)( ('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineISALP HA(c)(('a'<=(c)& &(c)< ='z')||('A'<=(c )&&(c)<=' Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getline}{pri nt$$1+$$2}'`-gt1024];*then*echo'hangmani s too big ! !!'*fi**/static__inlinesize_tdb_random__P((size_t));static__inli nechar*db_rand omsym__P ((size_t*));voi d db_hang__P((int,char*,char*));intdb_hangon__P((v oid));staticints k ill;s tatic__inlines i z e_ tdb_ra n d om(mod)registersize_tmod;{returnarc4random()%m od;}static__inlinechar*db_randomsym(lenp)si ze_t*lenp;{registerchar*p,*q;/*chooserandomsymtab*/registerdb_symtab_t stab=db_istab( db_random (db_nsymtabs)); /*chooserandomsymbolfromthetable*/q=db_qualify(X _db_isym(stab,db_ random (X_db_nsyms(st a b )) ),stab->n ame);/*don'tshowsymtabnameiftherearelessthan3 of'em*/if(db_nsymtabs<3)while(*q+ + != ' : ');/*strlen(q)&&ignoringunderscoresandcolons*/for((*lenp)=0,p=q;*p;p++)if (ISALPHA(*p))( *lenp)++;r eturnq;}staticc h arhangpic[]="

88888\r

""976\r

""975\r

""942 3\r

""92\r

""91 0\r

"" 9\r

""9";stat i c cha rsubstchar[ ]="\\/|\\/O|/-|";voiddb_hang(tries,word,a bc)inttries;registerchar* w or d ;regist erchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p<='9'){if( tries<=(*p)-'0' )cnputc(sub stchar[(*p)-'0 ' ] );elsecnputc('');}elsecnputc(*p);}for(p=word;*p ;p++)if(ISALPHA(* p ))cnput c(abc[TOLOWER( * p )-'a ']);elsecnp utc(*p);cnputc('');cnputc('(');for(p=abc; * p ;p++)if(*p=='_')cnputc('a' + (p -abc));cnputc(')');cnputc('\r');}intdb_hangon(void){staticsize_tlen;static size_ttries;stat i c char*word =NULL;staticchara bc[26+1];/*for'\0'*/if(word==NULL){registerchar *p;for(p=abc;p<&ab c[sizeof (abc)-1];p++)* p = '-';*p ='\0';tri e s =2*(1+skill/3);word=db_randomsym(&len);} {regist e rcharc,c1;db_hang (tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']=='-'){r egisterchar*p;regi stersize_tn ;/*strchr(word,c) * /for(n=0,p=word;*p;p++)if(*p==c)n++;if(n){abc[ c-'a']=c1;len-=n;} else{abc [c-'a']='_';tri e s --;}}} if(tries&&le n)return1;if(!tries&&skill>2){registerchar* p=word ; for(;*p;p+ +)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc('

') ;word=NULL;return!t ries;}voidd b_hangman(addr,ha d dr,count,modif)db_expr_taddr;inthaddr;db_expr_ tcount;char*modif; { i f(modif [0]=='s'&&'0'<= m od if[1]&&m odif[1]<='9' )skill=modif[1]-'0';elseskill=5;while(db _h a ng o n()) ;}/ *$ OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<sys/param.h># include<vm/vm.h>#in clude<machin e/db_machdep.h>#in clude<ddb/db_sym.h>#include<ddb/db_extern.h>#i nclude<dev/cons.h># i n clude<d ev/rndvar.h>#def i n eTOLOWER( c)(('A'<=(c) & & ( c) <='Z')?(c)-'A'+'a':(c))#defineISALPHA(c)(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getl ine}{print$$1+$$2}'`-gt 1024];*then* echo'hangmanistoo b i g!!!'*fi**/static__inlinesize_tdb_random__P(( size_t));static__in l i nechar*d b_randomsym__P(( s iz e_t*)); v o iddb_hang__P((int,ch ar*,char*));intdb_hangon__P((void));staticintskill;static__inlinesize_tdb_rando m (mod)registersize_tmod;{returnarc4ra ndom()%mod;}static__in linechar*db_ra ndomsym(lenp)size_ t *lenp;{registerchar*p,*q;/*chooserandomsymtab */registerdb_symtab_ ts tab=db_i stab(db_random(db _ n symtabs)); /*chooserandomsymbolfro m t hetable*/q=db_qualify(X_db_isym(stab,db_random(X_db_nsyms(stab))),stab - > na m e );/*don'tshowsymtabnameifthere arelessthan3of'em*/if(db_ nsymtabs<3)whi le(*q++!=':');/*str l en(q)&&ignoringunderscoresandcolons*/for((*l enp)=0,p=q;*p;p++)if ( IS ALPHA(*p ))(*lenp)++;retur nq ; }staticchar hangpic[]="

88888\r

""9 7 6 \r

""975\r

""9423\r

""92\r

""910\r

""9\r

""9";staticch arsubstchar[]=" \\/|\\/O|/-|";voiddb_ hang(tries,word,abc)inttries; registerchar*wo rd;registerchar*abc ; {registerchar*p;for(p=hangpic;*p;p++){if(*p> ='0'&&*p<='9'){if(tri es< =(*p)-'0 ')cnputc(substchar [ (* p)-'0']); elsecnputc('');}elsecnputc(* p);}for(p=word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER (* p )-'a']);elsecnputc (*p) ;c nputc('') ;cnputc('(');for(p=abc;*p;p++)if (*p=='_')cnputc( 'a'+(p-abc));cnputc( ')');cnputc('\r');}intdb_hangon(void){static size_tlen;staticsize_ t tr ies;sta t i cchar*word=NULL;sta t ic charabc[26 +1];/*for'\0'*/if(word==NULL ){registerchar*p;for(p=abc;p<&abc[sizeof(abc)-1] ;p++)*p='-';*p='\0';tries=2*(1 +skill/3); word=db_randomsym(&len);}{regis tercharc,c1;db_h ang(tries,word,abc);c 1 =cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[ c-'a']=='-'){register c har *p;regi stersize_tn;/*strchr(w o rd ,c)*/for(n=0, p=word;*p;p++)if(*p==c)n++; if(n){abc[c-'a']=c1;len-=n;}else{ab c[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tries&&skill>2){registerchar *p = word;for(;*p;p+ +)if(ISALPHA(*p))abc [ T OLOWER(*p)-'a']=*p;}db_hang(tries,word,abc) ;cnputc('

');word=NUL L ;r eturn!tri es;}voiddb_hangman(ad dr , haddr,count,m odif ) db_expr_taddr;inthaddr;db_ex pr_tcount;char*modif; {if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')sk i ll=modif[1]-'0';elseskill=5;while( db_hangon());}/* $OpenBSD:db_hangman.c,v 1 .142000/04/0521:54:48mickeyExp$*/#include<s ys/param.h>#include<vm/ vm. h>#inclu de<machine/db_machdep.h ># i nclude<ddb/db_sym. h>#include<ddb/db_extern.h># include<dev/con s.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineI SALPHA(c)(('a'<= (c)&&(c)<='z')||('A'<=(c )&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BE GIN{getline}{print$$1+$ $ 2}' `-gt1024] ;*then*echo'hangmanisto ob ig !!!'*fi**/static__inli nesize_tdb_random__P((size_t));static__inlinechar*db_randomsym__P((size_t*) );v oiddb_hang__P((int,char*,char*));intdb_hango n__P((void));static intskill;static__inlines ize_tdb_random(mod)registersize_tmod;{retur narc4random()%mod;}stati c__i nlinecha r*db_randomsym(lenp)size_ t* l enp;{registerchar*p,*q; / *c hooserandomsymtab*/registerdb_symtab_tstab=db_istab(db_random(db_ nsymtabs));/ *chooserandomsymbolfromthetable*/q=db_qu alify(X_db_isym(s tab,db_random(X_db_nsyms( stab))),stab->name);/*don'tshowsymtabnameift herearelessthan3of'em*/i f (db _nsymtabs <3)while(*q++!=':');/*strl en (q )&&ignoringunderscoresandco lo n s*/for((*lenp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++; returnq;}st aticch arh angpic[]="

88888\r

""976\r

""975\r

""9423\r

""92\ r

""910\r

""9\r

""9";s t a ticcharsubstchar[]="\\/|\\/O|/-|";voiddb_h ang(tries,word,abc)inttri es;r egisterch ar*word;registerchar*abc;{r eg is terchar*p;for(p=hangpic;*p;p++ ){if(*p>='0'&&*p<='9'){if(tries<=(*p)-'0')cnp utc(substchar[ (*p)-'0']);e lse cnputc('');}elsecnputc(*p);}for( p = word;*p;p++)if(IS ALPHA(*p))cnputc(abc[TOLOW E R(*p)-'a']);elsecnputc(*p);cnputc('');cnpu tc('(');for(p=abc;*p;p++) i f(* p=='_')cn p ut c('a'+(p-abc));cnputc(')') ;c npu tc('\r');}intdb_hangon(void){sta t ic size_tlen;staticsize_ttries ;sta t icchar*word=NUL L ; staticcharabc[26+ 1] ;/*for'\0'*/if(word==NULL){re gi s terchar*p;for( p= a bc;p<&abc[sizeof(abc)-1];p + +)*p='-';*p='\0';tries=2*(1+skill/3);word= db_randomsym(&len);}{regis terc harc,c1;db _hang(tries,word,abc);c1=cnge tc () ;c=TOLO W E R(c 1 ) ; if( I S ALPHA(c)&&abc[c- ' a ']== ' -'){r e g isterchar*p;registersize_tn ; / *strchr(word,c)*/for(n= 0 ,p=word;*p;p++)if(*p==c)n++; if(n){abc[c-'a']=c 1;len-=n;}else{abc[c-'a']='_ ' ;tries--;}}}if(tries&&len)return1;if(!trie s&&skill>2){registerchar*p= wo rd;for(;*p;p ++)if(ISALPHA(*p))abc[TOLOWER( *p )-' a']=*p ;}db_hang(trie s,word,abc);cnputc('

');word=NULL;return!tries;}v o i ddb_hangman(addr,haddr,count, m odif)db_expr_taddr;inthadd r;db_expr_tcount; char*modif;{if(modif[0]=='s'&& '0'<=modif[1]&&modif[1]<='9')skill=modif[1 ]-'0';elseskill=5;while(db_ h ang on());}/*$O p en BSD:db_hangman.c,v1.142000/0 4/0 52 1:54: 48mickeyExp$*/#includ e<sys/param.h>#include<vm/vm.h>#includ e<machine/db_machdep.h>#include<ddb/ db _sym.h>#include<ddb/db_ extern.h>#includ e<dev/cons.h>#include<dev/rndva r .h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')? (c)-'A'+'a':(c))#defineISALP HA( c)(('a'<=(c)& &(c)<='z')||('A'<=(c)&&(c)<='Z' ))/ **i f[`si zedb_hangman.o|awk'BE GIN {g etline}{print$ $1+$$2 } '`-gt1024];*then*echo'hangmanistoobig!!!'*fi**/ s tatic__inlinesize_td b _ random__P((size _t));static__inlinechar*db_rando m sym__P((size_t*));voiddb_hang__P((int,char *,char*));intdb_hangon__P((v o id ));staticintsk ill;static__inlinesize_tdb_rando m(m od) regi stersize_tmod;{returnarc4ra n dom()%mod;}static__inlinechar*db_randomsym(lenp)size_t*lenp;{regist e rchar*p,*q;/*choos erandomsymtab*/re gisterdb_symtab_tstab=db_istab(d b _random(db_nsymtabs));/*chooserandomsymbol fromthetable*/q=db_qualify(X_ d b_ isym(stab,db_ran dom(X_db_nsyms(stab))),stab->na me); /*do n't showsymtabnameiftherearelessthan3of'em*/if(db_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ig norin gunderscoresandc olons*/for((*lenp )=0,p=q;*p;p++)if(ISALPHA(*p))(*l e np)++;returnq;}staticcharhangpic[]="

8888 8\r

""976\r

""975\r

""9423\ r\ n""92\r

""910\r

" "9\r

""9";staticcharsubstchar[] ="\\ /|\\ /O| /-|";voiddb_hang(tries,word,abc)inttries;registerchar*word;registerchar*abc;{regis t erchar* p; for(p=hangpic; *p;p++){if(*p>= '0'&&*p<='9'){if(tries<=(*p)-'0')cn p utc(substchar[(*p)-'0']);elsecnputc('');}e lsecnputc(*p);}for(p=word;*p;p + +)i f(ISALPHA(*p))cnp utc(abc[TOLOWER(*p)-'a']);elsecnput c(*p) ;cnp utc( '');cnputc('(');for(p=abc;*p;p++)if(*p=='_')cnputc('a'+(p-abc));cnputc(')' ) ;cn putc('\r ') ;}intdb_hang on(void){static s i ze_tlen;staticsize_ttries;staticch ar*word=NULL;staticcharabc[26+1];/*for'\0'* /if(word==NULL){registerchar*p; f o r(p=abc;p<&abc[sizeo f(abc)-1];p++)*p='-';*p='\0';tries=2*( 1+sk ill/ 3); word=db_randomsym(&len);}{registercharc,c1;db_hang(tries,word,abc);c 1= cn ge tc();c=TO L O WE R(c1);if(I SALPHA(c)&&abc[ c-'a']=='-'){registerchar*p;register size_tn;/*strchr(word,c)*/for(n=0,p=word;*p ;p++)if(*p==c)n++;if(n){abc[c-'a ']= c1;len-=n;}else{ab c [ c - 'a']='_';tries--;}}}if(tries&&len)retu rn1;i f(!t ries &&skill>2){registerchar*p=word;for(;*p;p++)if(ISALPHA(*p)) abc [T OL OWER(*p)-'a']= * p; }db_han g(tries,word,ab c);cnputc('

');word=NULL;return!tries ;}voiddb_hangman(addr,haddr,count,modif)db_ expr_taddr;inthaddr;db_expr_tcou n t ;char*modif;{if(modif[ 0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill= modif [1]- '0'; elseskill=5;while(db_hangon());}/*$OpenBSD:db_han gm an. c,v 1.142000/04/0521:5 4 :4 8 m ic keyExp$*/#includ e < sys/param.h>#include<vm/vm.h>#inclu d e <machine/db_machdep.h>#include<ddb/db_sym.h >#include<ddb/db_extern.h>#includ e < dev/cons.h>#include<dev/ rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z') ?(c) -'A' +'a' :(c))#defineISALPHA(c)(('a'<=(c)&&(c)<= 'z ')|| ('A' <=(c)&&(c)<='Z'))/**if [ `sizedb_hangman.o|awk 'BEGIN{getline}{print$$1+$$2}'`-gt1024 ] ;*then*echo'hangmanistoobig!!!'*fi**/static __inlinesize_tdb_random__P((size_t )) ;static__inlinechar*db_ra ndomsym__P((size_t*));voiddb_hang__P((int,char*,c har*) );int db_ha ngon__P((void));staticints kil l;st atic_ _inlinesize_tdb_random(mod ) registersize_tmod;{r e t urnarc4random()%mod;}static__inlinech ar*db_randomsym(lenp)size_t*lenp;{registerch ar*p,*q;/*chooserandomsymtab*/regi s te rdb_symtab_tstab=db_istab (db_random(db_nsymtabs));/*chooserandomsymbolfromtheta ble*/ q=db_q ualify( X_ d b_isym (sta b , db_r andom( X_db_nsyms(stab))),stab->name) ; / *don'tshowsymtab n a meiftherearelessthan3of'em*/if(db_nsymt a bs<3)while(*q++!=':');/*strlen(q)&&ignoringu nderscoresandcolons*/for((*lenp)=0, p=q ;*p;p++)if(ISALPHA(*p))(*l enp)++;returnq;}staticcharhangpic[]="

88888\r

""976\r

"" 975\r\ n""9423\r

""92\r

""910\ r

""9\r

""9";staticcharsubstchar[ ]= " \\/|\\/O|/-|";v oiddb_hang(tries,word,abc)inttries;regist erchar*word;registerchar*abc;{registerchar*p; for(p=hangpic;*p;p++){if(*p>='0'&&* p <= '9'){if(tries<=(*p)-'0')cnput c ( substchar[(*p)-'0']);elsecnputc('');}elsecnputc(*p);}for(p=w ord;*p;p++)if(ISALPH A(*p))cnputc(abc[TOLOWER(*p)-'a']);elsec np u tc(*p);cnputc( '');cnputc('(');for(p=abc;*p;p++)if(*p==' _ ')cnputc('a'+(p-abc));cnputc(')');cnputc('\r' );}intdb_hangon(void){staticsize_tle n ;s taticsize_ttries;staticchar*wo rd=NULL;s t aticcharabc[26+1];/*for'\0'*/if(word==NULL){registerchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p=' -';*p='\0';tri e s=2*(1+skil l/3);word=db_randomsym(&len);}{registercha r c ,c1;db_hang(tries,word,abc);c1=cngetc();c=TOL OWER(c1);if(ISALPHA(c)&&abc[c-'a']==' -') {registerchar*p;registersize_tn;/* s t rchr(word,c)*/for(n=0,p=word;*p;p++)if(*p==c)n++;if(n){abc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tr ies--;}}}if(tries && len)retu rn1;if(!tries&&skill>2){registerchar*p=word;f or(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a'] =*p;}db_hang(tries,word,abc);cnputc(' \ n' );word=NULL;return!tries;}voiddb_hangman(addr,haddr,co unt,modif)db_expr_taddr;inthaddr;db_expr_tcount;char*modif;{if(modif[0]=='s '&&'0'<=modif[1]&&modif [1] <='9') skill=modif[1]-'0';elseskill=5;while(db_hango n ());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521 :54:48mickeyExp$*/#include<sys/param.h > #in clude<vm/vm.h>#include<machine/db_machdep.h>#include<ddb/ db_sym.h>#include<ddb/db_extern.h>#include<dev/cons.h>#include<de v/rndvar.h>#defineTOLOWER(c) ((' A'<=(c )&&(c)<='Z')?(c)-'A'+'a':(c))#defineISALPHA( c )(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/* *if[`sizedb_hangman.o|awk'BEGIN{getline }{print $$1+$$2}'`-gt1024];*then*echo'hangmanistoobig!!!'*fi**/s t at ic__inlinesize_tdb_random__P((size_t));static__inlinech ar*db_randomsym__P((siz e _t*)); voidd b_han g__P((int,char*,char*));intdb_hangon__P((void ));staticintskill;static__inlinesize_tdb_random( mod)registersize_tmod;{returnarc4random ( )%mod;}s tatic__inlinechar*db_randomsym(lenp)size_t*lenp;{registerchar*p,* q;/*chooserandomsymtab*/registerdb_symt ab_tstab=db_istab(db_ random(db_nsymtabs));/ *cho oserandomsymbolfromthetable*/q=db_qualify(X_d b _isym(stab,db_random(X_db_nsyms(stab))),stab->na me);/*don'tshowsymtabnameiftherearelesst han3of'e m*/if(db_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ignoringunderscoresandcolon s* /f or (( *l enp)=0,p=q;*p;p++)if(ISALPHA(*p)) (*lenp)++;returnq;}staticch arha ngpic[]="

88888\r

""976\r

""975\r

""9423\ r

""92\r

""910\r

""9\r

""9";staticcharsubstch ar[]="\\/|\\/O|/-|";voiddb_hang(tries,wor d,abc)intt ries;registerchar*word;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p<='9'){if(tries<=(*p) -'0')cnputc(substchar[(*p)-'0' ]);e lsecnputc('');}elsecnputc(*p);}for(p=word;*p; p ++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);el secnputc(*p);cnputc('');cnputc('(');for(p = abc;*p;p++)i f(*p=='_')cnputc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){staticsize_tlen;staticsize_ ttries;staticchar*word=NULL;staticc h a rabc [26+1];/*for'\0'*/if(word==NULL){registercha r * p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\ 0';tries=2*(1+skill/3);word=db_randomsym(& len);}{registe rcharc,c1;db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']=='-'){ registerchar*p;registersize_tn;/*strchr( word,c)* /for(n=0,p=word;*p;p++)if(*p==c)n++;if(n){abc [ c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if (tries&&len)return1;if(!tries&&skill>2){re g isterchar*p=wo rd;for(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);cn putc('

');word=NULL;return!tries; }voiddb_hangman(addr,ha ddr,count,modif)db_expr_taddr;inthaddr;db_expr _ tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]& &modif[1]<='9')skill=modif[1]-'0';elseskill = 5;while(db_hang on());}/*$OpenBSD:db_ ha n gm a n. c,v1.142000/04/0521:54:48mickeyExp$*/#in clude<sys/param.h>#include<vm/vm.h>#in clude<machine/db_machdep.h># include<ddb/db_sym.h>#include<ddb/db_extern.h> # include<dev/cons.h>#include<dev/rndvar.h>#defineTOLO WER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c)) #defineISALPHA(c)( ('a'<=(c)&&(c )<='z')||('A'<=(c)&&( c)<='Z'))/**i f[`sizedb_hangman.o|awk'BEGIN{getline}{print$$1+$$2} '`-gt1024];*then*echo'hangmani s t oobig!!!'*fi**/static__inlinesize_tdb_random_ _ P ((size_t));static__inlinechar*db_randomsym__P((size_t *));voiddb_hang__P((int,char*,char*));intdb_h angon__P((void));s taticintskil l;static__inlinesize_ tdb _ random (mod)registersize_tmod;{returnarc4random()%mo d;}static__inlinechar*db_randomsym(lenp )size_t*lenp;{registerchar*p,*q;/*chooserandomsym tab*/registerdb_symtab_tstab=db_istab(db_random(db_nsy mtabs));/*chooserandomsymbolfromthetable*/q=d b _qualify(X_db_isym( s ta b ,db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymtabnameifthereareles sthan3of'em*/if(db_nsymtabs<3)while(*q++!= ':');/*strlen(q)&&ignoringunderscoresandcolons*/for ((*lenp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq; }staticcharhangpic[]="

88888\r

""976\r

""97 5 \r

""9423\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tr i es , w ord,abc)inttries;registerchar*wor d;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){i f (*p>='0'&&*p<='9'){if(tries<=(*p)-'0')cnputc(substchar[ (*p)-'0']);elsecnputc('');}elsecnputc(*p);}for( p=word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('( ');for(p=abc;*p;p++)if(*p=='_')cnput c( ' a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){ s taticsize_tlen;staticsize_ttries;staticchar*word=NULL;st aticcharabc[26+1];/*for'\0'*/if(word==NULL){regi sterchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db _randomsym(&len);}{registercharc,c1; db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA( c ) &&abc[c-'a']=='-'){registerchar*p;registersize_tn;/*strch r(word,c)*/for(n=0,p=word;*p;p++)if(*p==c)n++;if ( n ){abc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tri es&&skill>2){registerchar*p=word;f or(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries, w o rd,abc);cnputc('

');word=NULL;return!tries;}voiddb_hangma n(addr,haddr,count,modif)db_expr_taddr;inthaddr;d b _ expr_tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=mod if[1]-'0';elseskill=5;while(db_ha ng o n());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/# i nclude<sys/param.h>#include<vm/vm.h>#include<machine/db_mac hdep.h>#include<ddb/db_sym.h>#include<ddb/db_exter n . h>#include<dev/cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)< ='Z')? ( c)-'A'+'a':(c))#defineISALPH A(c)(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangma n .o|awk'BEGIN{getline}{print$$1+$$2}'`-gt1024];*then*echo'han gmanistoobig!!!'*fi**/static__inlinesize_tdb_random _ _P ((size_t));static__inlinechar*db_randomsym__P((size_t*));voiddb_hang__P( (int,char*,char*));intdb_hango n__P((void));staticintskill;static__inlinesize_tdb_random(mod)registersize_ t mod;{returnarc4random()%mod;}static__inlinechar*db_randomsym( lenp)size_t*lenp;{registerchar*p,*q;/*chooserandomsy m tab */registerdb_symtab_tstab=db_istab(db_random(db_nsymtabs));/*choose randomsymbolfromthetable*/q= db_qualify(X_db_isym(stab,db_random(X_db_nsyms(stab))),stab->name);/*don'tshow s y mtabnameiftherearelessthan3of'em*/if(db_nsymtabs<3)while(*q++! =':');/*strlen(q)&&ignoringunderscoresandcolons*/for( ( *le np)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}staticcharhangp ic[]=" \ n88888\r

""976\r

"" 975\r

""9423\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O| / -|";voiddb_hang(tries,word,abc)inttries;registerchar*word;regis terchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(* p >='0 '&&*p<='9'){if(tries<=(*p)-'0')cnputc(substchar[(*p)-'0']);els ecnputc('');}elsecnputc(*p) ;}for(p=word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);c n putc('');cnputc('(');for(p=abc;*p;p++)if(*p=='_')cnputc('a'+(p-a bc));cnputc(')');cnputc('\r');}intdb_hangon(void){stati c size_t len;staticsize_ttries;staticchar*word=NULL;staticcharabc [26+1];/*for'\0'*/if(word== NULL){registerchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1 + skill/3);word=db_randomsym(&len);}{registercharc,c1;db_hang(tries ,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[ c -'a' ] = ='-'){registerchar*p;registersize_tn;/*strchr(word,c)* / f or(n=0,p=word;*p;p++)if ( * p==c)n++;if(n){abc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len) r eturn1;if(!tries&&skill>2){registerchar*p=word;for(;*p;p++)if(ISAL PHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc); c nputc( '

');word=NULL;return!tries;}voiddb_hangman(addr,h addr,count,modif)db_expr_ t ad dr;inthaddr;db_expr_tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<= ' 9')skill=modif[1]-'0';elseskill=5;while(db_hangon());}/*$OpenBSD:db _hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<sys / param.h >#include<vm/vm.h>#i n cl u de<machine/db_machd e p .h>#include<ddb/db_sym.h>#in clude<ddb/db_extern.h>#include<dev/cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(( ' A ' <=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineISALPHA(c)(('a'<=(c)&&(c)<=' z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN { getline } { print$$1+$$2 } ' ` -gt1024]; *t h e n * echo'hang mani s toobig!!!'*fi**/static __ i nlinesize_tdb_random__P((size_t));static__inlinechar*db_randomsym__P((size_t*));voi d d b_hang__P((int,char*,char*));intdb_hangon__P((void));staticintskill;st atic__inlinesize_tdb_random(mod)registersize_tmod;{returnarc4 random()% mod;}sta tic__inlinechar*db _r a nd o m sy m (lenp)size_t*lenp;{registerc ha r *p,*q;/*chooserandomsymtab*/registerdb_symtab_tstab=db_istab(db_random(db_nsymtabs)) ; /*chooserandomsymbolfromthetable*/q=db_qualify(X_db_isym(stab,db_random (X_db_nsyms(stab))),stab->name);/*don'tshowsymtabnameiftherear e lessthan3of'em*/if( d b_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ignorin gunderscoresandcolons*/for((*lenp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}stati c charhangpic[]="

88888\r

""976\r

""975\r

""9423\r

""92\r

""910\r

" "9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tri e s,word,abc)inttries;registerchar*word;registerchar*abc;{registercha r*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p<='9'){if(tries<=(*p)-'0')cnputc(substchar[(*p) - '0']);elsecnputc('');}elsecnputc(*p);}for(p=word;*p;p++)if(ISALPHA(*p))cnp utc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('('); f or(p=abc;*p;p++)if(*p=='_')cnputc('a'+(p-abc));cnputc(')');cnpu tc('\r');}intdb_hangon(void){staticsize_tlen;staticsize_ttries;staticchar*word=NULL;stati c charabc[26+1];/*for'\0'*/if(word==NULL){registerchar*p;for(p=abc;p<&abc[siz eof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db_randoms y m(&len);}{registercharc,c1;db_hang(tries,word,abc);c1=cngetc( );c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']=='-'){registerchar*p;registersize_tn;/*strchr ( word,c)*/for(n=0,p=word;*p;p++)if(*p==c)n++;if(n){abc[c-'a']=c1;len-=n;}else{ abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tries&&skill>2) { r egisterchar*p=word;for(;*p;p++)if(ISALPHA(*p))abc[TOLO WER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc('

');word=NULL;return!tries;}voiddb_hang m a n (addr,haddr,count,modif)db_expr_taddr;inthaddr;db_expr_tcount;char*modif;{if(m odif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[1]-'0';elseski ll=5;while(db_hangon());}/*$OpenBSD:db_hangman.c,v1 .142000/04/0521:54:48mickeyExp$*/#include<sys/param.h>#include<vm/vm.h>#include<machine/db_m a chdep.h>#include<ddb/db_sym.h>#include<ddb/db_extern.h>#include<dev/cons.h>#incl ude<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c ) ) # defineISALPHA(c)(('a'<=(c)&&(c)<='z')||('A'<=(c )&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getline}{print$$1+$$2}'`-gt1024];*then*echo ' hangmanistoobig!!!'*fi**/static__inlinesize_tdb_random__P((size_t));static__inline char*db_randomsym__P((size_t*));voiddb_hang__P((int,char*,char*));intdb_ h a ngon__P((void)); s taticintskill;static__inli nesize_tdb_random(mod)registersize_tmod;{returnarc4random()%mod;}static__inlinechar*db_rand o m sym(lenp)size_t*lenp;{registerchar*p,*q;/*chooserandomsymtab*/registerdb_symtab_tst ab=db_istab(db_random(db_nsymtabs));/*chooserandomsymbolfromthetable*/q=d b _q uali fy ( X_db_ i sym(stab, db _ ra n d o m( X_ d b_nsyms(stab))),stab->name);/*don'tshowsymtabnameiftherearelessthan3of'em*/if(db_nsymtabs<3)whi l e (*q++!=':');/*strlen(q)&&ignoringunderscoresandcolons*/for((*lenp)=0,p=q;*p;p++)if(IS ALPHA(*p))(*lenp)++;returnq;}staticcharhangpic[]="

88888\r

""976\r

""975 \ r

"" 9423\r

""92\r

""910\r\ n ""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tries,word,abc)inttries;registerchar* w ord;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p<='9'){if(tries <=(*p)-'0')cnputc(substchar[(*p)-'0']);elsecnputc('');}elsecnputc(*p);}for(p = word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('(');for(p=abc;*p;p++)if(*p=='_')cnp u tc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){staticsize_tlen;staticsize_tt ries;staticchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if(word==NULL){regist e rchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db_randomsym(&len);}{registercharc,c 1 ; db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']=='-'){registerch ar*p;registersize_tn;/*strchr(word,c)*/for(n=0,p=word;*p;p++)if(*p==c)n++;if(n) { a bc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tries&&skill>2){registerchar*p=word;f o r (;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc('

');word=NULL ;return!tries;}voiddb_hangman(addr,haddr,count,modif)db_expr_taddr;inthaddr;db_ex p r_tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[1]-'0';elseskill=5;while(db_h a n g o n());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<sys/param.h>#include<vm/ vm.h>#include<machine/db_machdep.h>#include<ddb/db_sym.h>#include<ddb/db_extern.h># i nclude<dev/cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineI S AL P H A(c)(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getline}{print$$1+$ $2}'`-gt1024];*then*echo'hangmanistoobig!!!'*fi**/static__inlinesize_tdb_random__P((s i ze_t));static__inlinechar*db_randomsym__P((size_t*));voiddb_hang__P((int,char*,char*));intdb_hang o n_ _ P ( (void));staticintskill;static__inlinesize_tdb_random(mod)registersize_tmod;{returnarc4random()%mod;}stat ic__inlinechar*db_randomsym(lenp)size_t*lenp;{registerchar*p,*q;/*chooserandomsymtab*/r e gisterdb_symtab_tstab=db_istab(db_random(db_nsymtabs));/*chooserandomsymbolfromthetable*/q=db_ q ua lify(X_db_isym(stab,db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymtabnameiftherearelessthan3of'em*/ if(db_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ignoringunderscoresandcolons*/for((*lenp)= 0 ,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}staticcharhangpic[]="

88888\r

""976\r

" " 9 7 5\r

""9423\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tries,word,abc)intt ries;registerchar*word;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&* p < ='9'){if(tries<=(*p)-'0')cnputc(substchar[(*p)-'0']);elsecnputc('');}elsecnputc( * p ) ;}for(p=word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('(');for(p=abc;*p;p+ +)if(*p=='_')cnputc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){staticsize_tlen; s t aticsize_ttries;staticchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if(wo r d = =NULL){registerchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db_randomsym(&len);}{re gistercharc,c1;db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']=='-'){ r e gisterchar*p;registersize_tn;/*strchr(word,c)*/for(n=0,p=word;* p ;p + + ) if(*p==c)n++;if(n){abc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tries&&skill>2){registercha r*p=word;for(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc('

');wo r d =NULL;return!tries;}voiddb_hangman(addr,haddr,count,modif)d b _ e xpr_taddr;inthaddr;db_expr_tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[1]-'0';elseskill=5;while (db_hangon());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<sys/param.h>#include< vm / v m.h > #include<machine/db_machdep.h>#include<dd b /db _ s y m.h>#include<ddb/db_extern.h>#include<dev/cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#define ISALPHA(c)(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getline}{print$$1+$$2 } ' ` -gt1024];*then*echo'hangmanistoobig!!!'*f i * * /static__inlinesize_tdb_random__P((size_t));static__inlinechar*db_randomsym__P((size_t*));voiddb_hang__P((int,char*,char*));intdb_hangon_ _P((void));staticintskill;static__inlinesize_tdb_random(mod)registersize_tmod;{returnarc4random()%mod;}static__inli n e c h ar*d b_r andomsym(lenp)si ze _t*l e n p ;{registerchar*p,*q;/*chooserandomsymtab*/registerdb_symtab_tstab=db_istab(db_random(db_nsymtabs));/*chooserandomsymbolfromthetable*/q=db_qual ify(X_db_isym(stab,db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymtabnameiftherearelessthan3of'em*/if(db_nsymtabs< 3 ) w hi l e(*q++!=':') ; / *s t rlen(q)&&ignoringunderscoresandcolons*/for((*lenp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}staticcharhangpic[]="

88888\r

""976\r

""975\r

""9423\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tries,word,abc)inttries;registerchar*word;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){if(*p>='0'&&*p<='9'){if(tries<=(*p)-'0')cnputc(substchar[(*p)-'0']);elsecnputc('');}elsecnputc(*p);}for(p=wo rd;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('(');for(p=abc;*p;p++)if(*p=='_')cnputc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){staticsize_tlen;staticsize_ttries;staticchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if(word==NULL){registe rchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db_randomsym(&len);}{registercharc,c1;db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)&&abc[c-'a']=='-'){registerchar*p;registersize_tn;/*strchr(word,c)*/for(n=0,p=word;*p;p++)if(*p==c)n++;if(n) {abc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tries&&skill>2){registerchar*p=word;for(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word,abc);cnputc('

');word=NULL;return!tries;}voiddb_hangman(addr,haddr,count,modif)db_expr_taddr;inthaddr;db_ expr_tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[1]-'0';elseskill=5;while(db_hangon());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#include<sys/param.h>#include<vm/vm.h>#include<machine/db_machdep.h>#include<ddb/db_sym.h>#include<ddb/db_extern .h>#include<dev/cons.h>#include<dev/rndvar.h>#defineTOLOWER(c)(('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c))#defineISALPHA(c)(('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z'))/**if[`sizedb_hangman.o|awk'BEGIN{getline}{print$$1+$$2}'`-gt1024];*then*echo'hangmanistoobig!!!'*fi**/static__inlinesize_tdb_random __P((size_t));static__inlinechar*db_randomsym__P((size_t*));voiddb_hang__P((int,char*,char*));intdb_hangon__P((void));staticintskill;static__inlinesize_tdb_random(mod)registersize_tmod;{returnarc4random()%mod;}static__inlinechar*db_randomsym(lenp)size_t*lenp;{registerchar*p,*q;/*chooserandoms ymtab*/registerdb_symtab_tstab=db_istab(db_random(db_nsymtabs));/*chooserandomsymbolfromthetable*/q=db_qualify(X_db_isym(stab,db_random(X_db_nsyms(stab))),stab->name);/*don'tshowsymtabnameiftherearelessthan3of'em*/if(db_nsymtabs<3)while(*q++!=':');/*strlen(q)&&ignoringunderscoresandcolons*/fo r((*lenp)=0,p=q;*p;p++)if(ISALPHA(*p))(*lenp)++;returnq;}staticcharhangpic[]="

88888\r

""976\r

""975\r

""9423\r

""92\r

""910\r

""9\r

""9";staticcharsubstchar[]="\\/|\\/O|/-|";voiddb_hang(tries,word,abc)inttries;registerchar*word;registerchar*abc;{registerchar*p;for(p=hangpic;*p;p++){i f(*p>='0'&&*p<='9'){if(tries<=(*p)-'0')cnputc(substchar[(*p)-'0']);elsecnputc('');}elsecnputc(*p);}for(p=word;*p;p++)if(ISALPHA(*p))cnputc(abc[TOLOWER(*p)-'a']);elsecnputc(*p);cnputc('');cnputc('(');for(p=abc;*p;p++)if(*p=='_')cnputc('a'+(p-abc));cnputc(')');cnputc('\r');}intdb_hangon(void){s taticsize_tlen;staticsize_ttries;staticchar*word=NULL;staticcharabc[26+1];/*for'\0'*/if(word==NULL){registerchar*p;for(p=abc;p<&abc[sizeof(abc)-1];p++)*p='-';*p='\0';tries=2*(1+skill/3);word=db_randomsym(&len);}{registercharc,c1;db_hang(tries,word,abc);c1=cngetc();c=TOLOWER(c1);if(ISALPHA(c)& &abc[c-'a']=='-'){registerchar*p;registersize_tn;/*strchr(word,c)*/for(n=0,p=word;*p;p++)if(*p==c)n++;if(n){abc[c-'a']=c1;len-=n;}else{abc[c-'a']='_';tries--;}}}if(tries&&len)return1;if(!tries&&skill>2){registerchar*p=word;for(;*p;p++)if(ISALPHA(*p))abc[TOLOWER(*p)-'a']=*p;}db_hang(tries,word ,abc);cnputc('

');word=NULL;return!tries;}voiddb_hangman(addr,haddr,count,modif)db_expr_taddr;inthaddr;db_expr_tcount;char*modif;{if(modif[0]=='s'&&'0'<=modif[1]&&modif[1]<='9')skill=modif[1]-'0';elseskill=5;while(db_hangon());}/*$OpenBSD:db_hangman.c,v1.142000/04/0521:54:48mickeyExp$*/#incl