Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/paccache.sh.in4
-rw-r--r--contrib/rankmirrors.sh.in2
-rw-r--r--lib/libalpm/add.c2
-rw-r--r--lib/libalpm/alpm.h14
-rw-r--r--lib/libalpm/be_package.c2
-rw-r--r--lib/libalpm/deps.c4
-rw-r--r--lib/libalpm/diskspace.c2
-rw-r--r--lib/libalpm/dload.c2
-rw-r--r--lib/libalpm/filelist.c2
-rw-r--r--lib/libalpm/handle.h8
-rw-r--r--lib/libalpm/remove.c4
-rw-r--r--lib/libalpm/signing.c24
-rw-r--r--lib/libalpm/trans.c2
-rw-r--r--lib/libalpm/util.c6
-rw-r--r--scripts/makepkg.sh.in6
-rw-r--r--scripts/pacman-optimize.sh.in4
-rw-r--r--src/common/util-common.c19
-rw-r--r--src/pacman/callback.c6
-rw-r--r--src/pacman/conf.c2
-rw-r--r--src/pacman/package.c4
-rw-r--r--src/pacman/pacman.c2
-rw-r--r--src/pacman/query.c2
-rw-r--r--src/pacman/util.c2
-rwxr-xr-xtest/scripts/human_to_size_test.sh54
-rwxr-xr-xtest/scripts/parseopts_test.sh58
25 files changed, 119 insertions, 118 deletions
diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index 2bbe7266..6b8df25e 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -298,8 +298,8 @@ pkgcount=${#candidates[*]}
# copy the list, merging in any found sigs
for cand in "${candidates[@]}"; do
- candtemp+=("$cand")
- [[ -f $cand.sig ]] && candtemp+=("$cand.sig")
+ candtemp+=("$cand")
+ [[ -f $cand.sig ]] && candtemp+=("$cand.sig")
done
candidates=("${candtemp[@]}")
unset candtemp
diff --git a/contrib/rankmirrors.sh.in b/contrib/rankmirrors.sh.in
index 5555edf9..82bf9ae0 100644
--- a/contrib/rankmirrors.sh.in
+++ b/contrib/rankmirrors.sh.in
@@ -184,7 +184,7 @@ elif [[ $FILE ]]; then
fi
timesarray=()
-for line in "${linearray[@]}"; do
+for line in "${linearray[@]}"; do
if [[ $line =~ ^[[:space:]]*# ]]; then
[[ $TIMESONLY ]] || echo $line
elif [[ $line =~ ^[[:space:]]*Server ]]; then
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index ee29a127..214e78ee 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -671,7 +671,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
break;
}
- /* run the post-install script if it exists */
+ /* run the post-install script if it exists */
if(alpm_pkg_has_scriptlet(newpkg)
&& !(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
char *scriptlet = _alpm_local_db_pkgpath(db, newpkg, "install");
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 2c8c1e61..e9b0febd 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -79,17 +79,17 @@ typedef enum _alpm_pkgvalidation_t {
/** Types of version constraints in dependency specs. */
typedef enum _alpm_depmod_t {
- /** No version constraint */
+ /** No version constraint */
ALPM_DEP_MOD_ANY = 1,
- /** Test version equality (package=x.y.z) */
+ /** Test version equality (package=x.y.z) */
ALPM_DEP_MOD_EQ,
- /** Test for at least a version (package>=x.y.z) */
+ /** Test for at least a version (package>=x.y.z) */
ALPM_DEP_MOD_GE,
- /** Test for at most a version (package<=x.y.z) */
+ /** Test for at most a version (package<=x.y.z) */
ALPM_DEP_MOD_LE,
- /** Test for greater than some version (package>x.y.z) */
+ /** Test for greater than some version (package>x.y.z) */
ALPM_DEP_MOD_GT,
- /** Test for less than some version (package<x.y.z) */
+ /** Test for less than some version (package<x.y.z) */
ALPM_DEP_MOD_LT
} alpm_depmod_t;
@@ -250,7 +250,7 @@ typedef struct _alpm_sigresult_t {
/**
* Signature list. Contains the number of signatures found and a pointer to an
- * array of results. The array is of size count.
+ * array of results. The array is of size count.
*/
typedef struct _alpm_siglist_t {
size_t count;
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 4e814f8b..aaf60fe8 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -423,7 +423,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
}
config = 1;
continue;
- } else if(strcmp(entry_name, ".INSTALL") == 0) {
+ } else if(strcmp(entry_name, ".INSTALL") == 0) {
newpkg->scriptlet = 1;
} else if(*entry_name == '.') {
/* for now, ignore all files starting with '.' that haven't
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index dd85a014..e5a04047 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -381,8 +381,8 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
/* 1. check upgrade list for satisfiers */
/* 2. check dblist for satisfiers */
if(causingpkg &&
- !find_dep_satisfier(upgrade, depend) &&
- !find_dep_satisfier(dblist, depend)) {
+ !find_dep_satisfier(upgrade, depend) &&
+ !find_dep_satisfier(dblist, depend)) {
alpm_depmissing_t *miss;
char *missdepstring = alpm_dep_compute_string(depend);
_alpm_log(handle, ALPM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index 4526e89e..dcab3b03 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -357,7 +357,7 @@ int _alpm_check_downloadspace(alpm_handle_t *handle, const char *cachedir,
size_t j;
int error = 0;
- /* resolve the cachedir path to ensure we check the right mountpoint. We
+ /* resolve the cachedir path to ensure we check the right mountpoint. We
* handle failures silently, and continue to use the possibly unresolved
* path. */
if(realpath(cachedir, resolved_cachedir) != NULL) {
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 866c51df..c74d2ad1 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -465,7 +465,7 @@ static int curl_download_internal(struct dload_payload *payload,
payload->curlerr);
/* disconnect relationships from the curl handle for things that might go out
- * of scope, but could still be touched on connection teardown. This really
+ * of scope, but could still be touched on connection teardown. This really
* only applies to FTP transfers. */
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)NULL);
diff --git a/lib/libalpm/filelist.c b/lib/libalpm/filelist.c
index f8db9a33..e6da681e 100644
--- a/lib/libalpm/filelist.c
+++ b/lib/libalpm/filelist.c
@@ -97,7 +97,7 @@ alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
} else {
/* TODO: this creates conflicts between a symlink to a directory in
* one package and a real directory in the other. For example,
- * lib -> /usr/lib in pkg1 and /lib in pkg2. This would be allowed
+ * lib -> /usr/lib in pkg1 and /lib in pkg2. This would be allowed
* when installing one package at a time _provided_ pkg1 is installed
* first. This will need adjusted if the order of package install can
* be guaranteed to install the symlink first */
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index a4e2cf72..4126e1ac 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -52,7 +52,7 @@ do { \
struct __alpm_handle_t {
/* internal usage */
- alpm_db_t *db_local; /* local db pointer */
+ alpm_db_t *db_local; /* local db pointer */
alpm_list_t *dbs_sync; /* List of (alpm_db_t *) */
FILE *logstream; /* log file stream pointer */
int lockfd; /* lock file descriptor */
@@ -64,10 +64,10 @@ struct __alpm_handle_t {
#endif
/* callback functions */
- alpm_cb_log logcb; /* Log callback function */
- alpm_cb_download dlcb; /* Download callback function */
+ alpm_cb_log logcb; /* Log callback function */
+ alpm_cb_download dlcb; /* Download callback function */
alpm_cb_totaldl totaldlcb; /* Total download callback function */
- alpm_cb_fetch fetchcb; /* Download file callback function */
+ alpm_cb_fetch fetchcb; /* Download file callback function */
alpm_cb_event eventcb;
alpm_cb_question questioncb;
alpm_cb_progress progresscb;
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index e745d89f..9417a61e 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -672,7 +672,7 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
_alpm_log(handle, ALPM_LOG_DEBUG, "removing package %s-%s\n",
pkgname, pkgver);
- /* run the pre-remove scriptlet if it exists */
+ /* run the pre-remove scriptlet if it exists */
if(alpm_pkg_has_scriptlet(oldpkg) &&
!(handle->trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
char *scriptlet = _alpm_local_db_pkgpath(handle->db_local,
@@ -692,7 +692,7 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
oldpkg->name, oldpkg->version);
}
- /* run the post-remove script if it exists */
+ /* run the post-remove script if it exists */
if(!newpkg && alpm_pkg_has_scriptlet(oldpkg) &&
!(handle->trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
char *scriptlet = _alpm_local_db_pkgpath(handle->db_local,
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index 7e4d41bc..b594a9be 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -85,27 +85,27 @@ static alpm_list_t *list_sigsum(gpgme_sigsum_t sigsum)
/* The docs say this can be a bitmask...not sure I believe it, but we'll code
* for it anyway and show all possible flags in the returned string. */
- /* The signature is fully valid. */
+ /* The signature is fully valid. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_VALID, "valid");
- /* The signature is good. */
+ /* The signature is good. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_GREEN, "green");
- /* The signature is bad. */
+ /* The signature is bad. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_RED, "red");
- /* One key has been revoked. */
+ /* One key has been revoked. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_KEY_REVOKED, "key revoked");
- /* One key has expired. */
+ /* One key has expired. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_KEY_EXPIRED, "key expired");
- /* The signature has expired. */
+ /* The signature has expired. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_SIG_EXPIRED, "sig expired");
- /* Can't verify: key missing. */
+ /* Can't verify: key missing. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_KEY_MISSING, "key missing");
- /* CRL not available. */
+ /* CRL not available. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_CRL_MISSING, "crl missing");
- /* Available CRL is too old. */
+ /* Available CRL is too old. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_CRL_TOO_OLD, "crl too old");
- /* A policy was not met. */
+ /* A policy was not met. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_BAD_POLICY, "bad policy");
- /* A system error occurred. */
+ /* A system error occurred. */
sigsum_test_bit(sigsum, &summary, GPGME_SIGSUM_SYS_ERROR, "sys error");
/* Fallback case */
if(!sigsum) {
@@ -679,7 +679,7 @@ error:
return ret;
}
-#else /* HAVE_LIBGPGME */
+#else /* HAVE_LIBGPGME */
int _alpm_key_in_keychain(alpm_handle_t UNUSED *handle, const char UNUSED *fpr)
{
return -1;
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 8d4e0e73..a795a1fa 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -289,7 +289,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath,
if(!is_archive && !grep(filepath, script)) {
/* script not found in scriptlet file; we can only short-circuit this early
- * if it is an actual scriptlet file and not an archive. */
+ * if it is an actual scriptlet file and not an archive. */
return 0;
}
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 19a8612f..f9fdb018 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -142,7 +142,7 @@ done:
/** Copies a file.
* @param src file path to copy from
* @param dest file path to copy to
- * @return 0 on success, 1 on error
+ * @return 0 on success, 1 on error
*/
int _alpm_copyfile(const char *src, const char *dest)
{
@@ -920,7 +920,7 @@ char SYMEXPORT *alpm_compute_sha256sum(const char *filename)
return hex_representation(output, 32);
}
-/** Calculates a file's MD5 or SHA2 digest and compares it to an expected value.
+/** Calculates a file's MD5 or SHA-2 digest and compares it to an expected value.
* @param filepath path of the file to check
* @param expected hash value to compare against
* @param type digest type to use
@@ -958,7 +958,7 @@ int _alpm_test_checksum(const char *filepath, const char *expected,
* Does not handle sparse files on purpose for speed.
* @param a
* @param b
- * @return
+ * @return
*/
int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
{
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 86b3d4de..c1c09006 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1336,8 +1336,8 @@ extract_sources() {
for netfile in "${source[@]}"; do
local file=$(get_filename "$netfile")
if in_array "$file" "${noextract[@]}"; then
- #skip source files in the noextract=() array
- # these are marked explicitly to NOT be extracted
+ # skip source files in the noextract=() array
+ # these are marked explicitly to NOT be extracted
continue
fi
local proto=$(get_protocol "$netfile")
@@ -2488,7 +2488,7 @@ usage() {
printf -- "$(gettext "Options:")\n"
printf -- "$(gettext " -A, --ignorearch Ignore incomplete %s field in %s")\n" "arch" "$BUILDSCRIPT"
printf -- "$(gettext " -c, --clean Clean up work files after build")\n"
- printf -- "$(gettext " -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/"
+ printf -- "$(gettext " -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/"
printf -- "$(gettext " -d, --nodeps Skip all dependency checks")\n"
printf -- "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "\$srcdir/"
printf -- "$(gettext " -f, --force Overwrite existing package")\n"
diff --git a/scripts/pacman-optimize.sh.in b/scripts/pacman-optimize.sh.in
index 47fbb492..498bd77a 100644
--- a/scripts/pacman-optimize.sh.in
+++ b/scripts/pacman-optimize.sh.in
@@ -142,8 +142,8 @@ msg "$(gettext "Making and MD5sum'ing the new database...")"
mkdir "$localdb.new"
bsdtar -xpf "$workdir/pacman-db.tar.gz" -C "$localdb.new"
if (( $? )); then
- rm -rf "$workdir"
- die_r "$(gettext "Untar'ing %s failed.")" "$localdb"
+ rm -rf "$workdir"
+ die_r "$(gettext "Untar'ing %s failed.")" "$localdb"
fi
# immediate sync following extraction should get it written continuously on HDD
msg "$(gettext "Syncing database to disk...")"
diff --git a/src/common/util-common.c b/src/common/util-common.c
index 40623b92..e4a9de91 100644
--- a/src/common/util-common.c
+++ b/src/common/util-common.c
@@ -82,9 +82,9 @@ char *mdirname(const char *path)
*/
static size_t strnlen(const char *s, size_t max)
{
- register const char *p;
- for(p = s; *p && max--; ++p);
- return (p - s);
+ register const char *p;
+ for(p = s; *p && max--; ++p);
+ return (p - s);
}
/** Copies a string.
@@ -95,14 +95,15 @@ static size_t strnlen(const char *s, size_t max)
*/
char *strndup(const char *s, size_t n)
{
- size_t len = strnlen(s, n);
- char *new = (char *) malloc(len + 1);
+ size_t len = strnlen(s, n);
+ char *new = (char *) malloc(len + 1);
- if(new == NULL)
- return NULL;
+ if(new == NULL) {
+ return NULL;
+ }
- new[len] = '\0';
- return (char *)memcpy(new, s, len);
+ new[len] = '\0';
+ return (char *)memcpy(new, s, len);
}
#endif
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 3bdfe2cb..a181fa5c 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -156,7 +156,7 @@ void cb_event(alpm_event_t event, void *data1, void *data2)
}
switch(event) {
case ALPM_EVENT_CHECKDEPS_START:
- printf(_("checking dependencies...\n"));
+ printf(_("checking dependencies...\n"));
break;
case ALPM_EVENT_FILECONFLICTS_START:
if(config->noprogressbar) {
@@ -294,7 +294,7 @@ void cb_question(alpm_question_t event, void *data1, void *data2,
case ALPM_QUESTION_INSTALL_IGNOREPKG:
if(!config->op_s_downloadonly) {
*response = yesno(_("%s is in IgnorePkg/IgnoreGroup. Install anyway?"),
- alpm_pkg_get_name(data1));
+ alpm_pkg_get_name(data1));
} else {
*response = 1;
}
@@ -698,7 +698,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
fname[len] = '\0';
/* 1 space + filenamelen + 1 space + 6 for size + 1 space + 3 for label +
- * + 2 spaces + 4 for rate + 1 for label + 2 for /s + 1 space +
+ * + 2 spaces + 4 for rate + 1 for label + 2 for /s + 1 space +
* 8 for eta, gives us the magic 30 */
filenamelen = infolen - 30;
/* see printf() code, we omit 'HH:' in these conditions */
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 231fe2ad..cf8a417b 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -689,7 +689,7 @@ static int setup_libalpm(void)
return ret;
}
- /* Set GnuPG's home directory. This is not relative to rootdir, even if
+ /* Set GnuPG's home directory. This is not relative to rootdir, even if
* rootdir is defined. Reasoning: gpgdir contains configuration data. */
config->gpgdir = config->gpgdir ? config->gpgdir : strdup(GPGDIR);
ret = alpm_option_set_gpgdir(handle, config->gpgdir);
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 78bfb504..52219ffa 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -189,7 +189,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
}
if(from == ALPM_PKG_FROM_FILE || from == ALPM_PKG_FROM_LOCALDB) {
string_display(_("Install Script :"),
- alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"), cols);
+ alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"), cols);
}
if(from == ALPM_PKG_FROM_SYNCDB && extra) {
@@ -206,7 +206,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
}
string_display(_("MD5 Sum :"), alpm_pkg_get_md5sum(pkg), cols);
- string_display(_("SHA256 Sum :"), alpm_pkg_get_sha256sum(pkg), cols);
+ string_display(_("SHA-256 Sum :"), alpm_pkg_get_sha256sum(pkg), cols);
list_display(_("Signatures :"), keys, cols);
} else {
list_display(_("Validated By :"), validation, cols);
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index e5d16fc5..df73bcf4 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -601,7 +601,7 @@ static void checkargs_query(void)
invalid_opt(config->op_q_deps && config->op_q_explicit, "--deps", "--explicit");
invalid_opt((config->op_q_locality & PKG_LOCALITY_NATIVE) &&
- (config->op_q_locality & PKG_LOCALITY_FOREIGN),
+ (config->op_q_locality & PKG_LOCALITY_FOREIGN),
"--native", "--foreign");
}
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 8814307c..e62272aa 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -170,7 +170,7 @@ static int query_fileowner(alpm_list_t *targets)
}
if(lstat(filename, &buf) == -1) {
- /* if it is not a path but a program name, then check in PATH */
+ /* if it is not a path but a program name, then check in PATH */
if(strchr(filename, '/') == NULL) {
if(search_path(&filename, &buf) == -1) {
pm_printf(ALPM_LOG_ERROR, _("failed to find '%s' in PATH: %s\n"),
diff --git a/src/pacman/util.c b/src/pacman/util.c
index d7e44fbf..23eea982 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1569,7 +1569,7 @@ int pm_asprintf(char **string, const char *format, ...)
/* print the message using va_arg list */
va_start(args, format);
if(vasprintf(string, format, args) == -1) {
- pm_printf(ALPM_LOG_ERROR, _("failed to allocate string\n"));
+ pm_printf(ALPM_LOG_ERROR, _("failed to allocate string\n"));
ret = -1;
}
va_end(args);
diff --git a/test/scripts/human_to_size_test.sh b/test/scripts/human_to_size_test.sh
index a467f27e..cde3ba82 100755
--- a/test/scripts/human_to_size_test.sh
+++ b/test/scripts/human_to_size_test.sh
@@ -5,43 +5,43 @@ declare -i testcount=0 fail=0 pass=0 total=15
# source the library function
lib=${1:-${PMTEST_SCRIPTLIB_DIR}human_to_size.sh}
if [[ -z $lib || ! -f $lib ]]; then
- echo "Bail out! human_to_size library ($lib) could not be located\n"
- exit 1
+ echo "Bail out! human_to_size library ($lib) could not be located\n"
+ exit 1
fi
. "$lib"
if ! type -t human_to_size &>/dev/null; then
- printf 'Bail out! human_to_size function not found\n'
- exit 1
+ printf "Bail out! human_to_size function not found\n"
+ exit 1
fi
parse_hts() {
- local input=$1 expected=$2 result
-
- (( ++testcount ))
-
- result=$(human_to_size "$1")
- if [[ $result = "$expected" ]]; then
- (( ++pass ))
- printf "ok %d - %s\n" "$testcount" "$input"
- else
- (( ++fail ))
- printf "not ok %d - %s\n" "$testcount" "$input"
- printf '# [TEST %3s]: FAIL\n' "$testcount"
- printf '# input: %s\n' "$input"
- printf '# output: %s\n' "$result"
- printf '# expected: %s\n' "$expected"
- fi
+ local input=$1 expected=$2 result
+
+ (( ++testcount ))
+
+ result=$(human_to_size "$1")
+ if [[ $result = "$expected" ]]; then
+ (( ++pass ))
+ printf "ok %d - %s\n" "$testcount" "$input"
+ else
+ (( ++fail ))
+ printf "not ok %d - %s\n" "$testcount" "$input"
+ printf '# [TEST %3s]: FAIL\n' "$testcount"
+ printf '# input: %s\n' "$input"
+ printf '# output: %s\n' "$result"
+ printf '# expected: %s\n' "$expected"
+ fi
}
summarize() {
- if (( !fail )); then
- printf '# All %s tests successful\n\n' "$testcount"
- exit 0
- else
- printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
- exit 1
- fi
+ if (( !fail )); then
+ printf '# All %s tests successful\n\n' "$testcount"
+ exit 0
+ else
+ printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
+ exit 1
+ fi
}
trap 'summarize' EXIT
diff --git a/test/scripts/parseopts_test.sh b/test/scripts/parseopts_test.sh
index 00bdbd85..2c055b1b 100755
--- a/test/scripts/parseopts_test.sh
+++ b/test/scripts/parseopts_test.sh
@@ -5,14 +5,14 @@ declare -i testcount=0 pass=0 fail=0 total=25
# source the library function
lib=${1:-${PMTEST_SCRIPTLIB_DIR}parseopts.sh}
if [[ -z $lib || ! -f $lib ]]; then
- printf "Bail out! parseopts library ($lib) could not be located\n"
- exit 1
+ printf "Bail out! parseopts library ($lib) could not be located\n"
+ exit 1
fi
. "$lib"
if ! type -t parseopts &>/dev/null; then
- printf 'Bail out! parseopts function not found\n'
- exit 1
+ printf "Bail out! parseopts function not found\n"
+ exit 1
fi
# borrow opts from makepkg
@@ -24,38 +24,38 @@ OPT_LONG=('allsource' 'asroot' 'ignorearch' 'check' 'clean:' 'cleanall' 'nodeps'
'noconfirm' 'noprogressbar')
parse() {
- local result=$1 tokencount=$2; shift 2
+ local result=$1 tokencount=$2; shift 2
- (( ++testcount ))
- parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@" 2>/dev/null
- test_result "$result" "$tokencount" "$*" "${OPTRET[@]}"
- unset OPTRET
+ (( ++testcount ))
+ parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@" 2>/dev/null
+ test_result "$result" "$tokencount" "$*" "${OPTRET[@]}"
+ unset OPTRET
}
test_result() {
- local result=$1 tokencount=$2 input=$3; shift 3
-
- if [[ $result = "$*" ]] && (( tokencount == $# )); then
- (( ++pass ))
- printf 'ok %d - %s\n' "$testcount" "$input"
- else
- printf 'not ok %d - %s\n' "$testcount" "$input"
- printf '# [TEST %3s]: FAIL\n' "$testcount"
- printf '# input: %s\n' "$input"
- printf '# output: %s (%s tokens)\n' "$*" "$#"
- printf '# expected: %s (%s tokens)\n' "$result" "$tokencount"
- (( ++fail ))
- fi
+ local result=$1 tokencount=$2 input=$3; shift 3
+
+ if [[ $result = "$*" ]] && (( tokencount == $# )); then
+ (( ++pass ))
+ printf 'ok %d - %s\n' "$testcount" "$input"
+ else
+ printf 'not ok %d - %s\n' "$testcount" "$input"
+ printf '# [TEST %3s]: FAIL\n' "$testcount"
+ printf '# input: %s\n' "$input"
+ printf '# output: %s (%s tokens)\n' "$*" "$#"
+ printf '# expected: %s (%s tokens)\n' "$result" "$tokencount"
+ (( ++fail ))
+ fi
}
summarize() {
- if (( !fail )); then
- printf '# All %s tests successful\n\n' "$testcount"
- exit 0
- else
- printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
- exit 1
- fi
+ if (( !fail )); then
+ printf '# All %s tests successful\n\n' "$testcount"
+ exit 0
+ else
+ printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
+ exit 1
+ fi
}
trap 'summarize' EXIT