Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

rotate ascii image in perl

Name: Anonymous 2009-03-03 9:20

has anyone ever written a script that will rotate input of multiple lines ascii text by a certain number of degrees?

would love it in perl but if anyone has the same in bourne shell or bash it would be awesome and you would surely achieve satori on your death bed.

Name: Anonymous 2009-03-03 9:42


/* rotate - might be buggy
(C) Copyright Anonymous.
This program is free software; you can redistribute it and/or modify
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/
#include <stdio.h>
#include <stdlib.h>
#define zz malloc(sizeof(P))
#define Z(zp) (zp)->a=0;(zp)->z=0
#define aa a>=0;a--
struct p{char *a;struct p*z;};typedef struct p P;int main(){char _[0xff];
int a,A,o;A=o=0;struct{P*a,*z;}z;z.z=zz;Z(z.z);z.z->z=zz; Z(z.z->z); z.a\
=z.z->z;do{if(!fgets(_,sizeof(_),stdin)) break; for(a=0;*(_+a);a++);if(a)
if(_[a-2]-'\n') { _[a---2]=0; } if(a>A) A=a; z.a->a=malloc(a);for(;aa) *\
((z.a->a) +a) = _[a]; z.a->z=zz; Z(z.a->z); z.a=z.a->z; } while(z.a); for
(a=A-1;aa) for(z.a=z.z->z;z.a->z;z.a=z.a->z) {  for(o=0;*(z.a->a+o);o++);
putchar((a>=o)?' ':z.a->a[a]); if(!z.a->z->z) putchar('\n'); }return 0; }

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List