lshal: fix file streams for testing.

* If a file is specified for list, the file is opened and
  closed within the ListCommand::dump() function.

* Add a missing break in ListCommand::parseArgs, case
  for '--init-vintf'

Test: lshal_test
Test: lshal --init-vintf
Test: lshal --init-vintf=/data/data/a.xml ; adb shell cat \
      /data/data/a.xml
Test: lshal -d
Test: lshal --debug=/data/data/d.txt ; adb shell cat \
      /data/data/d.txt

Change-Id: I1acee5878638d25257a13244713dc416e9d8d6b2
diff --git a/cmds/lshal/ListCommand.h b/cmds/lshal/ListCommand.h
index 97c2cdc..51f1ca5 100644
--- a/cmds/lshal/ListCommand.h
+++ b/cmds/lshal/ListCommand.h
@@ -44,7 +44,7 @@
     Status parseArgs(const std::string &command, const Arg &arg);
     Status fetch();
     void postprocess();
-    void dump();
+    Status dump();
     void putEntry(TableEntrySource source, TableEntry &&entry);
     Status fetchPassthrough(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
     Status fetchBinderized(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
@@ -57,8 +57,8 @@
     };
     bool getPidInfo(pid_t serverPid, PidInfo *info) const;
 
-    void dumpTable();
-    void dumpVintf() const;
+    void dumpTable(const NullableOStream<std::ostream>& out) const;
+    void dumpVintf(const NullableOStream<std::ostream>& out) const;
     void addLine(TextTable *table, const std::string &interfaceName, const std::string &transport,
                  const std::string &arch, const std::string &threadUsage, const std::string &server,
                  const std::string &serverCmdline, const std::string &address,
@@ -81,7 +81,7 @@
     Table mPassthroughRefTable{};
     Table mImplementationsTable{};
 
-    NullableOStream<std::ofstream> mFileOutput = nullptr;
+    std::string mFileOutputPath;
     TableEntryCompare mSortColumn = nullptr;
 
     bool mEmitDebugInfo = false;