CFLAGS=-Wall -O2
-all: audiobooker bytor errno_speak show_default_sockopts random_word simple_time vimstart hexconv
+all: audiobooker bytor path-fixer errno_speak show_default_sockopts random_word simple_time vimstart hexconv
audiobooker:
go build audiobooker.go
bytor:
go build bytor.go
+path-fixer:
+ go build path-fixer.go
+
errno_speak: errno_speak.o
show_default_sockopts: show_default_sockopts.o
random_word: random_word.o
clean:
- rm -rf bytor errno_speak show_default_sockopts simple_time vimstart hexconv *.o
+ rm -rf bytor path-fixer errno_speak show_default_sockopts simple_time vimstart hexconv *.o
--- /dev/null
+package main
+
+import (
+ "fmt"
+ "os"
+ "strings"
+)
+
+func main() {
+ path := os.Getenv("PATH")
+ entries := make(map[string]bool)
+ var bld strings.Builder
+ prefix := ""
+ for {
+ index := strings.Index(path, ":")
+ var entry string
+ if index >= 0 {
+ entry = path[:index]
+ } else {
+ entry = path
+ }
+ if !entries[entry] {
+ entries[entry] = true
+ bld.WriteString(prefix)
+ prefix = ":"
+ bld.WriteString(entry)
+ }
+ if index < 0 {
+ break
+ } else {
+ path = path[index+1:]
+ }
+ }
+ fmt.Printf("%s", bld.String())
+}