Appease more warnings and remove unused getopt functions.

This commit is contained in:
tsutsui 2024-05-31 20:44:36 +00:00
parent d8b35192d7
commit 61549db5f1
8 changed files with 16 additions and 53 deletions

View File

@ -92,7 +92,7 @@ static char tmp_type[CT_SIZE+1], tmp_creator[CT_SIZE+1];
**
** ':' is replaced by '%' and string is terminated with '\0'
*/
void
static void
cstrncpy(char *t, const char *f, int c)
{
while (c-- && *f)
@ -142,7 +142,7 @@ hex2char(const char *s)
if(strlen(++s) < 2)
return(0);
if (!isxdigit(*s) || !isxdigit(*(s+1)))
if (!isxdigit((int)(u_char)*s) || !isxdigit((int)(u_char)*(s+1)))
return(0);
o = (dehex(*s) << 4) & 0xf0;
@ -163,7 +163,7 @@ hex2char(const char *s)
** that ":" is replaced by "%"
**
*/
void
static void
hstrncpy(unsigned char *t, const char *f, int c)
{
unsigned char o;
@ -244,7 +244,7 @@ get_none_info(char *hname, char *dname, dir_ent *s_entry, int ret)
** read_info_file: open and read a finderinfo file for an HFS file
** or directory
*/
int
static int
read_info_file(char *name, void *info, int len)
/* char *name; finderinfo filename */
/* void *info; info buffer */
@ -868,7 +868,7 @@ get_sgl_info(char *hname, char *dname, dir_ent *s_entry, int ret)
** Only tested with PC Exchange v2.1 - don't know if it will work
** with v2.2 and above.
*/
struct hfs_info *
static struct hfs_info *
get_hfs_fe_info(struct hfs_info *hfs_info, char *name)
{
FILE *fp;
@ -964,7 +964,7 @@ get_hfs_fe_info(struct hfs_info *hfs_info, char *name)
** directory - saves on reading this many times for each
** file.
*/
struct hfs_info *
static struct hfs_info *
get_hfs_sgi_info(struct hfs_info *hfs_info, char *name)
{
FILE *fp;
@ -1028,7 +1028,7 @@ del_hfs_info(struct hfs_info *hfs_info)
** match_key: find the correct hfs_ent using the Unix filename
** as the key
*/
hfsdirent *
static hfsdirent *
match_key(struct hfs_info *hfs_info, const char *key)
{
while (hfs_info) {
@ -1240,7 +1240,7 @@ get_sgi_info(char *hname, char *dname, dir_ent *s_entry, int ret)
/*
** get_hfs_itype: get the type of HFS info for a file
*/
int
static int
get_hfs_itype(const char *wname, const char *dname, char *htmp)
{
int wlen, i;

View File

@ -230,8 +230,7 @@ static int last_nonopt;
the new indices of the non-options in ARGV after they are moved. */
static void
exchange (argv)
char **argv;
exchange (char **argv)
{
int bottom = first_nonopt;
int middle = last_nonopt;
@ -288,8 +287,7 @@ exchange (argv)
/* Initialize the internal data when the first call is made. */
static const char *
_getopt_initialize (optstring)
const char *optstring;
_getopt_initialize (const char *optstring)
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
@ -673,18 +671,6 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
}
}
int
getopt (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST

View File

@ -95,16 +95,6 @@ struct option
#define optional_argument 2
#if __STDC__
#if defined(__GNU_LIBRARY__)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
@ -115,8 +105,6 @@ extern int _getopt_internal (int argc, char *const *argv,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();

View File

@ -65,17 +65,6 @@ char *getenv ();
#define NULL 0
#endif
int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option

View File

@ -72,7 +72,7 @@ struct file_hash * FDECL2(find_hash, dev_t, dev, ino_t, inode){
#ifdef APPLE_HYB
/* based on flush_file_hash() below - needed as we wnat to re-use the
file hash table */
void flush_hash(){
void flush_hash(void){
struct file_hash * fh, *fh1;
int i;

View File

@ -191,7 +191,7 @@ extern "C" {
* If there is no flock defined by the system, use emulation
* through fcntl record locking.
*/
#ifndef HAVE_FLOCK
#if !defined(HAVE_FLOCK_H) && !defined(HAVE_SYS_FCNTL_H)
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
#define LOCK_NB 4 /* don't block when locking */

View File

@ -412,7 +412,7 @@ extern int DECL(iso9660_date,(char *, time_t));
extern void DECL(add_hash,(struct directory_entry *));
extern struct file_hash * DECL(find_hash,(dev_t, ino_t));
#ifdef APPLE_HYB
extern void flush_hash();
extern void flush_hash(void);
#endif /* APPLE_HYB */
extern void DECL(add_directory_hash,(dev_t, ino_t));
extern struct file_hash * DECL(find_directory_hash,(dev_t, ino_t));

View File

@ -26,7 +26,7 @@ int DECL(copy_to_mac_vol, (hfsvol *, struct directory *));
/*
** AlcSiz: find allocation size for given volume size
*/
int
static int
AlcSiz(int vlen)
{
int lpa, drAlBlkSiz;
@ -45,7 +45,7 @@ AlcSiz(int vlen)
/*
** XClpSiz: find the default size of the catalog/extent file
*/
int
static int
XClpSiz(int vlen)
{
int olpa, lpa, drNmAlBlks, drAlBlkSiz;
@ -79,7 +79,7 @@ XClpSiz(int vlen)
/*
** get_vol_size: get the size of the volume including the extent/catalog
*/
int
static int
get_vol_size(int vblen)
{
int drXTClpSiz, drAlBlkSiz;