aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/urcdump.c
diff options
context:
space:
mode:
authorepochqwert <epoch@hacking.allowed.org>2015-04-23 04:53:35 -0500
committerepochqwert <epoch@hacking.allowed.org>2015-04-23 04:53:35 -0500
commita36652959e52e8c810b7d2d76a283b2ae9718d96 (patch)
treea8c9712f7eb243d72bfdb492c0c14e630e78a03d /src/bin/urcdump.c
parent318b3220d191011bb9132efd4dbd5e6fb467b4e7 (diff)
downloadmisc-a36652959e52e8c810b7d2d76a283b2ae9718d96.tar.gz
misc-a36652959e52e8c810b7d2d76a283b2ae9718d96.zip
elapsedtime handles partial seconds better
unescape now handles multiple lines from stdin clump can now have an optional argument to specify input separator cuturl can now take compressed short options. (like: cuturl -dPs) filemon... I don't remember. just reformatted it looks like. ipconvert. looks like I added explainations before output. normalpath now uses getenv("PWD") instead of getcwd() so you can pick what you want to be the base for relative paths. urcdump... nothing I guess. probably a space or something dumb. httpd... more environment variables set for CGIs
Diffstat (limited to 'src/bin/urcdump.c')
-rw-r--r--src/bin/urcdump.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/bin/urcdump.c b/src/bin/urcdump.c
index 8d19370..0fea8ed 100644
--- a/src/bin/urcdump.c
+++ b/src/bin/urcdump.c
@@ -7,7 +7,8 @@
int main(int argc,char *argv[]) {
int s;
struct sockaddr_in name;
- char *tmp;
+ //char *tmp;
+ int tmp;
char chunk[BS];
int off=0;
char buf[BS];
@@ -25,15 +26,34 @@ int main(int argc,char *argv[]) {
if(connect(s,(struct sockaddr *)&name,len) == -1) return -1;
while((len=read(s,buf,BS-1)) > 0) {
- memcpy(chunk+off,buf,len);
- off+=len;
- if(off > 26) {
+ for(tmp=0;tmp<len;tmp++) {
+ if(isprint(*(buf+tmp))) {
+ write(1,(buf+tmp),1);
+ } else {
+ write(1,"%",1);
+ write(1,"0123456789abcdef"+((buf[tmp])>>4&15),1);
+ write(1,"0123456789abcdef"+((buf[tmp])&15),1);
+ }
+ }
+/*
+ while(off > 26) {
if((tmp=memchr(chunk+26,'\n',off-26))) {
tmp++;
- write(1,chunk+26,tmp-chunk-26);
+//old write(1,chunk+26,tmp-chunk-26);
+//testing:
+ for(len=26;len<tmp-chunk-1;len++) {
+ if(isprint(*(chunk+len))) {
+ write(1,(chunk+len),1);
+ } else {
+ write(1,"%",1);
+ write(1,"0123456789abcdef"+((*chunk+len)>>4 & 15),1);
+ write(1,"0123456789abcdef"+((*chunk+len)&15),1);
+ }
+ }
memmove(chunk,tmp,tmp-chunk+1);
off-=(tmp-chunk);
}
}
+ */
}
}