1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Start of -Wall and cleaning up icky bits.

This commit is contained in:
millert 1997-09-22 05:45:26 +00:00
parent 6d3a414d29
commit 71eaa2b501
6 changed files with 44 additions and 38 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: common.h,v 1.8 1997/09/06 23:51:31 niklas Exp $ */
/* $OpenBSD: common.h,v 1.9 1997/09/22 05:45:26 millert Exp $ */
#define DEBUGGING
@ -30,9 +30,12 @@
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <ctype.h>
#include <paths.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#undef malloc
#undef realloc

View File

@ -1,4 +1,5 @@
/* * $OpenBSD: config.h,v 1.2 1996/06/10 11:21:27 niklas Exp $*/
/* $OpenBSD: config.h,v 1.3 1997/09/22 05:45:26 millert Exp $ */
/* config.h
* This file was produced by running the config.h.SH script, which
* gets its values from config.sh, which is generally produced by

View File

@ -1,7 +1,7 @@
/* $OpenBSD: inp.c,v 1.5 1996/09/24 04:19:26 millert Exp $ */
/* $OpenBSD: inp.c,v 1.6 1997/09/22 05:45:26 millert Exp $ */
#ifndef lint
static char rcsid[] = "$OpenBSD: inp.c,v 1.5 1996/09/24 04:19:26 millert Exp $";
static char rcsid[] = "$OpenBSD: inp.c,v 1.6 1997/09/22 05:45:26 millert Exp $";
#endif /* not lint */
#include "EXTERN.h"
@ -13,7 +13,7 @@ static char rcsid[] = "$OpenBSD: inp.c,v 1.5 1996/09/24 04:19:26 millert Exp $";
/* Input-file-with-indexable-lines abstract type */
static long i_size; /* size of the input file */
static off_t i_size; /* size of the input file */
static char *i_womp; /* plan a buffer for entire file */
static char **i_ptr; /* pointers to lines in i_womp */
@ -157,10 +157,10 @@ char *filename;
#endif
if (i_womp == Nullch)
return FALSE;
if ((ifd = open(filename, 0)) < 0)
if ((ifd = open(filename, O_RDONLY)) < 0)
pfatal2("can't open file %s", filename);
#ifndef lint
if (read(ifd, i_womp, (int)i_size) != i_size) {
if (read(ifd, i_womp, (size_t)i_size) != i_size) {
Close(ifd); /* probably means i_size > 15 or 16 bits worth */
free(i_womp); /* at this point it doesn't matter if i_womp was */
return FALSE; /* undersized. */
@ -296,7 +296,7 @@ char *filename;
}
Fclose(ifp);
Close(tifd);
if ((tifd = open(TMPINNAME, 0)) < 0) {
if ((tifd = open(TMPINNAME, O_RDONLY)) < 0) {
pfatal2("can't reopen file %s", TMPINNAME);
}
}
@ -323,7 +323,7 @@ int whichbuf; /* ignored when file in memory */
else {
tiline[whichbuf] = baseline;
#ifndef lint /* complains of long accuracy */
Lseek(tifd, (long)baseline / lines_per_buf * BUFFERSIZE, 0);
Lseek(tifd, (off_t)(baseline / lines_per_buf * BUFFERSIZE), 0);
#endif
if (read(tifd, tibuf[whichbuf], BUFFERSIZE) < 0)
pfatal2("error reading tmp file %s", TMPINNAME);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: patch.c,v 1.9 1997/01/17 07:13:04 millert Exp $ */
/* $OpenBSD: patch.c,v 1.10 1997/09/22 05:45:27 millert Exp $ */
/* patch - a program to apply diffs to original files
*
@ -9,7 +9,7 @@
*/
#ifndef lint
static char rcsid[] = "$OpenBSD: patch.c,v 1.9 1997/01/17 07:13:04 millert Exp $";
static char rcsid[] = "$OpenBSD: patch.c,v 1.10 1997/09/22 05:45:27 millert Exp $";
#endif /* not lint */
#include "INTERN.h"
@ -36,7 +36,11 @@ void dump_line();
bool patch_match();
bool similar();
void re_input();
#ifdef __GNUC__
void my_exit() __attribute__((noreturn));
#else
void my_exit();
#endif
/* TRUE if -E was specified on command line. */
static int remove_empty_files = FALSE;
@ -327,6 +331,7 @@ char **argv;
set_signals(1);
}
my_exit(failtotal);
/* NOTREACHED */
}
/* Prepare to find the next patch to do in the patch file. */

View File

