]> git.saurik.com Git - apt.git/blame - cmdline/apt-dump-solver.cc
fix sha512 calculation in Hashes::VerifyFiles()
[apt.git] / cmdline / apt-dump-solver.cc
CommitLineData
7f471354
DK
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* #####################################################################
4
5 dummy solver to get quickly a scenario file out of APT
6
7 ##################################################################### */
8 /*}}}*/
9// Include Files /*{{{*/
10#include <apt-pkg/edsp.h>
11
12#include <config.h>
13
14#include <cstdio>
15 /*}}}*/
16
17// ShowHelp - Show a help screen /*{{{*/
18// ---------------------------------------------------------------------
19/* */
20bool ShowHelp() {
21
22 std::cout <<
23 PACKAGE " " VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl <<
24 "Usage: apt-dump-resolver\n"
25 "\n"
26 "apt-dump-resolver is a dummy solver who just dumps its input to the\n"
27 "file /tmp/dump.edsp and exists with a proper EDSP error.\n"
28 "\n"
29 " This dump has lost Super Cow Powers.\n";
30 return true;
31}
32 /*}}}*/
33int main(int argc,const char *argv[]) /*{{{*/
34{
35 if (argc > 1 && (strcmp(argv[1], "--help") == 0 || strcmp(argv[1],"-h") == 0 ||
36 strcmp(argv[1],"-v") == 0 || strcmp(argv[1],"--version") == 0)) {
37 ShowHelp();
38 return 0;
39 }
40
41 FILE* input = fdopen(STDIN_FILENO, "r");
42 FILE* output = fopen("/tmp/dump.edsp", "w");
43 char buffer[400];
44 while (fgets(buffer, sizeof(buffer), input) != NULL)
45 fputs(buffer, output);
46 fclose(output);
47 fclose(input);
48
ebfeeaed 49 EDSP::WriteError("ERR_JUST_DUMPING", "I am too dumb, i can just dump!\nPlease use one of my friends instead!", stdout);
7f471354 50}