mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
syntax: if/while statements should have no trailing space
This is the standard, and we have had a few of these introduced lately that should not be here. Done with: find -name '*.c' | xargs sed -i -e 's#if (#if(#g' find -name '*.c' | xargs sed -i -e 's#while (#while(#g' Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
6760ec2b77
commit
4af6c72d79
@ -559,7 +559,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, size_t pkg_current,
|
|||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "extracting files\n");
|
_alpm_log(PM_LOG_DEBUG, "extracting files\n");
|
||||||
|
|
||||||
if ((archive = archive_read_new()) == NULL) {
|
if((archive = archive_read_new()) == NULL) {
|
||||||
pm_errno = PM_ERR_LIBARCHIVE;
|
pm_errno = PM_ERR_LIBARCHIVE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -178,10 +178,10 @@ alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
|
|||||||
{
|
{
|
||||||
alpm_list_t *tmp;
|
alpm_list_t *tmp;
|
||||||
|
|
||||||
if (first == NULL) {
|
if(first == NULL) {
|
||||||
return second;
|
return second;
|
||||||
}
|
}
|
||||||
if (second == NULL) {
|
if(second == NULL) {
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
/* tmp is the last element of the first list */
|
/* tmp is the last element of the first list */
|
||||||
@ -209,12 +209,12 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
|
|||||||
{
|
{
|
||||||
alpm_list_t *newlist, *lp;
|
alpm_list_t *newlist, *lp;
|
||||||
|
|
||||||
if (left == NULL)
|
if(left == NULL)
|
||||||
return right;
|
return right;
|
||||||
if (right == NULL)
|
if(right == NULL)
|
||||||
return left;
|
return left;
|
||||||
|
|
||||||
if (fn(left->data, right->data) <= 0) {
|
if(fn(left->data, right->data) <= 0) {
|
||||||
newlist = left;
|
newlist = left;
|
||||||
left = left->next;
|
left = left->next;
|
||||||
}
|
}
|
||||||
@ -226,8 +226,8 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
|
|||||||
newlist->next = NULL;
|
newlist->next = NULL;
|
||||||
lp = newlist;
|
lp = newlist;
|
||||||
|
|
||||||
while ((left != NULL) && (right != NULL)) {
|
while((left != NULL) && (right != NULL)) {
|
||||||
if (fn(left->data, right->data) <= 0) {
|
if(fn(left->data, right->data) <= 0) {
|
||||||
lp->next = left;
|
lp->next = left;
|
||||||
left->prev = lp;
|
left->prev = lp;
|
||||||
left = left->next;
|
left = left->next;
|
||||||
@ -240,11 +240,11 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
|
|||||||
lp = lp->next;
|
lp = lp->next;
|
||||||
lp->next = NULL;
|
lp->next = NULL;
|
||||||
}
|
}
|
||||||
if (left != NULL) {
|
if(left != NULL) {
|
||||||
lp->next = left;
|
lp->next = left;
|
||||||
left->prev = lp;
|
left->prev = lp;
|
||||||
}
|
}
|
||||||
else if (right != NULL) {
|
else if(right != NULL) {
|
||||||
lp->next = right;
|
lp->next = right;
|
||||||
right->prev = lp;
|
right->prev = lp;
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
|
|||||||
*/
|
*/
|
||||||
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn)
|
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn)
|
||||||
{
|
{
|
||||||
if (n > 1) {
|
if(n > 1) {
|
||||||
alpm_list_t *left = list;
|
alpm_list_t *left = list;
|
||||||
alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
|
alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
|
||||||
alpm_list_t *right = lastleft->next;
|
alpm_list_t *right = lastleft->next;
|
||||||
@ -689,7 +689,7 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (l != NULL && r != NULL) {
|
while(l != NULL && r != NULL) {
|
||||||
int cmp = fn(l->data, r->data);
|
int cmp = fn(l->data, r->data);
|
||||||
if(cmp < 0) {
|
if(cmp < 0) {
|
||||||
if(onlyleft) {
|
if(onlyleft) {
|
||||||
@ -707,13 +707,13 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
|
|||||||
r = r->next;
|
r = r->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (l != NULL) {
|
while(l != NULL) {
|
||||||
if(onlyleft) {
|
if(onlyleft) {
|
||||||
*onlyleft = alpm_list_add(*onlyleft, l->data);
|
*onlyleft = alpm_list_add(*onlyleft, l->data);
|
||||||
}
|
}
|
||||||
l = l->next;
|
l = l->next;
|
||||||
}
|
}
|
||||||
while (r != NULL) {
|
while(r != NULL) {
|
||||||
if(onlyright) {
|
if(onlyright) {
|
||||||
*onlyright = alpm_list_add(*onlyright, r->data);
|
*onlyright = alpm_list_add(*onlyright, r->data);
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ static int is_dir(const char *path, struct dirent *entry)
|
|||||||
|
|
||||||
snprintf(buffer, PATH_MAX, "%s/%s", path, entry->d_name);
|
snprintf(buffer, PATH_MAX, "%s/%s", path, entry->d_name);
|
||||||
|
|
||||||
if (!stat(buffer, &sbuf)) {
|
if(!stat(buffer, &sbuf)) {
|
||||||
return S_ISDIR(sbuf.st_mode);
|
return S_ISDIR(sbuf.st_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ static void *_package_changelog_open(pmpkg_t *pkg)
|
|||||||
archive_read_support_compression_all(archive);
|
archive_read_support_compression_all(archive);
|
||||||
archive_read_support_format_all(archive);
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
if (archive_read_open_filename(archive, pkgfile,
|
if(archive_read_open_filename(archive, pkgfile,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
RET_ERR(PM_ERR_PKG_OPEN, NULL);
|
RET_ERR(PM_ERR_PKG_OPEN, NULL);
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ static pmpkg_t *pkg_load(const char *pkgfile, int full)
|
|||||||
archive_read_support_compression_all(archive);
|
archive_read_support_compression_all(archive);
|
||||||
archive_read_support_format_all(archive);
|
archive_read_support_format_all(archive);
|
||||||
|
|
||||||
if (archive_read_open_filename(archive, pkgfile,
|
if(archive_read_open_filename(archive, pkgfile,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
alpm_pkg_free(newpkg);
|
alpm_pkg_free(newpkg);
|
||||||
RET_ERR(PM_ERR_PKG_OPEN, NULL);
|
RET_ERR(PM_ERR_PKG_OPEN, NULL);
|
||||||
|
@ -443,7 +443,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
matched = name;
|
matched = name;
|
||||||
}
|
}
|
||||||
/* check desc */
|
/* check desc */
|
||||||
else if (desc && regexec(®, desc, 0, 0, 0) == 0) {
|
else if(desc && regexec(®, desc, 0, 0, 0) == 0) {
|
||||||
matched = desc;
|
matched = desc;
|
||||||
}
|
}
|
||||||
/* TODO: should we be doing this, and should we print something
|
/* TODO: should we be doing this, and should we print something
|
||||||
@ -451,7 +451,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
if(!matched) {
|
if(!matched) {
|
||||||
/* check provides */
|
/* check provides */
|
||||||
for(k = alpm_pkg_get_provides(pkg); k; k = k->next) {
|
for(k = alpm_pkg_get_provides(pkg); k; k = k->next) {
|
||||||
if (regexec(®, k->data, 0, 0, 0) == 0) {
|
if(regexec(®, k->data, 0, 0, 0) == 0) {
|
||||||
matched = k->data;
|
matched = k->data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -460,7 +460,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
|
|||||||
if(!matched) {
|
if(!matched) {
|
||||||
/* check groups */
|
/* check groups */
|
||||||
for(k = alpm_pkg_get_groups(pkg); k; k = k->next) {
|
for(k = alpm_pkg_get_groups(pkg); k; k = k->next) {
|
||||||
if (regexec(®, k->data, 0, 0, 0) == 0) {
|
if(regexec(®, k->data, 0, 0, 0) == 0) {
|
||||||
matched = k->data;
|
matched = k->data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
|
|||||||
while(vertex->childptr && !found) {
|
while(vertex->childptr && !found) {
|
||||||
pmgraph_t *nextchild = vertex->childptr->data;
|
pmgraph_t *nextchild = vertex->childptr->data;
|
||||||
vertex->childptr = vertex->childptr->next;
|
vertex->childptr = vertex->childptr->next;
|
||||||
if (nextchild->state == 0) {
|
if(nextchild->state == 0) {
|
||||||
found = 1;
|
found = 1;
|
||||||
nextchild->parent = vertex;
|
nextchild->parent = vertex;
|
||||||
vertex = nextchild;
|
vertex = nextchild;
|
||||||
@ -181,7 +181,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
|
|||||||
vptr = vptr->next;
|
vptr = vptr->next;
|
||||||
while(vptr) {
|
while(vptr) {
|
||||||
vertex = vptr->data;
|
vertex = vptr->data;
|
||||||
if (vertex->state == 0) break;
|
if(vertex->state == 0) break;
|
||||||
vptr = vptr->next;
|
vptr = vptr->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -569,7 +569,7 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
|||||||
if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(pkg)) {
|
if(_alpm_pkg_should_ignore(pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if (prompt) {
|
if(prompt) {
|
||||||
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
||||||
NULL, NULL, &install);
|
NULL, NULL, &install);
|
||||||
} else {
|
} else {
|
||||||
@ -591,7 +591,7 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
|||||||
!_alpm_pkg_find(excluding, pkg->name)) {
|
!_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(pkg)) {
|
if(_alpm_pkg_should_ignore(pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if (prompt) {
|
if(prompt) {
|
||||||
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
|
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
|
||||||
pkg, NULL, NULL, &install);
|
pkg, NULL, NULL, &install);
|
||||||
} else {
|
} else {
|
||||||
@ -613,13 +613,13 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
|||||||
/* first check if one provider is already installed locally */
|
/* first check if one provider is already installed locally */
|
||||||
for(i = providers; i; i = i->next) {
|
for(i = providers; i; i = i->next) {
|
||||||
pmpkg_t *pkg = i->data;
|
pmpkg_t *pkg = i->data;
|
||||||
if (_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) {
|
if(_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) {
|
||||||
alpm_list_free(providers);
|
alpm_list_free(providers);
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count = alpm_list_count(providers);
|
count = alpm_list_count(providers);
|
||||||
if (count >= 1) {
|
if(count >= 1) {
|
||||||
/* default to first provider if there is no QUESTION callback */
|
/* default to first provider if there is no QUESTION callback */
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if(count > 1) {
|
if(count > 1) {
|
||||||
|
@ -71,7 +71,7 @@ static alpm_list_t *mount_point_list(void)
|
|||||||
|
|
||||||
fp = setmntent(MOUNTED, "r");
|
fp = setmntent(MOUNTED, "r");
|
||||||
|
|
||||||
if (fp == NULL) {
|
if(fp == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ static alpm_list_t *mount_point_list(void)
|
|||||||
|
|
||||||
entries = getmntinfo(&fsp, MNT_NOWAIT);
|
entries = getmntinfo(&fsp, MNT_NOWAIT);
|
||||||
|
|
||||||
if (entries < 0) {
|
if(entries < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ static int calculate_installed_size(const alpm_list_t *mount_points,
|
|||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
|
|
||||||
if ((archive = archive_read_new()) == NULL) {
|
if((archive = archive_read_new()) == NULL) {
|
||||||
pm_errno = PM_ERR_LIBARCHIVE;
|
pm_errno = PM_ERR_LIBARCHIVE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -195,7 +195,7 @@ static int curl_download_internal(const char *url, const char *localpath,
|
|||||||
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile);
|
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile);
|
||||||
|
|
||||||
useragent = getenv("HTTP_USER_AGENT");
|
useragent = getenv("HTTP_USER_AGENT");
|
||||||
if (useragent != NULL) {
|
if(useragent != NULL) {
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent);
|
curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void _alpm_handle_free(pmhandle_t *handle)
|
|||||||
|
|
||||||
alpm_cb_log SYMEXPORT alpm_option_get_logcb()
|
alpm_cb_log SYMEXPORT alpm_option_get_logcb()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ alpm_cb_log SYMEXPORT alpm_option_get_logcb()
|
|||||||
|
|
||||||
alpm_cb_download SYMEXPORT alpm_option_get_dlcb()
|
alpm_cb_download SYMEXPORT alpm_option_get_dlcb()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ alpm_cb_download SYMEXPORT alpm_option_get_dlcb()
|
|||||||
|
|
||||||
alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb()
|
alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb()
|
|||||||
|
|
||||||
alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb()
|
alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb()
|
|||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_root()
|
const char SYMEXPORT *alpm_option_get_root()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ const char SYMEXPORT *alpm_option_get_root()
|
|||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_dbpath()
|
const char SYMEXPORT *alpm_option_get_dbpath()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ const char SYMEXPORT *alpm_option_get_dbpath()
|
|||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_cachedirs()
|
alpm_list_t SYMEXPORT *alpm_option_get_cachedirs()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_cachedirs()
|
|||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_logfile()
|
const char SYMEXPORT *alpm_option_get_logfile()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ const char SYMEXPORT *alpm_option_get_logfile()
|
|||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_lockfile()
|
const char SYMEXPORT *alpm_option_get_lockfile()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ const char SYMEXPORT *alpm_option_get_lockfile()
|
|||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_signaturedir()
|
const char SYMEXPORT *alpm_option_get_signaturedir()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ const char SYMEXPORT *alpm_option_get_signaturedir()
|
|||||||
|
|
||||||
int SYMEXPORT alpm_option_get_usesyslog()
|
int SYMEXPORT alpm_option_get_usesyslog()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ int SYMEXPORT alpm_option_get_usesyslog()
|
|||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_noupgrades()
|
alpm_list_t SYMEXPORT *alpm_option_get_noupgrades()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_noupgrades()
|
|||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_noextracts()
|
alpm_list_t SYMEXPORT *alpm_option_get_noextracts()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_noextracts()
|
|||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs()
|
alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs()
|
|||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
|
alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
|
|||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_arch()
|
const char SYMEXPORT *alpm_option_get_arch()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ const char SYMEXPORT *alpm_option_get_arch()
|
|||||||
|
|
||||||
int SYMEXPORT alpm_option_get_usedelta()
|
int SYMEXPORT alpm_option_get_usedelta()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -251,7 +251,7 @@ int SYMEXPORT alpm_option_get_usedelta()
|
|||||||
|
|
||||||
int SYMEXPORT alpm_option_get_checkspace()
|
int SYMEXPORT alpm_option_get_checkspace()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ int SYMEXPORT alpm_option_get_checkspace()
|
|||||||
|
|
||||||
pmdb_t SYMEXPORT *alpm_option_get_localdb()
|
pmdb_t SYMEXPORT *alpm_option_get_localdb()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ pmdb_t SYMEXPORT *alpm_option_get_localdb()
|
|||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs()
|
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs()
|
||||||
{
|
{
|
||||||
if (handle == NULL) {
|
if(handle == NULL) {
|
||||||
pm_errno = PM_ERR_HANDLE_NULL;
|
pm_errno = PM_ERR_HANDLE_NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg)
|
|||||||
|
|
||||||
if(retval == 0) {
|
if(retval == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (retval == 1) {
|
} else if(retval == 1) {
|
||||||
pm_errno = PM_ERR_PKG_INVALID;
|
pm_errno = PM_ERR_PKG_INVALID;
|
||||||
retval = -1;
|
retval = -1;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
|||||||
|
|
||||||
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
|
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
|
||||||
remove_prepare_cascade(trans, db, lp);
|
remove_prepare_cascade(trans, db, lp);
|
||||||
} else if (trans->flags & PM_TRANS_FLAG_UNNEEDED) {
|
} else if(trans->flags & PM_TRANS_FLAG_UNNEEDED) {
|
||||||
/* Remove needed packages (which would break dependencies)
|
/* Remove needed packages (which would break dependencies)
|
||||||
* from target list */
|
* from target list */
|
||||||
remove_prepare_keep_needed(trans, db, lp);
|
remove_prepare_keep_needed(trans, db, lp);
|
||||||
|
@ -148,7 +148,7 @@ int _alpm_gpgme_checksig(const char *path, const pmpgpsig_t *sig)
|
|||||||
CHECK_ERR();
|
CHECK_ERR();
|
||||||
result = gpgme_op_verify_result(ctx);
|
result = gpgme_op_verify_result(ctx);
|
||||||
gpgsig = result->signatures;
|
gpgsig = result->signatures;
|
||||||
if (!gpgsig || gpgsig->next) {
|
if(!gpgsig || gpgsig->next) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("Unexpected number of signatures\n"));
|
_alpm_log(PM_LOG_ERROR, _("Unexpected number of signatures\n"));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -360,7 +360,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
|||||||
int remove_unresolvable = 0;
|
int remove_unresolvable = 0;
|
||||||
QUESTION(handle->trans, PM_TRANS_CONV_REMOVE_PKGS, unresolvable,
|
QUESTION(handle->trans, PM_TRANS_CONV_REMOVE_PKGS, unresolvable,
|
||||||
NULL, NULL, &remove_unresolvable);
|
NULL, NULL, &remove_unresolvable);
|
||||||
if (remove_unresolvable) {
|
if(remove_unresolvable) {
|
||||||
/* User wants to remove the unresolvable packages from the
|
/* User wants to remove the unresolvable packages from the
|
||||||
transaction. The packages will be removed from the actual
|
transaction. The packages will be removed from the actual
|
||||||
transaction when the transaction packages are replaced with a
|
transaction when the transaction packages are replaced with a
|
||||||
@ -764,7 +764,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
|
|||||||
EVENT(trans, PM_TRANS_EVT_RETRIEVE_START, current->treename, NULL);
|
EVENT(trans, PM_TRANS_EVT_RETRIEVE_START, current->treename, NULL);
|
||||||
errors = _alpm_download_files(files, current->servers, cachedir);
|
errors = _alpm_download_files(files, current->servers, cachedir);
|
||||||
|
|
||||||
if (errors) {
|
if(errors) {
|
||||||
_alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
|
_alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
|
||||||
current->treename);
|
current->treename);
|
||||||
if(pm_errno == 0) {
|
if(pm_errno == 0) {
|
||||||
|
@ -72,7 +72,7 @@ static int make_lock(pmhandle_t *handle)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
fd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL, 0000);
|
fd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL, 0000);
|
||||||
} while (fd == -1 && errno == EINTR);
|
} while(fd == -1 && errno == EINTR);
|
||||||
if(fd > 0) {
|
if(fd > 0) {
|
||||||
FILE *f = fdopen(fd, "w");
|
FILE *f = fdopen(fd, "w");
|
||||||
fprintf(f, "%ld\n", (long)getpid());
|
fprintf(f, "%ld\n", (long)getpid());
|
||||||
|
@ -65,14 +65,14 @@ char* strsep(char** str, const char* delims)
|
|||||||
{
|
{
|
||||||
char* token;
|
char* token;
|
||||||
|
|
||||||
if (*str==NULL) {
|
if(*str==NULL) {
|
||||||
/* No more tokens */
|
/* No more tokens */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
token=*str;
|
token=*str;
|
||||||
while (**str!='\0') {
|
while(**str!='\0') {
|
||||||
if (strchr(delims,**str)!=NULL) {
|
if(strchr(delims,**str)!=NULL) {
|
||||||
**str='\0';
|
**str='\0';
|
||||||
(*str)++;
|
(*str)++;
|
||||||
return token;
|
return token;
|
||||||
@ -307,7 +307,7 @@ int _alpm_unpack(const char *archive, const char *prefix, alpm_list_t *list, int
|
|||||||
char *found = alpm_list_find_str(list, prefix);
|
char *found = alpm_list_find_str(list, prefix);
|
||||||
free(prefix);
|
free(prefix);
|
||||||
if(!found) {
|
if(!found) {
|
||||||
if (archive_read_data_skip(_archive) != ARCHIVE_OK) {
|
if(archive_read_data_skip(_archive) != ARCHIVE_OK) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -700,7 +700,7 @@ char SYMEXPORT *alpm_compute_md5sum(const char *filename)
|
|||||||
/* defined above for OpenSSL, otherwise defined in md5.h */
|
/* defined above for OpenSSL, otherwise defined in md5.h */
|
||||||
ret = md5_file(filename, output);
|
ret = md5_file(filename, output);
|
||||||
|
|
||||||
if (ret > 0) {
|
if(ret > 0) {
|
||||||
RET_ERR(PM_ERR_NOT_A_FILE, NULL);
|
RET_ERR(PM_ERR_NOT_A_FILE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,7 +838,7 @@ int _alpm_splitname(const char *target, pmpkg_t *pkg)
|
|||||||
end = target + strlen(target);
|
end = target + strlen(target);
|
||||||
|
|
||||||
/* remove any trailing '/' */
|
/* remove any trailing '/' */
|
||||||
while (*(end - 1) == '/') {
|
while(*(end - 1) == '/') {
|
||||||
--end;
|
--end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,7 +916,7 @@ char *strndup(const char *s, size_t n)
|
|||||||
size_t len = strnlen(s, n);
|
size_t len = strnlen(s, n);
|
||||||
char *new = (char *) malloc(len + 1);
|
char *new = (char *) malloc(len + 1);
|
||||||
|
|
||||||
if (new == NULL)
|
if(new == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
new[len] = '\0';
|
new[len] = '\0';
|
||||||
|
@ -398,7 +398,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
infolen = getcols() * 6 / 10;
|
infolen = getcols() * 6 / 10;
|
||||||
if (infolen < 50) {
|
if(infolen < 50) {
|
||||||
infolen = 50;
|
infolen = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
|
|||||||
}
|
}
|
||||||
|
|
||||||
infolen = getcols() * 6 / 10;
|
infolen = getcols() * 6 / 10;
|
||||||
if (infolen < 50) {
|
if(infolen < 50) {
|
||||||
infolen = 50;
|
infolen = 50;
|
||||||
}
|
}
|
||||||
/* explanation of magic 28 number at the end */
|
/* explanation of magic 28 number at the end */
|
||||||
|
@ -179,7 +179,7 @@ static const char *get_backup_file_status(const char *root,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if checksums don't match, file has been modified */
|
/* if checksums don't match, file has been modified */
|
||||||
if (strcmp(md5sum, expected_md5) != 0) {
|
if(strcmp(md5sum, expected_md5) != 0) {
|
||||||
ret = "MODIFIED";
|
ret = "MODIFIED";
|
||||||
} else {
|
} else {
|
||||||
ret = "UNMODIFIED";
|
ret = "UNMODIFIED";
|
||||||
|
@ -170,7 +170,7 @@ static void usage(int op, const char * const myname)
|
|||||||
addlist(_(" -w, --downloadonly download packages but do not install/upgrade anything\n"));
|
addlist(_(" -w, --downloadonly download packages but do not install/upgrade anything\n"));
|
||||||
addlist(_(" -y, --refresh download fresh package databases from the server\n"));
|
addlist(_(" -y, --refresh download fresh package databases from the server\n"));
|
||||||
addlist(_(" --needed don't reinstall up to date packages\n"));
|
addlist(_(" --needed don't reinstall up to date packages\n"));
|
||||||
} else if (op == PM_OP_DATABASE) {
|
} else if(op == PM_OP_DATABASE) {
|
||||||
printf("%s: %s {-D --database} <%s> <%s>\n", str_usg, myname, str_opt, str_pkg);
|
printf("%s: %s {-D --database} <%s> <%s>\n", str_usg, myname, str_opt, str_pkg);
|
||||||
printf("%s:\n", str_opt);
|
printf("%s:\n", str_opt);
|
||||||
addlist(_(" --asdeps mark packages as non-explicitly installed\n"));
|
addlist(_(" --asdeps mark packages as non-explicitly installed\n"));
|
||||||
@ -240,7 +240,7 @@ static void version(void)
|
|||||||
static void localize(void)
|
static void localize(void)
|
||||||
{
|
{
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
if (!init) {
|
if(!init) {
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
@ -264,7 +264,7 @@ static void setuseragent(void)
|
|||||||
|
|
||||||
static void setarch(const char *arch)
|
static void setarch(const char *arch)
|
||||||
{
|
{
|
||||||
if (strcmp(arch, "auto") == 0) {
|
if(strcmp(arch, "auto") == 0) {
|
||||||
struct utsname un;
|
struct utsname un;
|
||||||
uname(&un);
|
uname(&un);
|
||||||
pm_printf(PM_LOG_DEBUG, "config: Architecture: %s\n", un.machine);
|
pm_printf(PM_LOG_DEBUG, "config: Architecture: %s\n", un.machine);
|
||||||
@ -346,7 +346,7 @@ static void handler(int signum)
|
|||||||
static void setlibpaths(void)
|
static void setlibpaths(void)
|
||||||
{
|
{
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
if (!init) {
|
if(!init) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
pm_printf(PM_LOG_DEBUG, "setlibpaths() called\n");
|
pm_printf(PM_LOG_DEBUG, "setlibpaths() called\n");
|
||||||
@ -594,7 +594,7 @@ static int parsearg_trans(int opt)
|
|||||||
|
|
||||||
static int parsearg_remove(int opt)
|
static int parsearg_remove(int opt)
|
||||||
{
|
{
|
||||||
if (parsearg_trans(opt) == 0)
|
if(parsearg_trans(opt) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'c': config->flags |= PM_TRANS_FLAG_CASCADE; break;
|
case 'c': config->flags |= PM_TRANS_FLAG_CASCADE; break;
|
||||||
@ -615,7 +615,7 @@ static int parsearg_remove(int opt)
|
|||||||
/* options common to -S -U */
|
/* options common to -S -U */
|
||||||
static int parsearg_upgrade(int opt)
|
static int parsearg_upgrade(int opt)
|
||||||
{
|
{
|
||||||
if (parsearg_trans(opt) == 0)
|
if(parsearg_trans(opt) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'f': config->flags |= PM_TRANS_FLAG_FORCE; break;
|
case 'f': config->flags |= PM_TRANS_FLAG_FORCE; break;
|
||||||
@ -634,7 +634,7 @@ static int parsearg_upgrade(int opt)
|
|||||||
|
|
||||||
static int parsearg_sync(int opt)
|
static int parsearg_sync(int opt)
|
||||||
{
|
{
|
||||||
if (parsearg_upgrade(opt) == 0)
|
if(parsearg_upgrade(opt) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case OP_NEEDED: config->flags |= PM_TRANS_FLAG_NEEDED; break;
|
case OP_NEEDED: config->flags |= PM_TRANS_FLAG_NEEDED; break;
|
||||||
@ -787,7 +787,7 @@ static int parseargs(int argc, char *argv[])
|
|||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (result == 0) {
|
if(result == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,9 +823,9 @@ static int option_add_syncfirst(const char *name) {
|
|||||||
|
|
||||||
/* helper for being used with setrepeatingoption */
|
/* helper for being used with setrepeatingoption */
|
||||||
static int option_add_cleanmethod(const char *value) {
|
static int option_add_cleanmethod(const char *value) {
|
||||||
if (strcmp(value, "KeepInstalled") == 0) {
|
if(strcmp(value, "KeepInstalled") == 0) {
|
||||||
config->cleanmethod |= PM_CLEAN_KEEPINST;
|
config->cleanmethod |= PM_CLEAN_KEEPINST;
|
||||||
} else if (strcmp(value, "KeepCurrent") == 0) {
|
} else if(strcmp(value, "KeepCurrent") == 0) {
|
||||||
config->cleanmethod |= PM_CLEAN_KEEPCUR;
|
config->cleanmethod |= PM_CLEAN_KEEPCUR;
|
||||||
} else {
|
} else {
|
||||||
pm_printf(PM_LOG_ERROR, _("invalid value for 'CleanMethod' : '%s'\n"),
|
pm_printf(PM_LOG_ERROR, _("invalid value for 'CleanMethod' : '%s'\n"),
|
||||||
@ -1041,24 +1041,24 @@ static int _parse_options(const char *key, char *value,
|
|||||||
config->rootdir = strdup(value);
|
config->rootdir = strdup(value);
|
||||||
pm_printf(PM_LOG_DEBUG, "config: rootdir: %s\n", value);
|
pm_printf(PM_LOG_DEBUG, "config: rootdir: %s\n", value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "GPGDir") == 0) {
|
} else if(strcmp(key, "GPGDir") == 0) {
|
||||||
if(!config->gpgdir) {
|
if(!config->gpgdir) {
|
||||||
config->gpgdir = strdup(value);
|
config->gpgdir = strdup(value);
|
||||||
pm_printf(PM_LOG_DEBUG, "config: gpgdir: %s\n", value);
|
pm_printf(PM_LOG_DEBUG, "config: gpgdir: %s\n", value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "LogFile") == 0) {
|
} else if(strcmp(key, "LogFile") == 0) {
|
||||||
if(!config->logfile) {
|
if(!config->logfile) {
|
||||||
config->logfile = strdup(value);
|
config->logfile = strdup(value);
|
||||||
pm_printf(PM_LOG_DEBUG, "config: logfile: %s\n", value);
|
pm_printf(PM_LOG_DEBUG, "config: logfile: %s\n", value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "XferCommand") == 0) {
|
} else if(strcmp(key, "XferCommand") == 0) {
|
||||||
config->xfercommand = strdup(value);
|
config->xfercommand = strdup(value);
|
||||||
alpm_option_set_fetchcb(download_with_xfercommand);
|
alpm_option_set_fetchcb(download_with_xfercommand);
|
||||||
pm_printf(PM_LOG_DEBUG, "config: xfercommand: %s\n", value);
|
pm_printf(PM_LOG_DEBUG, "config: xfercommand: %s\n", value);
|
||||||
} else if (strcmp(key, "CleanMethod") == 0) {
|
} else if(strcmp(key, "CleanMethod") == 0) {
|
||||||
setrepeatingoption(value, "CleanMethod", option_add_cleanmethod);
|
setrepeatingoption(value, "CleanMethod", option_add_cleanmethod);
|
||||||
} else if(strcmp(key, "VerifySig") == 0) {
|
} else if(strcmp(key, "VerifySig") == 0) {
|
||||||
if (strcmp(value, "Always") == 0) {
|
if(strcmp(value, "Always") == 0) {
|
||||||
alpm_option_set_default_sigverify(PM_PGP_VERIFY_ALWAYS);
|
alpm_option_set_default_sigverify(PM_PGP_VERIFY_ALWAYS);
|
||||||
} else if(strcmp(value, "Optional") == 0) {
|
} else if(strcmp(value, "Optional") == 0) {
|
||||||
alpm_option_set_default_sigverify(PM_PGP_VERIFY_OPTIONAL);
|
alpm_option_set_default_sigverify(PM_PGP_VERIFY_OPTIONAL);
|
||||||
@ -1262,18 +1262,18 @@ static int _parseconfig(const char *file, const char *givensection,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if(strcmp(key, "VerifySig") == 0) {
|
} else if(strcmp(key, "VerifySig") == 0) {
|
||||||
if (strcmp(value, "Always") == 0) {
|
if(strcmp(value, "Always") == 0) {
|
||||||
ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_ALWAYS);
|
ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_ALWAYS);
|
||||||
} else if (strcmp(value, "Optional") == 0) {
|
} else if(strcmp(value, "Optional") == 0) {
|
||||||
ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_OPTIONAL);
|
ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_OPTIONAL);
|
||||||
} else if (strcmp(value, "Never") == 0) {
|
} else if(strcmp(value, "Never") == 0) {
|
||||||
ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_NEVER);
|
ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_NEVER);
|
||||||
} else {
|
} else {
|
||||||
pm_printf(PM_LOG_ERROR, _("invalid value for 'VerifySig' : '%s'\n"), value);
|
pm_printf(PM_LOG_ERROR, _("invalid value for 'VerifySig' : '%s'\n"), value);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (ret != 0) {
|
if(ret != 0) {
|
||||||
pm_printf(PM_LOG_ERROR, _("could not add pgp verify option to database '%s': %s (%s)\n"),
|
pm_printf(PM_LOG_ERROR, _("could not add pgp verify option to database '%s': %s (%s)\n"),
|
||||||
alpm_db_get_name(db), value, alpm_strerrorlast());
|
alpm_db_get_name(db), value, alpm_strerrorlast());
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1438,7 +1438,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* check for buffer overflow */
|
/* check for buffer overflow */
|
||||||
if (i >= PATH_MAX) {
|
if(i >= PATH_MAX) {
|
||||||
pm_printf(PM_LOG_ERROR, _("buffer overflow detected in arg parsing\n"));
|
pm_printf(PM_LOG_ERROR, _("buffer overflow detected in arg parsing\n"));
|
||||||
cleanup(EXIT_FAILURE);
|
cleanup(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -1448,7 +1448,7 @@ int main(int argc, char *argv[])
|
|||||||
line[i] = '\0';
|
line[i] = '\0';
|
||||||
pm_targets = alpm_list_add(pm_targets, strdup(line));
|
pm_targets = alpm_list_add(pm_targets, strdup(line));
|
||||||
}
|
}
|
||||||
if (!freopen(ctermid(NULL), "r", stdin)) {
|
if(!freopen(ctermid(NULL), "r", stdin)) {
|
||||||
pm_printf(PM_LOG_ERROR, _("failed to reopen stdin for reading: (%s)\n"),
|
pm_printf(PM_LOG_ERROR, _("failed to reopen stdin for reading: (%s)\n"),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -60,16 +60,16 @@ static int search_path(char **filename, struct stat *bufptr)
|
|||||||
char *envpath, *envpathsplit, *path, *fullname;
|
char *envpath, *envpathsplit, *path, *fullname;
|
||||||
size_t flen;
|
size_t flen;
|
||||||
|
|
||||||
if ((envpath = getenv("PATH")) == NULL) {
|
if((envpath = getenv("PATH")) == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((envpath = envpathsplit = strdup(envpath)) == NULL) {
|
if((envpath = envpathsplit = strdup(envpath)) == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
flen = strlen(*filename);
|
flen = strlen(*filename);
|
||||||
|
|
||||||
while ((path = strsep(&envpathsplit, ":")) != NULL) {
|
while((path = strsep(&envpathsplit, ":")) != NULL) {
|
||||||
size_t plen = strlen(path);
|
size_t plen = strlen(path);
|
||||||
|
|
||||||
/* strip the trailing slash if one exists */
|
/* strip the trailing slash if one exists */
|
||||||
@ -94,7 +94,7 @@ static int search_path(char **filename, struct stat *bufptr)
|
|||||||
|
|
||||||
static void print_query_fileowner(const char *filename, pmpkg_t *info)
|
static void print_query_fileowner(const char *filename, pmpkg_t *info)
|
||||||
{
|
{
|
||||||
if (!config->quiet) {
|
if(!config->quiet) {
|
||||||
printf(_("%s is owned by %s %s\n"), filename,
|
printf(_("%s is owned by %s %s\n"), filename,
|
||||||
alpm_pkg_get_name(info), alpm_pkg_get_version(info));
|
alpm_pkg_get_name(info), alpm_pkg_get_version(info));
|
||||||
} else {
|
} else {
|
||||||
@ -167,7 +167,7 @@ static int query_fileowner(alpm_list_t *targets)
|
|||||||
bname = mbasename(filename);
|
bname = mbasename(filename);
|
||||||
dname = mdirname(filename);
|
dname = mdirname(filename);
|
||||||
/* for files in '/', there is no directory name to match */
|
/* for files in '/', there is no directory name to match */
|
||||||
if (strcmp(dname, "") == 0) {
|
if(strcmp(dname, "") == 0) {
|
||||||
rpath = NULL;
|
rpath = NULL;
|
||||||
} else {
|
} else {
|
||||||
rpath = resolve_path(dname);
|
rpath = resolve_path(dname);
|
||||||
@ -255,14 +255,14 @@ static int query_search(alpm_list_t *targets)
|
|||||||
alpm_list_t *grp;
|
alpm_list_t *grp;
|
||||||
pmpkg_t *pkg = alpm_list_getdata(i);
|
pmpkg_t *pkg = alpm_list_getdata(i);
|
||||||
|
|
||||||
if (!config->quiet) {
|
if(!config->quiet) {
|
||||||
printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
||||||
} else {
|
} else {
|
||||||
printf("%s", alpm_pkg_get_name(pkg));
|
printf("%s", alpm_pkg_get_name(pkg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!config->quiet) {
|
if(!config->quiet) {
|
||||||
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
||||||
alpm_list_t *k;
|
alpm_list_t *k;
|
||||||
printf(" (");
|
printf(" (");
|
||||||
@ -468,7 +468,7 @@ static int display(pmpkg_t *pkg)
|
|||||||
}
|
}
|
||||||
if(!config->op_q_info && !config->op_q_list
|
if(!config->op_q_info && !config->op_q_list
|
||||||
&& !config->op_q_changelog && !config->op_q_check) {
|
&& !config->op_q_changelog && !config->op_q_check) {
|
||||||
if (!config->quiet) {
|
if(!config->quiet) {
|
||||||
printf("%s %s\n", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
printf("%s %s\n", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
||||||
} else {
|
} else {
|
||||||
printf("%s\n", alpm_pkg_get_name(pkg));
|
printf("%s\n", alpm_pkg_get_name(pkg));
|
||||||
|
@ -340,14 +340,14 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
|
|||||||
alpm_list_t *grp;
|
alpm_list_t *grp;
|
||||||
pmpkg_t *pkg = alpm_list_getdata(j);
|
pmpkg_t *pkg = alpm_list_getdata(j);
|
||||||
|
|
||||||
if (!config->quiet) {
|
if(!config->quiet) {
|
||||||
printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
|
printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
|
||||||
alpm_pkg_get_version(pkg));
|
alpm_pkg_get_version(pkg));
|
||||||
} else {
|
} else {
|
||||||
printf("%s", alpm_pkg_get_name(pkg));
|
printf("%s", alpm_pkg_get_name(pkg));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config->quiet) {
|
if(!config->quiet) {
|
||||||
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
||||||
alpm_list_t *k;
|
alpm_list_t *k;
|
||||||
printf(" (");
|
printf(" (");
|
||||||
@ -550,7 +550,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
|
|||||||
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
||||||
pmpkg_t *pkg = alpm_list_getdata(j);
|
pmpkg_t *pkg = alpm_list_getdata(j);
|
||||||
|
|
||||||
if (!config->quiet) {
|
if(!config->quiet) {
|
||||||
printf("%s %s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
|
printf("%s %s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
|
||||||
alpm_pkg_get_version(pkg));
|
alpm_pkg_get_version(pkg));
|
||||||
print_installed(db_local, pkg);
|
print_installed(db_local, pkg);
|
||||||
|
@ -589,7 +589,7 @@ void list_display(const char *title, const alpm_list_t *list)
|
|||||||
for (j = 1; j <= len; j++) {
|
for (j = 1; j <= len; j++) {
|
||||||
printf(" ");
|
printf(" ");
|
||||||
}
|
}
|
||||||
} else if (cols != len) {
|
} else if(cols != len) {
|
||||||
/* 2 spaces are added if this is not the first element on a line. */
|
/* 2 spaces are added if this is not the first element on a line. */
|
||||||
printf(" ");
|
printf(" ");
|
||||||
cols += 2;
|
cols += 2;
|
||||||
@ -978,7 +978,7 @@ static int multiselect_parse(char *array, int count, char *response)
|
|||||||
char *ends = NULL;
|
char *ends = NULL;
|
||||||
char *starts = strtok_r(str, " ", &saveptr);
|
char *starts = strtok_r(str, " ", &saveptr);
|
||||||
|
|
||||||
if (starts == NULL) {
|
if(starts == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strtrim(starts);
|
strtrim(starts);
|
||||||
@ -986,7 +986,7 @@ static int multiselect_parse(char *array, int count, char *response)
|
|||||||
if(len == 0)
|
if(len == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*starts == '^') {
|
if(*starts == '^') {
|
||||||
starts++;
|
starts++;
|
||||||
len--;
|
len--;
|
||||||
include = 0;
|
include = 0;
|
||||||
@ -1145,7 +1145,7 @@ static int question(short preset, char *fmt, va_list args)
|
|||||||
|
|
||||||
if(strcasecmp(response, _("Y")) == 0 || strcasecmp(response, _("YES")) == 0) {
|
if(strcasecmp(response, _("Y")) == 0 || strcasecmp(response, _("YES")) == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (strcasecmp(response, _("N")) == 0 || strcasecmp(response, _("NO")) == 0) {
|
} else if(strcasecmp(response, _("N")) == 0 || strcasecmp(response, _("NO")) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1316,7 +1316,7 @@ char *strndup(const char *s, size_t n)
|
|||||||
size_t len = strnlen(s, n);
|
size_t len = strnlen(s, n);
|
||||||
char *new = (char *) malloc(len + 1);
|
char *new = (char *) malloc(len + 1);
|
||||||
|
|
||||||
if (new == NULL)
|
if(new == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
new[len] = '\0';
|
new[len] = '\0';
|
||||||
|
@ -66,7 +66,7 @@ static int check_localdb_files(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ent = readdir(dir)) != NULL) {
|
while((ent = readdir(dir)) != NULL) {
|
||||||
if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0
|
if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0
|
||||||
|| ent->d_name[0] == '.') {
|
|| ent->d_name[0] == '.') {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user