matthewbauer avatar matthewbauer committed def3458

changed docs to markdown format; added ls and cleanname source; changed ls and uniq source

Comments (0)

Files changed (11)

 syntax: glob
 
+_test
 tmp
 pkg
 bin

COMMANDS

-ascii
-awk
-basename
-bc
-cal
-cat
-cleanname
-cmp
-date
-dc
-du
-dd
-diff
-echo
-ed
-factor
-fortune
-fmt
-freq
-getflags
-grep
-hoc
-join
-look
-ls
-mk
-mkdir
-mtime
-pbd
-primes
-rc
-read
-sam
-sha1sum
-sed
-seq
-sleep
-sort
-split
-strings
-tail
-tee
-test
-touch
-tr
-troff
-unicode
-uniq
-unutf

INSTALL

-#!/bin/sh
-
-./MAKE install
 [ -z "$SRCEXT" ] && SRCEXT='.go'
 
 clean(){
-	rm -r bin tmp
+	rm -rf bin tmp
 }
 
 compile(){
 	fi
 }
 
+test(){
+	mkdir -p _test
+	cd _test
+	$GC "../$@"
+	filename="$(basename "$@" | sed 's/^\(.*\)\.[^\.]*$/\1/')"
+	{
+		echo 'package main'
+		echo
+		# imports
+		echo 'import "./'$filename'"'
+		echo 'import "testing"'
+		# test array
+		echo
+		echo 'var tests = []testing.Test {'
+		echo '	testing.Test{ "'$filename'", '$filename'.main },'
+		echo '}'
+		# benchmark array
+		echo 'var benchmarks = []testing.Benchmark {'
+		echo '	testing.Benchmark{ "'$filename'", '$filename'.main },'
+		echo '}'
+
+		# body
+		echo
+		echo 'func main() {'
+		echo '	testing.Main(tests);'
+		echo '	testing.RunBenchmarks(benchmarks)'
+		echo '}'
+	} > _testmain.go
+	$GC "_testmain.go"
+	$GL "_testmain.$ARCH"
+	exec ./$ARCH.out
+	rm -r _test
+}
+
 usage(){
-	echo "$0 [build|compile|clean|install|test \$bin|help|\$srcfile]"
+	echo "$0 [build|compile|clean|comparebin \$bin|install|test \$source|help|\$srcfile]"
 }
 
 default(){
 		compile) compile;;
 		clean) clean;;
 		install) install;;
-		test) shift; comparebin "$1";;
+		comparebin) shift; comparebin "$1";;
+		test) shift; test $1;;
 		help|--help|-h) usage;;
 		'') break;;
 		*) compilelink "$1";;

NOTES

-* Binary Naming
-
-The naming for some of these binaries has always seemed 
 #!/bin/english
 
-* Description
+-*- markdown -*-
 
+Description
+===========
 Rewrite the most useful unix userland commands in the new Go language created by Google to form a robust base for future Unix-like userlands that do not suffer from the vulnerabilities that are common in C or C++ code.
 The minimum of commands that need to be implemented in Go are those found in 9base.
 
-* Installation
+Installation
+===========
+Just run:
+./MAKE install
 
-Just run:
-./INSTALL
+Project Page
+===========
+Write the most useful unix userland commands in the new Go language created by Google to form a robust base for future Unix-like userlands that do not suffer from the vulnerabilities that are common in C or C++ code. The minimum of commands that need to be implemented in Go are those found in 9base, with the exception of rc and awk which could be separated into a second project for another student.
 
-* Documentation
+Having goblin would allow to migrate decent web frameworks like werc on a proper foundation.
 
+Requirements: Good C/Unix and Go knowledge is essential.
+
+http://suckless.org/project_ideas section goblin
+
+Documentation
+===========
 Should work the same as the original unix ones.
 
-* Based on
-
+Based on
+===========
 The Go developers provide example code for "echo" and "cat". This is used but some modifications may have been made.
 
-* Contact
+Commands
+===========
+* ascii
+* awk
+* basename
+* bc
+* cal
+* cat
+* cleanname
+* cmp
+* date
+* dc
+* du
+* dd
+* diff
+* echo
+* ed
+* factor
+* fortune
+* fmt
+* freq
+* getflags
+* grep
+* hoc
+* join
+* look
+* ls
+* mk
+* mkdir
+* mtime
+* pbd
+* primes
+* rc
+* read
+* sam
+* sha1sum
+* sed
+* seq
+* sleep
+* sort
+* split
+* strings
+* tail
+* tee
+* test
+* touch
+* tr
+* troff
+* unicode
+* uniq
+* unutf
 
+Contact
+===========
 Matthew Bauer <mjbauer95@gmail.com>
+#!/bin/english
 
