]> git.saurik.com Git - apt.git/blame - cmdline/apt-dump-solver.cc
Provide "apt-get full-upgrade" to match "apt full-upgrade"
[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
453b82a3
DK
12#include <string.h>
13#include <unistd.h>
7f471354 14#include <cstdio>
472ff00e 15#include <iostream>
453b82a3
DK
16
17#include <config.h>
7f471354
DK
18 /*}}}*/
19
20// ShowHelp - Show a help screen /*{{{*/
21// ---------------------------------------------------------------------
22/* */
c3ccac92 23static bool ShowHelp() {
249aec3b 24 ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
7f471354 25 std::cout <<
7f471354
DK
26 "Usage: apt-dump-resolver\n"
27 "\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"
30 "\n"
31 " This dump has lost Super Cow Powers.\n";
32 return true;
33}
34 /*}}}*/
35int main(int argc,const char *argv[]) /*{{{*/
36{
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)) {
39 ShowHelp();
40 return 0;
41 }
fc1a78d8 42 // we really don't need anything
373fa2b4 43 DropPrivileges();
7f471354
DK
44
45 FILE* input = fdopen(STDIN_FILENO, "r");
46 FILE* output = fopen("/tmp/dump.edsp", "w");
47 char buffer[400];
48 while (fgets(buffer, sizeof(buffer), input) != NULL)
49 fputs(buffer, output);
50 fclose(output);
51 fclose(input);
52
ebfeeaed 53 EDSP::WriteError("ERR_JUST_DUMPING", "I am too dumb, i can just dump!\nPlease use one of my friends instead!", stdout);
7f471354 54}