summaryrefslogtreecommitdiffstats
path: root/bin/ps/ps.c
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2004-06-23 23:48:09 +0000
committergad <gad@FreeBSD.org>2004-06-23 23:48:09 +0000
commit30666d1f0f431b581eeacc45735ff41d85d27c23 (patch)
tree42f4c0ba023a1c380ef10b9c78d4a46eb691734d /bin/ps/ps.c
parent8ab36c09a858cbd52cbf9795162660a1ff1a423c (diff)
downloadFreeBSD-src-30666d1f0f431b581eeacc45735ff41d85d27c23.zip
FreeBSD-src-30666d1f0f431b581eeacc45735ff41d85d27c23.tar.gz
Change "struct varent" to use the standard queue(8) macros, instead of
using it's own version of the same basic algorithm. Submitted by: part by Cyrille Lefevre, part of it done by me
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r--bin/ps/ps.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index f4b0208..7d09131 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -98,7 +98,7 @@ int sumrusage; /* -S */
int termwidth; /* Width of the screen (0 == infinity). */
int totwidth; /* Calculated-width of requested variables. */
-struct varent *vhead;
+struct velisthead varlist = STAILQ_HEAD_INITIALIZER(varlist);
static int forceuread = DEF_UREAD; /* Do extra work to get u-area. */
static kvm_t *kd;
@@ -600,9 +600,9 @@ main(int argc, char *argv[])
* For each process, call each variable output function.
*/
for (i = lineno = 0; i < nkept; i++) {
- for (vent = vhead; vent; vent = vent->next) {
+ STAILQ_FOREACH(vent, &varlist, next_ve) {
(vent->var->oproc)(&kinfo[i], vent);
- if (vent->next != NULL)
+ if (STAILQ_NEXT(vent, next_ve) != NULL)
(void)putchar(' ');
}
(void)putchar('\n');
@@ -886,7 +886,7 @@ find_varentry(VAR *v)
{
struct varent *vent;
- for (vent = vhead; vent; vent = vent->next) {
+ STAILQ_FOREACH(vent, &varlist, next_ve) {
if (strcmp(vent->var->name, v->name) == 0)
return vent;
}
@@ -899,7 +899,7 @@ scanvars(void)
struct varent *vent;
VAR *v;
- for (vent = vhead; vent; vent = vent->next) {
+ STAILQ_FOREACH(vent, &varlist, next_ve) {
v = vent->var;
if (v->flag & DSIZ) {
v->dwidth = v->width;
@@ -919,7 +919,7 @@ dynsizevars(KINFO *ki)
VAR *v;
int i;
- for (vent = vhead; vent; vent = vent->next) {
+ STAILQ_FOREACH(vent, &varlist, next_ve) {
v = vent->var;
if (!(v->flag & DSIZ))
continue;
@@ -938,7 +938,7 @@ sizevars(void)
VAR *v;
int i;
- for (vent = vhead; vent; vent = vent->next) {
+ STAILQ_FOREACH(vent, &varlist, next_ve) {
v = vent->var;
i = strlen(vent->header);
if (v->width < i)
OpenPOWER on IntegriCloud