File: cpp_compress_main.cc

package info (click to toggle)
fparserc%2B%2B 4.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 6,132 kB
  • sloc: cpp: 23,297; pascal: 7,097; yacc: 1,650; ansic: 973; makefile: 307; php: 53; sh: 28
file content (20 lines) | stat: -rw-r--r-- 448 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <cstdio>
#include <iostream>
#include "cpp_compress.hh"

int main(int argc, char* argv[])
{
    std::string out;
    for(;;)
    {
        char Buf[32768];
        if(!std::fgets(Buf, sizeof(Buf), stdin)) break;
        Buf[(sizeof Buf)-1] = '\0';
        out += Buf;
    }
    CPPcompressor Compressor;

    std::string prefix;
    if(argc == 2 && argv[1][0] != '-') prefix = argv[1];
    std::cout << Compressor.Compress(out, prefix);
}