File: sed.cc

package info (click to toggle)
pstreams 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 412 kB
  • sloc: cpp: 1,912; makefile: 126; sh: 18
file content (15 lines) | stat: -rw-r--r-- 349 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <pstreams/pstream.h>
#include <iostream>

int main() {
  std::string output;
  redi::pstream sed("sed -e s/x/./g", redi::pstream::pstdin | redi::pstream::pstdout | redi::pstream::pstderr);
  sed << "xxx" << std::endl << redi::peof;
  std::getline(sed.out(), output);
  sed.close();
  if (output != "...") {
    return 1;
  }

  return 0;
}