-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: shell-daemons action: commit revision: path_from: revision_from: 1b42a9f931fe1a5dd8126d3487542cc717f5dc93: path_to: revision_to:
commit 1b42a9f931fe1a5dd8126d3487542cc717f5dc93 Author: epoch <epoch@hack.thebackupbox.net> Date: Sun May 24 04:45:37 2020 +0000 save point. collecting deps diff --git a/README b/README new file mode 100644 index 0000000000000000000000000000000000000000..3770e1e60eeb01666274f0fd7ca6d31d38fee4e4 --- /dev/null +++ b/README @@ -0,0 +1,3 @@ +You'll need uritools to get some of these working. + +git://thebackupbox.net/uritools diff --git a/mime-type b/mime-type new file mode 100755 index 0000000000000000000000000000000000000000..83dc116ed384a40395683e9cb8a586dd461ed293 --- /dev/null +++ b/mime-type @@ -0,0 +1,15 @@ +#!/bin/sh +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 + 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/normalpath.c b/normalpath.c new file mode 100644 index 0000000000000000000000000000000000000000..a80ecda2643af7137986d1943827a3ef96204613 --- /dev/null +++ b/normalpath.c @@ -0,0 +1,75 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/param.h> + +#define DEBUG 0 + +int main(int argc,char *argv[]) { + int i,j,k,l; + char *s=argv[1]; + char *out=malloc(MAXPATHLEN+1); + switch(s[0]) { + case '/': + strcpy(out,"/"); + break; + case '~': + strcpy(out,(char *)getenv("HOME")); + break; + default: +//old code, but might be what I decide I /really/ want. +// getcwd(out,MAXPATHLEN); + if(getenv("PWD")) strcpy(out,getenv("PWD")); + strcat(out,"/"); + } + strcat(out,s); +#if DEBUG + printf("%s\n",out); +#endif + l=strlen(out)-1; + if(out[l] == '.' && out[l-1] == '/') strcat(out,"/"); + if(out[l] == '.' && out[l-1] == '.' && out[l-2] == '/') strcat(out,"/"); + for(i=0;out[i];) { +#if DEBUG + printf("%s @ %s\n",out,out+i); +#endif + if(strlen(out+i) >= 4) { + if(out[i] == '/' && out[i+1] == '.' && out[i+2] == '.' && out[i+3] == '/') { + for(j=i-1;j>0 && out[j] != '/';j--) { + } + if(j<0) j=0; + for(k=j;out[k];k++) { + out[k]=out[k+(i-j)+3]; + if(!out[k]) break; + } + i=0; + continue; + } + } + if(strlen(out+i) >= 3) { + if(out[i] == '/' && out[i+1] == '.' && out[i+2] == '/') { + for(j=i;out[j];j++) { + out[j]=out[j+2]; + if(!out[j]) break; + } + i=0; + continue; + } + } + if(strlen(out+i) >= 2) { + if(out[i] == '/' && out[i+1] == '/') { + //leftshift over it. + for(j=i;out[j];j++) { + out[j]=out[j+1]; + if(!out[j]) break; + } + i=0; + continue; + } + } + i++; + } + printf("%s\n",out); + return 0; +}
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 14:03:08 2024