ref: 047056278743954884b1c9a70b1a5f34eefac908
parent: 9b5a13f47f1c44c8721e38cabd2d2e4411d0e25d
author: sirjofri <sirjofri@sirjofri.de>
date: Wed Sep 9 14:53:00 EDT 2020
adds bunch of 9front script files
--- /dev/null
+++ b/pub/files/9front/.htaccess
@@ -1,0 +1,1 @@
+AddDescription "rc scripts" rc
--- /dev/null
+++ b/pub/files/9front/rc/.htaccess
@@ -1,0 +1,5 @@
+AddDescription "fill this directory with a mkfile template (many C files)" mkmanymk
+AddDescription "fill this directory with a mkfile template (one C file)" mkonemk
+AddDescription "invoke google translator. echo text | trans en de" trans
+AddDescription "fill this directory with an empty wikifs" mkwikifs
+AddDescription "snarfs the path to the file (or text if no file exists)" snarf
--- /dev/null
+++ b/pub/files/9front/rc/mkmanymk
@@ -1,0 +1,27 @@
+#!/bin/rc
+
+fn stubfile{
+ echo '#include <u.h>
+#include <libc.h>
+
+void
+main(int argc, char **argv)
+{
+}' > $1.c
+}
+
+if(~ $#* 0){
+ names=`{basename `{pwd}}
+}
+if not{
+ names=$*
+}
+
+for(i in $names)
+ stubfile $i
+
+echo '</$objtype/mkfile
+
+TARG='^$"names^'
+
+</sys/src/cmd/mkmany' > mkfile
--- /dev/null
+++ b/pub/files/9front/rc/mkonemk
@@ -1,0 +1,23 @@
+#!/bin/rc
+
+if(~ $1 ''){
+ name=`{basename `{pwd}}
+}
+if not{
+ name=$1
+}
+
+echo '#include <u.h>
+#include <libc.h>
+
+void
+main(int argc, char **argv)
+{
+}' > $name.c
+
+echo '</$objtype/mkfile
+
+TARG='$name'
+OFILES='$name'.$O
+
+</sys/src/cmd/mkone' > mkfile
--- /dev/null
+++ b/pub/files/9front/rc/mkwikifs
@@ -1,0 +1,14 @@
+#!/bin/rc
+
+echo 'TITLE
+
+PAGE' > page.txt
+
+mkdir d
+
+echo '1 start' > d/map
+echo 'Start
+D'`{date -n}'
+A'`{cat /env/user}'
+#empty page
+#' > d/1
--- /dev/null
+++ b/pub/files/9front/rc/snarf
@@ -1,0 +1,15 @@
+#!/bin/rc
+
+fn usage{
+ echo 'usage: '^`{basename $0}^' file' >[1=2]
+ exit usage
+}
+
+if(~ $#1 0)
+ usage $0;
+
+if(! test -f $1){
+ echo -n $1 >/dev/snarf
+ exit
+}
+echo -n `{pwd}^'/'^$1 >/dev/snarf
--- /dev/null
+++ b/pub/files/9front/rc/trans
@@ -1,0 +1,12 @@
+#!/bin/rc
+
+if(! ~ $#* 2)
+ exit 'usage'
+
+sourcelang=$*(1)
+targetlang=$*(2)
+
+text=`{cat}
+send=`{echo $"text | urlencode}
+
+hget 'https://translate.googleapis.com/translate_a/single?client=gtx&sl='^$sourcelang^'&tl='^$targetlang^'&dt=t&q='^$"send | sed 1q | sed 's/^\[\[\["//;s/\",\".*$//g'