veyron/lib/modules: Make modules parse flags using the veyron2.Init
flag parsing mechanism.

Now the user of modules need not call veyron2.Init to parse the flags,
whereas before the flags had to be parsed before calling dispatch.

The profiles can now use the flags passed to a subcommand whereas before
they could not.

Upcoming changes:
(1) Make the rest of the callers to testutil.Init use go1.4's TestMain to avoid
flags being parsed in init functions.
(2) Get rid of modules.DispatchInTest and use go1.4's TestMain instead.

Change-Id: I71e31929a674dfc11310d203aba452a69c10b2b2
diff --git a/lib/modules/core/wspr.go b/lib/modules/core/wspr.go
index 42db213..8e38a84 100644
--- a/lib/modules/core/wspr.go
+++ b/lib/modules/core/wspr.go
@@ -5,7 +5,6 @@
 	"fmt"
 	"io"
 
-	"v.io/core/veyron/lib/flags"
 	"v.io/core/veyron/lib/modules"
 	"v.io/wspr/veyron/services/wsprd/wspr"
 
@@ -13,29 +12,19 @@
 )
 
 var (
-	// TODO(sadovsky): We should restructure things so that we can avoid
-	// duplicating code between subprocess command impls and actual main()'s.
-	fs *flag.FlagSet = flag.NewFlagSet("wspr", flag.ContinueOnError)
-
-	port   *int    = fs.Int("port", 0, "Port to listen on.")
-	identd *string = fs.String("identd", "", "identd server name. Must be set.")
-
-	fl *flags.Flags = flags.CreateAndRegister(fs, flags.Listen)
+	port   *int    = flag.CommandLine.Int("port", 0, "Port to listen on.")
+	identd *string = flag.CommandLine.String("identd", "", "identd server name. Must be set.")
 )
 
 func init() {
-	modules.RegisterChild(WSPRCommand, usage(fs), startWSPR)
+	modules.RegisterChild(WSPRCommand, usage(flag.CommandLine), startWSPR)
 }
 
 func startWSPR(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
-	if err := parseFlags(fl, args); err != nil {
-		return fmt.Errorf("failed to parse args: %s", err)
-	}
-
 	ctx, shutdown := veyron2.Init()
 	defer shutdown()
 
-	l := initListenSpec(fl)
+	l := veyron2.GetListenSpec(ctx)
 	proxy := wspr.NewWSPR(ctx, *port, &l, *identd, nil)
 	defer proxy.Shutdown()