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. --- num.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 num.c (limited to 'num.c') diff --git a/num.c b/num.c new file mode 100644 index 0000000..b24da39 --- /dev/null +++ b/num.c @@ -0,0 +1,128 @@ +#include + +#define LONG 0 +#define WORD 1 +#define BYTE 2 + +main(argc,argv) +int argc; +char *argv[]; + +{ + signed long snum; + unsigned long num; + unsigned short word; + unsigned char byte; + double dbl; + int mode=LONG; + int arg=0; + int f; + char *binary(); + char *ascii(); + + if(argc==1) + { + printf("%s: usage %s N1 [..Nn]\n",argv[0],argv[0]); + exit(-1); + } + + for(f=1;f>1) + { + if (!((c+1)%4)&&!first) + *p++=' '; + + if(i&b) + *p++='1'; + else + *p++='0'; + + first=0; + } + + *p='\0'; + + return(buff); +} + + +char *ascii(num,l) +unsigned long num; +{ + static char s[5]; + int f; + unsigned char c; + + s[l]=0; + + for(f=0;f=32)&&(c<127)) + s[(l-1)-f]=c; + else + s[(l-1)-f]='.'; + num=num>>8; + } + + return(s); +} -- cgit v1.2.3