/*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * This file is distributed subject to a Software License Agreement found * in the file LICENSE that is included with this distribution. \*************************************************************************/ #include "mdb.h" #include "scan.h" #if defined(_WIN32) #define popen(x,y) _popen(x,y) #endif #define UNPACK_TYPES 3 static char *unpackSuffix[UNPACK_TYPES] = { "gz", "F", "Z", }; static char *unpackCommand[UNPACK_TYPES] = { "gzip -dcn %s 2> /dev/null ", "freeze -dc %s ", "uncompress -c %s ", }; long PackSuffixType(char *filename, char **unpackedName, unsigned long mode) { char *extension, buffer[10]; FILE *fp; long i; if (!(extension = strrchr(filename, '.'))) return -1; extension++; for (i=0; i /tmp/"); strcat(command, tmpName); system(command); sprintf(command, "/tmp/%s", tmpName); if (tmpFileUsed) cp_str(tmpFileUsed, command); return fopen(command, FOPEN_READ_MODE); } } #if defined(zLib) gzFile *UnpackGZipOpen(char *filename) { if (!filename) return NULL; return gzopen(filename, "rb"); } #endif