1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Export the min_free() function.

This commit is contained in:
Jordan K. Hubbard 1995-04-22 13:58:44 +00:00
parent cbf098db0e
commit 3e1a18606d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7999
3 changed files with 23 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: file.c,v 1.5 1993/09/18 03:39:48 jkh Exp $";
static const char *rcsid = "$Id: file.c,v 1.6 1994/12/06 00:51:48 jkh Exp $";
#endif
/*
@ -132,6 +132,19 @@ copy_file(char *dir, char *fname, char *to)
barf("Couldn't perform '%s'", cmd);
}
void
move_file(char *dir, char *fname, char *to)
{
char cmd[FILENAME_MAX];
if (fname[0] == '/')
sprintf(cmd, "mv %s %s", fname, to);
else
sprintf(cmd, "mv %s/%s %s", dir, fname, to);
if (vsystem(cmd))
barf("Couldn't perform '%s'", cmd);
}
/*
* Copy a hierarchy (possibly from dir) to the current directory, or
* if "to" is TRUE, from the current directory to a location someplace
@ -174,7 +187,7 @@ unpack(char *pkg, char *flist)
if (cp) {
strcpy(suffix, cp + 1);
if (index(suffix, 'z') || index(suffix, 'Z'))
strcpy(args, "z");
strcpy(args, "-z");
}
strcat(args, "xpf");
if (vsystem("tar %s %s %s", args, pkg, flist ? flist : "")) {

View File

@ -1,4 +1,4 @@
/* $Id: lib.h,v 1.13 1995/04/19 14:02:01 jkh Exp $ */
/* $Id: lib.h,v 1.14 1995/04/22 07:41:01 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@ -109,6 +109,7 @@ void cleanup(int);
char *make_playpen(char *, size_t);
void leave_playpen(void);
char *where_playpen(void);
long min_free(char *);
/* String */
char *get_dash_string(char **);
@ -125,6 +126,7 @@ Boolean isempty(char *);
char *get_file_contents(char *);
void write_file(char *, char *);
void copy_file(char *, char *, char *);
void move_file(char *, char *, char *);
void copy_hierarchy(char *, char *, Boolean);
int delete_hierarchy(char *, Boolean, Boolean);
int unpack(char *, char *);

View File

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: pen.c,v 1.10 1995/04/18 13:04:34 jkh Exp $";
static const char *rcsid = "$Id: pen.c,v 1.11 1995/04/21 06:30:41 jkh Exp $";
#endif
/*
@ -30,8 +30,6 @@ static const char *rcsid = "$Id: pen.c,v 1.10 1995/04/18 13:04:34 jkh Exp $";
static char Cwd[FILENAME_MAX];
static char Pen[FILENAME_MAX];
static long min_free(char *);
/*
* Make a temporary directory to play in and chdir() to it, returning
* pathname of previous working directory.
@ -93,10 +91,13 @@ where_playpen(void)
return NULL;
}
static long min_free(char *tmpdir)
long
min_free(char *tmpdir)
{
struct statfs buf;
if (!tmpdir)
tmpdir = Pen;
if (statfs(tmpdir, &buf) != 0) {
perror("Error in statfs");
return -1;