aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-11-09 00:18:05 +0000
committerMike Frysinger <vapier@gentoo.org>2006-11-09 00:18:05 +0000
commit2e47392dace8f653c89a012c696eb75480b0093b (patch)
treed8680eff00890a3f307b8819f4be6c5731552e41
parenttest for x* func usage and code style (diff)
downloadportage-utils-2e47392dace8f653c89a012c696eb75480b0093b.tar.gz
portage-utils-2e47392dace8f653c89a012c696eb75480b0093b.tar.bz2
portage-utils-2e47392dace8f653c89a012c696eb75480b0093b.zip
fix style/whitespace
-rw-r--r--libq/atom_explode.c4
-rw-r--r--libq/human_readable.c7
-rw-r--r--libq/md5_sha1_sum.c2
-rw-r--r--libq/virtuals.c99
-rw-r--r--main.c123
-rw-r--r--q.c6
-rw-r--r--qcache.c209
-rw-r--r--qcheck.c8
-rw-r--r--qdepends.c6
-rw-r--r--qfile.c42
-rw-r--r--qglsa.c6
-rw-r--r--qgrep.c6
-rw-r--r--qlist.c35
-rw-r--r--qlop.c6
-rw-r--r--qmerge.c139
-rw-r--r--qpy.c11
-rw-r--r--qsearch.c8
-rw-r--r--qsize.c10
-rw-r--r--quse.c7
-rw-r--r--qxpak.c6
20 files changed, 396 insertions, 344 deletions
diff --git a/libq/atom_explode.c b/libq/atom_explode.c
index d16c2ab..30cc444 100644
--- a/libq/atom_explode.c
+++ b/libq/atom_explode.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/atom_explode.c,v 1.16 2006/11/08 23:27:11 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/atom_explode.c,v 1.17 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -109,7 +109,7 @@ retry_suffix:
if (slen > len) continue;
while (slen < len) {
if (ptr[slen] && !isdigit(ptr[slen]) && ptr[slen]!='-') {
- /* ok, it was a fake out ... lets skip this
+ /* ok, it was a fake out ... lets skip this
* fake and try to match the suffix again
*/
ptr_tmp = ptr + 1;
diff --git a/libq/human_readable.c b/libq/human_readable.c
index 5832333..bdef428 100644
--- a/libq/human_readable.c
+++ b/libq/human_readable.c
@@ -75,11 +75,10 @@ const char *make_human_readable_str(unsigned long long size,
}
#if 0
/* Sample code to omit decimal point and tenths digit. */
- if ( /* no_tenths */ 1 ) {
- if ( frac >= 5 ) {
+ if (1) { /* no_tenths */
+ if (frac >= 5)
++val;
- }
- f = "%Lu%*c" /* fmt_no_tenths */ ;
+ f = "%Lu%*c"; /* fmt_no_tenths */
frac = 1;
}
#endif
diff --git a/libq/md5_sha1_sum.c b/libq/md5_sha1_sum.c
index fb7765d..f8a84e0 100644
--- a/libq/md5_sha1_sum.c
+++ b/libq/md5_sha1_sum.c
@@ -54,7 +54,7 @@ static unsigned char *hash_file(const char *filename, uint8_t hash_algo)
if (fd != -1) {
static uint8_t hash_value_bin[20];
static unsigned char *hash_value;
- hash_value =
+ hash_value =
(hash_fd(fd, -1, hash_algo, hash_value_bin) != -2 ?
hash_bin_to_hex(hash_value_bin, hash_algo == HASH_MD5 ? 16 : 20) :
NULL);
diff --git a/libq/virtuals.c b/libq/virtuals.c
index 2de4fc1..c974c33 100644
--- a/libq/virtuals.c
+++ b/libq/virtuals.c
@@ -1,12 +1,12 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v 1.13 2006/11/08 23:27:11 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v 1.14 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
*
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v 1.13 2006/11/08 23:27:11 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v 1.14 2006/11/09 00:18:05 vapier Exp $
*/
@@ -17,7 +17,7 @@
/* used to queue a lot of things */
struct queue_t {
- char *name;
+ char *name;
char *item;
struct queue_t *next;
};
@@ -36,29 +36,29 @@ void free_virtuals(queue *list);
queue *add_set(const char *vv, const char *ss, queue *q)
{
queue *ll, *z;
- char *s, *ptr;
+ char *s, *ptr;
char *v, *vptr;
s = xstrdup(ss);
- v = xstrdup(vv);
+ v = xstrdup(vv);
ptr = xmalloc(strlen(ss));
vptr = xmalloc(strlen(vv));
-
- do {
+
+ do {
*ptr = 0;
- *vptr = 0;
+ *vptr = 0;
rmspace(ptr);
- rmspace(s);
+ rmspace(s);
rmspace(vptr);
rmspace(v);
ll = xmalloc(sizeof(queue));
ll->next = NULL;
ll->name = xmalloc(strlen(v) + 1);
- ll->item = xmalloc(strlen(s) + 1);
- strcpy(ll->item, s);
+ ll->item = xmalloc(strlen(s) + 1);
+ strcpy(ll->item, s);
strcpy(ll->name, v);
-
+
if (q == NULL)
q = ll;
else {
@@ -76,20 +76,20 @@ queue *add_set(const char *vv, const char *ss, queue *q)
} while (v[0]);
free(s);
free(ptr);
- free(v);
+ free(v);
free(vptr);
return q;
}
/* remove a set from a cache. matches ->name and frees name,item */
queue *del_set(char *s, queue *q, int *ok)
-{
+{
queue *ll, *list, *old;
ll = q;
list = q;
- old = q;
+ old = q;
*ok = 0;
-
+
while (ll != NULL) {
if (strcmp(ll->name, s) == 0) {
if (ll == list) {
@@ -98,12 +98,12 @@ queue *del_set(char *s, queue *q, int *ok)
free(ll->item);
free(ll);
ll = list;
-
+
} else {
old->next = ll->next;
- free(ll->name);
+ free(ll->name);
free(ll->item);
- free(ll);
+ free(ll);
ll = old->next;
}
*ok = 1;
@@ -120,10 +120,10 @@ void free_sets(queue *list);
void free_sets(queue *list)
{
queue *ll, *q;
- ll = list;
+ ll = list;
while (ll != NULL) {
q = ll->next;
- free(ll->name);
+ free(ll->name);
free(ll->item);
free(ll);
ll = q;
@@ -149,29 +149,30 @@ void print_sets(queue *list)
}
queue *resolve_vdb_virtuals(char *vdb);
-queue *resolve_vdb_virtuals(char *vdb) {
- DIR *dir, *dirp;
- struct dirent *dentry_cat, *dentry_pkg;
- char buf[BUFSIZE];
- depend_atom *atom;
+queue *resolve_vdb_virtuals(char *vdb)
+{
+ DIR *dir, *dirp;
+ struct dirent *dentry_cat, *dentry_pkg;
+ char buf[BUFSIZE];
+ depend_atom *atom;
chdir("/");
- /* now try to run through vdb and locate matches for user inputs */
- if ((dir = opendir(vdb)) == NULL)
- return virtuals;
+ /* now try to run through vdb and locate matches for user inputs */
+ if ((dir = opendir(vdb)) == NULL)
+ return virtuals;
- /* scan all the categories */
- while ((dentry_cat = q_vdb_get_next_dir(dir)) != NULL) {
- snprintf(buf, sizeof(buf), "%s/%s", vdb, dentry_cat->d_name);
- if ((dirp = opendir(buf)) == NULL)
- continue;
+ /* scan all the categories */
+ while ((dentry_cat = q_vdb_get_next_dir(dir)) != NULL) {
+ snprintf(buf, sizeof(buf), "%s/%s", vdb, dentry_cat->d_name);
+ if ((dirp = opendir(buf)) == NULL)
+ continue;
- /* scan all the packages in this category */
- while ((dentry_pkg = q_vdb_get_next_dir(dirp)) != NULL) {
+ /* scan all the packages in this category */
+ while ((dentry_pkg = q_vdb_get_next_dir(dirp)) != NULL) {
FILE *fp;
char *p;
- /* see if user wants any of these packages */
+ /* see if user wants any of these packages */
snprintf(buf, sizeof(buf), "%s/%s/%s/PROVIDE", vdb, dentry_cat->d_name, dentry_pkg->d_name);
if ((fp = fopen(buf, "r")) != NULL) {
fgets(buf, sizeof(buf), fp);
@@ -184,13 +185,13 @@ queue *resolve_vdb_virtuals(char *vdb) {
if (*buf) {
int ok = 0;
char *v, *tmp = xstrdup(buf);
- snprintf(buf, sizeof(buf), "%s/%s", dentry_cat->d_name, dentry_pkg->d_name);
+ snprintf(buf, sizeof(buf), "%s/%s", dentry_cat->d_name, dentry_pkg->d_name);
atom = atom_explode(buf);
if (!atom) {
warn("could not explode '%s'", buf);
continue;
- }
+ }
sprintf(buf, "%s/%s", atom->CATEGORY, atom->PN);
if ((v = virtual(tmp, virtuals)) != NULL) {
// IF_DEBUG(fprintf(stderr, "%s provided by %s (removing)\n", tmp, v));
@@ -203,13 +204,14 @@ queue *resolve_vdb_virtuals(char *vdb) {
}
fclose(fp);
}
- }
- }
+ }
+ }
return virtuals;
}
static queue *resolve_local_profile_virtuals();
-static queue *resolve_local_profile_virtuals() {
+static queue *resolve_local_profile_virtuals()
+{
char buf[BUFSIZ];
FILE *fp;
char *p;
@@ -218,9 +220,9 @@ static queue *resolve_local_profile_virtuals() {
for (i = 0; i < sizeof(paths)/sizeof(paths[0]); i++) {
if ((fp = fopen(paths[i], "r")) != NULL) {
- while((fgets(buf, sizeof(buf), fp)) != NULL) {
+ while ((fgets(buf, sizeof(buf), fp)) != NULL) {
if (*buf != 'v') continue;
- for (p = buf ; *p != 0; ++p) if (isspace(*p)) *p = ' ';
+ for (p = buf; *p != 0; ++p) if (isspace(*p)) *p = ' ';
if ((p = strchr(buf, ' ')) != NULL) {
int ok = 0;
*p = 0;
@@ -236,7 +238,8 @@ static queue *resolve_local_profile_virtuals() {
}
static queue *resolve_virtuals();
-static queue *resolve_virtuals() {
+static queue *resolve_virtuals()
+{
static char buf[BUFSIZ];
static char savecwd[_POSIX_PATH_MAX];
static char *p;
@@ -261,9 +264,9 @@ static queue *resolve_virtuals() {
return virtuals;
vstart:
if ((fp = fopen("virtuals", "r")) != NULL) {
- while((fgets(buf, sizeof(buf), fp)) != NULL) {
+ while ((fgets(buf, sizeof(buf), fp)) != NULL) {
if (*buf != 'v') continue;
- for (p = buf ; *p != 0; ++p) if (isspace(*p)) *p = ' ';
+ for (p = buf; *p != 0; ++p) if (isspace(*p)) *p = ' ';
if ((p = strchr(buf, ' ')) != NULL) {
*p = 0;
if (virtual(buf, virtuals) == NULL)
@@ -273,7 +276,7 @@ static queue *resolve_virtuals() {
fclose(fp);
}
if ((fp = fopen("parent", "r")) != NULL) {
- while((fgets(buf, sizeof(buf), fp)) != NULL) {
+ while ((fgets(buf, sizeof(buf), fp)) != NULL) {
rmspace(buf);
if (!*buf) continue;
if (*buf == '#') continue;
diff --git a/main.c b/main.c
index 8379337..81d8ea2 100644
--- a/main.c
+++ b/main.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.c,v 1.126 2006/11/08 23:27:11 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.c,v 1.127 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -138,7 +138,8 @@ void init_coredumps(void)
#include "libq/libq.c"
void no_colors(void);
-void no_colors() {
+void no_colors()
+{
// echo $(awk '{print $4,"="}' libq/colors.c | grep ^* |cut -c 2-| grep ^[A-Z] |tr '\n' ' ') = \"\"\;
BOLD = NORM = BLUE = DKBLUE = CYAN = GREEN = DKGREEN = MAGENTA = RED = YELLOW = BRYELLOW = WHITE = "";
setenv("NOCOLOR", "true", 1);
@@ -297,45 +298,47 @@ static char *remove_extra_space(char *str)
}
void freeargv(int, char **);
-void freeargv(int argc, char **argv) {
+void freeargv(int argc, char **argv)
+{
int i;
- if (argc > 0) {
- for (i = 0; i < argc; i++)
- free(argv[i]);
- free(argv);
- }
+ if (argc > 0) {
+ for (i = 0; i < argc; i++)
+ free(argv[i]);
+ free(argv);
+ }
}
void makeargv(char *string, int *argc, char ***argv);
-void makeargv(char *string, int *argc, char ***argv) {
+void makeargv(char *string, int *argc, char ***argv)
+{
int curc = 2;
- char *q, *p, *str;
+ char *q, *p, *str;
(*argv) = (char **) malloc(sizeof(char **) * curc);
- *argc = 1;
+ *argc = 1;
(*argv)[0] = xstrdup(argv0);
- q = xstrdup(string);
+ q = xstrdup(string);
str = q;
- remove_extra_space(str);
+ remove_extra_space(str);
rmspace(str);
while (str) {
if ((p = strchr(str, ' ')) != NULL)
*(p++) = '\0';
- if (*argc == curc) {
+ if (*argc == curc) {
curc *= 2;
(*argv) = (char **) realloc(*argv, sizeof(char **) * curc);
- }
- (*argv)[*argc] = xstrdup(str);
- (*argc)++;
- str = p;
- }
+ }
+ (*argv)[*argc] = xstrdup(str);
+ (*argc)++;
+ str = p;
+ }
free(q);
}
-/*
+/*
* Parse a line of CONTENTS file and provide access to the individual fields
*/
typedef enum {
@@ -365,10 +368,10 @@ contents_entry *contents_parse_line(char *line)
if ((p = strrchr(line, '\n')) != NULL)
*p = '\0';
- /* ferringb wants to break portage/vdb by using tabs vs spaces
- * so filenames can have lame ass spaces in them..
+ /* ferringb wants to break portage/vdb by using tabs vs spaces
+ * so filenames can have lame ass spaces in them..
* (I smell Windows near by)
- * Anyway we just convert that crap to a space so we can still
+ * Anyway we just convert that crap to a space so we can still
* parse quickly */
for (x = 0; x < strlen(line); x++)
@@ -427,8 +430,9 @@ contents_entry *contents_parse_line(char *line)
return &e;
}
-char *strincr_var(const char *, char *, char *, const size_t );
-char *strincr_var(const char *name, char *s, char *value, const size_t value_len) {
+char *strincr_var(const char *, char *, char *, const size_t);
+char *strincr_var(const char *name, char *s, char *value, const size_t value_len)
+{
char buf[BUFSIZ];
char *p;
@@ -438,7 +442,7 @@ char *strincr_var(const char *name, char *s, char *value, const size_t value_len
while ((p = strstr(value, "-*")) != NULL)
memset(value, ' ', (strlen(value)-strlen(p))+2);
- /* This function is mainly used by the startup code for parsing
+ /* This function is mainly used by the startup code for parsing
make.conf and stacking variables remove.
variables can be in the form of ${v} or $v
works:
@@ -483,17 +487,17 @@ void initialize_portage_env(void)
char *value;
const size_t value_len;
} vars_to_read[] = {
- {"ACCEPT_LICENSE", 14, _Q_STR, accept_license, sizeof(accept_license)},
- {"INSTALL_MASK", 12, _Q_ISTR, install_mask, sizeof(install_mask)},
- {"ARCH", 4, _Q_STR, portarch, sizeof(portarch)},
- {"CONFIG_PROTECT", 14, _Q_STR, config_protect, sizeof(config_protect)},
- {"NOCOLOR", 7, _Q_BOOL, &nocolor, 1},
- {"FEATURES",8, _Q_ISTR, features, sizeof(features)},
- {"PORTDIR", 7, _Q_STR, portdir, sizeof(portdir)},
- {"PORTAGE_BINHOST", 15, _Q_STR, binhost, sizeof(binhost)},
- {"PORTAGE_TMPDIR", 14, _Q_STR, port_tmpdir, sizeof(port_tmpdir)},
- {"PKGDIR", 6, _Q_STR, pkgdir, sizeof(pkgdir)},
- {"ROOT", 4, _Q_STR, portroot, sizeof(portroot)}
+ {"ACCEPT_LICENSE", 14, _Q_STR, accept_license, sizeof(accept_license)},
+ {"INSTALL_MASK", 12, _Q_ISTR, install_mask, sizeof(install_mask)},
+ {"ARCH", 4, _Q_STR, portarch, sizeof(portarch)},
+ {"CONFIG_PROTECT", 14, _Q_STR, config_protect, sizeof(config_protect)},
+ {"NOCOLOR", 7, _Q_BOOL, &nocolor, 1},
+ {"FEATURES", 8, _Q_ISTR, features, sizeof(features)},
+ {"PORTDIR", 7, _Q_STR, portdir, sizeof(portdir)},
+ {"PORTAGE_BINHOST", 15, _Q_STR, binhost, sizeof(binhost)},
+ {"PORTAGE_TMPDIR", 14, _Q_STR, port_tmpdir, sizeof(port_tmpdir)},
+ {"PKGDIR", 6, _Q_STR, pkgdir, sizeof(pkgdir)},
+ {"ROOT", 4, _Q_STR, portroot, sizeof(portroot)}
};
if ((p = strchr(portroot, '/')) != NULL)
@@ -639,7 +643,7 @@ const char *initialize_flat(int cache_type)
if (access(cache_file, R_OK) == 0)
goto ret;
if (!quiet)
- warn("Updating ebuild %scache ... ", cache_type == CACHE_EBUILD ? "" : "meta" );
+ warn("Updating ebuild %scache ... ", cache_type == CACHE_EBUILD ? "" : "meta");
unlink(cache_file);
if (errno != ENOENT) {
@@ -657,7 +661,7 @@ const char *initialize_flat(int cache_type)
if ((a = scandir(".", &category, filter_hidden, alphasort)) < 0)
goto ret;
- for (i = 0 ; i < a; i++) {
+ for (i = 0; i < a; i++) {
stat(category[i]->d_name, &st);
if (!S_ISDIR(st.st_mode))
continue;
@@ -688,21 +692,21 @@ const char *initialize_flat(int cache_type)
}
if ((e = scandir(de, &eb, filter_hidden, alphasort)) < 0)
continue;
- for (d = 0 ; d < e; d++) {
+ for (d = 0; d < e; d++) {
if ((p = strrchr(eb[d]->d_name, '.')) != NULL)
if (strcmp(p, ".ebuild") == 0) {
count++;
fprintf(fp, "%s/%s/%s\n", category[i]->d_name, pn[c]->d_name, eb[d]->d_name);
}
}
- while(d--) free(eb[d]);
+ while (d--) free(eb[d]);
free(eb);
}
- while(b--) free(pn[b]);
+ while (b--) free(pn[b]);
free(pn);
}
fclose(fp);
- while(a--) free(category[a]);
+ while (a--) free(category[a]);
free(category);
if (quiet) goto ret;
@@ -711,7 +715,6 @@ const char *initialize_flat(int cache_type)
if (start.tv_usec > finish.tv_usec) {
finish.tv_usec += 1000000;
finish.tv_sec--;
-
}
frac = (finish.tv_usec - start.tv_usec);
secs = (finish.tv_sec - start.tv_sec);
@@ -911,30 +914,32 @@ void cache_free(portage_cache *cache)
}
char *grab_vdb_item(const char *, const char *, const char *);
-char *grab_vdb_item(const char *item, const char *CATEGORY, const char *PF) {
- static char buf[_Q_PATH_MAX];
- char *p;
- FILE *fp;
+char *grab_vdb_item(const char *item, const char *CATEGORY, const char *PF)
+{
+ static char buf[_Q_PATH_MAX];
+ char *p;
+ FILE *fp;
snprintf(buf, sizeof(buf), "%s%s/%s/%s/%s", portroot, portvdb, CATEGORY, PF, item);
if ((fp = fopen(buf, "r")) == NULL)
- return NULL;
+ return NULL;
fgets(buf, sizeof(buf), fp);
- if ((p = strchr(buf, '\n')) != NULL)
+ if ((p = strchr(buf, '\n')) != NULL)
*p = 0;
fclose(fp);
rmspace(buf);
-
+
return buf;
}
queue *get_vdb_atoms(void);
-queue *get_vdb_atoms(void) {
+queue *get_vdb_atoms(void)
+{
int cfd, j;
int dfd, i;
char buf[_Q_PATH_MAX];
- static char savecwd[_POSIX_PATH_MAX];
+ static char savecwd[_POSIX_PATH_MAX];
struct dirent **cat;
struct dirent **pf;
@@ -942,7 +947,7 @@ queue *get_vdb_atoms(void) {
depend_atom *atom = NULL;
queue *cpf = NULL;
- getcwd(savecwd, sizeof(savecwd));
+ getcwd(savecwd, sizeof(savecwd));
assert(chdir(savecwd) == 0);
@@ -957,7 +962,7 @@ queue *get_vdb_atoms(void) {
if ((cfd = scandir(".", &cat, filter_hidden, alphasort)) < 0)
goto fuckit;
- for (j = 0; j < cfd ; j++) {
+ for (j = 0; j < cfd; j++) {
if (cat[j]->d_name[0] == '-')
continue;
if (chdir(cat[j]->d_name) != 0)
@@ -986,15 +991,14 @@ queue *get_vdb_atoms(void) {
snprintf(buf, sizeof(buf), "%s/%s-%s", atom->CATEGORY, atom->PN, atom->PV);
atom_implode(atom);
cpf = add_set(buf, "0", cpf);
-
}
chdir("..");
- while(dfd--) free(pf[dfd]);
+ while (dfd--) free(pf[dfd]);
free(pf);
}
/* cleanup */
- while(cfd--) free(cat[cfd]);
+ while (cfd--) free(cat[cfd]);
free(cat);
fuckit:
@@ -1002,7 +1006,8 @@ fuckit:
return cpf;
}
-void cleanup() {
+void cleanup()
+{
reinitialize_as_needed();
free_sets(virtuals);
fclose(stderr);
diff --git a/q.c b/q.c
index 85b45c6..65a2c4e 100644
--- a/q.c
+++ b/q.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/q.c,v 1.32 2006/07/09 14:27:52 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/q.c,v 1.33 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -20,7 +20,7 @@ static const char *q_opts_help[] = {
"Reinitialize metadata cache",
COMMON_OPTS_HELP
};
-static const char q_rcsid[] = "$Id: q.c,v 1.32 2006/07/09 14:27:52 solar Exp $";
+static const char q_rcsid[] = "$Id: q.c,v 1.33 2006/11/09 00:18:05 vapier Exp $";
#define q_usage(ret) usage(ret, Q_FLAGS, q_long_opts, q_opts_help, lookup_applet_idx("q"))
@@ -119,7 +119,7 @@ int q_main(int argc, char **argv)
if ((func = lookup_applet(argv[optind])) == NULL)
return 1;
- /* In case of "q --option ... appletname ...", remove appletname from the
+ /* In case of "q --option ... appletname ...", remove appletname from the
* applet's args, exchange "appletname" and "--option". */
if (optind > 1) {
char* appletname = argv[optind];
diff --git a/qcache.c b/qcache.c
index ad238e8..85a6c15 100644
--- a/qcache.c
+++ b/qcache.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qcache.c,v 1.18 2006/11/08 23:27:11 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qcache.c,v 1.19 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2006 Thomas A. Cort - <tcort@gentoo.org>
*/
@@ -48,7 +48,7 @@ static const char *qcache_opts_help[] = {
COMMON_OPTS_HELP
};
-static const char qcache_rcsid[] = "$Id: qcache.c,v 1.18 2006/11/08 23:27:11 vapier Exp $";
+static const char qcache_rcsid[] = "$Id: qcache.c,v 1.19 2006/11/09 00:18:05 vapier Exp $";
#define qcache_usage(ret) usage(ret, QCACHE_FLAGS, qcache_long_opts, qcache_opts_help, lookup_applet_idx("qcache"))
/********************************************************************/
@@ -76,7 +76,7 @@ typedef struct {
/********************************************************************/
char **archlist; /* Read from PORTDIR/profiles/arch.list in qcache_init() */
-char status[3] = {'-','~','+'};
+char status[3] = {'-', '~', '+'};
int qcache_skip, qcache_test_arch, qcache_last = 0;
char *qcache_matchpkg = NULL, *qcache_matchcat = NULL;
@@ -101,7 +101,8 @@ enum { none = 0, testing, stable, minus };
* int - one of the following enum { none = 0, testing, stable, minus };
*/
int decode_status(char c);
-int decode_status(char c) {
+int decode_status(char c)
+{
switch (c) {
case '-': return minus;
case '~': return testing;
@@ -120,7 +121,8 @@ int decode_status(char c) {
* int pos - location of arch in archlist[]
*/
int decode_arch(const char *arch);
-int decode_arch(const char *arch) {
+int decode_arch(const char *arch)
+{
int i;
char *p;
@@ -145,21 +147,22 @@ int decode_arch(const char *arch) {
* int *keywords - an array of keywords that coincides with archlist
*/
void print_keywords(char *category, char *ebuild, int *keywords);
-void print_keywords(char *category, char *ebuild, int *keywords) {
+void print_keywords(char *category, char *ebuild, int *keywords)
+{
int i;
char *package;
package = xstrdup(ebuild);
package[strlen(ebuild)-7] = '\0';
- printf("%s%s/%s%s%s ",BOLD,category,BLUE,package,NORM);
+ printf("%s%s/%s%s%s ", BOLD, category, BLUE, package, NORM);
for (i = 0; archlist[i]; i++) {
switch (keywords[i]) {
case stable:
- printf("%s%c%s%s ",GREEN,status[keywords[i]],archlist[i],NORM);
+ printf("%s%c%s%s ", GREEN, status[keywords[i]], archlist[i], NORM);
break;
case testing:
- printf("%s%c%s%s ",YELLOW,status[keywords[i]],archlist[i],NORM);
+ printf("%s%c%s%s ", YELLOW, status[keywords[i]], archlist[i], NORM);
break;
default:
break;
@@ -182,7 +185,8 @@ void print_keywords(char *category, char *ebuild, int *keywords) {
* int rc - -1 is returned on error (if !s || !keywords)
*/
int read_keywords(char *s, int *keywords);
-int read_keywords(char *s, int *keywords) {
+int read_keywords(char *s, int *keywords)
+{
char *arch, delim[2] = { ' ', '\0' };
int i;
@@ -224,14 +228,15 @@ int read_keywords(char *s, int *keywords) {
* -1 is returned if the file cannot be read.
*/
inline unsigned int qcache_count_lines(char *filename);
-inline unsigned int qcache_count_lines(char *filename) {
+inline unsigned int qcache_count_lines(char *filename)
+{
unsigned int count, fd;
char c;
if ((fd = open(filename, O_RDONLY)) != -1) {
count = 0;
- while(read(fd,&c,1) == 1)
+ while (read(fd, &c, 1) == 1)
if (c == '\n')
count++;
@@ -255,7 +260,8 @@ inline unsigned int qcache_count_lines(char *filename) {
* NULL is returned if an error occurs.
*/
char **qcache_read_lines(char *filename);
-char **qcache_read_lines(char *filename) {
+char **qcache_read_lines(char *filename)
+{
unsigned int len, fd, count, i, num_lines;
char **lines, c;
@@ -264,22 +270,23 @@ char **qcache_read_lines(char *filename) {
len = sizeof(char*) * (num_lines + 1);
lines = xmalloc(len);
- memset(lines,0,len);
+ memset(lines, 0, len);
if ((fd = open(filename, O_RDONLY)) != -1) {
for (i = 0; i < num_lines; i++) {
count = 0;
/* determine the space needed for storing the line */
- while(read(fd,&c,1) == 1 && c != '\n') count++;
- lseek(fd,lseek(fd,0,SEEK_CUR)-count-1,SEEK_SET);
+ while (read(fd, &c, 1) == 1 && c != '\n')
+ count++;
+ lseek(fd, (lseek(fd, 0, SEEK_CUR) - count - 1), SEEK_SET);
- lines[i] = xmalloc(sizeof(char)*(count+1));
- memset(lines[i],0,count+1);
+ lines[i] = xmalloc(sizeof(char) * (count+1));
+ memset(lines[i], 0, count+1);
/* copy the line into lines[i] */
- read(fd,lines[i],count);
- read(fd,&c,1); /* skip '\n' */
+ read(fd, lines[i], count);
+ read(fd, &c, 1); /* skip '\n' */
}
close(fd);
@@ -295,10 +302,11 @@ char **qcache_read_lines(char *filename) {
* free()'s memory allocated by qcache_read_lines
*/
void qcache_free_lines(char **lines);
-void qcache_free_lines(char **lines) {
+void qcache_free_lines(char **lines)
+{
int i;
- for (i = 0; lines[i]; i++)
+ for (i = 0; lines[i]; i++)
free(lines[i]);
free(lines);
@@ -317,7 +325,8 @@ void qcache_free_lines(char **lines) {
* NULL is returned when an error occurs.
*/
portage_cache *qcache_read_cache_file(const char *filename);
-portage_cache *qcache_read_cache_file(const char *filename) {
+portage_cache *qcache_read_cache_file(const char *filename)
+{
struct stat s;
char *ptr, buf[BUFSIZE];
FILE *f;
@@ -380,15 +389,15 @@ portage_cache *qcache_read_cache_file(const char *filename) {
ret->SRC_URI = xstrdup(buf + 8);
}
- ret->atom = atom_explode(filename);
+ ret->atom = atom_explode(filename);
fclose(f);
- return ret;
+ return ret;
err:
- if (ret) cache_free(ret);
- return NULL;
-
+ if (ret)
+ cache_free(ret);
+ return NULL;
}
/*
@@ -400,7 +409,8 @@ err:
* portage_cache *cache - the portage_cache to be free()'d
*/
void qcache_free_data(portage_cache *cache);
-void qcache_free_data(portage_cache *cache) {
+void qcache_free_data(portage_cache *cache)
+{
int i;
char **c;
@@ -433,7 +443,8 @@ void qcache_free_data(portage_cache *cache) {
* 0 (SAME)
*/
int qcache_vercmp(const void *x, const void *y);
-int qcache_vercmp(const void *x, const void *y) {
+int qcache_vercmp(const void *x, const void *y)
+{
switch (atom_compare_str((*((const struct dirent **)x))->d_name, (*((const struct dirent **)y))->d_name)) {
case NEWER: return -1;
case OLDER: return 1;
@@ -456,7 +467,8 @@ int qcache_vercmp(const void *x, const void *y) {
* int - 0 if filename begins with '.' or is "metadata.xml", otherwise 1
*/
int qcache_file_select(const struct dirent *entry);
-int qcache_file_select(const struct dirent *entry) {
+int qcache_file_select(const struct dirent *entry)
+{
return !(entry->d_name[0] == '.' || (strcmp(entry->d_name, "metadata.xml") == 0));
}
@@ -471,8 +483,9 @@ int qcache_file_select(const struct dirent *entry) {
* int - 1 if the filename ends in ".ebuild", otherwise 0
*/
int qcache_ebuild_select(const struct dirent *entry);
-int qcache_ebuild_select(const struct dirent *entry) {
- return ((strlen(entry->d_name) > 7) && !strcmp(entry->d_name+strlen(entry->d_name)-7,".ebuild"));
+int qcache_ebuild_select(const struct dirent *entry)
+{
+ return ((strlen(entry->d_name) > 7) && !strcmp(entry->d_name+strlen(entry->d_name)-7, ".ebuild"));
}
/********************************************************************/
@@ -492,7 +505,8 @@ int qcache_ebuild_select(const struct dirent *entry) {
* exit or return -1 on failure.
*/
int qcache_traverse(void (*func)(qcache_data*));
-int qcache_traverse(void (*func)(qcache_data*)) {
+int qcache_traverse(void (*func)(qcache_data*))
+{
qcache_data data;
char *catpath, *pkgpath, *ebuildpath, *cachepath;
int i, j, k, len, num_cat, num_pkg, num_ebuild;
@@ -500,8 +514,8 @@ int qcache_traverse(void (*func)(qcache_data*)) {
len = sizeof(char) * (strlen(QCACHE_EDB) + strlen(portdir) + 1);
catpath = xmalloc(len);
- memset(catpath,0,len);
- snprintf(catpath,len,"%s%s",QCACHE_EDB,portdir);
+ memset(catpath, 0, len);
+ snprintf(catpath, len, "%s%s", QCACHE_EDB, portdir);
if (-1 == (num_cat = scandir(catpath, &categories, qcache_file_select, alphasort))) {
err("%s %s", catpath, strerror(errno));
@@ -516,7 +530,7 @@ int qcache_traverse(void (*func)(qcache_data*)) {
len = sizeof(char) * (strlen(portdir) + strlen("/") + strlen(categories[i]->d_name) + 1);
pkgpath = xmalloc(len);
memset(pkgpath, 0, len);
- snprintf(pkgpath,len,"%s/%s",portdir,categories[i]->d_name);
+ snprintf(pkgpath, len, "%s/%s", portdir, categories[i]->d_name);
if (-1 == (num_pkg = scandir(pkgpath, &packages, qcache_file_select, alphasort))) {
warn("%s %s", catpath, strerror(errno));
@@ -541,7 +555,7 @@ int qcache_traverse(void (*func)(qcache_data*)) {
len = sizeof(char) * (strlen(portdir) + strlen("/") + strlen(categories[i]->d_name) + strlen("/") + strlen(packages[j]->d_name) + 1);
ebuildpath = xmalloc(len);
memset(ebuildpath, 0, len);
- snprintf(ebuildpath,len,"%s/%s/%s",portdir,categories[i]->d_name,packages[j]->d_name);
+ snprintf(ebuildpath, len, "%s/%s/%s", portdir, categories[i]->d_name, packages[j]->d_name);
if (-1 == (num_ebuild = scandir(ebuildpath, &ebuilds, qcache_ebuild_select, qcache_vercmp))) {
warn("%s %s", ebuildpath, strerror(errno));
@@ -568,7 +582,7 @@ int qcache_traverse(void (*func)(qcache_data*)) {
len = sizeof(char) * (strlen(catpath) + strlen("/") + strlen(categories[i]->d_name) + strlen("/") + strlen(ebuilds[k]->d_name) + 1);
cachepath = xmalloc(len);
memset(cachepath, 0, len);
- snprintf(cachepath,len,"%s/%s/%s",catpath,categories[i]->d_name,ebuilds[k]->d_name);
+ snprintf(cachepath, len, "%s/%s/%s", catpath, categories[i]->d_name, ebuilds[k]->d_name);
cachepath[len-8] = '\0'; /* remove ".ebuild" */
data.cache_data = qcache_read_cache_file(cachepath);
@@ -611,7 +625,8 @@ int qcache_traverse(void (*func)(qcache_data*)) {
/********************************************************************/
void qcache_imlate(qcache_data *data);
-void qcache_imlate(qcache_data *data) {
+void qcache_imlate(qcache_data *data)
+{
int *keywords, i = 0;
while (archlist[i])
@@ -619,8 +634,8 @@ void qcache_imlate(qcache_data *data) {
keywords = xmalloc(sizeof(int)*i);
- if (read_keywords(data->cache_data->KEYWORDS,keywords) < 0) {
- warn("Failed to read keywords for %s%s/%s%s%s",BOLD,data->category,BLUE,data->ebuild,NORM);
+ if (read_keywords(data->cache_data->KEYWORDS, keywords) < 0) {
+ warn("Failed to read keywords for %s%s/%s%s%s", BOLD, data->category, BLUE, data->ebuild, NORM);
free(keywords);
return;
}
@@ -637,14 +652,15 @@ void qcache_imlate(qcache_data *data) {
if (keywords[i] != stable)
continue;
qcache_skip = 1;
- print_keywords(data->category,data->ebuild,keywords);
+ print_keywords(data->category, data->ebuild, keywords);
}
}
free(keywords);
}
void qcache_not(qcache_data *data);
-void qcache_not(qcache_data *data) {
+void qcache_not(qcache_data *data)
+{
int *keywords, i = 0;
while (archlist[i])
@@ -652,8 +668,8 @@ void qcache_not(qcache_data *data) {
keywords = xmalloc(sizeof(int)*i);
- if (read_keywords(data->cache_data->KEYWORDS,keywords) < 0) {
- warn("Failed to read keywords for %s%s/%s%s%s",BOLD,data->category,BLUE,data->ebuild,NORM);
+ if (read_keywords(data->cache_data->KEYWORDS, keywords) < 0) {
+ warn("Failed to read keywords for %s%s/%s%s%s", BOLD, data->category, BLUE, data->ebuild, NORM);
free(keywords);
return;
}
@@ -661,14 +677,15 @@ void qcache_not(qcache_data *data) {
if (keywords[qcache_test_arch] == testing || keywords[qcache_test_arch] == stable) {
qcache_skip = 1;
} else if (data->cur == data->num) {
- printf("%s%s/%s%s%s\n",BOLD,data->category,BLUE,data->package,NORM);
+ printf("%s%s/%s%s%s\n", BOLD, data->category, BLUE, data->package, NORM);
}
free(keywords);
}
void qcache_all(qcache_data *data);
-void qcache_all(qcache_data *data) {
+void qcache_all(qcache_data *data)
+{
int *keywords, i = 0;
while (archlist[i])
@@ -676,22 +693,23 @@ void qcache_all(qcache_data *data) {
keywords = xmalloc(sizeof(int)*i);
- if (read_keywords(data->cache_data->KEYWORDS,keywords) < 0) {
- warn("Failed to read keywords for %s%s/%s%s%s",BOLD,data->category,BLUE,data->ebuild,NORM);
+ if (read_keywords(data->cache_data->KEYWORDS, keywords) < 0) {
+ warn("Failed to read keywords for %s%s/%s%s%s", BOLD, data->category, BLUE, data->ebuild, NORM);
free(keywords);
return;
}
- if (keywords[qcache_test_arch] == stable || keywords[qcache_test_arch] == testing) {
+ if (keywords[qcache_test_arch] == stable || keywords[qcache_test_arch] == testing) {
qcache_skip = 1;
- printf("%s%s/%s%s%s\n",BOLD,data->category,BLUE,data->package,NORM);
+ printf("%s%s/%s%s%s\n", BOLD, data->category, BLUE, data->package, NORM);
}
- free(keywords);
+ free(keywords);
}
void qcache_dropped(qcache_data *data);
-void qcache_dropped(qcache_data *data) {
+void qcache_dropped(qcache_data *data)
+{
static int possible = 0;
int *keywords, i = 0;
@@ -703,8 +721,8 @@ void qcache_dropped(qcache_data *data) {
keywords = xmalloc(sizeof(int)*i);
- if (read_keywords(data->cache_data->KEYWORDS,keywords) < 0) {
- warn("Failed to read keywords for %s%s/%s%s%s",BOLD,data->category,BLUE,data->ebuild,NORM);
+ if (read_keywords(data->cache_data->KEYWORDS, keywords) < 0) {
+ warn("Failed to read keywords for %s%s/%s%s%s", BOLD, data->category, BLUE, data->ebuild, NORM);
free(keywords);
return;
}
@@ -713,7 +731,7 @@ void qcache_dropped(qcache_data *data) {
qcache_skip = 1;
if (possible) {
- printf("%s%s/%s%s%s\n",BOLD,data->category,BLUE,data->package,NORM);
+ printf("%s%s/%s%s%s\n", BOLD, data->category, BLUE, data->package, NORM);
}
free(keywords);
@@ -730,11 +748,12 @@ void qcache_dropped(qcache_data *data) {
}
}
- free(keywords);
+ free(keywords);
}
void qcache_stats(qcache_data *data);
-void qcache_stats(qcache_data *data) {
+void qcache_stats(qcache_data *data)
+{
static time_t runtime;
static unsigned int numpkg = 0;
static unsigned int numebld = 0;
@@ -756,8 +775,8 @@ void qcache_stats(qcache_data *data) {
len = sizeof(char) * (strlen(QCACHE_EDB) + strlen(portdir) + 1);
catpath = xmalloc(len);
- memset(catpath,0,len);
- snprintf(catpath,len,"%s%s",QCACHE_EDB,portdir);
+ memset(catpath, 0, len);
+ snprintf(catpath, len, "%s%s", QCACHE_EDB, portdir);
if (-1 == (numcat = scandir(catpath, &categories, qcache_file_select, alphasort))) {
err("%s %s", catpath, strerror(errno));
@@ -775,21 +794,20 @@ void qcache_stats(qcache_data *data) {
keywords = (int*) malloc(sizeof( int)*architectures);
current_package_keywords = (int*) malloc(sizeof( int)*architectures);
- memset(packages_stable,0,architectures*sizeof(unsigned int));
- memset(packages_testing,0,architectures*sizeof(unsigned int));
- memset(keywords,0,architectures*sizeof(int));
- memset(current_package_keywords,0,architectures*sizeof(int));
+ memset(packages_stable, 0, architectures*sizeof(unsigned int));
+ memset(packages_testing, 0, architectures*sizeof(unsigned int));
+ memset(keywords, 0, architectures*sizeof(int));
+ memset(current_package_keywords, 0, architectures*sizeof(int));
}
if (data->cur == 1) {
numpkg++;
- memset(current_package_keywords,0,architectures*sizeof(int));
+ memset(current_package_keywords, 0, architectures*sizeof(int));
} numebld++;
-
- memset(keywords,0,architectures*sizeof(int));
- if (read_keywords(data->cache_data->KEYWORDS,keywords) < 0) {
- warn("Failed to read keywords for %s%s/%s%s%s",BOLD,data->category,BLUE,data->ebuild,NORM);
+ memset(keywords, 0, architectures*sizeof(int));
+ if (read_keywords(data->cache_data->KEYWORDS, keywords) < 0) {
+ warn("Failed to read keywords for %s%s/%s%s%s", BOLD, data->category, BLUE, data->ebuild, NORM);
free(keywords);
return;
}
@@ -809,7 +827,7 @@ void qcache_stats(qcache_data *data) {
if (data->cur == data->num) {
for (i = 0; i < architectures; i++) {
- switch(current_package_keywords[i]) {
+ switch (current_package_keywords[i]) {
case stable:
packages_stable[i]++;
break;
@@ -821,35 +839,34 @@ void qcache_stats(qcache_data *data) {
}
}
-
if (qcache_last) {
printf("+-------------------------+\n");
printf("| general statistics |\n");
printf("+-------------------------+\n");
- printf("| %s%13s%s | %s%7d%s |\n",GREEN,"architectures",NORM,BLUE,architectures,NORM);
- printf("| %s%13s%s | %s%7d%s |\n",GREEN,"categories",NORM,BLUE,numcat,NORM);
- printf("| %s%13s%s | %s%7d%s |\n",GREEN,"packages",NORM,BLUE,numpkg,NORM);
- printf("| %s%13s%s | %s%7d%s |\n",GREEN,"ebuilds",NORM,BLUE,numebld,NORM);
+ printf("| %s%13s%s | %s%7d%s |\n", GREEN, "architectures", NORM, BLUE, architectures, NORM);
+ printf("| %s%13s%s | %s%7d%s |\n", GREEN, "categories", NORM, BLUE, numcat, NORM);
+ printf("| %s%13s%s | %s%7d%s |\n", GREEN, "packages", NORM, BLUE, numpkg, NORM);
+ printf("| %s%13s%s | %s%7d%s |\n", GREEN, "ebuilds", NORM, BLUE, numebld, NORM);
printf("+-------------------------+\n\n");
printf("+----------------------------------------------------------+\n");
printf("| keyword distribution |\n");
printf("+----------------------------------------------------------+\n");
- printf("| %s%12s%s |%s%8s%s |%s%8s%s |%s%8s%s | %s%8s%s |\n",RED,"architecture",NORM,RED,"stable",NORM,RED,"~arch",NORM,RED,"total",NORM,RED,"total/#pkgs",NORM);
- printf("| | |%s%8s%s | | |\n",RED,"only",NORM);
+ printf("| %s%12s%s |%s%8s%s |%s%8s%s |%s%8s%s | %s%8s%s |\n", RED, "architecture", NORM, RED, "stable", NORM, RED, "~arch", NORM, RED, "total", NORM, RED, "total/#pkgs", NORM);
+ printf("| | |%s%8s%s | | |\n", RED, "only", NORM);
printf("+----------------------------------------------------------+\n");
for (i = 0; i < architectures; i++) {
- printf("| %s%12s%s |",GREEN,archlist[i],NORM);
- printf("%s%8d%s |",BLUE,packages_stable[i],NORM);
- printf("%s%8d%s |",BLUE,packages_testing[i],NORM);
- printf("%s%8d%s |",BLUE,packages_testing[i]+packages_stable[i],NORM);
- printf("%s%11.2f%s%% |\n",BLUE,(100.0*(packages_testing[i]+packages_stable[i]))/numpkg,NORM);
+ printf("| %s%12s%s |", GREEN, archlist[i], NORM);
+ printf("%s%8d%s |", BLUE, packages_stable[i], NORM);
+ printf("%s%8d%s |", BLUE, packages_testing[i], NORM);
+ printf("%s%8d%s |", BLUE, packages_testing[i]+packages_stable[i], NORM);
+ printf("%s%11.2f%s%% |\n", BLUE, (100.0*(packages_testing[i]+packages_stable[i]))/numpkg, NORM);
}
printf("+----------------------------------------------------------+\n\n");
- printf("Completed in %s%d%s seconds.\n",BLUE,(int)(time(NULL)-runtime),NORM);
+ printf("Completed in %s%d%s seconds.\n", BLUE, (int)(time(NULL)-runtime), NORM);
free(packages_stable);
free(packages_testing);
@@ -859,7 +876,8 @@ void qcache_stats(qcache_data *data) {
}
void qcache_testing_only(qcache_data *data);
-void qcache_testing_only(qcache_data *data) {
+void qcache_testing_only(qcache_data *data)
+{
static int possible = 0;
int *keywords, i = 0;
@@ -871,8 +889,8 @@ void qcache_testing_only(qcache_data *data) {
keywords = xmalloc(sizeof(int)*i);
- if (read_keywords(data->cache_data->KEYWORDS,keywords) < 0) {
- warn("Failed to read keywords for %s%s/%s%s%s",BOLD,data->category,BLUE,data->ebuild,NORM);
+ if (read_keywords(data->cache_data->KEYWORDS, keywords) < 0) {
+ warn("Failed to read keywords for %s%s/%s%s%s", BOLD, data->category, BLUE, data->ebuild, NORM);
free(keywords);
return;
}
@@ -888,10 +906,9 @@ void qcache_testing_only(qcache_data *data) {
possible = 1;
if (data->cur == data->num && possible) {
- printf("%s%s/%s%s%s\n",BOLD,data->category,BLUE,data->package,NORM);
+ printf("%s%s/%s%s%s\n", BOLD, data->category, BLUE, data->package, NORM);
}
-
free(keywords);
}
@@ -910,15 +927,16 @@ void qcache_testing_only(qcache_data *data) {
* -1 is returned on error.
*/
int qcache_init();
-int qcache_init() {
+int qcache_init()
+{
char *filename;
unsigned int len;
len = sizeof(char) * (strlen(portdir) + strlen("/profiles/arch.list") + 1);
filename = xmalloc(len);
- memset(filename,0,len);
- snprintf(filename,len,"%s/profiles/arch.list",portdir);
+ memset(filename, 0, len);
+ snprintf(filename, len, "%s/profiles/arch.list", portdir);
if (NULL == (archlist = qcache_read_lines(filename))) {
free(filename);
@@ -935,7 +953,8 @@ int qcache_init() {
* Deallocate variables (archlist)
*/
void qcache_free();
-void qcache_free() {
+void qcache_free()
+{
qcache_free_lines(archlist);
}
@@ -943,7 +962,8 @@ void qcache_free() {
/* main */
/********************************************************************/
-int qcache_main(int argc, char **argv) {
+int qcache_main(int argc, char **argv)
+{
int i, action = 0;
DBG("argc=%d argv[0]=%s argv[1]=%s",
@@ -994,4 +1014,3 @@ int qcache_main(int argc, char **argv) {
#else
DEFINE_APPLET_STUB(qcache)
#endif
-
diff --git a/qcheck.c b/qcheck.c
index 1a72c98..9f51c00 100644
--- a/qcheck.c
+++ b/qcheck.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qcheck.c,v 1.27 2006/05/24 03:30:42 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qcheck.c,v 1.28 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -20,7 +20,7 @@ static const char *qcheck_opts_help[] = {
"Update chksum and mtimes for packages",
COMMON_OPTS_HELP
};
-static const char qcheck_rcsid[] = "$Id: qcheck.c,v 1.27 2006/05/24 03:30:42 vapier Exp $";
+static const char qcheck_rcsid[] = "$Id: qcheck.c,v 1.28 2006/11/09 00:18:05 vapier Exp $";
#define qcheck_usage(ret) usage(ret, QCHECK_FLAGS, qcheck_long_opts, qcheck_opts_help, lookup_applet_idx("qcheck"))
@@ -73,7 +73,7 @@ int qcheck_main(int argc, char **argv)
/* see if this cat/pkg is requested */
if (!search_all) {
for (i = optind; i < argc; ++i) {
- snprintf(buf, sizeof(buf), "%s/%s", dentry->d_name,
+ snprintf(buf, sizeof(buf), "%s/%s", dentry->d_name,
de->d_name);
if (rematch(argv[i], buf, REG_EXTENDED) == 0)
break;
@@ -91,7 +91,7 @@ int qcheck_main(int argc, char **argv)
strncat(buf, "~", sizeof(buf));
num_files = num_files_ok = num_files_unknown = 0;
printf("%sing %s%s/%s%s ...\n",
- (qc_update ? "Updat" : "Check"),
+ (qc_update ? "Updat" : "Check"),
GREEN, dentry->d_name, de->d_name, NORM);
if (qc_update) {
if ((fpx = fopen(buf, "w")) == NULL) {
diff --git a/qdepends.c b/qdepends.c
index 431a347..9f1f2b8 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.41 2006/11/08 23:27:11 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.42 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -30,7 +30,7 @@ static const char *qdepends_opts_help[] = {
"Show all DEPEND info",
COMMON_OPTS_HELP
};
-static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.41 2006/11/08 23:27:11 vapier Exp $";
+static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.42 2006/11/09 00:18:05 vapier Exp $";
#define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, lookup_applet_idx("qdepends"))
static char qdep_name_only = 0;
@@ -379,7 +379,7 @@ int qdepends_main_vdb(const char *depend_file, int argc, char **argv)
/* see if this cat/pkg is requested */
for (i = optind; i < argc; ++i) {
- snprintf(buf, sizeof(buf), "%s/%s", dentry->d_name,
+ snprintf(buf, sizeof(buf), "%s/%s", dentry->d_name,
de->d_name);
if (rematch(argv[i], buf, REG_EXTENDED) == 0)
break;
diff --git a/qfile.c b/qfile.c
index 3855df3..972116d 100644
--- a/qfile.c
+++ b/qfile.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qfile.c,v 1.35 2006/08/21 00:11:54 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qfile.c,v 1.36 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -22,11 +22,12 @@ static const char *qfile_opts_help[] = {
"Assume arguments are already prefixed by $ROOT",
COMMON_OPTS_HELP
};
-static char qfile_rcsid[] = "$Id: qfile.c,v 1.35 2006/08/21 00:11:54 solar Exp $";
+static char qfile_rcsid[] = "$Id: qfile.c,v 1.36 2006/11/09 00:18:05 vapier Exp $";
#define qfile_usage(ret) usage(ret, QFILE_FLAGS, qfile_long_opts, qfile_opts_help, lookup_applet_idx("qfile"))
-static inline short qfile_is_prefix(const char* path, const char* prefix, int prefix_length) {
- return !prefix_length
+static inline short qfile_is_prefix(const char* path, const char* prefix, int prefix_length)
+{
+ return !prefix_length
|| (strlen(path) >= prefix_length
&& (path[prefix_length] == '/' || path[prefix_length] == '\0')
&& !strncmp(path, prefix, prefix_length));
@@ -76,8 +77,8 @@ void qfile(char *path, int argc, char* root, char* real_root, char* bn_firstchar
// used to cut the number of strcmp() calls
bn_firstchar = entry_basename[0];
-
- for(i = 0; i < argc; i++) {
+
+ for (i = 0; i < argc; i++) {
if (base_names[i] == NULL)
continue;
if (non_orphans != NULL && non_orphans[i])
@@ -100,11 +101,11 @@ void qfile(char *path, int argc, char* root, char* real_root, char* bn_firstchar
*(p + 1) = '\0';
else
*p = '\0';
- if (dir_names[i] != NULL &&
+ if (dir_names[i] != NULL &&
strcmp(entry_dirname, dir_names[i]) == 0)
// dir_name == dirname(CONTENTS)
path_ok = 1;
- else if (real_dir_names[i] != NULL &&
+ else if (real_dir_names[i] != NULL &&
strcmp(entry_dirname, real_dir_names[i]) == 0)
// real_dir_name == dirname(CONTENTS)
path_ok = 1;
@@ -117,19 +118,19 @@ void qfile(char *path, int argc, char* root, char* real_root, char* bn_firstchar
realpath(fullpath, rpath);
if (errno != 0) {
if (verbose) {
- warn("Could not read real path of \"%s\" (from %s): %s",
+ warn("Could not read real path of \"%s\" (from %s): %s",
fullpath, pkg, strerror(errno));
- warn("We'll never know whether \"%s/%s\" was a result for your query...",
+ warn("We'll never know whether \"%s/%s\" was a result for your query...",
entry_dirname, entry_basename);
}
} else if (!qfile_is_prefix(rpath, real_root, strlen(real_root))) {
if (verbose)
warn("Real path of \"%s\" is not under ROOT: %s", fullpath, rpath);
- } else if (dir_names[i] != NULL &&
+ } else if (dir_names[i] != NULL &&
strcmp(rpath + strlen(real_root), dir_names[i]) == 0)
// dir_name == realpath(dirname(CONTENTS))
path_ok = 1;
- else if (real_dir_names[i] != NULL &&
+ else if (real_dir_names[i] != NULL &&
strcmp(rpath + strlen(real_root), real_dir_names[i]) == 0)
// real_dir_name == realpath(dirname(CONTENTS))
path_ok = 1;
@@ -155,7 +156,7 @@ void qfile(char *path, int argc, char* root, char* real_root, char* bn_firstchar
printf(" (%s%s)\n", root, e->name);
else
printf(" (%s)\n", e->name);
-
+
atom_implode(atom);
} else {
non_orphans[i] = 1;
@@ -266,9 +267,10 @@ int qfile_main(int argc, char **argv)
// Record basename, but if it is ".", ".." or "/"
strncpy(tmppath, basename(argv[i+optind]), _Q_PATH_MAX);
- if ((strlen(tmppath) > 2) ||
- (strncmp(tmppath, "..", strlen(tmppath))
- && strncmp(tmppath, "/", strlen(tmppath)))) {
+ if ((strlen(tmppath) > 2) ||
+ (strncmp(tmppath, "..", strlen(tmppath))
+ && strncmp(tmppath, "/", strlen(tmppath))))
+ {
basenames[i] = xstrdup(tmppath);
basenames_firstchars[i] = basenames[i][0];
// If there is no "/" in the argument, then it's over.
@@ -295,7 +297,7 @@ int qfile_main(int argc, char **argv)
if (basenames[i] != NULL) {
// Get both the dirname and its realpath. This paths will
- // have no trailing slash, but if it is the only char (ie.,
+ // have no trailing slash, but if it is the only char (ie.,
// when searching for "/foobar").
strncpy(tmppath, abspath, _Q_PATH_MAX);
strncpy(abspath, dirname(tmppath), _Q_PATH_MAX);
@@ -310,7 +312,7 @@ int qfile_main(int argc, char **argv)
warn("Results for query item \"%s\" may be inaccurate.", argv[i+optind]);
}
continue;
- }
+ }
if (!qfile_is_prefix(tmppath, real_root, real_root_length)) {
warn("Real path of \"%s\" is not under ROOT: %s", abspath, tmppath);
goto skip_query_item;
@@ -321,7 +323,7 @@ int qfile_main(int argc, char **argv)
realdirnames[i] = xstrdup(tmppath + real_root_length);
} else {
// No basename means we are looking for something like "/foo/bar/.."
- // Dirname is meaningless here, we can only get realpath of the full
+ // Dirname is meaningless here, we can only get realpath of the full
// path and then split it.
errno = 0;
realpath(abspath, tmppath);
@@ -363,7 +365,7 @@ int qfile_main(int argc, char **argv)
if (non_orphans != NULL) {
// display orphan files
for (i = 0; i < (argc-optind); i++) {
- if (non_orphans[i])
+ if (non_orphans[i])
continue;
if (basenames[i] != NULL) {
found = 0; // ~inverse return code (as soon as an orphan is found, return non-zero)
diff --git a/qglsa.c b/qglsa.c
index ab99373..865639e 100644
--- a/qglsa.c
+++ b/qglsa.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qglsa.c,v 1.6 2006/04/21 22:15:47 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qglsa.c,v 1.7 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -31,7 +31,7 @@ static const char *qglsa_opts_help[] = {
"Mark specified GLSAs as fixed",
COMMON_OPTS_HELP
};
-static const char qglsa_rcsid[] = "$Id: qglsa.c,v 1.6 2006/04/21 22:15:47 vapier Exp $";
+static const char qglsa_rcsid[] = "$Id: qglsa.c,v 1.7 2006/11/09 00:18:05 vapier Exp $";
#define qglsa_usage(ret) usage(ret, QGLSA_FLAGS, qglsa_long_opts, qglsa_opts_help, lookup_applet_idx("qglsa"))
@@ -153,7 +153,7 @@ static const char *qglsa_opts_portage[] = {
static void qglsa_act_list(char *glsa)
{
-
+
}
*/
int qglsa_main(int argc, char **argv)
diff --git a/qgrep.c b/qgrep.c
index 6217a21..b4fecb3 100644
--- a/qgrep.c
+++ b/qgrep.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qgrep.c,v 1.14 2006/02/12 23:54:05 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qgrep.c,v 1.15 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -27,7 +27,7 @@ static const char *qgrep_opts_help[] = {
"Use PATTERN as a regular expression",
COMMON_OPTS_HELP
};
-static const char qgrep_rcsid[] = "$Id: qgrep.c,v 1.14 2006/02/12 23:54:05 solar Exp $";
+static const char qgrep_rcsid[] = "$Id: qgrep.c,v 1.15 2006/11/09 00:18:05 vapier Exp $";
#define qgrep_usage(ret) usage(ret, QGREP_FLAGS, qgrep_long_opts, qgrep_opts_help, lookup_applet_idx("qgrep"))
int qgrep_main(int argc, char **argv)
@@ -102,7 +102,7 @@ int qgrep_main(int argc, char **argv)
count++;
if (do_count) continue;
if (verbose || show_filename) {
- printf("%s:", ebuild);
+ printf("%s:", ebuild);
if (verbose > 1) printf("%d:", lineno);
printf(" ");
}
diff --git a/qlist.c b/qlist.c
index de2e852..61402c2 100644
--- a/qlist.c
+++ b/qlist.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlist.c,v 1.41 2006/08/19 16:10:24 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlist.c,v 1.42 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -37,19 +37,20 @@ static const char *qlist_opts_help[] = {
/* "query filename for pkgname", */
COMMON_OPTS_HELP
};
-static const char qlist_rcsid[] = "$Id: qlist.c,v 1.41 2006/08/19 16:10:24 solar Exp $";
+static const char qlist_rcsid[] = "$Id: qlist.c,v 1.42 2006/11/09 00:18:05 vapier Exp $";
#define qlist_usage(ret) usage(ret, QLIST_FLAGS, qlist_long_opts, qlist_opts_help, lookup_applet_idx("qlist"))
extern char *grab_vdb_item(const char *, const char *, const char *);
queue *filter_dups(queue *sets);
-queue *filter_dups(queue *sets) {
+queue *filter_dups(queue *sets)
+{
queue *ll = NULL;
queue *dups = NULL;
queue *list = NULL;
- for (list = sets ; list != NULL; list = list->next) {
- for ( ll = sets ; ll != NULL; ll = ll->next) {
+ for (list = sets; list != NULL; list = list->next) {
+ for (ll = sets; ll != NULL; ll = ll->next) {
if ((strcmp(ll->name, list->name) == 0) && (strcmp(ll->item, list->item) != 0)) {
int ok = 0;
dups = del_set(ll->item, dups, &ok);
@@ -61,7 +62,8 @@ queue *filter_dups(queue *sets) {
return dups;
}
-static char *grab_pkg_umap(char *CAT, char *PV) {
+static char *grab_pkg_umap(char *CAT, char *PV)
+{
static char umap[BUFSIZ] = "";
char *use = NULL;
char *iuse = NULL;
@@ -80,8 +82,8 @@ static char *grab_pkg_umap(char *CAT, char *PV) {
memset(umap, 0, sizeof(umap));
makeargv(iuse, &iuse_argc, &iuse_argv);
- for (u = 1 ; u < use_argc; u++) {
- for (i = 1 ; i < iuse_argc; i++) {
+ for (u = 1; u < use_argc; u++) {
+ for (i = 1; i < iuse_argc; i++) {
if ((strcmp(use_argv[u], iuse_argv[i])) == 0) {
strncat(umap, use_argv[u], sizeof(umap));
strncat(umap, " ", sizeof(umap));
@@ -95,7 +97,7 @@ static char *grab_pkg_umap(char *CAT, char *PV) {
/* filter out the dup use flags */
use_argc = 0; use_argv = NULL;
makeargv(umap, &use_argc, &use_argv);
- for (i = 1 ; i < use_argc; i++) {
+ for (i = 1; i < use_argc; i++) {
int ok = 0;
sets = del_set(use_argv[i], sets, &ok);
sets = add_set(use_argv[i], use_argv[i], sets);
@@ -114,7 +116,8 @@ static char *grab_pkg_umap(char *CAT, char *PV) {
}
static char *umapstr(char display, char *cat, char *name);
-static char *umapstr(char display, char *cat, char *name) {
+static char *umapstr(char display, char *cat, char *name)
+{
static char buf[BUFSIZ] = "";
char *umap = NULL;
@@ -176,7 +179,7 @@ int qlist_main(int argc, char **argv)
return EXIT_FAILURE;
/* open /var/db/pkg */
- for (j = 0; j < dfd ; j++) {
+ for (j = 0; j < dfd; j++) {
int a, x;
if (cat[j]->d_name[0] == '-')
continue;
@@ -187,7 +190,7 @@ int qlist_main(int argc, char **argv)
if ((a = scandir(".", &de, filter_hidden, alphasort)) < 0)
continue;
- for (x = 0 ; x < a; x++) {
+ for (x = 0; x < a; x++) {
FILE *fp;
if (de[x]->d_name[0] == '.' || de[x]->d_name[0] == '-')
@@ -195,7 +198,7 @@ int qlist_main(int argc, char **argv)
/* see if this cat/pkg is requested */
for (i = optind; i < argc; ++i) {
- snprintf(buf, sizeof(buf), "%s/%s", cat[j]->d_name,
+ snprintf(buf, sizeof(buf), "%s/%s", cat[j]->d_name,
de[x]->d_name);
if (exact) {
@@ -238,7 +241,7 @@ int qlist_main(int argc, char **argv)
slot = grab_vdb_item("SLOT", cat[j]->d_name, de[x]->d_name);
/* display it */
- printf("%s%s/%s%s%s%s%s%s%s", BOLD, cat[j]->d_name, BLUE,
+ printf("%s%s/%s%s%s%s%s%s%s", BOLD, cat[j]->d_name, BLUE,
(pkgname ? pkgname->PN : de[x]->d_name), NORM,
YELLOW, slot ? " ": "", slot ? slot : "", NORM);
puts(umapstr(show_umap, cat[j]->d_name, de[x]->d_name));
@@ -287,7 +290,7 @@ int qlist_main(int argc, char **argv)
}
fclose(fp);
}
- while(a--) free(de[a]);
+ while (a--) free(de[a]);
free(de);
chdir("..");
}
@@ -318,7 +321,7 @@ int qlist_main(int argc, char **argv)
free_sets(dups);
free_sets(sets);
}
- while(dfd--) free(cat[dfd]);
+ while (dfd--) free(cat[dfd]);
free(cat);
return EXIT_SUCCESS;
}
diff --git a/qlop.c b/qlop.c
index b7fd62b..8460472 100644
--- a/qlop.c
+++ b/qlop.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.33 2006/09/11 04:02:01 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.34 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -41,7 +41,7 @@ static const char *qlop_opts_help[] = {
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.33 2006/09/11 04:02:01 vapier Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.34 2006/11/09 00:18:05 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -227,7 +227,7 @@ void show_emerge_history(char listflag, int argc, char **argv, const char *logfi
if ((p = strchr(q, ' ')) == NULL)
continue;
*p = 0;
- } else if((listflag & QLOP_UNLIST) && !strncmp(q, ">>> unmerge success: ", 21)) {
+ } else if ((listflag & QLOP_UNLIST) && !strncmp(q, ">>> unmerge success: ", 21)) {
merged = 0;
if ((p = strchr(q, ':')) == NULL)
continue;
diff --git a/qmerge.c b/qmerge.c
index 3f99215..597fc37 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.53 2006/08/21 00:14:57 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.54 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -50,14 +50,14 @@ static const char *qmerge_opts_help[] = {
"Don't prompt before overwriting",
"Don't merge dependencies",
"Don't verify MD5 digest of files",
- COMMON_OPTS_HELP
+ COMMON_OPTS_HELP
};
-static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.53 2006/08/21 00:14:57 solar Exp $";
+static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.54 2006/11/09 00:18:05 vapier Exp $";
#define qmerge_usage(ret) usage(ret, QMERGE_FLAGS, qmerge_long_opts, qmerge_opts_help, lookup_applet_idx("qmerge"))
char search_pkgs = 0;
-char interactive = 1;
+char interactive = 1;
char install = 0;
char uninstall = 0;
char force_download = 0;
@@ -90,7 +90,7 @@ void pkg_fetch(int, char **, struct pkg_t *);
void print_Pkg(int, struct pkg_t *);
int parse_packages(const char *, int, char **);
int config_protected(const char *, int, char **);
-int match_pkg(const char *, struct pkg_t *);
+int match_pkg(const char *, struct pkg_t *);
int pkg_verify_checksums(char *, struct pkg_t *, depend_atom *, int strict, int display);
int unmerge_packages(int, char **);
char *find_binpkg(const char *);
@@ -98,7 +98,8 @@ char *find_binpkg(const char *);
struct pkg_t *grab_binpkg_info(const char *);
int q_unlink_q(char *, const char *, int);
-int q_unlink_q(char *path, const char *func, int line) {
+int q_unlink_q(char *path, const char *func, int line)
+{
if ((strcmp(path, "/bin/sh") == 0) || (strcmp(path, BUSYBOX) == 0)) {
warn("Oh hell no: unlink(%s) from %s line %d", path, func, line);
return 1;
@@ -111,7 +112,8 @@ int q_unlink_q(char *path, const char *func, int line) {
#define unlink_q(path) q_unlink_q(path, __FUNCTION__, __LINE__)
// rewrite using copyfile() utime() stat(), lstat(), read() and perms.
-int interactive_rename(const char *src, const char *dst, struct pkg_t *pkg) {
+int interactive_rename(const char *src, const char *dst, struct pkg_t *pkg)
+{
FILE *fp;
char *p;
int ret;
@@ -146,7 +148,8 @@ int interactive_rename(const char *src, const char *dst, struct pkg_t *pkg) {
return ret;
}
-void fetch(const char *destdir, const char *src) {
+void fetch(const char *destdir, const char *src)
+{
char buf[BUFSIZ];
fflush(stdout);
@@ -154,9 +157,9 @@ void fetch(const char *destdir, const char *src) {
#if 0
if (getenv("FETCHCOMMAND") != NULL) {
- snprintf(buf, sizeof(buf), "(export DISTDIR='%s' URI='%s/%s' ; %s)",
+ snprintf(buf, sizeof(buf), "(export DISTDIR='%s' URI='%s/%s'; %s)",
destdir, binhost, src, getenv("FETCHCOMMAND"));
- } else
+ } else
#endif
{
snprintf(buf, sizeof(buf), "%s " BUSYBOX " wget %s -P %s %s/%s", (force_download || install) ? "" : pretend ? "echo " : "",
@@ -167,7 +170,8 @@ void fetch(const char *destdir, const char *src) {
fflush(stderr);
}
-void qmerge_initialize(const char *Packages) {
+void qmerge_initialize(const char *Packages)
+{
if (strlen(BUSYBOX))
if (access(BUSYBOX, X_OK) != 0)
err(BUSYBOX " must be installed");
@@ -186,7 +190,7 @@ void qmerge_initialize(const char *Packages) {
if (!binhost[0])
errf("PORTAGE_BINHOST= does not appear to be valid");
-
+
if ((access(pkgdir, R_OK|W_OK|X_OK)) != 0)
errf("Fatal errors with PKGDIR='%s'", pkgdir);
@@ -202,13 +206,14 @@ void qmerge_initialize(const char *Packages) {
fetch("./", Packages);
}
-char *best_version(const char *CATEGORY, const char *PN) {
+char *best_version(const char *CATEGORY, const char *PN)
+{
static char buf[1024];
FILE *fp;
char *p;
// if defined(EBUG) this spits out incorrect versions.
- snprintf(buf, sizeof(buf), "qlist -CIev %s%s%s 2>/dev/null | tr '\n' ' '",
+ snprintf(buf, sizeof(buf), "qlist -CIev %s%s%s 2>/dev/null | tr '\n' ' '",
(CATEGORY != NULL ? CATEGORY : ""), (CATEGORY != NULL ? "/" : ""), PN);
if ((fp = popen(buf, "r")) == NULL)
@@ -223,7 +228,8 @@ char *best_version(const char *CATEGORY, const char *PN) {
return (char *) buf;
}
-int config_protected(const char *buf, int ARGC, char **ARGV) {
+int config_protected(const char *buf, int ARGC, char **ARGV)
+{
int i;
for (i = 1; i < ARGC; i++)
@@ -241,7 +247,8 @@ int config_protected(const char *buf, int ARGC, char **ARGV) {
#if 0
queue *resolve_rdepends(const int, const struct pkg_t *, queue *);
-queue *resolve_rdepends(const int level, const struct pkg_t *package, queue *depends) {
+queue *resolve_rdepends(const int level, const struct pkg_t *package, queue *depends)
+{
struct pkg_t *pkg = NULL;
char buf[1024];
int i;
@@ -270,7 +277,7 @@ queue *resolve_rdepends(const int level, const struct pkg_t *package, queue *dep
// Walk the rdepends here. Merging what need be.
for (i = 1; i < ARGC; i++) {
depend_atom *subatom;
- switch(ARGV[i][0]) {
+ switch (ARGV[i][0]) {
case '|':
case '!':
case '~':
@@ -291,7 +298,7 @@ queue *resolve_rdepends(const int level, const struct pkg_t *package, queue *dep
if (virtuals == NULL)
virtuals = resolve_virtuals();
resolved = find_binpkg(virtual(ARGV[i], virtuals));
- if ((resolved == NULL) || (!strlen(resolved))) warn("puke here cant find binpkg for virtual(%s %s)", ARGV[i], virtual(ARGV[i],virtuals));
+ if ((resolved == NULL) || (!strlen(resolved))) warn("puke here cant find binpkg for virtual(%s %s)", ARGV[i], virtual(ARGV[i], virtuals));
} else
resolved = NULL;
@@ -336,9 +343,9 @@ queue *resolve_rdepends(const int level, const struct pkg_t *package, queue *dep
}
#endif
-
void crossmount_rm(char *, const size_t size, const char *, const struct stat);
-void crossmount_rm(char *buf, const size_t size, const char *fname, const struct stat st) {
+void crossmount_rm(char *buf, const size_t size, const char *fname, const struct stat st)
+{
struct stat lst;
assert(pretend == 0);
@@ -354,9 +361,9 @@ void crossmount_rm(char *buf, const size_t size, const char *fname, const struct
system(buf);
}
-
void install_mask_pwd(int argc, char **argv, const struct stat st);
-void install_mask_pwd(int iargc, char **iargv, const struct stat st) {
+void install_mask_pwd(int iargc, char **iargv, const struct stat st)
+{
char buf[1024];
int i;
@@ -388,7 +395,8 @@ void install_mask_pwd(int iargc, char **iargv, const struct stat st) {
char *atom2str(depend_atom *atom, char *buf, size_t size);
-char *atom2str(depend_atom *atom, char *buf, size_t size) {
+char *atom2str(depend_atom *atom, char *buf, size_t size)
+{
if (atom->PR_int)
snprintf(buf, size, "%s-%s-r%i", atom->PN, atom->PV, atom->PR_int);
else
@@ -397,7 +405,8 @@ char *atom2str(depend_atom *atom, char *buf, size_t size) {
}
char qprint_tree_node(int level, depend_atom *atom, struct pkg_t *pkg);
-char qprint_tree_node(int level, depend_atom *atom, struct pkg_t *pkg) {
+char qprint_tree_node(int level, depend_atom *atom, struct pkg_t *pkg)
+{
char buf[1024];
char *p;
int i, ret;
@@ -418,7 +427,7 @@ char qprint_tree_node(int level, depend_atom *atom, struct pkg_t *pkg) {
atom2str(subatom, buf, sizeof(buf));
atom2str(atom, install_ver, sizeof(install_ver));
ret = atom_compare_str(install_ver, buf);
- switch(ret) {
+ switch (ret) {
case EQUAL: c = 'R'; break;
case NEWER: c = 'U'; break;
case OLDER: c = 'D'; break;
@@ -439,7 +448,7 @@ char qprint_tree_node(int level, depend_atom *atom, struct pkg_t *pkg) {
snprintf(buf, sizeof(buf), "%s%c%s", BLUE, c, NORM);
#if 0
if (level) {
- switch(c) {
+ switch (c) {
case 'N':
case 'U': break;
default:
@@ -457,7 +466,8 @@ char qprint_tree_node(int level, depend_atom *atom, struct pkg_t *pkg) {
}
/* oh shit getting into pkg mgt here. FIXME: write a real dep resolver. */
-void pkg_merge(int level, depend_atom *atom, struct pkg_t *pkg) {
+void pkg_merge(int level, depend_atom *atom, struct pkg_t *pkg)
+{
FILE *fp, *contents;
char buf[1024];
char tarball[255];
@@ -502,7 +512,7 @@ void pkg_merge(int level, depend_atom *atom, struct pkg_t *pkg) {
// Walk the rdepends here. Merging what need be.
for (i = 1; i < ARGC; i++) {
depend_atom *subatom, *ratom;
- switch(ARGV[i][0]) {
+ switch (ARGV[i][0]) {
case '|':
case '!':
case '~':
@@ -625,7 +635,7 @@ void pkg_merge(int level, depend_atom *atom, struct pkg_t *pkg) {
char u;
strncpy(pf, ARGV[i], sizeof(pf));
- switch((ret = atom_compare_str(buf, pf))) {
+ switch ((ret = atom_compare_str(buf, pf))) {
case ERROR: break;
case NOT_EQUAL: break;
case NEWER:
@@ -700,7 +710,7 @@ void pkg_merge(int level, depend_atom *atom, struct pkg_t *pkg) {
line[0] = 0;
/* portage has code that handes fifo's but it looks unused */
-
+
if ((S_ISCHR(st.st_mode)) || \
(S_ISBLK(st.st_mode))); // block or character device
if (S_ISFIFO(st.st_mode)); // FIFO (named pipe)
@@ -772,7 +782,7 @@ void pkg_merge(int level, depend_atom *atom, struct pkg_t *pkg) {
assert(strlen(&buf[1]));
readlink(buf, path, sizeof(path));
assert(strlen(path));;
-
+
snprintf(line, sizeof(line), "sym %s -> %s%s%lu", &buf[1], path, " ", st.st_mtime);
// snprintf(line, sizeof(line), "sym %s -> %s", &buf[1], path);
// we better have one byte here to play with
@@ -798,8 +808,8 @@ void pkg_merge(int level, depend_atom *atom, struct pkg_t *pkg) {
freeargv(ARGC, ARGV); /* config_protect */
freeargv(iargc, iargv); /* install_mask */
- iargv =0 ; iargv = NULL;
-
+ iargv = 0;
+ iargv = NULL;
fclose(contents);
pclose(fp);
@@ -836,7 +846,8 @@ void pkg_merge(int level, depend_atom *atom, struct pkg_t *pkg) {
chdir(port_tmpdir);
}
-int pkg_unmerge(char *cat, char *pkgname) {
+int pkg_unmerge(char *cat, char *pkgname)
+{
char buf[BUFSIZ];
FILE *fp;
int argc;
@@ -879,7 +890,7 @@ int pkg_unmerge(char *cat, char *pkgname) {
protected = config_protected(e->name, argc, argv);
snprintf(zing, sizeof(zing), "%s%s%s", protected ? YELLOW : GREEN, protected ? "***" : "<<<" , NORM);
- /* Should we remove in order symlinks,objects,dirs ? */
+ /* Should we remove in order symlinks,objects,dirs ? */
switch (e->type) {
case CONTENTS_DIR:
if (!protected) { rmdir(e->name); }
@@ -933,7 +944,8 @@ int pkg_unmerge(char *cat, char *pkgname) {
return 1;
}
-int unlink_empty(char *buf) {
+int unlink_empty(char *buf)
+{
struct stat st;
if ((stat(buf, &st)) != (-1))
if (st.st_size == 0)
@@ -941,7 +953,8 @@ int unlink_empty(char *buf) {
return (-1);
}
-int match_pkg(const char *name, struct pkg_t *pkg) {
+int match_pkg(const char *name, struct pkg_t *pkg)
+{
depend_atom *atom;
char buf[255], buf2[255];
int match = 0;
@@ -962,7 +975,7 @@ int match_pkg(const char *name, struct pkg_t *pkg) {
if ((strcmp(name, buf2)) == 0)
match = 3;
- if ((strcmp(name, atom->PN)) == 0)
+ if ((strcmp(name, atom->PN)) == 0)
match = 4;
atom_implode(atom);
@@ -970,7 +983,8 @@ int match_pkg(const char *name, struct pkg_t *pkg) {
return match;
}
-int pkg_verify_checksums(char *fname, struct pkg_t *pkg, depend_atom *atom, int strict, int display) {
+int pkg_verify_checksums(char *fname, struct pkg_t *pkg, depend_atom *atom, int strict, int display)
+{
char *hash;
int ret = 0;
@@ -1010,7 +1024,8 @@ int pkg_verify_checksums(char *fname, struct pkg_t *pkg, depend_atom *atom, int
return ret;
}
-void pkg_fetch(int argc, char **argv, struct pkg_t *pkg) {
+void pkg_fetch(int argc, char **argv, struct pkg_t *pkg)
+{
depend_atom *atom;
char buf[255], buf2[255];
int i;
@@ -1083,7 +1098,8 @@ void pkg_fetch(int argc, char **argv, struct pkg_t *pkg) {
atom_implode(atom);
}
-void print_Pkg(int full, struct pkg_t *pkg) {
+void print_Pkg(int full, struct pkg_t *pkg)
+{
char *p = NULL;
char buf[512];
depend_atom *atom = NULL;
@@ -1125,19 +1141,20 @@ void print_Pkg(int full, struct pkg_t *pkg) {
int ret;
char *icolor = (char *) RED;
ret = atom_compare_str(buf, p);
- switch(ret) {
+ switch (ret) {
case EQUAL: icolor = (char *) RED; break;
- case NEWER: icolor = (char *) YELLOW; break;
+ case NEWER: icolor = (char *) YELLOW; break;
case OLDER: icolor = (char *) BLUE; break;
default: icolor = (char *) NORM; break;
- }
+ }
printf(" %sInstalled%s:%s %s%s%s\n", DKGREEN, YELLOW, NORM, icolor, p, NORM);
}
}
atom_implode(atom);
}
-int unmerge_packages(int argc, char **argv) {
+int unmerge_packages(int argc, char **argv)
+{
depend_atom *atom;
char *p;
int i;
@@ -1145,7 +1162,7 @@ int unmerge_packages(int argc, char **argv) {
if (argc == optind)
return 1;
- for ( i = 1 ; i < argc; i++) {
+ for (i = 1; i < argc; i++) {
char buf[512];
if (argv[i][0] == '-')
@@ -1161,8 +1178,8 @@ int unmerge_packages(int argc, char **argv) {
return 0;
}
-
-struct pkg_t *grab_binpkg_info(const char *name) {
+struct pkg_t *grab_binpkg_info(const char *name)
+{
FILE *fp;
char buf[BUFSIZ];
char value[BUFSIZ];
@@ -1182,7 +1199,7 @@ struct pkg_t *grab_binpkg_info(const char *name) {
if ((fp = fopen(buf, "r")) == NULL)
err("Unable to open package file %s: %s", buf, strerror(errno));
- while((fgets(buf, sizeof(buf), fp)) != NULL) {
+ while ((fgets(buf, sizeof(buf), fp)) != NULL) {
if (*buf == '\n') {
if (pkg->PF[0] && pkg->CATEGORY[0]) {
int ret;
@@ -1200,7 +1217,7 @@ struct pkg_t *grab_binpkg_info(const char *name) {
snprintf(buf, sizeof(buf), "%s/%s-%s-r%i", atom->CATEGORY, atom->PN, atom->PV, atom->PR_int);
ret = atom_compare_str(name, buf);
IF_DEBUG(fprintf(stderr, "=== atom_compare(%s, %s) = %d %s\n", name, buf, ret, booga[ret])); // buf(%s) depend(%s)\n", ret, pkg->CATEGORY, pkg->PF, name, pkg->RDEPEND);
- switch(ret) {
+ switch (ret) {
case EQUAL:
case NEWER:
snprintf(buf, sizeof(buf), "%s/%s", pkg->CATEGORY, pkg->PF);
@@ -1258,7 +1275,8 @@ struct pkg_t *grab_binpkg_info(const char *name) {
return rpkg;
}
-char *find_binpkg(const char *name) {
+char *find_binpkg(const char *name)
+{
FILE *fp;
char buf[BUFSIZ];
char value[BUFSIZ];
@@ -1277,7 +1295,7 @@ char *find_binpkg(const char *name) {
if ((fp = fopen(buf, "r")) == NULL)
err("Unable to open package file %s: %s", buf, strerror(errno));
- while((fgets(buf, sizeof(buf), fp)) != NULL) {
+ while ((fgets(buf, sizeof(buf), fp)) != NULL) {
if (*buf == '\n') {
if (PF[0] && CATEGORY[0]) {
int ret;
@@ -1291,7 +1309,7 @@ char *find_binpkg(const char *name) {
atom = atom_explode(buf);
snprintf(buf, sizeof(buf), "%s/%s", atom->CATEGORY, atom->PN);
ret = atom_compare_str(name, buf);
- switch(ret) {
+ switch (ret) {
case OLDER: break;
case NEWER:
case EQUAL:
@@ -1331,8 +1349,8 @@ char *find_binpkg(const char *name) {
return best_match;
}
-
-int parse_packages(const char *Packages, int argc, char **argv) {
+int parse_packages(const char *Packages, int argc, char **argv)
+{
FILE *fp;
char buf[BUFSIZ];
char value[BUFSIZ];
@@ -1345,7 +1363,7 @@ int parse_packages(const char *Packages, int argc, char **argv) {
memset(&Pkg, 0, sizeof(Pkg));
- while((fgets(buf, sizeof(buf), fp)) != NULL) {
+ while ((fgets(buf, sizeof(buf), fp)) != NULL) {
lineno++;
if (*buf == '\n') {
if ((strlen(Pkg.PF) > 0) && (strlen(Pkg.CATEGORY) > 0)) {
@@ -1353,7 +1371,7 @@ int parse_packages(const char *Packages, int argc, char **argv) {
memcpy(pkg, &Pkg, sizeof(struct pkg_t));
if (search_pkgs) {
if (argc != optind) {
- for ( i = 0 ; i < argc; i++)
+ for (i = 0; i < argc; i++)
if ((match_pkg(argv[i], pkg) > 0) || (strcmp(argv[i], pkg->CATEGORY) == 0))
print_Pkg(verbose, pkg);
} else {
@@ -1380,7 +1398,7 @@ int parse_packages(const char *Packages, int argc, char **argv) {
++p;
strncpy(value, p, sizeof(value));
- switch(*buf) {
+ switch (*buf) {
case 'U':
if ((strcmp(buf, "USE:")) == 0) strncpy(Pkg.USE, value, sizeof(Pkg.USE));
break;
@@ -1416,7 +1434,8 @@ int parse_packages(const char *Packages, int argc, char **argv) {
return 0;
}
-int qmerge_main(int argc, char **argv) {
+int qmerge_main(int argc, char **argv)
+{
int i;
const char *Packages = "Packages";
int ARGC = argc;
@@ -1462,7 +1481,7 @@ int qmerge_main(int argc, char **argv) {
if (argc > 1) {
queue *world;
- for (i = 0 ; i < argc ; i++) {
+ for (i = 0; i < argc; i++) {
size_t size = 0;
if ((strcmp(argv[i], "world") != 0))
continue;
diff --git a/qpy.c b/qpy.c
index 1f4de32..f3a3065 100644
--- a/qpy.c
+++ b/qpy.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/Attic/qpy.c,v 1.1 2006/05/26 01:46:16 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/Attic/qpy.c,v 1.2 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -21,7 +21,7 @@ static const char *qpy_opts_help[] = {
COMMON_OPTS_HELP
};
-static const char qpy_rcsid[] = "$Id: qpy.c,v 1.1 2006/05/26 01:46:16 solar Exp $";
+static const char qpy_rcsid[] = "$Id: qpy.c,v 1.2 2006/11/09 00:18:05 vapier Exp $";
#define qpy_usage(ret) usage(ret, QPY_FLAGS, qpy_long_opts, qpy_opts_help, lookup_applet_idx("qpy"))
struct portage_t {
@@ -75,16 +75,17 @@ int import_portage_settings(void)
return 1;
}
if (!(portage.settings = PyObject_GetAttrString(portage.interp, (char *) "settings"))) {
- Py_DECREF(portage.interp);
+ Py_DECREF(portage.interp);
fprintf(stderr, "getting settings failed");
return 1;
- }
+ }
return 0;
}
#if 0
void portage_reload(void);
-void portage_reload(void) {
+void portage_reload(void)
+{
Py_Finalize();
Py_Initialize();
import_portage_settings();
diff --git a/qsearch.c b/qsearch.c
index 9d9536c..f92df1d 100644
--- a/qsearch.c
+++ b/qsearch.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qsearch.c,v 1.30 2006/05/24 03:25:30 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qsearch.c,v 1.31 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -28,7 +28,7 @@ static const char *qsearch_opts_help[] = {
"Show homepage info",
COMMON_OPTS_HELP
};
-static const char qsearch_rcsid[] = "$Id: qsearch.c,v 1.30 2006/05/24 03:25:30 vapier Exp $";
+static const char qsearch_rcsid[] = "$Id: qsearch.c,v 1.31 2006/11/09 00:18:05 vapier Exp $";
#define qsearch_usage(ret) usage(ret, QSEARCH_FLAGS, qsearch_long_opts, qsearch_opts_help, lookup_applet_idx("qsearch"))
@@ -130,11 +130,11 @@ int qsearch_main(int argc, char **argv)
q = buf + search_len + 1;
if (!search_all && !search_name && rematch(search_me, q, REG_EXTENDED | REG_ICASE) != 0)
break;
- // hppa/arm dirname(),basename() eats the ptr so we need to copy the variables before
+ // hppa/arm dirname(),basename() eats the ptr so we need to copy the variables before
// doing operations with them.
strncpy(dp, p, sizeof(dp));
strncpy(bp, p, sizeof(bp));
- printf("%s%s/%s%s%s %s\n",
+ printf("%s%s/%s%s%s %s\n",
BOLD, dirname(dp), BLUE, basename(bp), NORM,
(show_name_only ? "" : q));
break;
diff --git a/qsize.c b/qsize.c
index ecd92e6..5e23fab 100644
--- a/qsize.c
+++ b/qsize.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qsize.c,v 1.22 2006/04/06 11:29:55 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qsize.c,v 1.23 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -30,7 +30,7 @@ static const char *qsize_opts_help[] = {
"Display size in bytes",
COMMON_OPTS_HELP
};
-static const char qsize_rcsid[] = "$Id: qsize.c,v 1.22 2006/04/06 11:29:55 solar Exp $";
+static const char qsize_rcsid[] = "$Id: qsize.c,v 1.23 2006/11/09 00:18:05 vapier Exp $";
#define qsize_usage(ret) usage(ret, QSIZE_FLAGS, qsize_long_opts, qsize_opts_help, lookup_applet_idx("qsize"))
@@ -92,7 +92,7 @@ int qsize_main(int argc, char **argv)
/* see if this cat/pkg is requested */
if (!search_all) {
for (i = optind; i < argc; ++i) {
- snprintf(buf, sizeof(buf), "%s/%s", dentry->d_name,
+ snprintf(buf, sizeof(buf), "%s/%s", dentry->d_name,
de->d_name);
if (rematch(argv[i], buf, REG_EXTENDED) == 0)
break;
@@ -128,9 +128,9 @@ int qsize_main(int argc, char **argv)
num_all_files += num_files;
num_all_nonfiles += num_nonfiles;
if (!summary_only) {
- printf("%s%s/%s%s%s: %lu files, %lu non-files, ", BOLD,
+ printf("%s%s/%s%s%s: %lu files, %lu non-files, ", BOLD,
basename(dentry->d_name), BLUE, de->d_name, NORM,
- (unsigned long)num_files,
+ (unsigned long)num_files,
(unsigned long)num_nonfiles);
if (disp_units)
printf("%s %s\n",
diff --git a/quse.c b/quse.c
index 3009362..2ef685f 100644
--- a/quse.c
+++ b/quse.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/quse.c,v 1.52 2006/06/10 14:01:21 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/quse.c,v 1.53 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -35,14 +35,15 @@ static const char *quse_opts_help[] = {
"Only show package name",
COMMON_OPTS_HELP
};
-static const char quse_rcsid[] = "$Id: quse.c,v 1.52 2006/06/10 14:01:21 vapier Exp $";
+static const char quse_rcsid[] = "$Id: quse.c,v 1.53 2006/11/09 00:18:05 vapier Exp $";
#define quse_usage(ret) usage(ret, QUSE_FLAGS, quse_long_opts, quse_opts_help, lookup_applet_idx("quse"))
int quse_describe_flag(int ind, int argc, char **argv);
char quse_name_only = 0;
-static void print_highlighted_use_flags(char *string, int ind, int argc, char **argv) {
+static void print_highlighted_use_flags(char *string, int ind, int argc, char **argv)
+{
char *str, *p;
char buf[BUFSIZ];
size_t pos, len;
diff --git a/qxpak.c b/qxpak.c
index 25063dc..8433f10 100644
--- a/qxpak.c
+++ b/qxpak.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qxpak.c,v 1.13 2006/04/21 03:13:25 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qxpak.c,v 1.14 2006/11/09 00:18:05 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -48,7 +48,7 @@ static const char *qxpak_opts_help[] = {
"Write files to stdout",
COMMON_OPTS_HELP
};
-static const char qxpak_rcsid[] = "$Id: qxpak.c,v 1.13 2006/04/21 03:13:25 vapier Exp $";
+static const char qxpak_rcsid[] = "$Id: qxpak.c,v 1.14 2006/11/09 00:18:05 vapier Exp $";
#define qxpak_usage(ret) usage(ret, QXPAK_FLAGS, qxpak_long_opts, qxpak_opts_help, lookup_applet_idx("qxpak"))
@@ -267,7 +267,7 @@ fake_data_len:
return;
}
in_len = st->st_size;
- /* the xpak format can only store files whose size is a 32bit int
+ /* the xpak format can only store files whose size is a 32bit int
* so we have to make sure we don't store a big file */
if (in_len != st->st_size) {
warnf("File is too big: %lu", st->st_size);