Changeset 16338
- Timestamp:
- Feb 6, 2008, 10:33:18 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psLogMsg.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psLogMsg.c
r16337 r16338 11 11 * @author GLG, MHPCC 12 12 * 13 * @version $Revision: 1.6 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2008-02-06 20:3 0:49$13 * @version $Revision: 1.69 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2008-02-06 20:33:18 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 195 195 } 196 196 197 // Destination is protocol:location 198 psList *protocolLocation = psStringSplit(dest, ":", false); // A list containing the protocol and location 199 const char *protocol, *location; // Protocol and location for message 200 if (protocolLocation->n == 1) { 201 // "file" is the default protocol --- use it if no protocol is specified. 202 protocol = "file"; 203 location = psListGet(protocolLocation, PS_LIST_TAIL); // The location 204 } else if (protocolLocation->n != 2) { 205 psFree(protocolLocation); 206 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unable to parse protocol:location from: %s\n", dest); 197 int fileD = creat(dest, 0666); 198 if (fileD == 0) { 199 psError(PS_ERR_IO, true, _("Could not open file '%s' for output."), dest); 207 200 return -1; 208 } else { 209 protocol = psListGet(protocolLocation, PS_LIST_HEAD); 210 location = psListGet(protocolLocation, PS_LIST_TAIL); 211 } 212 213 if (strcasecmp(protocol, "file") == 0) { 214 int fileD = creat(location, 0666); 215 216 if (fileD == 0) { 217 psError(PS_ERR_IO, true, _("Could not open file '%s' for output."), 218 location); 219 psFree(protocolLocation); 220 return -1; 221 } 222 psFree(protocolLocation); 223 return fileD; 224 } 225 226 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised protocol: %s\n", protocol); 227 psFree(protocolLocation); 228 return -1; 201 } 202 return fileD; 229 203 } 230 204
Note:
See TracChangeset
for help on using the changeset viewer.
