From 954af9179665457b40453a0417ddf5b3949a0449 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 4 Mar 2007 18:35:36 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2, which included commits to RCS files with non-trunk default branches. --- asc.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 asc.c (limited to 'asc.c') diff --git a/asc.c b/asc.c new file mode 100644 index 0000000..46f37b2 --- /dev/null +++ b/asc.c @@ -0,0 +1,73 @@ +#include + +main(argc,argv) +int argc; +char *argv[]; + +{ + int f,l,r; + unsigned int c; + + char *binary(); + + if(argc==1) + { + printf("%s: usage %s string1 [..stringn] | -c num1 [.. num n]\n", + argv[0],argv[0]); + exit(-1); + } + + if(strcmp(argv[1],"-c")) + { + for(r=1;r 31) ? (*(argv[r]+f)) : '?') + ,c,c,binary(c,8)); + } + } + } + else + { + if(argc==2) + { + printf("%s:usage %s -c num1 [.. num n]\n",argv[0],argv[0]); + exit(-1); + } + for(f=2;f31) ? (char)c : '?', + c,c,binary(c,8)); + } + } + +} + + +char *binary(i,w) +unsigned int i,w; + +{ + static char buff[1024],*p; + unsigned int c=w,b=1<<(w-1); + + p=buff; + + for(;c--;b=b>>1) + if(i&b) + *p++='1'; + else + *p++='0'; + + *p='\0'; + + return(buff); +} -- cgit v1.2.3