@ -1,7 +1,7 @@
/* $OpenBSD: util.c,v 1.3 1996/09/24 04:19:30 millert Exp $ */
/* $OpenBSD: util.c,v 1.4 1997/09/22 05:45:27 millert Exp $ */
#ifndef lint
static char rcsid[] = "$OpenBSD: util.c,v 1.3 1996/09/24 04:19:30 millert Exp $";
static char rcsid[] = "$OpenBSD: util.c,v 1.4 1997/09/22 05:45:27 millert Exp $";
#endif /* not lint */
#include "EXTERN.h"
@ -10,7 +10,11 @@ static char rcsid[] = "$OpenBSD: util.c,v 1.3 1996/09/24 04:19:30 millert Exp $"
#include "util.h"
#include "backupfile.h"
#ifdef __GNUC__
void my_exit() __attribute__((noreturn));
#else
void my_exit();
#endif
/* Rename a file, copying it if necessary. */
@ -18,7 +22,7 @@ int
move_file(from,to)
char *from, *to;
{
char bakname[512];
char bakname[MAXPATHLEN];
Reg1 char *s;
Reg2 int i;
Reg3 int fromfd;
@ -30,7 +34,7 @@ char *from, *to;
if (debug & 4)
say2("Moving %s to stdout.\n", from);
#endif
fromfd = open(from, 0);
fromfd = open(from, O_RDONLY);
if (fromfd < 0)
pfatal2("internal error, can't reopen %s", from);
while ((i=read(fromfd, buf, sizeof buf)) > 0)
@ -95,7 +99,7 @@ char *from, *to;
strerror(errno));
return -1;
}
tofd = open(to, 0);
tofd = open(to, O_RDONLY);
if (tofd < 0)
pfatal2("internal error, can't open %s", to);
while ((i=read(tofd, buf, sizeof buf)) > 0)
@ -119,7 +123,7 @@ char *from, *to;
to, from, strerror(errno));
return -1;
}
fromfd = open(from, 0);
fromfd = open(from, O_RDONLY);
if (fromfd < 0)
pfatal2("internal error, can't reopen %s", from);
while ((i=read(fromfd, buf, sizeof buf)) > 0)
@ -145,7 +149,7 @@ char *from, *to;
tofd = creat(to, 0666);
if (tofd < 0)
pfatal2("can't create %s", to);
fromfd = open(from, 0);
fromfd = open(from, O_RDONLY);
if (fromfd < 0)
pfatal2("internal error, can't reopen %s", from);
while ((i=read(fromfd, buf, sizeof buf)) > 0)
@ -177,7 +181,8 @@ Reg1 char *s;
}
else {
t = rv;
while (*t++ = *s++);
while ((*t++ = *s++))
;
}
return rv;
}
@ -255,7 +260,7 @@ long arg1,arg2,arg3;
write(1, buf, strlen(buf));
r = read(1, buf, sizeof buf);
}
else if ((ttyfd = open("/dev/tty", 2)) >= 0 && isatty(ttyfd)) {
else if ((ttyfd = open(_PATH_TTY, O_RDWR)) >= 0 && isatty(ttyfd)) {
/* might be deleted or unwriteable */
write(ttyfd, buf, strlen(buf));
r = read(ttyfd, buf, sizeof buf);
@ -286,27 +291,15 @@ set_signals(reset)
int reset;
{
#ifndef lint
#ifdef VOIDSIG
static void (*hupval)(),(*intval)();
#else
static int (*hupval)(),(*intval)();
#endif
static sig_t hupval, intval;
if (!reset) {
hupval = signal(SIGHUP, SIG_IGN);
if (hupval != SIG_IGN)
#ifdef VOIDSIG
hupval = my_exit;
#else
hupval = (int(*)())my_exit;
#endif
hupval = (sig_t)my_exit;
intval = signal(SIGINT, SIG_IGN);
if (intval != SIG_IGN)
#ifdef VOIDSIG
intval = my_exit;
#else
intval = (int(*)())my_exit;
#endif
intval = (sig_t)my_exit;
}
Signal(SIGHUP, hupval);
Signal(SIGINT, intval);
@ -430,7 +423,7 @@ int assume_exists;
#define try(f, a1, a2) (Snprintf(tmpbuf + pathlen, sizeof tmpbuf - pathlen, f, a1, a2), stat(tmpbuf, &filestat) == 0)
if ( try("RCS/%s%s", filebase, RCSSUFFIX)
|| try("RCS/%s" , filebase, 0)
|| try("RCS/%s%s", filebase, "")
|| try( "%s%s", filebase, RCSSUFFIX)
|| try("SCCS/%s%s", SCCSPREFIX, filebase)
|| try( "%s%s", SCCSPREFIX, filebase))

View File

@ -1,7 +1,7 @@
/* $OpenBSD: version.c,v 1.2 1996/06/10 11:21:35 niklas Exp $ */
/* $OpenBSD: version.c,v 1.3 1997/09/22 05:45:28 millert Exp $ */
#ifndef lint
static char rcsid[] = "$OpenBSD: version.c,v 1.2 1996/06/10 11:21:35 niklas Exp $";
static char rcsid[] = "$OpenBSD: version.c,v 1.3 1997/09/22 05:45:28 millert Exp $";
#endif /* not lint */
#include "EXTERN.h"
@ -11,7 +11,11 @@ static char rcsid[] = "$OpenBSD: version.c,v 1.2 1996/06/10 11:21:35 niklas Exp
#include "patchlevel.h"
#include "version.h"
#ifdef __GNUC__
void my_exit() __attribute__((noreturn));
#else
void my_exit();
#endif
/* Print out the version number and die. */