made --percent look like it did in RPM 1.x
authorewt <devnull@localhost>
Sat, 24 Feb 1996 23:46:09 +0000 (23:46 +0000)
committerewt <devnull@localhost>
Sat, 24 Feb 1996 23:46:09 +0000 (23:46 +0000)
CVS patchset: 415
CVS date: 1996/02/24 23:46:09

install.c
lib/install.c

index 3fbdab4..7fdb4e1 100644 (file)
--- a/install.c
+++ b/install.c
@@ -42,6 +42,7 @@ void doInstall(char * prefix, char * arg, int installFlags, int interfaceFlags)
     int mode, rc;
     char * chptr;
     notifyFunction fn;
+    char * printFormat = NULL;
 
     hashesPrinted = 0;
 
@@ -72,7 +73,7 @@ void doInstall(char * prefix, char * arg, int installFlags, int interfaceFlags)
     }
 
     if (interfaceFlags & RPMINSTALL_PERCENT) 
-       printf("%%f %s\n", arg);
+       printFormat = "%%f %s:%s:%s\n";
     else if (isVerbose() && (interfaceFlags & RPMINSTALL_HASH)) {
        chptr = strrchr(arg, '/');
        if (!chptr)
@@ -80,11 +81,11 @@ void doInstall(char * prefix, char * arg, int installFlags, int interfaceFlags)
        else
            chptr++;
 
-       installFlags |= INSTALL_PRINTLABEL;
+       printFormat = "%-28s";
     } else if (isVerbose())
        printf("Installing %s\n", arg);
 
-    rc = rpmInstallPackage(prefix, db, fd, installFlags, fn);
+    rc = rpmInstallPackage(prefix, db, fd, installFlags, fn, printFormat);
     if (rc == 1) {
        fprintf(stderr, "error: %s cannot be installed\n", arg);
     }
index f138f29..18aaf2f 100644 (file)
@@ -75,7 +75,7 @@ int rpmInstallSourcePackage(char * prefix, int fd, char ** specFile) {
 /* 1 bad magic */
 /* 2 error */
 int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags, 
-                     notifyFunction notify) {
+                     notifyFunction notify, char * labelFormat) {
     int rc, isSource;
     char * name, * version, * release;
     Header h, h2;
@@ -98,7 +98,6 @@ int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags,
     struct replacedFile * replacedList = NULL;
     char * sptr, * dptr;
     int length;
-    char * s;
     dbIndexSet matches;
     int * oldVersions;
     int * intptr;
@@ -134,15 +133,8 @@ int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags,
     getEntry(h, RPMTAG_VERSION, &type, (void **) &version, &fileCount);
     getEntry(h, RPMTAG_RELEASE, &type, (void **) &release, &fileCount);
 
-    if (flags & INSTALL_PRINTLABEL) {
-       s = alloca(strlen(name) + strlen(version) + strlen(release) + 3);
-       strcpy(s, name);
-       strcat(s, "-");
-       strcat(s, version);
-       strcat(s, "-");
-       strcat(s, release);
-
-       printf("%-28s", s);
+    if (labelFormat) {
+       printf(labelFormat, name, version, release);
        fflush(stdout);
     }