[BusyBox-cvs] svn commit: trunk/busybox/procps

vapier at busybox.net vapier at busybox.net
Sat Jul 30 09:42:06 UTC 2005


Author: vapier
Date: 2005-07-30 03:42:05 -0600 (Sat, 30 Jul 2005)
New Revision: 10983

Log:
touchup syntax

Modified:
   trunk/busybox/procps/top.c


Changeset:
Modified: trunk/busybox/procps/top.c
===================================================================
--- trunk/busybox/procps/top.c	2005-07-30 09:29:10 UTC (rev 10982)
+++ trunk/busybox/procps/top.c	2005-07-30 09:42:05 UTC (rev 10983)
@@ -52,11 +52,12 @@
 static procps_status_t *top;   /* Hehe */
 static int ntop;
 
-
+#ifdef CONFIG_FEATURE_USE_TERMIOS
 static int pid_sort (procps_status_t *P, procps_status_t *Q)
 {
     return (Q->pid - P->pid);
 }
+#endif
 
 static int mem_sort (procps_status_t *P, procps_status_t *Q)
 {
@@ -410,7 +411,7 @@
 	ntop = 0;
 }
 
-#if defined CONFIG_FEATURE_USE_TERMIOS
+#ifdef CONFIG_FEATURE_USE_TERMIOS
 #include <termios.h>
 #include <sys/time.h>
 #include <signal.h>
@@ -439,7 +440,7 @@
 int top_main(int argc, char **argv)
 {
 	int opt, interval, lines, col;
-#if defined CONFIG_FEATURE_USE_TERMIOS
+#ifdef CONFIG_FEATURE_USE_TERMIOS
 	struct termios new_settings;
 	struct timeval tv;
 	fd_set readfds;
@@ -473,7 +474,7 @@
 	if (chdir("/proc") < 0) {
 		bb_perror_msg_and_die("chdir('/proc')");
 	}
-#if defined CONFIG_FEATURE_USE_TERMIOS
+#ifdef CONFIG_FEATURE_USE_TERMIOS
 	tcgetattr(0, (void *) &initial_settings);
 	memcpy(&new_settings, &initial_settings, sizeof(struct termios));
 	new_settings.c_lflag &= ~(ISIG | ICANON); /* unbuffered input */
@@ -499,13 +500,15 @@
 #endif
 	}
 #endif /* CONFIG_FEATURE_USE_TERMIOS */
+
 #ifdef FEATURE_CPU_USAGE_PERCENTAGE
 	sort_function[0] = pcpu_sort;
 	sort_function[1] = mem_sort;
 	sort_function[2] = time_sort;
 #else
 	sort_function = mem_sort;
-#endif
+#endif /* FEATURE_CPU_USAGE_PERCENTAGE */
+
 	while (1) {
 		/* read process IDs & status for all the processes */
 		procps_status_t * p;
@@ -530,14 +533,14 @@
 		do_stats();
 #else
 		qsort(top, ntop, sizeof(procps_status_t), (void*)sort_function);
-#endif
+#endif /* FEATURE_CPU_USAGE_PERCENTAGE */
 		opt = lines;
 		if (opt > ntop) {
 			opt = ntop;
 		}
 		/* show status for each of the processes */
 		display_status(opt, col);
-#if defined CONFIG_FEATURE_USE_TERMIOS
+#ifdef CONFIG_FEATURE_USE_TERMIOS
 		tv.tv_sec = interval;
 		tv.tv_usec = 0;
 		FD_ZERO (&readfds);
@@ -545,8 +548,8 @@
 		select (1, &readfds, NULL, NULL, &tv);
 		if (FD_ISSET (0, &readfds)) {
 			if (read (0, &c, 1) <= 0) {   /* signal */
-		return EXIT_FAILURE;
-	}
+				return EXIT_FAILURE;
+			}
 			if(c == 'q' || c == initial_settings.c_cc[VINTR])
 				return EXIT_SUCCESS;
 			if(c == 'M') {
@@ -580,7 +583,7 @@
 		}
 #else
 		sleep(interval);
-#endif                                  /* CONFIG_FEATURE_USE_TERMIOS */
+#endif /* CONFIG_FEATURE_USE_TERMIOS */
 		clearmems();
 	}
 




More information about the busybox-cvs mailing list