+-*- restructuredtext -*-
+
+* Change doc files to Markdown or Restructured text
+  http://zerokspot.com/weblog/2009/03/08/marked-up-readme-bitbucket/
+
+* Add rest of plan9 commands
+  ./COMMANDS
+  http://tools.suckless.org/9base
+
+* Optimize commands to be as good or better than GCC ones
+package main
+
+import (
+	"os"
+	"flag"
+)
+
+var str = []string{
+	"nul",	"soh",	"stx",	"etx",	"eot",	"enq",	"ack",	"bel",
+	"bs ",	"ht ",	"nl ",	"vt ",	"np ",	"cr ",	"so ",	"si ",
+	"dle",	"dc1",	"dc2",	"dc3",	"dc4",	"nak",	"syn",	"etb",
+	"can",	"em ",	"sub",	"esc",	"fs ",	"gs ",	"rs ",	"us ",
+	"sp ",	" ! ",	" \" ",	" # ",	" $ ",	" % ",	" & ",	" ' ",
+	" ( ",	" ) ",	" * ",	" + ",	" , ",	" - ",	" . ",	" / ",
+	" 0 ",	" 1 ",	" 2 ",	" 3 ",	" 4 ",	" 5 ",	" 6 ",	" 7 ",
+	" 8 ",	" 9 ",	" : ",	" ; ",	" < ",	" = ",	" > ",	" ? ",
+	" @ ",	" A ",	" B ",	" C ",	" D ",	" E ",	" F ",	" G ",
+	" H ",	" I ",	" J ",	" K ",	" L ",	" M ",	" N ",	" O ",
+	" P ",	" Q ",	" R ",	" S ",	" T ",	" U ",	" V ",	" W ",
+	" X ",	" Y ",	" Z ",	" [ ",	" \\ ",	" ] ",	" ^ ",	" _ ",
+	" ` ",	" a ",	" b ",	" c ",	" d ",	" e ",	" f ",	" g ",
+	" h ",	" i ",	" j ",	" k ",	" l ",	" m ",	" n ",	" o ",
+	" p ",	" q ",	" r ",	" s ",	" t ",	" u ",	" v ",	" w ",
+	" x ",	" y ",	" z ",	" { ",	" | ",	" } ",	" ~ ",	"del",
+	"x80",	"x81",	"x82",	"x83",	"x84",	"x85",	"x86",	"x87",
+	"x88",	"x89",	"x8a",	"x8b",	"x8c",	"x8d",	"x8e",	"x8f",
+	"x90",	"x91",	"x92",	"x93",	"x94",	"x95",	"x96",	"x97",
+	"x98",	"x99",	"x9a",	"x9b",	"x9c",	"x9d",	"x9e",	"x9f",
+	"xa0",	" ¡ ",	" ¢ ",	" £ ",	" ¤ ",	" ¥ ",	" ¦ ",	" § ",
+	" ¨ ",	" © ",	" ª ",	" « ",	" ¬ ",	" ­ ",	" ® ",	" ¯ ",
+	" ° ",	" ± ",	" ² ",	" ³ ",	" ´ ",	" µ ",	" ¶ ",	" · ",
+	" ¸ ",	" ¹ ",	" º ",	" » ",	" ¼ ",	" ½ ",	" ¾ ",	" ¿ ",
+	" À ",	" Á ",	" Â ",	" Ã ",	" Ä ",	" Å ",	" Æ ",	" Ç ",
+	" È ",	" É ",	" Ê ",	" Ë ",	" Ì ",	" Í ",	" Î ",	" Ï ",
+	" Ð ",	" Ñ ",	" Ò ",	" Ó ",	" Ô ",	" Õ ",	" Ö ",	" × ",
+	" Ø ",	" Ù ",	" Ú ",	" Û ",	" Ü ",	" Ý ",	" Þ ",	" ß ",
+	" à ",	" á ",	" â ",	" ã ",	" ä ",	" å ",	" æ ",	" ç ",
+	" è ",	" é ",	" ê ",	" ë ",	" ì ",	" í ",	" î ",	" ï ",
+	" ð ",	" ñ ",	" ò ",	" ó ",	" ô ",	" õ ",	" ö ",	" ÷ ",
+	" ø ",	" ù ",	" ú ",	" û ",	" ü ",	" ý ",	" þ ",	" ÿ " }
+
+func usage(){
+	fmt.Fprintf(os.Stderr, "usage: ./ascii [-8] [-xod | -b8] [-ncst] [--] [text]")
+	os.Exit(1)
+}
+
+func main(){
+	flag.Parse()
+	if flag.NArg() == 0 {
+		for i:=0; i<len(str); i++ {
+			os.Stdout.WriteString(str[i]);
+			os.Stdout.WriteString(" ");
+			if (i&7)==7 {
+				os.Stdout.WriteString("|\n");
+			}
+		}
+	} else {
+		if flag.Arg()
+	}
+}

src/cmd/cleanname.go

+package main
+
+import (
+	"flag"
+	"fmt"
+	"os"
+	"strings"
+)
+
+func main(){
+	flag.Parse()
+	if flag.NArg()==0 {
+		os.Stderr.write("usage: cleanname [-d pwd] name...\n")
+	} else {
+		for i:=0; i < flag.NArg(); i++ {
+			
+		}
+	}
+}
 	flag.Parse()
 	if flag.NArg() == 0 {
 		ls(".")
-	}
-	for i := 0; i < flag.NArg(); i++ {
-		ls(flag.Arg(i))
+	} else {
+		for i := 0; i < flag.NArg(); i++ {
+			ls(flag.Arg(i))
+		}
 	}
 }
 			returndata += Newline
 		}
 	}
-	
+
 	os.Stdout.WriteString(returndata)
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.