diff options
-rwxr-xr-x | XTERM | 20 | ||||
-rw-r--r-- | cfile.c | 25 | ||||
-rw-r--r-- | dotrc/_vimrc | 22 | ||||
-rw-r--r-- | num.c | 5 | ||||
-rw-r--r-- | serv.c | 47 |
5 files changed, 103 insertions, 16 deletions
@@ -1,2 +1,18 @@ -xterm -vb -bg black -fg white -cr red -sb -sl 5000 -sk -si -geom 80x60 \ - -fn 9x15 -n xterm -title xterm & +if [ "$(xlsatoms -name AMIWM_SCREEN 2> /dev/null)" ] ; then + FG=black + BG=gray75 + TITLE=Terminal + SIZE=80x35 + #FONT="-commodore-topaz2 double 1h-medium-r-normal--16--96-96-m-70-winsys-1" + FONT="-commodore-topaz2 normal-medium-r-normal--18--96-96-m-70-winsys-1" + +else + FG=white + BG=black + TITLE=xterm + SIZE=80x60 + FONT="-misc-proggysquarettsz-medium-r-normal--0-0-0-0-c-0-ascii-0" +fi + +xterm -vb -bg $BG -fg $FG -cr red -sb -sl 5000 -sk -si -geom $SIZE \ + -fn "$FONT" -n "$TITLE" -title "$TITLE" & @@ -5,14 +5,19 @@ #include <stdio.h> #include <errno.h> +#define TYPE unsigned char +#define STR(x) #x +#define XSTR(x) STR(x) + int main(int argc, char *argv[]) { const char *name="bfile"; FILE *in,*out; - unsigned long num; + TYPE num; int col; int first; int len; + int fldsz; in=stdin; out=stdout; @@ -47,7 +52,9 @@ int main(int argc, char *argv[]) fprintf(out,"/* Auto-generated binary */\n\n"); } - fprintf(out,"unsigned long %s[]=\n\t\t\t{",name); + fldsz = sizeof num * 2; + + fprintf(out,XSTR(TYPE) " %s[]=\n\t{",name); col=0; num=0; @@ -56,33 +63,33 @@ int main(int argc, char *argv[]) while(!feof(in)) { - fread(&num,sizeof(unsigned long),1,in); + fread(&num,sizeof num,1,in); if (col==0) { if (first) { - fprintf(out,"\n\t\t\t"); + fprintf(out,"\n\t\t"); first=0; } else { - fprintf(out,",\n\t\t\t"); + fprintf(out,",\n\t\t"); } } else { - fprintf(out,","); + fprintf(out,", "); } - fprintf(out,"0x%.8x",num); + fprintf(out,"0x%.*x",fldsz, num); - col=(col+1)%4; + col=(col+1) % (8 / sizeof num); num=0; len++; } - fprintf(out,"\n\t\t\t};\n#define %s_LEN %d\n", name, len); + fprintf(out,"\n\t};\n#define %s_LEN %d\n", name, len); fclose(in); fclose(out); diff --git a/dotrc/_vimrc b/dotrc/_vimrc index fcda293..06c3f5e 100644 --- a/dotrc/_vimrc +++ b/dotrc/_vimrc @@ -15,15 +15,28 @@ set modeline : syntax on :endif -set background=dark -syntax on +let Gtags_Auto_Map = 1 + +:if $BGLIGHT == "Y" +: set background=light +:else +: set background=dark +:endif + +:if $AMIGA == "Y" +: syntax off +: set background=light +:else +: syntax on +: let &colorcolumn=join(range(81, 999),",") +:endif set wildchar=^I set wildmode=list,longest set wildignore=*.o,core,*~,*.bak,*.a,*.obj set wildmenu -" set fileformats=unix,dos,mac +set fileformats=unix,dos,mac " For quickfix " set mp=make\ \\\|&\ egrep\ ^cc:\ \\\|&\ egrep\ error @@ -42,6 +55,9 @@ map __ :cc map <C-Tab> :bnext
map! <C-Tab> :bnext
+" Spelling options +set spellfile=$HOME/.spell.en.add + " Try and set color for xterm " " :if &term =~ "xterm" @@ -87,27 +87,30 @@ int main(int argc, char *argv[]) for(f = 1; f < argc; f++) { num = strtoull(argv[f], NULL, 0); - snum=(signed long long)num; if (num < 0x100ull) { h_width = 2; b_width = 8; + snum=(signed char)num; } else if (num < 0x10000ull) { h_width = 4; b_width = 16; + snum=(signed short)num; } else if (num < 0x100000000ull) { h_width = 8; b_width = 32; + snum=(signed long)num; } else { h_width = 16; b_width = 64; + snum=(signed long long)num; } printf("Original : %s\n", argv[f]); @@ -12,6 +12,8 @@ #include <netinet/tcp.h> #include <netdb.h> +#define DUMP_WIDTH 16 + static const char *name; static int Socket(int p) @@ -46,6 +48,48 @@ static int Socket(int p) return sock_fd; } +static void Dump(const char *p, int len) +{ + char asc[DUMP_WIDTH + 1] = {0}; + unsigned int off = 0; + int col = 0; + + while (len > 0) + { + unsigned char c = *p; + + if (col == 0) + { + printf("%4.4x:", off); + } + + printf(" %2.2x", (unsigned int)c); + + asc[col++] = isprint(c) ? c : '.'; + + if (col == DUMP_WIDTH) + { + printf(" %s\n", asc); + memset(asc, 0, sizeof asc); + col = 0; + } + + off++; + p++; + len--; + } + + if (col > 0) + { + while (col++ < DUMP_WIDTH) + { + printf(" **"); + } + + printf(" %s\n", asc); + } +} + int main(int argc, char *argv[]) { struct sockaddr_in addr; @@ -98,7 +142,8 @@ int main(int argc, char *argv[]) while((len=read(connect_fd,buff,1024))>0) { buff[len]=0; - printf("%s: recieved '%s'\n",name,buff); + printf("%s: recieved\n",name); + Dump(buff, len); } if (len == -1) |