WARNS=2 fixup.

This commit is contained in:
Mark Murray 2001-12-02 12:36:35 +00:00
parent e3a3c468a5
commit 865eb33a74
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87210
8 changed files with 30 additions and 22 deletions

View File

@ -2,9 +2,10 @@
# $FreeBSD$
PROG= ar
CFLAGS+=-I${.CURDIR} -Wall
SRCS= append.c ar.c archive.c contents.c delete.c extract.c misc.c \
move.c print.c replace.c
CFLAGS+=-I${.CURDIR}
WARNS?= 2
MAN= ar.1aout ar.5
BINDIR= /usr/libexec/aout

View File

@ -64,8 +64,9 @@ static const char sccsid[] = "@(#)ar.c 8.3 (Berkeley) 4/2/94";
CHDR chdr;
u_int options;
char *archive, *envtmp, *posarg, *posname;
static void badoptions __P((char *));
char *archive, *posarg, *posname;
const char *envtmp;
static void badoptions __P((const char *));
static void usage __P((void));
/*
@ -219,7 +220,7 @@ main(argc, argv)
static void
badoptions(arg)
char *arg;
const char *arg;
{
warnx("illegal option combination for %s", arg);

View File

@ -201,7 +201,7 @@ put_arobj(cfp, sb)
CF *cfp;
struct stat *sb;
{
int lname;
size_t lname;
char *name;
struct ar_hdr *hdr;
off_t size;
@ -253,7 +253,7 @@ put_arobj(cfp, sb)
if (write(cfp->wfd, hb, sizeof(HDR)) != sizeof(HDR))
error(cfp->wname);
if (lname) {
if (write(cfp->wfd, name, lname) != lname)
if ((size_t)write(cfp->wfd, name, lname) != lname)
error(cfp->wname);
already_written = lname;
}

View File

@ -34,6 +34,7 @@
* SUCH DAMAGE.
*
* @(#)archive.h 8.3 (Berkeley) 4/2/94
* $FreeBSD$
*/
/* Ar(1) options. */
@ -65,9 +66,9 @@ extern u_int options;
/* File copy structure. */
typedef struct {
int rfd; /* read file descriptor */
char *rname; /* read name */
const char *rname; /* read name */
int wfd; /* write file descriptor */
char *wname; /* write name */
const char *wname; /* write name */
#define NOPAD 0x00 /* don't pad */
#define RPAD 0x01 /* pad on reads */
#define WPAD 0x02 /* pad on writes */

View File

@ -39,7 +39,7 @@ void badfmt __P((void));
int compare __P((char *));
int contents __P((char **));
int delete __P((char **));
void error __P((char *));
void error __P((const char *));
int extract __P((char **));
char *files __P((char **argv));
int move __P((char **));
@ -50,5 +50,5 @@ int tmp __P((void));
extern char *archive;
extern char *posarg, *posname; /* positioning file name */
extern char *tname; /* temporary file "name" */
extern const char *tname; /* temporary file "name" */
extern CHDR chdr; /* converted header */

View File

@ -56,7 +56,7 @@ static const char rcsid[] =
#include "extern.h"
#include "pathnames.h"
char *tname = "temporary file"; /* temporary file "name" */
const char *tname = "temporary file"; /* temporary file "name" */
int
tmp()
@ -134,7 +134,7 @@ badfmt()
void
error(name)
char *name;
const char *name;
{
err(1, "%s", name);

View File

@ -1,6 +1,7 @@
# $FreeBSD$
PROG= c89
WARNS?= 2
MAN= c89.1
.include <bsd.prog.mk>

View File

@ -47,7 +47,7 @@ static const char rcsid[] =
* benefit of making c89 -D_ANSI_SOURCE do the right thing (or any other
* -D_FOO_SOURCE feature test macro we support.)
*/
static char *args_prepended[] = {
static const char *args_prepended[] = {
"-std=iso9899:199409",
"-pedantic"
};
@ -63,15 +63,19 @@ int
main(int argc, char **argv)
{
int Argc, i;
char **Argv;
size_t j;
union {
const char **a;
char * const *b;
} Argv;
Argc = 0;
Argv = malloc((argc + 1 + N_ARGS_PREPENDED) * sizeof *Argv);
if (Argv == NULL)
Argv.a = malloc((argc + 1 + N_ARGS_PREPENDED) * sizeof *Argv.a);
if (Argv.a == NULL)
err(1, "malloc");
Argv[Argc++] = argv[0];
for (i = 0; i < N_ARGS_PREPENDED; ++i)
Argv[Argc++] = args_prepended[i];
Argv.a[Argc++] = argv[0];
for (j = 0; j < N_ARGS_PREPENDED; ++j)
Argv.a[Argc++] = args_prepended[j];
while ((i = getopt(argc, argv, "cD:EgI:l:L:o:OsU:")) != -1) {
if (i == '?')
usage();
@ -88,10 +92,10 @@ main(int argc, char **argv)
usage();
}
/* Append argv[1..] at the end of Argv[]. */
/* Append argv[1..] at the end of Argv[].a. */
for (i = 1; i <= argc; ++i)
Argv[Argc++] = argv[i];
(void)execv(CC, Argv);
Argv.a[Argc++] = argv[i];
(void)execv(CC, Argv.b);
err(1, "execv(" CC ")");
}