]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-extracttemplates.cc
Merge from mvo
[apt.git] / cmdline / apt-extracttemplates.cc
index 70e7f914aa122c7d4fe4ca8dfdde71e4b6ccf208..d6894a7323864f9b8173dc37f4f82d0cda137d0d 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);
 }
                                                                        /*}}}*/
@@ -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 = "";