From 71b72b36cec1f7a04a5b47cdcc851081f5fc0896 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 27 Dec 2011 16:22:43 -0600 Subject: [PATCH] ps: minor reformatting and trailing whitespace elimination This patch mostly reorganizes include files and eliminates some useless trailing whitespace. It also adopts the standard procps-ng unconditional approach to nls initialization. --- ps/COPYING | 2 +- ps/display.c | 32 ++++++++++++-------------------- ps/global.c | 25 +++++++++++++------------ ps/output.c | 13 +++++++------ ps/parser.c | 22 ++++++++++------------ ps/ps.1 | 2 +- ps/select.c | 15 ++++++++------- ps/sortformat.c | 8 ++++---- ps/stacktrace.c | 5 +++-- 9 files changed, 59 insertions(+), 65 deletions(-) diff --git a/ps/COPYING b/ps/COPYING index 92b8903f..066a80a2 100644 --- a/ps/COPYING +++ b/ps/COPYING @@ -133,7 +133,7 @@ such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an diff --git a/ps/display.c b/ps/display.c index 2917edb5..99d1d18d 100644 --- a/ps/display.c +++ b/ps/display.c @@ -9,32 +9,26 @@ * GNU Library General Public License for more details. */ -#include +#include +#include +#include +#include #include +#include #include #include -#if (__GNU_LIBRARY__ >= 6) -# include -#endif - -/* username lookups */ -#include -#include -#include - -/* major/minor number */ #include +#include -#include /* catch signals */ +#include "../proc/alloc.h" +#include "../proc/readproc.h" +#include "../proc/sig.h" +#include "../proc/sysinfo.h" +#include "../proc/version.h" +#include "../proc/wchan.h" #include "common.h" -#include "../proc/alloc.h" -#include "../proc/wchan.h" -#include "../proc/version.h" -#include "../proc/readproc.h" -#include "../proc/sysinfo.h" -#include "../proc/sig.h" #ifndef SIGCHLD #define SIGCHLD SIGCLD @@ -529,11 +523,9 @@ static void fancy_spew(void){ /***** no comment */ int main(int argc, char *argv[]){ -#if (__GNU_LIBRARY__ >= 6) setlocale (LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); -#endif #ifdef DEBUG init_stack_trace(argv[0]); diff --git a/ps/global.c b/ps/global.c index 4a88525c..8e3fbd21 100644 --- a/ps/global.c +++ b/ps/global.c @@ -8,25 +8,26 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include +#include +#include +#include +#include +#include +#include +#include -#include "common.h" - +#include +#include #include +#include + #include "../proc/wchan.h" #include "../proc/version.h" #include "../proc/sysinfo.h" +#include "common.h" #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ -1 diff --git a/ps/output.c b/ps/output.c index 5dbae861..6880c8b7 100644 --- a/ps/output.c +++ b/ps/output.c @@ -21,7 +21,6 @@ * For example, Digital prints the real-time signals. */ - /* * Data table idea: * @@ -40,6 +39,7 @@ */ #include +#include #include #include #include @@ -47,13 +47,13 @@ #include #include #include -#include -#include -#include -#include #include #include -#include + +#include +#include +#include +#include #include "../proc/readproc.h" #include "../proc/sysinfo.h" @@ -61,6 +61,7 @@ #include "../proc/procps.h" #include "../proc/devname.h" #include "../proc/escape.h" + #include "common.h" /* TODO: diff --git a/ps/parser.c b/ps/parser.c index 552face3..4fe9723f 100644 --- a/ps/parser.c +++ b/ps/parser.c @@ -13,22 +13,21 @@ * #define Print(fmt, args...) printf("Debug: " fmt, ## args) */ -#include -#include -#include - -/* username lookups */ -#include -#include #include - -#include +#include +#include +#include +#include #include -#include "common.h" +#include +#include + #include "../proc/alloc.h" #include "../proc/version.h" +#include "common.h" + #define ARG_GNU 0 #define ARG_END 1 #define ARG_PGRP 2 @@ -154,8 +153,7 @@ found_it: return 0; } -static int parse_usage_section(const char *opt) -{ +static int parse_usage_section(const char *opt){ if (!strcmp(opt, "s") || !strcmp(opt, "selection")) return USAGE_SELECTION; if (!strcmp(opt, "l") || !strcmp(opt, "list")) diff --git a/ps/ps.1 b/ps/ps.1 index a2fa18cf..c08d39db 100644 --- a/ps/ps.1 +++ b/ps/ps.1 @@ -1085,7 +1085,7 @@ class CLS T{ scheduling class of the process. (alias .BR policy , \ cls ). Field's possible values are: -.IP "" 2 +.IP "" 2 \- not reported .br TS SCHED_OTHER diff --git a/ps/select.c b/ps/select.c index 6b8220df..6a87fcc5 100644 --- a/ps/select.c +++ b/ps/select.c @@ -1,21 +1,22 @@ /* - * Copyright 1998-2002 by Albert Cahalan; all rights resered. + * Copyright 1998-2002 by Albert Cahalan; all rights resered. * This file may be used subject to the terms and conditions of the - * GNU Library General Public License Version 2, or any later version + * GNU Library General Public License Version 2, or any later version * at your option, as published by the Free Software Foundation. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - */ + */ -#include -#include #include +#include +#include + +#include "../proc/procps.h" +#include "../proc/readproc.h" #include "common.h" -#include "../proc/readproc.h" -#include "../proc/procps.h" //#define process_group_leader(p) ((p)->pgid == (p)->tgid) //#define some_other_user(p) ((p)->euid != cached_euid) diff --git a/ps/sortformat.c b/ps/sortformat.c index 663ffee4..8b399152 100644 --- a/ps/sortformat.c +++ b/ps/sortformat.c @@ -9,17 +9,17 @@ * GNU Library General Public License for more details. */ -#include +#include +#include #include +#include #include -/* username lookups */ #include -#include -#include #include "../proc/readproc.h" #include "../proc/sysinfo.h" + #include "common.h" static sf_node *sf_list = NULL; /* deferred sorting and formatting */ diff --git a/ps/stacktrace.c b/ps/stacktrace.c index f16a2f85..0cf0c8de 100644 --- a/ps/stacktrace.c +++ b/ps/stacktrace.c @@ -5,14 +5,15 @@ * Modified for easy use by Albert Cahalan. */ -#include #include #include #include #include +#include + +#include #include #include -#include #include "common.h"