Browse Source

define test_pfstream

David Rose 23 years ago
parent
commit
dbdb77986e
2 changed files with 57 additions and 0 deletions
  1. 8 0
      dtool/src/dtoolutil/Sources.pp
  2. 49 0
      dtool/src/dtoolutil/test_pfstream.cxx

+ 8 - 0
dtool/src/dtoolutil/Sources.pp

@@ -23,3 +23,11 @@
     pfstreamBuf.h vector_src.cxx vector_src.h
     pfstreamBuf.h vector_src.cxx vector_src.h
 
 
 #end lib_target
 #end lib_target
+
+#begin test_bin_target
+  #define TARGET test_pfstream
+  #define LOCAL_LIBS dtoolbase dtoolutil
+
+  #define SOURCES test_pfstream.cxx
+#end test_bin_target
+

+ 49 - 0
dtool/src/dtoolutil/test_pfstream.cxx

@@ -0,0 +1,49 @@
+// Filename: test_pfstream.cxx
+// Created by:  drose (31Jul02)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "dtoolbase.h"
+#include "pfstream.h"
+
+int 
+main(int argc, char *argv[]) {
+  if (argc < 2) {
+    cerr << "test_pfstream command-line\n";
+    return (1);
+  }
+
+  // Build one command out of the arguments.
+  string cmd;
+  cmd = argv[1];
+  for (int i = 2; i < argc; i++) {
+    cmd += " ";
+    cmd += argv[i];
+  }
+
+  cerr << "Executing command:\n" << cmd << "\n";
+  
+  IPipeStream in(cmd);
+
+  char c;
+  c = in.get();
+  while (in && !in.fail() && !in.eof()) {
+    cout.put(toupper(c));
+    c = in.get();
+  }
+
+  return (0);
+}