]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cypherpunks.ru/nncp/cmd/nncp-daemon/main.go
Humanized priorities
[nncp.git] / src / cypherpunks.ru / nncp / cmd / nncp-daemon / main.go
index 1ea30de168b8fb3300adb7dd41a0eb52cef917cd..ba2d602c005f0ebf9bc46fb6774f01afa2db37ef 100644 (file)
@@ -41,7 +41,7 @@ func usage() {
 func main() {
        var (
                cfgPath   = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
-               niceRaw   = flag.Int("nice", 255, "Minimal required niceness")
+               niceRaw   = flag.String("nice", nncp.NicenessFmt(255), "Minimal required niceness")
                bind      = flag.String("bind", "[::]:5400", "Address to bind to")
                maxConn   = flag.Int("maxconn", 128, "Maximal number of simultaneous connections")
                spoolPath = flag.String("spool", "", "Override path to spool")
@@ -61,10 +61,10 @@ func main() {
                fmt.Println(nncp.VersionGet())
                return
        }
-       if *niceRaw < 1 || *niceRaw > 255 {
-               log.Fatalln("-nice must be between 1 and 255")
+       nice, err := nncp.NicenessParse(*niceRaw)
+       if err != nil {
+               log.Fatalln(err)
        }
-       nice := uint8(*niceRaw)
 
        ctx, err := nncp.CtxFromCmdline(*cfgPath, *spoolPath, *logPath, *quiet, *debug)
        if err != nil {