diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1995-04-26 15:06:58 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1995-04-26 15:06:58 +0000 |
| commit | 18a7c7704f00190086a1f42944022413dafc7453 (patch) | |
| tree | 09fe57f70f82f95dd54572e8476566a0dd6ed031 /usr.sbin/pkg_install/create/perform.c | |
| parent | 7113d27114638a5faca69bbd2cc3b65c22bcf1ea (diff) | |
Notes
Diffstat (limited to 'usr.sbin/pkg_install/create/perform.c')
| -rw-r--r-- | usr.sbin/pkg_install/create/perform.c | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index fc78cf2a027a..1165278f9e79 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.23 1995/04/26 11:43:20 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.24 1995/04/26 12:37:46 jkh Exp $"; #endif /* @@ -180,7 +180,7 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist) { char tball[FILENAME_MAX]; char *cmd; - int ret, max; + int ret, max, len; PackingList p; max = sysconf(_SC_ARG_MAX); @@ -200,27 +200,46 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist) printf("Creating gzip'd tar ball in '%s'\n", tball); strncat(cmd, "cf ", max - strlen(cmd)); strncat(cmd, tball, max - strlen(cmd)); - if (ExcludeFrom) - snprintf(&cmd[strlen(cmd)], max, " -X %s", ExcludeFrom); - snprintf(&cmd[strlen(cmd)], max, " %s %s %s", CONTENTS_FNAME, - COMMENT_FNAME, DESC_FNAME); - if (Install) - snprintf(&cmd[strlen(cmd)], max, " %s", INSTALL_FNAME); - if (DeInstall) - snprintf(&cmd[strlen(cmd)], max, " %s", DEINSTALL_FNAME); - if (Require) - snprintf(&cmd[strlen(cmd)], max, " %s", REQUIRE_FNAME); - if (Display) - snprintf(&cmd[strlen(cmd)], max, " %s", DISPLAY_FNAME); - if (Mtree) - snprintf(&cmd[strlen(cmd)], max, " %s", MTREE_FNAME); + if (ExcludeFrom) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " -X %s", ExcludeFrom); + } + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " %s %s %s", CONTENTS_FNAME, + COMMENT_FNAME, DESC_FNAME); + if (Install) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " %s", INSTALL_FNAME); + } + if (DeInstall) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " %s", DEINSTALL_FNAME); + } + if (Require) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " %s", REQUIRE_FNAME); + } + if (Display) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " %s", DISPLAY_FNAME); + } + if (Mtree) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " %s", MTREE_FNAME); + } for (p = plist->head; p; p = p->next) { - if (p->type == PLIST_FILE) - snprintf(&cmd[strlen(cmd)], max, " %s", p->name); - else if (p->type == PLIST_CWD) - snprintf(&cmd[strlen(cmd)], max, " -C %s", p->name); - else if (p->type == PLIST_SRC) - snprintf(&cmd[strlen(cmd)], max, " -C %s", p->name); + if (p->type == PLIST_FILE) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " %s", p->name); + } + else if (p->type == PLIST_CWD) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " -C %s", p->name); + } + else if (p->type == PLIST_SRC) { + len = strlen(cmd); + snprintf(&cmd[len], max -= len, " -C %s", p->name); + } else if (p->type == PLIST_IGNORE) p = p->next; } |
