code slightly easier to understand.
okay and tweak kn@
-/* $OpenBSD: buf_subs.c,v 1.31 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: buf_subs.c,v 1.32 2023/11/26 16:04:17 espie Exp $ */
/* $NetBSD: buf_subs.c,v 1.5 1995/03/21 09:07:08 cgd Exp $ */
/*-
* routines which implement archive and file buffering
*/
+static int buf_fill(void);
+static int buf_flush(int);
+
#define MINFBSZ 512 /* default block size for hole detect */
#define MAXFLT 10 /* default media read error limit */
* 0 when finished (user specified termination in ar_next()).
*/
-int
+static int
buf_fill(void)
{
int cnt;
* 0 if all is ok, -1 when a write error occurs.
*/
-int
+static int
buf_flush(int bufcnt)
{
int cnt;
-/* $OpenBSD: extern.h,v 1.60 2020/03/23 20:04:19 espie Exp $ */
+/* $OpenBSD: extern.h,v 1.61 2023/11/26 16:04:17 espie Exp $ */
/* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */
/*-
int wr_rdfile(ARCHD *, int, off_t *);
int rd_wrfile(ARCHD *, int, off_t *);
void cp_file(ARCHD *, int, int);
-int buf_fill(void);
-int buf_flush(int);
/*
* cpio.c
int cross_lnk(ARCHD *);
int chk_same(ARCHD *);
int node_creat(ARCHD *);
-int unlnk_exist(char *, int);
-int chk_path(char *, uid_t, gid_t, int);
void set_ftime(const char *, const struct timespec *,
const struct timespec *, int);
-void fset_ftime(const char *, int, const struct timespec *,
- const struct timespec *, int);
int set_ids(char *, uid_t, gid_t);
-int fset_ids(char *, int, uid_t, gid_t);
void set_pmode(char *, mode_t);
-void fset_pmode(char *, int, mode_t);
int set_attr(const struct file_times *, int _force_times, mode_t, int _do_mode,
int _in_sig);
int file_write(int, char *, int, int *, int *, int, char *);
extern int ford[];
void options(int, char **);
OPLIST * opt_next(void);
-int opt_add(const char *);
-int bad_opt(void);
extern char *chdname;
/*
extern char *tempbase;
extern int havechd;
-void sig_cleanup(int);
/*
* sel_subs.c
void add_dir(char *, struct stat *, int);
void delete_dir(dev_t, ino_t);
void proc_dir(int _in_sig);
-u_int st_hash(const char *, int, int);
/*
* tar.c
-/* $OpenBSD: file_subs.c,v 1.55 2020/03/23 20:04:19 espie Exp $ */
+/* $OpenBSD: file_subs.c,v 1.56 2023/11/26 16:04:17 espie Exp $ */
/* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */
/*-
#include "pax.h"
#include "extern.h"
-static int
-mk_link(char *, struct stat *, char *, int);
+static int fset_ids(char *, int, uid_t, gid_t);
+static int unlnk_exist(char *, int);
+static int chk_path(char *, uid_t, gid_t, int);
+static int mk_link(char *, struct stat *, char *, int);
+static void fset_ftime(const char *, int, const struct timespec *,
+ const struct timespec *, int);
+static void fset_pmode(char *, int, mode_t);
/*
* routines that deal with file operations such as: creating, removing;
* 1 we found a directory and we were going to create a directory.
*/
-int
+static int
unlnk_exist(char *name, int type)
{
struct stat sb;
fnm);
}
-void
+static void
fset_ftime(const char *fnm, int fd, const struct timespec *mtimp,
const struct timespec *atimp, int frc)
{
syswarn(1, errno, "Could not set permissions on %s", fnm);
}
-void
+static void
fset_pmode(char *fnm, int fd, mode_t mode)
{
mode &= ABITS;
-/* $OpenBSD: options.c,v 1.105 2023/01/17 16:20:28 tb Exp $ */
+/* $OpenBSD: options.c,v 1.106 2023/11/26 16:04:17 espie Exp $ */
/* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */
/*-
#include "tar.h"
#include "extern.h"
+static int bad_opt(void);
+static int opt_add(const char *);
/*
* argv[0] names. Used for tar and cpio emulation
*/
}
}
-int mkpath(char *);
+static int mkpath(char *);
-int
+static int
mkpath(char *path)
{
struct stat sb;
* when the format does not support options.
*/
-int
+static int
bad_opt(void)
{
OPLIST *opt;
* 0 if format in name=value format, -1 if -o is passed junk
*/
-int
+static int
opt_add(const char *str)
{
OPLIST *opt;
-/* $OpenBSD: pax.c,v 1.56 2023/11/09 18:54:15 kn Exp $ */
+/* $OpenBSD: pax.c,v 1.57 2023/11/26 16:04:17 espie Exp $ */
/* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */
/*-
#include "pax.h"
#include "extern.h"
static int gen_init(void);
+static void sig_cleanup(int);
/*
* PAX main routines, general globals and some simple start up routines
* never....
*/
-void
+static void
sig_cleanup(int which_sig)
{
/*
-/* $OpenBSD: tables.c,v 1.54 2019/06/28 05:35:34 deraadt Exp $ */
+/* $OpenBSD: tables.c,v 1.55 2023/11/26 16:04:17 espie Exp $ */
/* $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $ */
/*-
#include "pax.h"
#include "extern.h"
+static u_int st_hash(const char *, int, int);
/*
* Routines for controlling the contents of all the different databases pax
* the hash value of the string MOD (%) the table size.
*/
-u_int
+static u_int
st_hash(const char *name, int len, int tabsz)
{
const char *pt;