diff options
author | epochqwert <epoch@hacking.allowed.org> | 2015-05-28 07:16:46 -0500 |
---|---|---|
committer | epochqwert <epoch@hacking.allowed.org> | 2015-05-28 07:16:46 -0500 |
commit | 05f18ac5c65755e1dde4d4bd44575011310bc648 (patch) | |
tree | fc8120feb1a68a205127ea3219ae0e9b32e5e629 | |
parent | bab39151c44f47c296a53f32f378b948d6d11cef (diff) | |
download | misc-05f18ac5c65755e1dde4d4bd44575011310bc648.tar.gz misc-05f18ac5c65755e1dde4d4bd44575011310bc648.zip |
added quot to the html entities programs
cat fontfile.808 | fontdump > editme.font ; cat editme.font | fontbuild.sh > filefile2.808
the fontstuff is for text-mode fonts for NetBSD. at least. can probably be used for any binary files if you want. only support for 8x8 fonts in build atm.
mime-type got a fix for css
-rwxr-xr-x | nocompile/bin/decode_html_entities | 1 | ||||
-rwxr-xr-x | nocompile/bin/encode_html_entities | 3 | ||||
-rwxr-xr-x | nocompile/bin/fontbuild.sh | 2 | ||||
-rwxr-xr-x | nocompile/bin/mime-type | 12 | ||||
-rw-r--r-- | src/bin/fontbuild.c | 21 | ||||
-rw-r--r-- | src/bin/fontdump.c | 19 |
6 files changed, 52 insertions, 6 deletions
diff --git a/nocompile/bin/decode_html_entities b/nocompile/bin/decode_html_entities index 08bd7c9..dea945a 100755 --- a/nocompile/bin/decode_html_entities +++ b/nocompile/bin/decode_html_entities @@ -1,4 +1,5 @@ #!/bin/sh sed "s/\>/>/g" \ | sed "s/\</</g" \ + | sed 's/\"/"/g' \ | sed "s/\&/\&/g" diff --git a/nocompile/bin/encode_html_entities b/nocompile/bin/encode_html_entities index 4cb1836..e2bcf30 100755 --- a/nocompile/bin/encode_html_entities +++ b/nocompile/bin/encode_html_entities @@ -1,4 +1,5 @@ #!/bin/sh sed "s/&/\&/g" \ | sed "s/</\</g" \ - | sed "s/>/\>/g" + | sed "s/>/\>/g" \ + | sed 's/"/\"/g' diff --git a/nocompile/bin/fontbuild.sh b/nocompile/bin/fontbuild.sh new file mode 100755 index 0000000..cd16ec8 --- /dev/null +++ b/nocompile/bin/fontbuild.sh @@ -0,0 +1,2 @@ +#!/bin/sh +grep -v ^0 | tr -d '\n' | fontbuild diff --git a/nocompile/bin/mime-type b/nocompile/bin/mime-type index 2b1bad0..83dc116 100755 --- a/nocompile/bin/mime-type +++ b/nocompile/bin/mime-type @@ -1,13 +1,15 @@ #!/bin/sh -TYPE="$(file -b --mime-type $1)" -MAIN="$(echo "${TYPE}" | cut -d/ -f1)" -SUB="$(echo "${TYPE}" | cut -d/ -f2)" +EXT="$(printf "%s" "$1" | rev | cut -d. -f1 | rev)" +TYPE="$(file -b --mime-type "$1")" +MAIN="$(printf "%s" "${TYPE}" | cut -d/ -f1)" +SUB="$(printf "%s" "${TYPE}" | cut -d/ -f2)" if [ "_${MAIN}" = "_inode" ];then - printf "text/plain\r\n" -# printf "this is a directory or symlink! wtf?!?" #ssssshhhhh TYPE="text/plain" fi if [ "_${MAIN}" = "_text" -a "_${SUB}" != "_html" ];then TYPE="text/plain" fi +if [ "_${EXT}" = "_css" ];then + TYPE="text/css" +fi printf "%s\r\n" "$TYPE" diff --git a/src/bin/fontbuild.c b/src/bin/fontbuild.c new file mode 100644 index 0000000..b4a212a --- /dev/null +++ b/src/bin/fontbuild.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <stdlib.h> + +int main(int argc,char *argv[]) { + int i,j,k; + int height=8; + int width=8; + char line; + char *map=malloc(width); + for(i=0;i<256;i++) { + for(j=0;j<height;j++) { + read(0,map,width); + line=0; + for(k=0;k<8;k++) { + line|=((map[7-k]=='#')<<k); + } + printf("%c",line); + } + } + return 0; +} diff --git a/src/bin/fontdump.c b/src/bin/fontdump.c new file mode 100644 index 0000000..eb481d0 --- /dev/null +++ b/src/bin/fontdump.c @@ -0,0 +1,19 @@ +#include <stdio.h> +#include <stdlib.h> + +int main(int argc,char *argv[]) { + int i,j,k; + int height=argc>1?atoi(argv[1]):8; + char *map=malloc(height); + for(i=0;i<256;i++) { + printf("0x%02x (%3d) '%c'\n",i,i,isprint(i)?i:'?'); + read(0,map,height); + for(j=0;j<height;j++) { + for(k=7;k>=0;k--) { + printf("%c",(map[j]>>k&1)?'#':' '); + } + printf("\n"); + } + } + return 0; +} |