Changeset 29876
- Timestamp:
- Nov 29, 2010, 11:39:13 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101103/ppConfigDump/src/ppConfigDump.c
r29821 r29876 28 28 psMetadata *md, // Metadata to dump 29 29 const char *compressMode 30 )30 ) 31 31 { 32 32 if (!filename || strlen(filename) == 0) { … … 40 40 } 41 41 42 # if (PS_SLURP_GZIP)43 44 char modeString[4];45 46 42 if (compressMode) { 47 43 if (strlen(compressMode) > 2) { … … 49 45 die(PS_EXIT_CONFIG_ERROR); 50 46 } 47 char modeString[4]; 51 48 snprintf (modeString, 4, "w%s", compressMode); 49 50 gzFile file = gzdopen (STDOUT_FILENO, modeString); 51 if (file == Z_NULL) { 52 psErrorStackPrint(stderr, "Failed to open file\n"); 53 die(PS_EXIT_SYS_ERROR); 54 } 55 int nbytes = gzwrite (file, string, strlen(string)); 56 if (nbytes != strlen(string)) { 57 psErrorStackPrint(stderr, "Failed to write contents of configuration file %s", filename); 58 psFree(string); 59 gzclose(file); 60 die(PS_EXIT_SYS_ERROR); 61 } 62 psFree(string); 63 if (gzclose(file) != Z_OK) { 64 psErrorStackPrint(stderr, "Failed to close file, %s\n", filename); 65 die(PS_EXIT_SYS_ERROR); 66 } 52 67 } else { 53 strcpy (modeString, "w0");54 } 55 56 gzFile file = gzdopen (STDOUT_FILENO, modeString); 57 if ( file == Z_NULL) {58 psErrorStackPrint(stderr, " Failed to open file\n");68 fprintf(stdout, "%s", string); 69 } 70 psFree(string); 71 } else { 72 if (!psMetadataConfigWrite(md, filename, compressMode)) { 73 psErrorStackPrint(stderr, "Can't write %s to %s\n", description, filename); 59 74 die(PS_EXIT_SYS_ERROR); 60 75 } 61 int nbytes = gzwrite (file, string, strlen(string));62 if (nbytes != strlen(string)) {63 psErrorStackPrint(stderr, "Failed to write contents of configuration file %s", filename);64 psFree(string);65 gzclose(file);66 die(PS_EXIT_SYS_ERROR);67 }68 psFree(string);69 if (gzclose(file) != Z_OK) {70 psErrorStackPrint(stderr, "Failed to close file, %s\n", filename);71 die(PS_EXIT_SYS_ERROR);72 }73 # else74 fprintf(stdout, "%s", string);75 # endif76 psFree(string);77 } else if (!psMetadataConfigWrite(md, filename, compressMode)) {78 psErrorStackPrint(stderr, "Can't write %s to %s\n", description, filename);79 die(PS_EXIT_SYS_ERROR);80 76 } 81 77 }
Note:
See TracChangeset
for help on using the changeset viewer.
