From 4af6c72d790e13fd28abc0d7b2eaaece51fd7862 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 20 Apr 2011 19:45:16 -0500 Subject: 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 --- src/pacman/pacman.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/pacman/pacman.c') diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 4c43c36a..7e9fd6b9 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -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(_(" -y, --refresh download fresh package databases from the server\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:\n", str_opt); addlist(_(" --asdeps mark packages as non-explicitly installed\n")); @@ -240,7 +240,7 @@ static void version(void) static void localize(void) { static int init = 0; - if (!init) { + if(!init) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); @@ -264,7 +264,7 @@ static void setuseragent(void) static void setarch(const char *arch) { - if (strcmp(arch, "auto") == 0) { + if(strcmp(arch, "auto") == 0) { struct utsname un; uname(&un); 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 int init = 0; - if (!init) { + if(!init) { int ret = 0; pm_printf(PM_LOG_DEBUG, "setlibpaths() called\n"); @@ -594,7 +594,7 @@ static int parsearg_trans(int opt) static int parsearg_remove(int opt) { - if (parsearg_trans(opt) == 0) + if(parsearg_trans(opt) == 0) return 0; switch(opt) { case 'c': config->flags |= PM_TRANS_FLAG_CASCADE; break; @@ -615,7 +615,7 @@ static int parsearg_remove(int opt) /* options common to -S -U */ static int parsearg_upgrade(int opt) { - if (parsearg_trans(opt) == 0) + if(parsearg_trans(opt) == 0) return 0; switch(opt) { 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) { - if (parsearg_upgrade(opt) == 0) + if(parsearg_upgrade(opt) == 0) return 0; switch(opt) { case OP_NEEDED: config->flags |= PM_TRANS_FLAG_NEEDED; break; @@ -787,7 +787,7 @@ static int parseargs(int argc, char *argv[]) result = 1; break; } - if (result == 0) { + if(result == 0) { continue; } @@ -823,9 +823,9 @@ static int option_add_syncfirst(const char *name) { /* helper for being used with setrepeatingoption */ static int option_add_cleanmethod(const char *value) { - if (strcmp(value, "KeepInstalled") == 0) { + if(strcmp(value, "KeepInstalled") == 0) { config->cleanmethod |= PM_CLEAN_KEEPINST; - } else if (strcmp(value, "KeepCurrent") == 0) { + } else if(strcmp(value, "KeepCurrent") == 0) { config->cleanmethod |= PM_CLEAN_KEEPCUR; } else { 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); 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) { config->gpgdir = strdup(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) { config->logfile = strdup(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); alpm_option_set_fetchcb(download_with_xfercommand); 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); } 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); } else if(strcmp(value, "Optional") == 0) { alpm_option_set_default_sigverify(PM_PGP_VERIFY_OPTIONAL); @@ -1262,18 +1262,18 @@ static int _parseconfig(const char *file, const char *givensection, goto cleanup; } } else if(strcmp(key, "VerifySig") == 0) { - if (strcmp(value, "Always") == 0) { - ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_ALWAYS); - } else if (strcmp(value, "Optional") == 0) { - ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_OPTIONAL); - } else if (strcmp(value, "Never") == 0) { - ret = alpm_db_set_pgp_verify(db,PM_PGP_VERIFY_NEVER); + if(strcmp(value, "Always") == 0) { + ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_ALWAYS); + } else if(strcmp(value, "Optional") == 0) { + ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_OPTIONAL); + } else if(strcmp(value, "Never") == 0) { + ret = alpm_db_set_pgp_verify(db, PM_PGP_VERIFY_NEVER); } else { pm_printf(PM_LOG_ERROR, _("invalid value for 'VerifySig' : '%s'\n"), value); ret = 1; 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"), alpm_db_get_name(db), value, alpm_strerrorlast()); goto cleanup; @@ -1438,7 +1438,7 @@ int main(int argc, char *argv[]) } } /* check for buffer overflow */ - if (i >= PATH_MAX) { + if(i >= PATH_MAX) { pm_printf(PM_LOG_ERROR, _("buffer overflow detected in arg parsing\n")); cleanup(EXIT_FAILURE); } @@ -1448,7 +1448,7 @@ int main(int argc, char *argv[]) line[i] = '\0'; 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"), strerror(errno)); } -- cgit v1.2.3-70-g09d2