plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

demangler.c (427B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include <bio.h>
      4 #include <mach.h>
      5 
      6 void
      7 main(void)
      8 {
      9 	Biobuf b, bout;
     10 	char *p, *s;
     11 	char buf[100000];
     12 
     13 	Binit(&b, 0, OREAD);
     14 	Binit(&bout, 1, OWRITE);
     15 
     16 	while((p = Brdline(&b, '\n')) != nil){
     17 		p[Blinelen(&b)-1] = 0;
     18 		werrstr("no error");
     19 		s = demanglegcc2(p, buf);
     20 		if(s == p)
     21 			Bprint(&bout, "# %s (%r)\n", p);
     22 		else
     23 			Bprint(&bout, "%s\t%s\n", p, s);
     24 	}
     25 	Bflush(&bout);
     26 	exits(0);
     27 }