]>
git.saurik.com Git - apt.git/blob - cmdline/apt-dump-solver.cc
1 // -*- mode: cpp; mode: fold -*-
3 /* #####################################################################
5 dummy solver to get quickly a scenario file out of APT
7 ##################################################################### */
9 // Include Files /*{{{*/
10 #include <apt-pkg/edsp.h>
20 // ShowHelp - Show a help screen /*{{{*/
21 // ---------------------------------------------------------------------
23 static bool ShowHelp() {
24 ioprintf(std::cout
, "%s %s (%s)\n", PACKAGE
, PACKAGE_VERSION
, COMMON_ARCH
);
26 "Usage: apt-dump-resolver\n"
28 "apt-dump-resolver is a dummy solver who just dumps its input to the\n"
29 "file /tmp/dump.edsp and exists with a proper EDSP error.\n"
31 " This dump has lost Super Cow Powers.\n";
35 int main(int argc
,const char *argv
[]) /*{{{*/
37 if (argc
> 1 && (strcmp(argv
[1], "--help") == 0 || strcmp(argv
[1],"-h") == 0 ||
38 strcmp(argv
[1],"-v") == 0 || strcmp(argv
[1],"--version") == 0)) {
42 // we really don't need anything
45 FILE* input
= fdopen(STDIN_FILENO
, "r");
46 FILE* output
= fopen("/tmp/dump.edsp", "w");
48 while (fgets(buffer
, sizeof(buffer
), input
) != NULL
)
49 fputs(buffer
, output
);
53 EDSP::WriteError("ERR_JUST_DUMPING", "I am too dumb, i can just dump!\nPlease use one of my friends instead!", stdout
);