1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Avoid gcc warnings on Cygwin.

This commit is contained in:
Eric Blake
2009-12-22 12:26:30 +01:00
committed by Bruno Haible
parent b4eb8c5c5e
commit 5860266d3b
4 changed files with 27 additions and 17 deletions

View File

@@ -1,3 +1,10 @@
2009-12-22 Eric Blake <ebb9@byu.net> (tiny change)
Avoid gcc warnings on Cygwin.
* lib/getopt.c (_getopt_internal): Add braces. Fix indentation.
* tests/smtp.gperf: Cast arguments of <ctype.h> functions.
* tests/test2.c: Include <io.h>.
2009-12-22 Bruno Haible <bruno@clisp.org>
Avoid g++ warnings.

View File

@@ -3,7 +3,7 @@
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 2009
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -686,16 +686,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
else
{
if (opterr)
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option `--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
{
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option `--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += strlen (nextchar);
@@ -711,8 +713,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
if (opterr)
fprintf (stderr,
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
optopt = pfound->val;
return optstring[0] == ':' ? ':' : '?';

View File

@@ -183,10 +183,10 @@ main (argc, argv)
if (len)
{
for (k = 0; k < len; k++)
if (isupper (s[k]))
s[k] = tolower (s[k]);
else if (islower (s[k]))
s[k] = toupper (s[k]);
if (isupper ((unsigned char) s[k]))
s[k] = tolower ((unsigned char) s[k]);
else if (islower ((unsigned char) s[k]))
s[k] = toupper ((unsigned char) s[k]);
hs = header_entry (s, len);
if (!(hs && my_case_strcmp (hs->field_name, s) == 0))
{

View File

@@ -15,6 +15,7 @@
# undef O_BINARY
#endif
#if O_BINARY
# include <io.h>
# define SET_BINARY(f) setmode (f, O_BINARY)
#else
# define SET_BINARY(f) (void)0