]> git.saurik.com Git - apt.git/blame - cmdline/apt-dump-solver.cc
fix authenificated→authenticated typo in sources.list manpage
[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>
472ff00e 15#include <iostream>
7f471354
DK
16 /*}}}*/
17
18// ShowHelp - Show a help screen /*{{{*/
19// ---------------------------------------------------------------------
20/* */
21bool ShowHelp() {
22
23 std::cout <<
9179f697 24 PACKAGE " " PACKAGE_VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl <<
7f471354
DK
25 "Usage: apt-dump-resolver\n"
26 "\n"
27 "apt-dump-resolver is a dummy solver who just dumps its input to the\n"
28 "file /tmp/dump.edsp and exists with a proper EDSP error.\n"
29 "\n"
30 " This dump has lost Super Cow Powers.\n";
31 return true;
32}
33 /*}}}*/
34int main(int argc,const char *argv[]) /*{{{*/
35{
36 if (argc > 1 && (strcmp(argv[1], "--help") == 0 || strcmp(argv[1],"-h") == 0 ||
37 strcmp(argv[1],"-v") == 0 || strcmp(argv[1],"--version") == 0)) {
38 ShowHelp();
39 return 0;
40 }
41
42 FILE* input = fdopen(STDIN_FILENO, "r");
43 FILE* output = fopen("/tmp/dump.edsp", "w");
44 char buffer[400];
45 while (fgets(buffer, sizeof(buffer), input) != NULL)
46 fputs(buffer, output);
47 fclose(output);
48 fclose(input);
49
ebfeeaed 50 EDSP::WriteError("ERR_JUST_DUMPING", "I am too dumb, i can just dump!\nPlease use one of my friends instead!", stdout);
7f471354 51}