Mercurial > hg > dmlib
comparison tools/data2inc.c @ 1428:9eecf7e5e23e
Get rid of direct errno usage.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 15 Nov 2017 07:41:58 +0200 |
parents | 5b8245e5f785 |
children | b117047ad8f3 |
comparison
equal
deleted
inserted
replaced
1427:ae1fcae5e622 | 1428:9eecf7e5e23e |
---|---|
3 * Programmed and designed by Matti 'ccr' Hamalainen | 3 * Programmed and designed by Matti 'ccr' Hamalainen |
4 * (C) Copyright 2003,2009-2012 Tecnic Software productions (TNSP) | 4 * (C) Copyright 2003,2009-2012 Tecnic Software productions (TNSP) |
5 * | 5 * |
6 * Please read file 'COPYING' for information on license and distribution. | 6 * Please read file 'COPYING' for information on license and distribution. |
7 */ | 7 */ |
8 #include <errno.h> | |
9 #include "dmlib.h" | 8 #include "dmlib.h" |
10 #include "dmargs.h" | 9 #include "dmargs.h" |
11 #include "dmmutex.h" | 10 #include "dmmutex.h" |
12 | 11 |
13 #define RA_LINEBUF (16) | 12 #define RA_LINEBUF (16) |
337 if (optInFilename == NULL) | 336 if (optInFilename == NULL) |
338 sfile = stdin; | 337 sfile = stdin; |
339 else | 338 else |
340 if ((sfile = fopen(optInFilename, "rb")) == NULL) | 339 if ((sfile = fopen(optInFilename, "rb")) == NULL) |
341 { | 340 { |
342 tmpRes = errno; | 341 tmpRes = dmGetErrno(); |
343 dmErrorMsg("Error opening input file '%s'. (%s)\n", | 342 dmErrorMsg("Error opening input file '%s'. (%s)\n", |
344 optInFilename, strerror(tmpRes)); | 343 optInFilename, dmErrorStr(tmpRes)); |
345 exit(3); | 344 exit(3); |
346 } | 345 } |
347 | 346 |
348 if (optOutFilename == NULL) | 347 if (optOutFilename == NULL) |
349 dfile = stdout; | 348 dfile = stdout; |
350 else | 349 else |
351 if ((dfile = fopen(optOutFilename, "wa")) == NULL) | 350 if ((dfile = fopen(optOutFilename, "wa")) == NULL) |
352 { | 351 { |
353 tmpRes = errno; | 352 tmpRes = dmGetErrno(); |
354 dmErrorMsg("Error creating output file '%s'. (%s)\n", | 353 dmErrorMsg("Error creating output file '%s'. (%s)\n", |
355 optOutFilename, strerror(tmpRes)); | 354 optOutFilename, dmErrorStr(tmpRes)); |
356 exit(4); | 355 exit(4); |
357 } | 356 } |
358 | 357 |
359 /* Get sourcefile size */ | 358 /* Get sourcefile size */ |
360 inSize = dmGetFileSize(sfile); | 359 inSize = dmGetFileSize(sfile); |
397 | 396 |
398 /* Exit */ | 397 /* Exit */ |
399 fclose(sfile); | 398 fclose(sfile); |
400 fclose(dfile); | 399 fclose(dfile); |
401 | 400 |
402 exit(0); | |
403 return 0; | 401 return 0; |
404 } | 402 } |