diff options
author | jkh <jkh@FreeBSD.org> | 1995-04-22 13:58:44 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-04-22 13:58:44 +0000 |
commit | d3abd00ffec4e327d8ad0d9d1401caf10752f449 (patch) | |
tree | 7aff6de9fe129eefedbbfe9af4b9488f6e43469c /usr.sbin/pkg_install/lib | |
parent | 631042660156d0f11cb143dc9a3fc9667a5705e2 (diff) | |
download | FreeBSD-src-d3abd00ffec4e327d8ad0d9d1401caf10752f449.zip FreeBSD-src-d3abd00ffec4e327d8ad0d9d1401caf10752f449.tar.gz |
Export the min_free() function.
Diffstat (limited to 'usr.sbin/pkg_install/lib')
-rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 17 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/lib.h | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/pen.c | 9 |
3 files changed, 23 insertions, 7 deletions
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index e2c2668..19470be 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -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 : "")) { diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index c1614fa..a6cc77b 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -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 *); diff --git a/usr.sbin/pkg_install/lib/pen.c b/usr.sbin/pkg_install/lib/pen.c index fe1468a..07ba4aa 100644 --- a/usr.sbin/pkg_install/lib/pen.c +++ b/usr.sbin/pkg_install/lib/pen.c @@ -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; |