]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-extracttemplates.cc
* apt-cache show <virtual-pkg> shows all virtual packages instead of nothing (thanks...
[apt.git] / cmdline / apt-extracttemplates.cc
index 70e7f914aa122c7d4fe4ca8dfdde71e4b6ccf208..c87b436ba65e85429f7eb6e8e374acabe6dcc476 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-extracttemplates.cc,v 1.13 2002/11/09 23:08:08 doogie Exp $
+// $Id: apt-extracttemplates.cc,v 1.15 2003/07/26 00:00:11 mdz Exp $
 /* ######################################################################
    
    APT Extract Templates - Program to extract debconf config and template
@@ -41,6 +41,8 @@
 #include "apt-extracttemplates.h"
                                                                        /*}}}*/
 
+using namespace std;
+
 #define TMPDIR         "/tmp"
 
 pkgCache *DebFile::Cache = 0;
@@ -97,7 +99,7 @@ bool DebFile::Go()
        
        if (File.Seek(Member->Start) == false)
                return false;
-       ExtractTar Tar(File, Member->Size);
+       ExtractTar Tar(File, Member->Size,"gzip");
        return Tar.Go(*this);
 }
                                                                        /*}}}*/
@@ -236,7 +238,7 @@ int ShowHelp(void)
                "  -h   This help text\n"
                "  -t   Set the temp dir\n"
                "  -c=? Read this configuration file\n"
-               "  -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp\n");
+               "  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n");
        return 0;
 }
                                                                        /*}}}*/
@@ -247,7 +249,15 @@ string WriteFile(const char *package, const char *prefix, const char *data)
 {
        char fn[512];
        static int i;
-       snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d", _config->Find("APT::ExtractTemplates::TempDir", TMPDIR).c_str(), package, prefix, getpid(), i++);
+        char *tempdir = NULL;
+
+        tempdir = getenv("TMPDIR");
+        if (tempdir == NULL)
+             tempdir = TMPDIR;
+
+       snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d",
+                 _config->Find("APT::ExtractTemplates::TempDir", tempdir).c_str(),
+                 package, prefix, getpid(), i++);
        FileFd f;
        if (data == NULL)
                data = "";