[zypp-commit] r8658 - /trunk/sat-solver/testsuite/deptestomatic.c
Author: coolo Date: Wed Feb 13 15:14:33 2008 New Revision: 8658 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8658&view=rev Log: support .xml.gz and fix coding style Modified: trunk/sat-solver/testsuite/deptestomatic.c Modified: trunk/sat-solver/testsuite/deptestomatic.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/deptestomatic.c?rev=8658&r1=8657&r2=8658&view=diff ============================================================================== --- trunk/sat-solver/testsuite/deptestomatic.c (original) +++ trunk/sat-solver/testsuite/deptestomatic.c Wed Feb 13 15:14:33 2008 @@ -1,4 +1,5 @@ -/* +/* -*- mode: C; c-file-style: "gnu"; fill-column: 78 -*- + * * Copyright (c) 2007, Novell Inc. * * This program is licensed under the BSD license, read LICENSE.BSD @@ -602,6 +603,7 @@ return NULL; } + int gzip = 0; const char *ptr = file + l - 1; while (*ptr) { @@ -609,10 +611,13 @@ break; if (*ptr == '.') { - if (!strncmp( ptr, ".xml", 4 )) { - l = ptr - file; - break; - } + if (!strncmp( ptr, ".gz", 3)) + gzip = 1; + if (!strncmp( ptr, ".xml", 4 )) + { + l = ptr - file; + break; + } } --ptr; } @@ -625,15 +630,20 @@ FILE *fp = fopen( solvname, "r" ); if (!fp) { - /* try to use the original helix xml file instead*/ - FILE *fpHelix = fopen( file, "r" ); - if (!fpHelix) + char command[PATH_MAX]; + if (gzip) + snprintf(command, PATH_MAX, "zcat %s", file); + else + snprintf(command, PATH_MAX, "cat %s", file); + /* try to use the original helix xml file instead*/ + FILE *fpHelix = popen( command, "r" ); + if (!fpHelix) { - perror( file ); - return NULL; + perror( file ); + return NULL; } - repo_add_helix(s, fpHelix); - fclose( fpHelix ); + repo_add_helix(s, fpHelix); + pclose( fpHelix ); } else { -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
coolo@svn.opensuse.org