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.
This commit is contained in:
Jim Warner 2011-12-27 16:22:43 -06:00 committed by Craig Small
parent fe20653a4e
commit 71b72b36ce
9 changed files with 59 additions and 65 deletions

View File

@ -9,32 +9,26 @@
* GNU Library General Public License for more details. * GNU Library General Public License for more details.
*/ */
#include <stdlib.h> #include <grp.h>
#include <locale.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#if (__GNU_LIBRARY__ >= 6)
# include <locale.h>
#endif
/* username lookups */
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
/* major/minor number */
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/types.h>
#include <signal.h> /* 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 "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 #ifndef SIGCHLD
#define SIGCHLD SIGCLD #define SIGCHLD SIGCLD
@ -529,11 +523,9 @@ static void fancy_spew(void){
/***** no comment */ /***** no comment */
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
#if (__GNU_LIBRARY__ >= 6)
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);
#endif
#ifdef DEBUG #ifdef DEBUG
init_stack_trace(argv[0]); init_stack_trace(argv[0]);

View File

@ -8,25 +8,26 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details. * GNU Library General Public License for more details.
*/ */
#include <stdlib.h>
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <grp.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include "common.h" #include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/types.h>
#include "../proc/wchan.h" #include "../proc/wchan.h"
#include "../proc/version.h" #include "../proc/version.h"
#include "../proc/sysinfo.h" #include "../proc/sysinfo.h"
#include "common.h"
#ifndef __GNU_LIBRARY__ #ifndef __GNU_LIBRARY__
#define __GNU_LIBRARY__ -1 #define __GNU_LIBRARY__ -1

View File

@ -21,7 +21,6 @@
* For example, Digital prints the real-time signals. * For example, Digital prints the real-time signals.
*/ */
/* /*
* Data table idea: * Data table idea:
* *
@ -40,6 +39,7 @@
*/ */
#include <ctype.h> #include <ctype.h>
#include <dlfcn.h>
#include <fcntl.h> #include <fcntl.h>
#include <grp.h> #include <grp.h>
#include <limits.h> #include <limits.h>
@ -47,13 +47,13 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/ioctl.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <dlfcn.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/types.h>
#include "../proc/readproc.h" #include "../proc/readproc.h"
#include "../proc/sysinfo.h" #include "../proc/sysinfo.h"
@ -61,6 +61,7 @@
#include "../proc/procps.h" #include "../proc/procps.h"
#include "../proc/devname.h" #include "../proc/devname.h"
#include "../proc/escape.h" #include "../proc/escape.h"
#include "common.h" #include "common.h"
/* TODO: /* TODO:

View File

@ -13,22 +13,21 @@
* #define Print(fmt, args...) printf("Debug: " fmt, ## args) * #define Print(fmt, args...) printf("Debug: " fmt, ## args)
*/ */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* username lookups */
#include <sys/types.h>
#include <pwd.h>
#include <grp.h> #include <grp.h>
#include <pwd.h>
#include <sys/stat.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include "common.h" #include <sys/stat.h>
#include <sys/types.h>
#include "../proc/alloc.h" #include "../proc/alloc.h"
#include "../proc/version.h" #include "../proc/version.h"
#include "common.h"
#define ARG_GNU 0 #define ARG_GNU 0
#define ARG_END 1 #define ARG_END 1
#define ARG_PGRP 2 #define ARG_PGRP 2
@ -154,8 +153,7 @@ found_it:
return 0; 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")) if (!strcmp(opt, "s") || !strcmp(opt, "selection"))
return USAGE_SELECTION; return USAGE_SELECTION;
if (!strcmp(opt, "l") || !strcmp(opt, "list")) if (!strcmp(opt, "l") || !strcmp(opt, "list"))

View File

@ -9,13 +9,14 @@
* GNU Library General Public License for more details. * GNU Library General Public License for more details.
*/ */
#include <string.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../proc/procps.h"
#include "../proc/readproc.h"
#include "common.h" #include "common.h"
#include "../proc/readproc.h"
#include "../proc/procps.h"
//#define process_group_leader(p) ((p)->pgid == (p)->tgid) //#define process_group_leader(p) ((p)->pgid == (p)->tgid)
//#define some_other_user(p) ((p)->euid != cached_euid) //#define some_other_user(p) ((p)->euid != cached_euid)

View File

@ -9,17 +9,17 @@
* GNU Library General Public License for more details. * GNU Library General Public License for more details.
*/ */
#include <stdlib.h> #include <grp.h>
#include <pwd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
/* username lookups */
#include <sys/types.h> #include <sys/types.h>
#include <pwd.h>
#include <grp.h>
#include "../proc/readproc.h" #include "../proc/readproc.h"
#include "../proc/sysinfo.h" #include "../proc/sysinfo.h"
#include "common.h" #include "common.h"
static sf_node *sf_list = NULL; /* deferred sorting and formatting */ static sf_node *sf_list = NULL; /* deferred sorting and formatting */

View File

@ -5,14 +5,15 @@
* Modified for easy use by Albert Cahalan. * Modified for easy use by Albert Cahalan.
*/ */
#include <unistd.h>
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/time.h>
#include "common.h" #include "common.h"