"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "prog/udunits2.c" between
udunits-2.2.26.tar.gz and udunits-2.2.28.tar.gz

About: UDUNITS supports units of physical quantities. Its C library provides for arithmetic manipulation of units and for conversion of numeric values between compatible units.

udunits2.c  (udunits-2.2.26):udunits2.c  (udunits-2.2.28)
/* /*
* Copyright 2013 University Corporation for Atmospheric Research. All rights * Copyright 2020 University Corporation for Atmospheric Research. All rights
* reserved. * reserved.
* *
* This file is part of the UDUNITS-2 package. See the file COPYRIGHT * This file is part of the UDUNITS-2 package. See the file COPYRIGHT
* in the top-level source-directory of the package for copying and * in the top-level source-directory of the package for copying and
* redistribution conditions. * redistribution conditions.
*/ */
/* /*
* This program prints definitions of units of physical quantities and converts * This program prints definitions of units of physical quantities and converts
* values between such units. * values between such units.
*/ */
#include "config.h" #include "config.h"
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 500
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#include "XGetOpt.h" #include "XGetOpt.h"
#endif #endif
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#ifndef _MSC_VER #ifndef _MSC_VER
#include <libgen.h> #include <libgen.h>
#endif #endif
#include <limits.h> #include <limits.h>
skipping to change at line 67 skipping to change at line 63
specification */ specification */
static ut_unit* _haveUnit; /* "have" unit minus amount */ static ut_unit* _haveUnit; /* "have" unit minus amount */
static ut_unit* _wantUnit; /* complete "want" unit */ static ut_unit* _wantUnit; /* complete "want" unit */
static int _wantDefinition; /* "have" unit definition desired? */ static int _wantDefinition; /* "have" unit definition desired? */
static int _formattingOptions = UT_DEFINITION; static int _formattingOptions = UT_DEFINITION;
static int _exitStatus = EXIT_FAILURE; static int _exitStatus = EXIT_FAILURE;
static void static void
usage(void) usage(void)
{ {
ut_status status;
const char * default_xml = ut_get_path_xml(NULL, &status);
(void)fprintf(stderr, (void)fprintf(stderr,
"Usage:\n" "Usage:\n"
" %s -h\n" " %s -h\n"
" %s [-A|-L|-U] [-r] [-H have] [-W want] [XML_file]\n" " %s [-A|-L|-U] [-r] [-H <have>] [-W <want>] [<XML_file>]\n"
"\n" "\n"
"where:\n" "where:\n"
" -A Use ASCII encoding (default).\n" " -A Use ASCII encoding (default).\n"
" -L Use ISO-8859-1 (ISO Latin-1) encoding.\n" " -L Use ISO-8859-1 (ISO Latin-1) encoding.\n"
" -U Use UTF-8 encoding.\n" " -U Use UTF-8 encoding.\n"
" -h Help. Print this message.\n" " -h Help. Print this message.\n"
" -r Reveal any problems in the database.\n" " -r Reveal any problems in the database.\n"
" -H have Use \"have\" unit for conversion. Default is reply to prompt.\n" " -H <have> Use <have> unit for conversion. Default is reply to prompt.\n"
" -W want Use \"want\" unit for conversion. Empty string requests\n" " -W <want> Use <want> unit for conversion. Empty string requests\n"
" definition of \"have\" unit. Default is reply to prompt.\n" " definition of <have> unit. Default is reply to prompt.\n"
" XML_file XML database file. Default is \"%s\".\n", " <XML_file> XML database file. Default is \"%s\".\n",
_progname, _progname, DEFAULT_UDUNITS2_XML_PATH); _progname, _progname, default_xml);
} }
/** /**
* Prints an error-message to the standard error stream. * Prints an error-message to the standard error stream.
* *
* @param format The format for the error-message. It shouldn't have a * @param format The format for the error-message. It shouldn't have a
* trailing newline. * trailing newline.
* @param ... Arguments referenced by the format. * @param ... Arguments referenced by the format.
*/ */
static void static void
skipping to change at line 211 skipping to change at line 210
const char* string) const char* string)
{ {
char* const copy = malloc(strlen(string)+1); char* const copy = malloc(strlen(string)+1);
if (copy == NULL) { if (copy == NULL) {
errMsg("Couldn't copy string \"%s\": %s", string, strerror(errno)); errMsg("Couldn't copy string \"%s\": %s", string, strerror(errno));
} }
else { else {
char* cp = copy; char* cp = copy;
while (*cp++ = tolower(*string++)) while ((*cp++ = tolower(*string++)))
; /* empty */ ; /* empty */
} }
return copy; return copy;
} }
/** /**
* Sets the character encoding from a (case insensitive) string specification * Sets the character encoding from a (case insensitive) string specification
* of the encoding that might be embedded in a larger string. * of the encoding that might be embedded in a larger string.
* *
 End of changes. 6 change blocks. 
17 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)