diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-12-25 04:05:54 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-12-25 05:13:02 +0900 |
| commit | 7bfbd5981025282007f09225e22e895523d7a7bf (patch) | |
| tree | 14e4ea7475ab63c8fa22845d287a307fb029c110 /cmd/sharefs/main.go | |
| parent | ea815a59e85a5acad8e22e98a16cdc6de1323824 (diff) | |
cmd/sharefs: implement shared filesystem
This is for passing files between applications, similar to android /sdcard.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/sharefs/main.go')
| -rw-r--r-- | cmd/sharefs/main.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cmd/sharefs/main.go b/cmd/sharefs/main.go new file mode 100644 index 00000000..44a7e510 --- /dev/null +++ b/cmd/sharefs/main.go @@ -0,0 +1,31 @@ +package main + +import ( + "log" + "os" + "path" + "runtime" + "syscall" +) + +// executableName is the [path.Base] name of the executable that started the current process. +var executableName = func() string { + if len(os.Args) > 0 { + return path.Base(os.Args[0]) + } else if name, err := os.Executable(); err != nil { + return "sharefs" + } else { + return path.Base(name) + } +}() + +func main() { + runtime.LockOSThread() + log.SetFlags(0) + log.SetPrefix(executableName + ": ") + + // don't mask creation mode, kernel already did that + syscall.Umask(0) + + os.Exit(_main(len(os.Args), copyStrings(os.Args...))) +} |
