#include<stdio.h>
# include <time.h>
/* ,*/# include <stdlib.h>
/* o*/ typedef char*l;typedef
int L;L _, D,e,A,T,H,N,O,t,E
; L X(l o){return(L)(*o+=((*o>64&&*o<91)?32:0)
);} typedef union{l I;L i;}h;typedef/*L*/void
P;l x,y;FILE*f;typedef struct {L i,g;h*t;}v;v V[26],w;L s
(l d){for(D=0;*d++;D++);return D;}P p(L o){putchar(o );}P k
(L o){fseek(f,0,o);}P F(P*o){free(o);}P S(v*o,l d){h*
a,*b,*c;D=sizeof(h);if(! o->t)o->t=(h*)malloc((
o->g=32)*D);if(o->t&&o-> i +1>o->g){if((a=c=(h
*)malloc((o->g*2)*D))){b =o->t;for(D=o ->i;-D--;a++->i=b++
->i);F(o->t) ; o->t=c;o -> g*=2;}}if(o->t)o->t[o->i++]
.I=d;}P q(l/**/o ){for(;*o ;p(*o++));}P R(v*l){l->t=(h
*)0;l->i=l->g=0;}P Z( v*o){if(o-> t)F(o->t);}P z(l a,l b){for
(N=0;*a&&*b&&*a==*b;a++,b ++,N++);}P Q( P){fclose(f);}L main(L u,l
* U){l a="fopen error\n";if(u< 2){;q("<file> [width] [...]\n");}else{if(
( f=fopen(U[01], "rb"))){k(2);_= ftell(f);if(_>9&&(y=(l)malloc (_+1))){k(0)
; y[fread(y ,1,_,f) ]=0;Q();;for( e=0;e<26;R(&V[e++]));R(&w);for( x=y;_
--;*(x++)= 0){if((* x>64&&*x<91) ||(*x>96&&*x<123)){S(&(V[X(x)-
97] ),(l)w .i);for(S( &w ,x);_--?(*x>64&&*x<91)||(*x>96&&*x<123)||(*x
>47 &&58>* x):0 ;x++)X (x);_ ++;}}if((_=(u>2)?atoi(U[2]):80)<1)_=80;if(
u> 3){++x; for( srand( time( 0)) ;u-->3;){p(10);t=s(x=U[u]);for( e=0
;e <t; e++ )X(x+e);q(x);for(E= _-1-s(U[u-1]);t<E;t+=1+s(x)){for(A= e=0
;! A | (t +1+s (w.t[e].I)>=_) /* ooo `*/;){O=*x-97;e=rand()%w.i;A =
O > - 1?O </* o888 */26 :0;if(A /* 8888b */){if(V[O].i){z(x,w.t[e=V[
O ] .t[rand(/* 88888 */)% V/* 9 88888 */[O].i].i].I);H=N; for( A
=0;A<V[O]/*9888P x */. /* 9888 */i/2;A++){T=V[O].t[ rand
()%V[O].i] .i;z(x , w. t [T].I) ;if(-N<-H){H=N;e=T ;}}
e= (e+1/* "" ( */)%w.i;}}}p(32);q (x
=w .t[e]. I );}}}else{t=_;for( e=
0; e<w.i ; ++e){if(_>(s(w.t[ e
] .I)+1+ t )){p(32);t++;}else
{p (10) ; t =0;}q(w.t [e].I)
; t+=s( w.t[e].I); }}e=0
; p(10) ;p(10 );; for(
;26 > e;Z (& V[e ++
]) , 0);Z(& w ); F (y) ;}
if ( ! y ) {Q
( ) ; } } if
( ! f ){
q(a );}}
return-0;}
|