Flags are named XBPS_FLAG_XXX, add XBPS_FLAG_FORCE.

--HG--
extra : convert_revision : 4f7ad37910303a87788b2daac9b4ba11bf39becd
This commit is contained in:
Juan RP 2009-08-11 14:01:28 +02:00
parent bd8e232a2d
commit 3e42bc6410
4 changed files with 13 additions and 12 deletions

View file

@ -113,7 +113,7 @@ main(int argc, char **argv)
break; break;
case 'v': case 'v':
verbose = true; verbose = true;
flags |= XBPS_VERBOSE; flags |= XBPS_FLAG_VERBOSE;
break; break;
case '?': case '?':
default: default:

View file

@ -58,7 +58,8 @@
#define XBPS_PKGINDEX_VERSION "1.0" #define XBPS_PKGINDEX_VERSION "1.0"
/* Verbose messages */ /* Verbose messages */
#define XBPS_VERBOSE 0x00000001 #define XBPS_FLAG_VERBOSE 0x00000001
#define XBPS_FLAG_FORCE 0x00000002
#define ARCHIVE_READ_BLOCKSIZE 10240 #define ARCHIVE_READ_BLOCKSIZE 10240

View file

@ -97,7 +97,7 @@ remove_pkg_metadir(const char *pkgname)
} }
if ((rv = unlink(path)) == -1) { if ((rv = unlink(path)) == -1) {
if (flags & XBPS_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf("WARNING: can't remove %s (%s)\n", printf("WARNING: can't remove %s (%s)\n",
pkgname, strerror(errno)); pkgname, strerror(errno));
} }
@ -144,13 +144,13 @@ remove_pkg_files(prop_dictionary_t dict)
return EINVAL; return EINVAL;
} }
if ((rv = remove(path)) == -1) { if ((rv = remove(path)) == -1) {
if (flags & XBPS_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf("WARNING: can't remove link %s (%s)\n", printf("WARNING: can't remove link %s (%s)\n",
file, strerror(errno)); file, strerror(errno));
free(path); free(path);
continue; continue;
} }
if (flags & XBPS_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf("Removed link: %s\n", file); printf("Removed link: %s\n", file);
free(path); free(path);
@ -199,7 +199,7 @@ files:
free(path); free(path);
continue; continue;
} else if (rv == ERANGE) { } else if (rv == ERANGE) {
if (flags & XBPS_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf("WARNING: SHA256 doesn't match " printf("WARNING: SHA256 doesn't match "
"for %s %s, ignoring...\n", "for %s %s, ignoring...\n",
curftype, file); curftype, file);
@ -211,14 +211,14 @@ files:
return rv; return rv;
} }
if ((rv = remove(path)) == -1) { if ((rv = remove(path)) == -1) {
if (flags & XBPS_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf("WARNING: can't remove " printf("WARNING: can't remove "
"%s %s (%s)\n", curftype, file, "%s %s (%s)\n", curftype, file,
strerror(errno)); strerror(errno));
free(path); free(path);
continue; continue;
} }
if (flags & XBPS_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf("Removed %s: %s\n", curftype, file); printf("Removed %s: %s\n", curftype, file);
free(path); free(path);
@ -256,7 +256,7 @@ dirs:
free(path); free(path);
continue; continue;
} }
if (flags & XBPS_VERBOSE) { if (flags & XBPS_FLAG_VERBOSE) {
printf("WARNING: can't remove " printf("WARNING: can't remove "
"directory %s (%s)\n", file, "directory %s (%s)\n", file,
strerror(errno)); strerror(errno));
@ -264,7 +264,7 @@ dirs:
continue; continue;
} }
} }
if (flags & XBPS_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf("Removed directory: %s\n", file); printf("Removed directory: %s\n", file);
free(path); free(path);

View file

@ -232,7 +232,7 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg,
archive_error_string(ar)); archive_error_string(ar));
return rv;; return rv;;
} else if (rv == EEXIST) { } else if (rv == EEXIST) {
if (flags & XBPS_VERBOSE) { if (flags & XBPS_FLAG_VERBOSE) {
printf("WARNING: ignoring existent " printf("WARNING: ignoring existent "
"path: %s\n", "path: %s\n",
archive_entry_pathname(entry)); archive_entry_pathname(entry));
@ -241,7 +241,7 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg,
continue; continue;
} }
} }
if (flags & XBPS_VERBOSE) { if (flags & XBPS_FLAG_VERBOSE) {
printf(" %s\n", archive_entry_pathname(entry)); printf(" %s\n", archive_entry_pathname(entry));
(void)fflush(stdout); (void)fflush(stdout);
} }