aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2018-06-21 21:02:57 -0400
committerJason Woodward2018-06-21 21:48:14 -0400
commit719252c459f06769b4d07c2ec62a65bcbb265d11 (patch)
tree8e78cbde05c15c6c0bfdf7c537fde4c73f3db20a /src
parent572033f35bd7120665ccf59602a7cb613931946e (diff)
downloadslapt-get-719252c459f06769b4d07c2ec62a65bcbb265d11.tar.gz
use c99 stdbool
Diffstat (limited to 'src')
-rw-r--r--src/action.c30
-rw-r--r--src/common.c10
-rw-r--r--src/common.h10
-rw-r--r--src/configuration.c48
-rw-r--r--src/configuration.h36
-rw-r--r--src/curl.c6
-rw-r--r--src/gpgme.c18
-rw-r--r--src/main.c46
-rw-r--r--src/main.h1
-rw-r--r--src/package.c98
-rw-r--r--src/package.h8
-rw-r--r--src/transaction.c56
12 files changed, 179 insertions, 188 deletions
diff --git a/src/action.c b/src/action.c
index 1c503ee..b6a3248 100644
--- a/src/action.c
+++ b/src/action.c
@@ -81,7 +81,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
installed_pkg = slapt_get_newest_pkg(installed_pkgs,pkg->name);
/* if it is not already installed, install it */
- if ( installed_pkg == NULL || global_config->no_upgrade == SLAPT_TRUE) {
+ if ( installed_pkg == NULL || global_config->no_upgrade == true) {
if ( slapt_add_deps_to_trans(global_config,tran,avail_pkgs,
installed_pkgs,pkg) == 0 ) {
@@ -93,7 +93,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
slapt_add_install_to_transaction(tran,pkg);
/* if there are conflicts, we schedule the conflicts for removal */
- if (conflicts->pkg_count > 0 && global_config->ignore_dep != SLAPT_TRUE) {
+ if (conflicts->pkg_count > 0 && global_config->ignore_dep != true) {
unsigned int cindex = 0;
for (cindex = 0; cindex < conflicts->pkg_count;cindex++) {
/* make sure to remove the conflict's dependencies as well */
@@ -126,7 +126,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
/* it is already installed, attempt an upgrade */
if (
((slapt_cmp_pkgs(installed_pkg,pkg)) < 0) ||
- (global_config->re_install == SLAPT_TRUE)
+ (global_config->re_install == true)
) {
if ( slapt_add_deps_to_trans(global_config,tran,avail_pkgs,
@@ -134,7 +134,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran,avail_pkgs,
installed_pkgs, pkg);
- if (conflicts->pkg_count > 0 && global_config->ignore_dep != SLAPT_TRUE) {
+ if (conflicts->pkg_count > 0 && global_config->ignore_dep != true) {
unsigned int cindex = 0;
for (cindex = 0;cindex < conflicts->pkg_count;cindex++) {
/* make sure to remove the conflict's dependencies as well */
@@ -329,7 +329,7 @@ void slapt_pkg_action_remove(const slapt_rc_config *global_config,
}
- if (global_config->remove_obsolete == SLAPT_TRUE) {
+ if (global_config->remove_obsolete == true) {
slapt_pkg_list_t *obsolete = slapt_get_obsolete_pkgs(
global_config, avail_pkgs, installed_pkgs);
@@ -528,7 +528,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
printf(gettext("Done\n"));
tran = slapt_init_transaction();
- if ( global_config->dist_upgrade == SLAPT_TRUE ) {
+ if ( global_config->dist_upgrade == true ) {
char *essential[] = {"pkgtools", "glibc-solibs", "glibc", "aaa_elflibs", "xz", "sed", "tar", "gzip", NULL};
int epi = 0;
slapt_pkg_info_t *newest_slaptget = NULL;
@@ -585,14 +585,12 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if ( slapt_is_excluded(global_config,slapt_upgrade_pkg) == 1 ) {
slapt_add_exclude_to_transaction(tran,slapt_upgrade_pkg);
} else {
- slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran,avail_pkgs,installed_pkgs,
- slapt_upgrade_pkg);
+ slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran,avail_pkgs,installed_pkgs, slapt_upgrade_pkg);
/* add install if all deps are good and it doesn't have conflicts */
if (
- (slapt_add_deps_to_trans(global_config,tran,avail_pkgs,
- installed_pkgs,slapt_upgrade_pkg) == 0)
- && ( conflicts->pkg_count == 0 && global_config->ignore_dep != SLAPT_TRUE)
+ (slapt_add_deps_to_trans(global_config,tran,avail_pkgs, installed_pkgs,slapt_upgrade_pkg) == 0)
+ && ( conflicts->pkg_count == 0 && global_config->ignore_dep != true)
) {
slapt_add_install_to_transaction(tran,slapt_upgrade_pkg);
} else {
@@ -624,7 +622,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if (
(slapt_add_deps_to_trans(global_config,tran,avail_pkgs,
installed_pkgs,slapt_upgrade_pkg) == 0)
- && ( conflicts->pkg_count == 0 && global_config->ignore_dep != SLAPT_TRUE)
+ && ( conflicts->pkg_count == 0 && global_config->ignore_dep != true)
) {
slapt_add_upgrade_to_transaction(tran,installed_pkg,
slapt_upgrade_pkg);
@@ -645,7 +643,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
slapt_free_pkg_list(matches);
/* remove obsolete packages if prompted to */
- if ( global_config->remove_obsolete == SLAPT_TRUE ) {
+ if ( global_config->remove_obsolete == true ) {
unsigned int r;
slapt_pkg_list_t *obsolete = slapt_get_obsolete_pkgs(
global_config, avail_pkgs, installed_pkgs);
@@ -703,13 +701,13 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
cmp_r = slapt_cmp_pkgs(installed_pkgs->pkgs[i],update_pkg);
if (
/* either it's greater, or we want to reinstall */
- cmp_r < 0 || (global_config->re_install == SLAPT_TRUE) ||
+ cmp_r < 0 || (global_config->re_install == true) ||
/*
* or this is a dist upgrade and the versions are the save
* except for the arch
*/
(
- global_config->dist_upgrade == SLAPT_TRUE &&
+ global_config->dist_upgrade == true &&
cmp_r == 0 &&
cmp_pkg_arch(installed_pkgs->pkgs[i]->version,
update_pkg->version) != 0
@@ -728,7 +726,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if (
(slapt_add_deps_to_trans(global_config,tran,avail_pkgs,
installed_pkgs,update_pkg) == 0)
- && ( global_config->ignore_dep == SLAPT_TRUE
+ && ( global_config->ignore_dep == true
|| ( conflicts->pkg_count == 0 ) )
) {
diff --git a/src/common.c b/src/common.c
index 94c0af4..fbf93c5 100644
--- a/src/common.c
+++ b/src/common.c
@@ -386,12 +386,12 @@ const char *slapt_priority_to_str(SLAPT_PRIORITY_T priority)
}
-SLAPT_BOOL_T slapt_disk_space_check (const char *path,double space_needed)
+bool slapt_disk_space_check (const char *path,double space_needed)
{
struct statvfs statvfs_buf;
if (space_needed < 0)
- return SLAPT_TRUE;
+ return true;
space_needed *= 1024;
@@ -400,13 +400,13 @@ SLAPT_BOOL_T slapt_disk_space_check (const char *path,double space_needed)
if (errno)
perror("statvfs");
- return SLAPT_FALSE;
+ return false;
} else {
if (statvfs_buf.f_bavail < (space_needed / statvfs_buf.f_bsize))
- return SLAPT_FALSE;
+ return false;
}
- return SLAPT_TRUE;
+ return true;
}
slapt_list_t *slapt_init_list(void)
diff --git a/src/common.h b/src/common.h
index ad89c51..ae792df 100644
--- a/src/common.h
+++ b/src/common.h
@@ -21,14 +21,6 @@
#define SLAPT_SLACK_BASE_SET_REGEX "^./slackware/a$"
typedef enum {
-#if !defined(FALSE) && !defined(TRUE)
-SLAPT_FALSE = 0, SLAPT_TRUE
-#else
-SLAPT_FALSE = FALSE, SLAPT_TRUE = TRUE
-#endif
-} SLAPT_BOOL_T;
-
-typedef enum {
SLAPT_OK = 0,
SLAPT_MD5_CHECKSUM_MISMATCH,
SLAPT_MD5_CHECKSUM_MISSING,
@@ -104,7 +96,7 @@ void *slapt_calloc(size_t n,size_t s);
const char *slapt_strerror(slapt_code_t code);
/* return human readable priority */
const char *slapt_priority_to_str(SLAPT_PRIORITY_T priority);
-SLAPT_BOOL_T slapt_disk_space_check (const char *path,double space_needed);
+bool slapt_disk_space_check (const char *path,double space_needed);
/* general list management */
slapt_list_t *slapt_parse_delimited_list(char *line, char delim);
diff --git a/src/configuration.c b/src/configuration.c
index 3fe0531..573ff89 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -25,24 +25,24 @@ slapt_rc_config *slapt_init_config(void)
{
slapt_rc_config *global_config = slapt_malloc( sizeof *global_config );
- global_config->download_only = SLAPT_FALSE;
- global_config->simulate = SLAPT_FALSE;
- global_config->ignore_excludes = SLAPT_FALSE;
- global_config->no_md5_check = SLAPT_FALSE;
- global_config->dist_upgrade = SLAPT_FALSE;
- global_config->ignore_dep = SLAPT_FALSE;
- global_config->disable_dep_check = SLAPT_FALSE;
- global_config->print_uris = SLAPT_FALSE;
- global_config->dl_stats = SLAPT_FALSE;
- global_config->no_prompt = SLAPT_FALSE;
- global_config->prompt = SLAPT_FALSE;
- global_config->re_install = SLAPT_FALSE;
- global_config->remove_obsolete = SLAPT_FALSE;
- global_config->no_upgrade = SLAPT_FALSE;
- global_config->use_priority = SLAPT_FALSE;
+ global_config->download_only = false;
+ global_config->simulate = false;
+ global_config->ignore_excludes = false;
+ global_config->no_md5_check = false;
+ global_config->dist_upgrade = false;
+ global_config->ignore_dep = false;
+ global_config->disable_dep_check = false;
+ global_config->print_uris = false;
+ global_config->dl_stats = false;
+ global_config->no_prompt = false;
+ global_config->prompt = false;
+ global_config->re_install = false;
+ global_config->remove_obsolete = false;
+ global_config->no_upgrade = false;
+ global_config->use_priority = false;
global_config->working_dir[0] = '\0';
global_config->progress_cb = NULL;
- global_config->gpgme_allow_unauth = SLAPT_FALSE; /* even without GPGME */
+ global_config->gpgme_allow_unauth = false; /* even without GPGME */
global_config->sources = slapt_init_source_list();
global_config->exclude_list = slapt_init_list();
@@ -84,7 +84,7 @@ slapt_rc_config *slapt_read_rc_config(const char *file_name)
if (s != NULL) {
slapt_add_source(global_config->sources,s);
if (s->priority != SLAPT_PRIORITY_DEFAULT) {
- global_config->use_priority = SLAPT_TRUE;
+ global_config->use_priority = true;
}
}
}
@@ -95,7 +95,7 @@ slapt_rc_config *slapt_read_rc_config(const char *file_name)
if (strlen(token_ptr) > strlen(SLAPT_DISABLED_SOURCE_TOKEN) ) {
slapt_source_t *s = slapt_init_source(token_ptr + strlen(SLAPT_DISABLED_SOURCE_TOKEN));
if (s != NULL) {
- s->disabled = SLAPT_TRUE;
+ s->disabled = true;
slapt_add_source(global_config->sources,s);
}
}
@@ -271,11 +271,11 @@ void slapt_free_source_list(slapt_source_list_t *list)
free(list);
}
-SLAPT_BOOL_T slapt_is_interactive(const slapt_rc_config *global_config)
+bool slapt_is_interactive(const slapt_rc_config *global_config)
{
- SLAPT_BOOL_T interactive = global_config->progress_cb == NULL
- ? SLAPT_TRUE
- : SLAPT_FALSE;
+ bool interactive = global_config->progress_cb == NULL
+ ? true
+ : false;
return interactive;
}
@@ -335,7 +335,7 @@ slapt_source_t *slapt_init_source(const char *s)
src = slapt_malloc(sizeof *src);
src->priority = SLAPT_PRIORITY_DEFAULT;
- src->disabled = SLAPT_FALSE;
+ src->disabled = false;
source_string = slapt_strip_whitespace (s);
source_len = strlen (source_string);
@@ -423,7 +423,7 @@ int slapt_write_rc_config(const slapt_rc_config *global_config, const char *loca
SLAPT_PRIORITY_T priority = src->priority;
const char *token = SLAPT_SOURCE_TOKEN;
- if (global_config->sources->src[i]->disabled == SLAPT_TRUE)
+ if (global_config->sources->src[i]->disabled == true)
token = SLAPT_DISABLED_SOURCE_TOKEN;
if (priority > SLAPT_PRIORITY_DEFAULT) {
diff --git a/src/configuration.h b/src/configuration.h
index d00e6f2..4591fe3 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -26,7 +26,7 @@
typedef struct {
char *url;
SLAPT_PRIORITY_T priority;
- SLAPT_BOOL_T disabled;
+ bool disabled;
} slapt_source_t;
typedef struct {
@@ -39,23 +39,23 @@ typedef struct {
slapt_source_list_t *sources;
slapt_list_t *exclude_list;
int(*progress_cb)(void *,double,double,double,double);
- SLAPT_BOOL_T download_only;
- SLAPT_BOOL_T dist_upgrade;
- SLAPT_BOOL_T simulate;
- SLAPT_BOOL_T no_prompt;
- SLAPT_BOOL_T prompt;
- SLAPT_BOOL_T re_install;
- SLAPT_BOOL_T ignore_excludes;
- SLAPT_BOOL_T no_md5_check;
- SLAPT_BOOL_T ignore_dep;
- SLAPT_BOOL_T disable_dep_check;
- SLAPT_BOOL_T print_uris;
- SLAPT_BOOL_T dl_stats;
- SLAPT_BOOL_T remove_obsolete;
- SLAPT_BOOL_T no_upgrade;
+ bool download_only;
+ bool dist_upgrade;
+ bool simulate;
+ bool no_prompt;
+ bool prompt;
+ bool re_install;
+ bool ignore_excludes;
+ bool no_md5_check;
+ bool ignore_dep;
+ bool disable_dep_check;
+ bool print_uris;
+ bool dl_stats;
+ bool remove_obsolete;
+ bool no_upgrade;
unsigned int retry;
- SLAPT_BOOL_T use_priority;
- SLAPT_BOOL_T gpgme_allow_unauth;
+ bool use_priority;
+ bool gpgme_allow_unauth;
} slapt_rc_config;
/* initialize slapt_rc_config */
@@ -81,6 +81,6 @@ void slapt_add_source(slapt_source_list_t *list, slapt_source_t *s);
void slapt_remove_source (slapt_source_list_t *list, const char *s);
void slapt_free_source_list(slapt_source_list_t *list);
-SLAPT_BOOL_T slapt_is_interactive(const slapt_rc_config *);
+bool slapt_is_interactive(const slapt_rc_config *);
int slapt_write_rc_config(const slapt_rc_config *global_config, const char *location);
diff --git a/src/curl.c b/src/curl.c
index 8348d64..184ec4b 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -61,7 +61,7 @@ int slapt_download_data(FILE *fh,const char *url,size_t bytes,long *filetime,
headers = curl_slist_append(headers, "Pragma: "); /* override no-cache */
- if (global_config->dl_stats != SLAPT_TRUE) {
+ if (global_config->dl_stats != true) {
if (global_config->progress_cb == NULL) {
curl_easy_setopt(ch, CURLOPT_PROGRESSFUNCTION, slapt_progress_callback );
} else {
@@ -200,7 +200,7 @@ const char *slapt_download_pkg(const slapt_rc_config *global_config,
size_t f_size = 0;
slapt_code_t verify = SLAPT_OK;
int dl_return = -1, dl_total_size = 0;
- SLAPT_BOOL_T is_interactive = slapt_is_interactive(global_config);
+ bool is_interactive = slapt_is_interactive(global_config);
long filetime = 0;
if (pkg == NULL) {
@@ -249,7 +249,7 @@ const char *slapt_download_pkg(const slapt_rc_config *global_config,
( dl_total_size > 1024 ) ? dl_total_size / 1024.0 : dl_total_size,
( dl_total_size > 1024 ) ? "MB" : "kB"
);
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
}
diff --git a/src/gpgme.c b/src/gpgme.c
index d8bcbf3..a4bb5b9 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -58,7 +58,7 @@ FILE *slapt_get_pkg_source_checksums_signature (const slapt_rc_config *global_co
{
FILE *tmp_checksum_f = NULL;
char *checksum_head = NULL;
- SLAPT_BOOL_T interactive = slapt_is_interactive(global_config);
+ bool interactive = slapt_is_interactive(global_config);
char *location_uncompressed = SLAPT_CHECKSUM_ASC_FILE;
char *location_compressed = SLAPT_CHECKSUM_ASC_FILE_GZ;
char *filename = NULL;
@@ -80,7 +80,7 @@ FILE *slapt_get_pkg_source_checksums_signature (const slapt_rc_config *global_co
if (checksum_head == NULL)
{
- if (interactive == SLAPT_TRUE)
+ if (interactive == true)
printf(gettext("Not Found\n"));
free(filename);
free(local_head);
@@ -100,7 +100,7 @@ FILE *slapt_get_pkg_source_checksums_signature (const slapt_rc_config *global_co
} else {
const char *err = NULL;
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if ((tmp_checksum_f = slapt_open_file(filename,"w+b")) == NULL)
@@ -111,7 +111,7 @@ FILE *slapt_get_pkg_source_checksums_signature (const slapt_rc_config *global_co
location);
if (!err) {
- if (interactive == SLAPT_TRUE)
+ if (interactive == true)
printf(gettext("Done\n"));
} else {
@@ -150,15 +150,15 @@ FILE *slapt_get_pkg_source_gpg_key(const slapt_rc_config *global_config,
char *key_head = NULL;
char *filename = slapt_gen_filename_from_url(url,SLAPT_GPG_KEY);
char *local_head = slapt_read_head_cache(filename);
- SLAPT_BOOL_T interactive = global_config->progress_cb == NULL && global_config->dl_stats == SLAPT_FALSE
- ? SLAPT_TRUE
- : SLAPT_FALSE;
+ bool interactive = global_config->progress_cb == NULL && global_config->dl_stats == false
+ ? true
+ : false;
*compressed = 0;
key_head = slapt_head_mirror_data(url,SLAPT_GPG_KEY);
if (key_head == NULL) {
- if (interactive == SLAPT_TRUE)
+ if (interactive == true)
printf(gettext("Not Found\n"));
free(filename);
free(local_head);
@@ -187,7 +187,7 @@ FILE *slapt_get_pkg_source_gpg_key(const slapt_rc_config *global_config,
SLAPT_GPG_KEY);
if (!err) {
- if (interactive == SLAPT_TRUE)
+ if (interactive == true)
printf(gettext("Done\n"));
} else{
fprintf(stderr,gettext("Failed to download: %s\n"),err);
diff --git a/src/main.c b/src/main.c
index 270c105..ec3b054 100644
--- a/src/main.c
+++ b/src/main.c
@@ -121,19 +121,19 @@ int main( int argc, char *argv[] )
break;
case SLAPT_SHOW_OPT: /* show */
do_action = SHOW;
- initial_config->simulate = SLAPT_TRUE; /* allow read access */
+ initial_config->simulate = true; /* allow read access */
break;
case SLAPT_SEARCH_OPT: /* search */
do_action = SEARCH;
- initial_config->simulate = SLAPT_TRUE; /* allow read access */
+ initial_config->simulate = true; /* allow read access */
break;
case SLAPT_LIST_OPT: /* list */
do_action = LIST;
- initial_config->simulate = SLAPT_TRUE; /* allow read access */
+ initial_config->simulate = true; /* allow read access */
break;
case SLAPT_INSTALLED_OPT: /* installed */
do_action = INSTALLED;
- initial_config->simulate = SLAPT_TRUE; /* allow read access */
+ initial_config->simulate = true; /* allow read access */
break;
case SLAPT_CLEAN_OPT: /* clean */
do_action = CLEAN;
@@ -142,10 +142,10 @@ int main( int argc, char *argv[] )
do_action = UPGRADE;
break;
case SLAPT_DOWNLOAD_ONLY_OPT: /* download only flag */
- initial_config->download_only = SLAPT_TRUE;
+ initial_config->download_only = true;
break;
case SLAPT_SIMULATE_OPT: /* simulate */
- initial_config->simulate = SLAPT_TRUE;
+ initial_config->simulate = true;
break;
case SLAPT_VERSION_OPT: /* version */
version_info();
@@ -153,22 +153,22 @@ int main( int argc, char *argv[] )
curl_global_cleanup();
exit(EXIT_SUCCESS);
case SLAPT_NO_PROMPT_OPT: /* auto */
- initial_config->no_prompt = SLAPT_TRUE;
+ initial_config->no_prompt = true;
break;
case SLAPT_PROMPT_OPT: /* always prompt */
- initial_config->prompt = SLAPT_TRUE;
+ initial_config->prompt = true;
break;
case SLAPT_REINSTALL_OPT: /* reinstall */
- initial_config->re_install = SLAPT_TRUE;
+ initial_config->re_install = true;
break;
case SLAPT_IGNORE_EXCLUDES_OPT: /* ignore-excludes */
- initial_config->ignore_excludes = SLAPT_TRUE;
+ initial_config->ignore_excludes = true;
break;
case SLAPT_NO_MD5_OPT: /* no-md5 */
- initial_config->no_md5_check = SLAPT_TRUE;
+ initial_config->no_md5_check = true;
break;
case SLAPT_DIST_UPGRADE_OPT: /* dist-upgrade */
- initial_config->dist_upgrade = SLAPT_TRUE;
+ initial_config->dist_upgrade = true;
do_action = UPGRADE;
break;
case SLAPT_HELP_OPT: /* help */
@@ -177,16 +177,16 @@ int main( int argc, char *argv[] )
curl_global_cleanup();
exit(EXIT_SUCCESS);
case SLAPT_IGNORE_DEP_OPT: /* ignore-dep */
- initial_config->ignore_dep = SLAPT_TRUE;
+ initial_config->ignore_dep = true;
break;
case SLAPT_NO_DEP_OPT: /* no-dep */
- initial_config->disable_dep_check = SLAPT_TRUE;
+ initial_config->disable_dep_check = true;
break;
case SLAPT_PRINT_URIS_OPT: /* print-uris */
- initial_config->print_uris = SLAPT_TRUE;
+ initial_config->print_uris = true;
break;
case SLAPT_SHOW_STATS_OPT: /* download-stats */
- initial_config->dl_stats = SLAPT_TRUE;
+ initial_config->dl_stats = true;
break;
case SLAPT_CONFIG_OPT: /* override rc location */
custom_rc_location = strdup(optarg);
@@ -195,17 +195,17 @@ int main( int argc, char *argv[] )
initial_config->retry = (atoi(optarg) > 0) ? atoi(optarg) : 1;
break;
case SLAPT_NO_UPGRADE_OPT: /* do not attempt to upgrade */
- initial_config->no_upgrade = SLAPT_TRUE;
+ initial_config->no_upgrade = true;
break;
case SLAPT_AUTOCLEAN_OPT: /* clean old old package versions */
do_action = AUTOCLEAN;
break;
case SLAPT_OBSOLETE_OPT: /* remove obsolete packages */
- initial_config->remove_obsolete = SLAPT_TRUE;
+ initial_config->remove_obsolete = true;
break;
case SLAPT_AVAILABLE_OPT: /* show available packages */
do_action = AVAILABLE;
- initial_config->simulate = SLAPT_TRUE; /* allow read access */
+ initial_config->simulate = true; /* allow read access */
break;
case SLAPT_INSTALL_DISK_SET_OPT: /* install a disk set */
do_action = INSTALL_DISK_SET;
@@ -215,12 +215,12 @@ int main( int argc, char *argv[] )
do_action = ADD_KEYS;
break;
case SLAPT_ALLOW_UNAUTH: /* allow unauthenticated key */
- initial_config->gpgme_allow_unauth = SLAPT_TRUE;
+ initial_config->gpgme_allow_unauth = true;
break;
#endif
case SLAPT_FILELIST:
do_action = FILELIST;
- initial_config->simulate = SLAPT_TRUE; /* allow read access */
+ initial_config->simulate = true; /* allow read access */
break;
default:
usage();
@@ -272,14 +272,14 @@ int main( int argc, char *argv[] )
case ADD_KEYS:
#endif
case UPDATE:
- global_config->simulate = SLAPT_FALSE;
+ global_config->simulate = false;
break;
/* remove obsolete can take the place of arguments */
case INSTALL:
case INSTALL_DISK_SET:
case REMOVE:
- if (global_config->remove_obsolete == SLAPT_TRUE)
+ if (global_config->remove_obsolete == true)
break;
/* fall through */
diff --git a/src/main.h b/src/main.h
index 2d0258f..92842a5 100644
--- a/src/main.h
+++ b/src/main.h
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdbool.h>
#include <unistd.h>
#include <getopt.h>
#include <curl/curl.h>
diff --git a/src/package.c b/src/package.c
index 339a478..9094365 100644
--- a/src/package.c
+++ b/src/package.c
@@ -50,7 +50,7 @@ static FILE *slapt_gunzip_file (const char *file_name,FILE *dest_file);
#ifdef SLAPT_HAS_GPGME
/* check if signature is unauthenticated by "acceptable" reasons */
-SLAPT_BOOL_T slapt_pkg_sign_is_unauthenticated(slapt_code_t code);
+bool slapt_pkg_sign_is_unauthenticated(slapt_code_t code);
#endif
/* parse the PACKAGES.TXT file */
@@ -74,7 +74,7 @@ slapt_pkg_list_t *slapt_get_available_pkgs(void)
as expected. */
qsort( list->pkgs, list->pkg_count, sizeof(list->pkgs[0]), pkg_compare );
- list->ordered = SLAPT_TRUE;
+ list->ordered = true;
return list;
}
@@ -455,7 +455,7 @@ slapt_pkg_list_t *slapt_parse_packages_txt(FILE *pkg_list_fh)
slapt_free_regex(size_c_regex);
slapt_free_regex(size_u_regex);
- list->free_pkgs = SLAPT_TRUE;
+ list->free_pkgs = true;
return list;
}
@@ -687,7 +687,7 @@ slapt_pkg_list_t *slapt_get_installed_pkgs(void)
}
/* mark as installed */
- tmp_pkg->installed = SLAPT_TRUE;
+ tmp_pkg->installed = true;
slapt_add_pkg_to_pkg_list(list,tmp_pkg);
tmp_pkg = NULL;
@@ -699,11 +699,11 @@ slapt_pkg_list_t *slapt_get_installed_pkgs(void)
slapt_free_regex(compressed_size_reg);
slapt_free_regex(uncompressed_size_reg);
- list->free_pkgs = SLAPT_TRUE;
+ list->free_pkgs = true;
qsort( list->pkgs, list->pkg_count, sizeof(list->pkgs[0]), pkg_compare );
- list->ordered = SLAPT_TRUE;
+ list->ordered = true;
return list;
}
@@ -907,7 +907,7 @@ void slapt_free_pkg(slapt_pkg_info_t *pkg)
void slapt_free_pkg_list(slapt_pkg_list_t *list)
{
unsigned int i;
- if (list->free_pkgs == SLAPT_TRUE) {
+ if (list->free_pkgs == true) {
for (i = 0;i < list->pkg_count;i++) {
slapt_free_pkg(list->pkgs[i]);
}
@@ -922,7 +922,7 @@ int slapt_is_excluded(const slapt_rc_config *global_config,
unsigned int i,pkg_not_excluded = 0, pkg_slapt_is_excluded = 1;
int name_reg_ret = -1,version_reg_ret = -1,location_reg_ret = -1;
- if (global_config->ignore_excludes == SLAPT_TRUE)
+ if (global_config->ignore_excludes == true)
return pkg_not_excluded;
/* maybe EXCLUDE= isn't defined in our rc? */
@@ -1051,7 +1051,7 @@ int slapt_cmp_pkgs(slapt_pkg_info_t *a, slapt_pkg_info_t *b)
/* if either of the two packages is installed, we look
for the same version to bail out early if possible */
- if (a->installed == SLAPT_TRUE || b->installed == SLAPT_TRUE)
+ if (a->installed == true || b->installed == true)
if (strcasecmp(a->version,b->version) == 0)
return equal;
@@ -1366,7 +1366,7 @@ int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
* don't go any further if the required member is empty
* or disable_dep_check is set
*/
- if (global_config->disable_dep_check == SLAPT_TRUE ||
+ if (global_config->disable_dep_check == true ||
strcmp(pkg->required,"") == 0 ||
strcmp(pkg->required," ") == 0 ||
strcmp(pkg->required," ") == 0
@@ -1401,7 +1401,7 @@ int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
}
/* if this pkg is excluded */
- if ((slapt_is_excluded(global_config,tmp_pkg) == 1) && (global_config->ignore_dep == SLAPT_FALSE)) {
+ if ((slapt_is_excluded(global_config,tmp_pkg) == 1) && (global_config->ignore_dep == false)) {
if (slapt_get_exact_pkg(installed_pkgs,tmp_pkg->name, tmp_pkg->version) == NULL) {
slapt_add_pkg_err_to_list(conflict_err,pkg->name,tmp_pkg->name);
slapt_free_list(dep_parts);
@@ -1422,7 +1422,7 @@ int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
deps,conflict_err,missing_err
);
- if (dep_check_return == -1 && global_config->ignore_dep == SLAPT_FALSE) {
+ if (dep_check_return == -1 && global_config->ignore_dep == false) {
slapt_free_list(dep_parts);
return -1;
} else {
@@ -1741,7 +1741,7 @@ slapt_pkg_list_t *slapt_is_required_by(const slapt_rc_config *global_config,
/*
* don't go any further if disable_dep_check is set
*/
- if (global_config->disable_dep_check == SLAPT_TRUE)
+ if (global_config->disable_dep_check == true)
return required_by_list;
required_by(avail,installed_pkgs,pkgs_to_install,pkgs_to_remove,pkg,required_by_list);
@@ -1830,7 +1830,7 @@ static void required_by(slapt_pkg_list_t *avail,
for (d = 0; d < dep_list->count; d++) {
slapt_list_t *satisfies = NULL;
unsigned int s = 0;
- SLAPT_BOOL_T has_alternative = SLAPT_FALSE, found = SLAPT_FALSE;
+ bool has_alternative = false, found = false;
/* found our package in the list of dependencies */
if (strstr(dep_list->items[d], pkg->name) == NULL)
@@ -1855,17 +1855,17 @@ static void required_by(slapt_pkg_list_t *avail,
continue;
if (strcmp(tmp_pkg->name,pkg->name) == 0) {
- found = SLAPT_TRUE;
+ found = true;
continue;
}
if (slapt_get_exact_pkg(installed_pkgs,tmp_pkg->name, tmp_pkg->version) != NULL) {
if (slapt_get_exact_pkg(pkgs_to_remove,tmp_pkg->name, tmp_pkg->version) == NULL) {
- has_alternative = SLAPT_TRUE;
+ has_alternative = true;
break;
}
} else if (slapt_get_exact_pkg(pkgs_to_install, tmp_pkg->name, tmp_pkg->version) != NULL) {
- has_alternative = SLAPT_TRUE;
+ has_alternative = true;
break;
}
@@ -1873,7 +1873,7 @@ static void required_by(slapt_pkg_list_t *avail,
slapt_free_list(satisfies);
/* we couldn't find an installed pkg that satisfies the |or */
- if (has_alternative == SLAPT_FALSE && found == SLAPT_TRUE) {
+ if (has_alternative == false && found == true) {
if (slapt_get_exact_pkg(required_by_list, pkg_ptr->name, pkg_ptr->version) == NULL) {
slapt_add_pkg_to_pkg_list(required_by_list,pkg_ptr);
required_by(avail,installed_pkgs,pkgs_to_install,pkgs_to_remove, pkg_ptr, required_by_list );
@@ -1974,7 +1974,7 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
{
unsigned int i,source_dl_failed = 0;
slapt_pkg_list_t *new_pkgs = slapt_init_pkg_list();
- new_pkgs->free_pkgs = SLAPT_TRUE;
+ new_pkgs->free_pkgs = true;
/* go through each package source and download the meta data */
for (i = 0; i < global_config->sources->count; i++) {
@@ -1989,7 +1989,7 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
const char *source_url = global_config->sources->src[i]->url;
SLAPT_PRIORITY_T source_priority = global_config->sources->src[i]->priority;
- if (global_config->sources->src[i]->disabled == SLAPT_TRUE)
+ if (global_config->sources->src[i]->disabled == true)
continue;
/* download our SLAPT_PKG_LIST */
@@ -2033,7 +2033,7 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
printf("%s\n",gettext("Verified"));
} else if (verified == SLAPT_CHECKSUMS_MISSING_KEY) {
printf("%s\n",gettext("No key for verification"));
- } else if ((global_config->gpgme_allow_unauth == SLAPT_TRUE) && (slapt_pkg_sign_is_unauthenticated(verified) == SLAPT_TRUE)) {
+ } else if ((global_config->gpgme_allow_unauth == true) && (slapt_pkg_sign_is_unauthenticated(verified) == true)) {
printf("%s%s\n", slapt_strerror(verified), gettext(", but accepted as an exception"));
} else {
printf("%s\n",gettext(slapt_strerror(verified)));
@@ -2086,7 +2086,7 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
slapt_add_pkg_to_pkg_list(new_pkgs,p);
}
- available_pkgs->free_pkgs = SLAPT_FALSE;
+ available_pkgs->free_pkgs = false;
if (patch_pkgs) {
slapt_get_md5sums(patch_pkgs, tmp_checksum_f);
@@ -2104,14 +2104,14 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
}
/* set the priority of the package based on the source, plus 1 for the patch priority */
- if (global_config->use_priority == SLAPT_TRUE)
+ if (global_config->use_priority == true)
p->priority = source_priority + 1;
else
p->priority = source_priority;
slapt_add_pkg_to_pkg_list(new_pkgs,p);
}
- patch_pkgs->free_pkgs = SLAPT_FALSE;
+ patch_pkgs->free_pkgs = false;
}
printf(gettext("Done\n"));
@@ -2153,7 +2153,7 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
}
#ifdef SLAPT_HAS_GPGME
-SLAPT_BOOL_T slapt_pkg_sign_is_unauthenticated(slapt_code_t code)
+bool slapt_pkg_sign_is_unauthenticated(slapt_code_t code)
{
switch (code)
{
@@ -2163,12 +2163,12 @@ SLAPT_BOOL_T slapt_pkg_sign_is_unauthenticated(slapt_code_t code)
case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_CRL_MISSING:
case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_CRL_TOO_OLD:
case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_BAD_POLICY:
- return SLAPT_TRUE;
+ return true;
default:
break;
}
- return SLAPT_FALSE;
+ return false;
}
#endif
@@ -2179,8 +2179,8 @@ slapt_pkg_list_t *slapt_init_pkg_list(void)
list = slapt_malloc(sizeof *list);
list->pkgs = slapt_malloc(sizeof *list->pkgs);
list->pkg_count = 0;
- list->free_pkgs = SLAPT_FALSE;
- list->ordered = SLAPT_FALSE;
+ list->free_pkgs = false;
+ list->ordered = false;
return list;
}
@@ -2236,7 +2236,7 @@ slapt_pkg_info_t *slapt_init_pkg(void)
pkg->priority = SLAPT_PRIORITY_DEFAULT;
- pkg->installed = SLAPT_FALSE;
+ pkg->installed = false;
return pkg;
}
@@ -2336,7 +2336,7 @@ slapt_code_t slapt_verify_downloaded_pkg(const slapt_rc_config *global_config,
*/
/* if not checking the md5 checksum and the sizes match, assume its good */
- if (global_config->no_md5_check == SLAPT_TRUE)
+ if (global_config->no_md5_check == true)
return SLAPT_OK;
/* check to see that we actually have an md5 checksum */
@@ -2462,7 +2462,7 @@ void slapt_purge_old_cached_pkgs(const slapt_rc_config *global_config,
if (tmp_pkg == NULL) {
- if (global_config->no_prompt == SLAPT_TRUE) {
+ if (global_config->no_prompt == true) {
unlink(file->d_name);
} else {
if (slapt_ask_yes_no(gettext("Delete %s ? [y/N]"),file->d_name) == 1)
@@ -2691,7 +2691,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_packages (const slapt_rc_config *global_c
{
slapt_pkg_list_t *available_pkgs = NULL;
char *pkg_head = NULL;
- SLAPT_BOOL_T is_interactive = slapt_is_interactive(global_config);
+ bool is_interactive = slapt_is_interactive(global_config);
*compressed = 0;
@@ -2733,7 +2733,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_packages (const slapt_rc_config *global_c
FILE *tmp_pkg_f = NULL;
const char *err = NULL;
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if ((tmp_pkg_f = slapt_open_file(pkg_filename,"w+b")) == NULL)
@@ -2821,7 +2821,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_packages (const slapt_rc_config *global_c
FILE *tmp_pkg_f = NULL;
const char *err = NULL;
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if ((tmp_pkg_f = slapt_open_file(pkg_filename,"w+b")) == NULL)
@@ -2887,7 +2887,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_patches (const slapt_rc_config *global_co
{
slapt_pkg_list_t *patch_pkgs = NULL;
char *patch_head = NULL;
- SLAPT_BOOL_T is_interactive = slapt_is_interactive(global_config);
+ bool is_interactive = slapt_is_interactive(global_config);
*compressed = 0;
if ((patch_head = slapt_head_mirror_data(url,SLAPT_PATCHES_LIST_GZ)) != NULL) {
@@ -2912,7 +2912,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_patches (const slapt_rc_config *global_co
FILE *tmp_patch_f = NULL;
const char *err = NULL;
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if ((tmp_patch_f = slapt_open_file(patch_filename,"w+b")) == NULL)
@@ -2948,7 +2948,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_patches (const slapt_rc_config *global_co
slapt_clear_head_cache(patch_filename);
}
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
}
@@ -2984,7 +2984,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_patches (const slapt_rc_config *global_co
FILE *tmp_patch_f = NULL;
const char *err = NULL;
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if ((tmp_patch_f = slapt_open_file(patch_filename,"w+b")) == NULL)
@@ -3013,7 +3013,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_patches (const slapt_rc_config *global_co
}
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
fclose(tmp_patch_f);
@@ -3033,7 +3033,7 @@ FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,
{
FILE *tmp_checksum_f = NULL;
char *checksum_head = NULL;
- SLAPT_BOOL_T is_interactive = slapt_is_interactive(global_config);
+ bool is_interactive = slapt_is_interactive(global_config);
*compressed = 0;
if ((checksum_head = slapt_head_mirror_data(url,SLAPT_CHECKSUM_FILE_GZ)) != NULL) {
@@ -3054,7 +3054,7 @@ FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,
FILE *working_checksum_f = NULL;
const char *err = NULL;
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if ((working_checksum_f = slapt_open_file(filename,"w+b")) == NULL)
@@ -3065,7 +3065,7 @@ FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,
SLAPT_CHECKSUM_FILE_GZ);
if (!err) {
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if (is_interactive)
printf(gettext("Done\n"));
@@ -3126,7 +3126,7 @@ FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,
if ((tmp_checksum_f = slapt_open_file(filename,"w+b")) == NULL)
exit(EXIT_FAILURE);
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
err = slapt_get_mirror_data_from_source(tmp_checksum_f,
@@ -3154,7 +3154,7 @@ FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,
if (checksum_head != NULL)
slapt_write_head_cache(checksum_head,filename);
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
}
@@ -3178,7 +3178,7 @@ int slapt_get_pkg_source_changelog (const slapt_rc_config *global_config,
char *location_uncomp = SLAPT_CHANGELOG_FILE;
char *location = location_gz;
int success = 0,failure = -1;
- SLAPT_BOOL_T is_interactive = slapt_is_interactive(global_config);
+ bool is_interactive = slapt_is_interactive(global_config);
*compressed = 0;
changelog_head = slapt_head_mirror_data(url,location);
@@ -3208,7 +3208,7 @@ int slapt_get_pkg_source_changelog (const slapt_rc_config *global_config,
FILE *working_changelog_f = NULL;
const char *err = NULL;
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if ((working_changelog_f = slapt_open_file(filename,"w+b")) == NULL)
@@ -3218,7 +3218,7 @@ int slapt_get_pkg_source_changelog (const slapt_rc_config *global_config,
global_config,url,
location);
if (!err) {
- if (global_config->dl_stats == SLAPT_TRUE)
+ if (global_config->dl_stats == true)
printf("\n");
if (is_interactive)
printf(gettext("Done\n"));
@@ -3496,7 +3496,7 @@ char *slapt_get_pkg_filelist(const slapt_pkg_info_t *pkg)
size_t pls = 1;
/* this only handles installed packages at the moment */
- if (pkg->installed != SLAPT_TRUE)
+ if (pkg->installed != true)
return filelist;
pkg_log_dirname = slapt_gen_package_log_dir_name();
diff --git a/src/package.h b/src/package.h
index 4555553..5c6d32b 100644
--- a/src/package.h
+++ b/src/package.h
@@ -66,20 +66,20 @@ typedef struct {
unsigned int size_c;
unsigned int size_u;
unsigned int priority;
- SLAPT_BOOL_T installed;
+ bool installed;
} slapt_pkg_info_t;
typedef struct {
slapt_pkg_info_t **pkgs;
unsigned int pkg_count;
- SLAPT_BOOL_T free_pkgs;
- SLAPT_BOOL_T ordered;
+ bool free_pkgs;
+ bool ordered;
} slapt_pkg_list_t;
typedef struct {
slapt_pkg_info_t *installed;
slapt_pkg_info_t *upgrade;
- SLAPT_BOOL_T reinstall;
+ bool reinstall;
} slapt_pkg_upgrade_t;
typedef struct {
diff --git a/src/transaction.c b/src/transaction.c
index 2268c3b..88e2212 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -30,7 +30,7 @@ static void add_suggestion(slapt_transaction_t *tran, slapt_pkg_info_t *pkg);
static void _slapt_add_upgrade_to_transaction(slapt_transaction_t *tran,
slapt_pkg_info_t *installed_pkg,
slapt_pkg_info_t *slapt_upgrade_pkg,
- SLAPT_BOOL_T reinstall
+ bool reinstall
);
slapt_transaction_t *slapt_init_transaction(void)
@@ -38,13 +38,13 @@ slapt_transaction_t *slapt_init_transaction(void)
slapt_transaction_t *tran = slapt_malloc(sizeof *tran);
tran->install_pkgs = slapt_init_pkg_list();
- tran->install_pkgs->free_pkgs = SLAPT_TRUE;
+ tran->install_pkgs->free_pkgs = true;
tran->remove_pkgs = slapt_init_pkg_list();
- tran->remove_pkgs->free_pkgs = SLAPT_TRUE;
+ tran->remove_pkgs->free_pkgs = true;
tran->exclude_pkgs = slapt_init_pkg_list();
- tran->exclude_pkgs->free_pkgs = SLAPT_TRUE;
+ tran->exclude_pkgs->free_pkgs = true;
tran->upgrade_pkgs = slapt_malloc(sizeof *tran->upgrade_pkgs);
tran->upgrade_pkgs->pkgs = slapt_malloc(sizeof *tran->upgrade_pkgs->pkgs);
@@ -220,7 +220,7 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
uncompressed_size += u->size_u;
uncompressed_size -= p->size_u;
- if (tran->upgrade_pkgs->pkgs[i]->reinstall == SLAPT_TRUE)
+ if (tran->upgrade_pkgs->pkgs[i]->reinstall == true)
continue;
if (line_len < MAX_LINE_LEN) {
@@ -245,7 +245,7 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
slapt_pkg_info_t *u = tran->upgrade_pkgs->pkgs[i]->upgrade;
int line_len = len + strlen(u->name) + 1;
- if (tran->upgrade_pkgs->pkgs[i]->reinstall == SLAPT_FALSE)
+ if (tran->upgrade_pkgs->pkgs[i]->reinstall == false)
continue;
if (line_len < MAX_LINE_LEN) {
@@ -299,7 +299,7 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
}
/* check we have enough space to download to our working dir */
- if (slapt_disk_space_check (global_config->working_dir,need_to_download_size) == SLAPT_FALSE) {
+ if (slapt_disk_space_check (global_config->working_dir,need_to_download_size) == false) {
printf(
gettext("You don't have enough free space in %s\n"),
global_config->working_dir
@@ -307,8 +307,8 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
exit(EXIT_FAILURE);
}
/* check that we have enough space in the root filesystem */
- if (global_config->download_only == SLAPT_FALSE) {
- if (slapt_disk_space_check ("/", uncompressed_size) == SLAPT_FALSE) {
+ if (global_config->download_only == false) {
+ if (slapt_disk_space_check ("/", uncompressed_size) == false) {
printf(gettext("You don't have enough free space in %s\n"),"/");
exit(EXIT_FAILURE);
}
@@ -319,7 +319,7 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
if (tran->upgrade_pkgs->pkg_count > 0 || tran->remove_pkgs->pkg_count > 0 ||
tran->install_pkgs->pkg_count > 0) {
- if (global_config->download_only == SLAPT_FALSE) {
+ if (global_config->download_only == false) {
if ((int)uncompressed_size < 0) {
uncompressed_size *= -1;
printf(gettext("After unpacking %.1f%s disk space will be freed.\n"),
@@ -339,14 +339,14 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
}
/* prompt */
- if ((global_config->prompt == SLAPT_TRUE) ||
+ if ((global_config->prompt == true) ||
((tran->upgrade_pkgs->pkg_count > 0 || tran->remove_pkgs->pkg_count > 0 ||
(tran->install_pkgs->pkg_count > 0 &&
- global_config->dist_upgrade == SLAPT_TRUE)) &&
- (global_config->no_prompt == SLAPT_FALSE &&
- global_config->download_only == SLAPT_FALSE &&
- global_config->simulate == SLAPT_FALSE &&
- global_config->print_uris == SLAPT_FALSE))
+ global_config->dist_upgrade == true)) &&
+ (global_config->no_prompt == false &&
+ global_config->download_only == false &&
+ global_config->simulate == false &&
+ global_config->print_uris == false))
) {
if (slapt_ask_yes_no(gettext("Do you want to continue? [y/N] ")) != 1) {
printf(gettext("Abort.\n"));
@@ -354,7 +354,7 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
}
}
- if (global_config->print_uris == SLAPT_TRUE) {
+ if (global_config->print_uris == true) {
for (i = 0; i < tran->install_pkgs->pkg_count; ++i) {
const slapt_pkg_info_t *info = tran->install_pkgs->pkgs[i];
const char *location = info->location + strspn(info->location, "./");
@@ -373,7 +373,7 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
}
/* if simulate is requested, just show what could happen and return */
- if (global_config->simulate == SLAPT_TRUE) {
+ if (global_config->simulate == true) {
for (i = 0; i < tran->remove_pkgs->pkg_count; ++i) {
const slapt_pkg_info_t *r = tran->remove_pkgs->pkgs[i];
@@ -448,7 +448,7 @@ int slapt_handle_transaction (const slapt_rc_config *global_config,
printf("\n");
/* run transaction, remove, install, and upgrade */
- if (global_config->download_only == SLAPT_FALSE) {
+ if (global_config->download_only == false) {
for (i = 0; i < tran->remove_pkgs->pkg_count; ++i) {
if (slapt_remove_pkg(global_config,tran->remove_pkgs->pkgs[i]) == -1) {
@@ -582,7 +582,7 @@ void slapt_add_reinstall_to_transaction(slapt_transaction_t *tran,
slapt_pkg_info_t *slapt_upgrade_pkg
)
{
- _slapt_add_upgrade_to_transaction(tran, installed_pkg, slapt_upgrade_pkg, SLAPT_TRUE);
+ _slapt_add_upgrade_to_transaction(tran, installed_pkg, slapt_upgrade_pkg, true);
}
void slapt_add_upgrade_to_transaction(slapt_transaction_t *tran,
@@ -590,14 +590,14 @@ void slapt_add_upgrade_to_transaction(slapt_transaction_t *tran,
slapt_pkg_info_t *slapt_upgrade_pkg
)
{
- _slapt_add_upgrade_to_transaction(tran, installed_pkg, slapt_upgrade_pkg, SLAPT_FALSE);
+ _slapt_add_upgrade_to_transaction(tran, installed_pkg, slapt_upgrade_pkg, false);
}
static void _slapt_add_upgrade_to_transaction(slapt_transaction_t *tran,
slapt_pkg_info_t *installed_pkg,
slapt_pkg_info_t *slapt_upgrade_pkg,
- SLAPT_BOOL_T reinstall
+ bool reinstall
)
{
slapt_pkg_upgrade_t **tmp_list;
@@ -642,7 +642,7 @@ static void _slapt_add_upgrade_to_transaction(slapt_transaction_t *tran,
++tran->upgrade_pkgs->pkg_count;
- if (reinstall == SLAPT_TRUE)
+ if (reinstall == true)
++tran->upgrade_pkgs->reinstall_count;
}
@@ -705,7 +705,7 @@ void slapt_free_transaction(slapt_transaction_t *tran)
{
unsigned int i;
- if (tran->install_pkgs->free_pkgs == SLAPT_TRUE) {
+ if (tran->install_pkgs->free_pkgs == true) {
for (i = 0;i < tran->install_pkgs->pkg_count; ++i) {
slapt_free_pkg(tran->install_pkgs->pkgs[i]);
}
@@ -713,7 +713,7 @@ void slapt_free_transaction(slapt_transaction_t *tran)
free(tran->install_pkgs->pkgs);
free(tran->install_pkgs);
- if (tran->remove_pkgs->free_pkgs == SLAPT_TRUE) {
+ if (tran->remove_pkgs->free_pkgs == true) {
for (i = 0;i < tran->remove_pkgs->pkg_count; ++i) {
slapt_free_pkg(tran->remove_pkgs->pkgs[i]);
}
@@ -729,7 +729,7 @@ void slapt_free_transaction(slapt_transaction_t *tran)
free(tran->upgrade_pkgs->pkgs);
free(tran->upgrade_pkgs);
- if (tran->exclude_pkgs->free_pkgs == SLAPT_TRUE) {
+ if (tran->exclude_pkgs->free_pkgs == true) {
for (i = 0; i < tran->exclude_pkgs->pkg_count; ++i) {
slapt_free_pkg(tran->exclude_pkgs->pkgs[i]);
}
@@ -836,7 +836,7 @@ int slapt_add_deps_to_trans(const slapt_rc_config *global_config,
int dep_return = -1;
slapt_pkg_list_t *deps = NULL;
- if (global_config->disable_dep_check == SLAPT_TRUE)
+ if (global_config->disable_dep_check == true)
return 0;
if (pkg == NULL)
@@ -851,7 +851,7 @@ int slapt_add_deps_to_trans(const slapt_rc_config *global_config,
/* check to see if there where issues with dep checking */
/* exclude the package if dep check barfed */
- if ((dep_return == -1) && (global_config->ignore_dep == SLAPT_FALSE) &&
+ if ((dep_return == -1) && (global_config->ignore_dep == false) &&
(slapt_get_exact_pkg(tran->exclude_pkgs,pkg->name,pkg->version) == NULL)
) {
slapt_free_pkg_list(deps);