Commit Diff


commit - 7e8b0c2adc5079cd71f90fde5b6a3ad6b60ff8fa
commit + f6ed57b5b3d22754d407d377759b1e6ec349b808
blob - d4d16fb114b495e953a8da848f444e2a96379b48
blob + e0c501285c7406403fbf39f254a8a6231b7125a9
--- apmtop.c
+++ apmtop.c
@@ -14,25 +14,24 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include <sys/types.h>
-#include <machine/apmvar.h>
-#include <sys/signal.h>
-#include <sys/sched.h>
-#include <sys/sysctl.h>
+#include <sys/time.h>
 #include <sys/ioctl.h>
+#include <sys/sched.h>
 #include <sys/sensors.h>
+#include <sys/sysctl.h>
+#include <machine/apmvar.h>
 
-#include <stdbool.h>
-#include <ncurses.h>
-#include <locale.h>
+#include <err.h>
+#include <fcntl.h>
 #include <limits.h>
-#include <unistd.h>
-#include <string.h>
+#include <locale.h>
+#include <ncurses.h>
+#include <stdbool.h>
 #include <stdint.h>
-#include <stdlib.h>
 #include <stdio.h>
-#include <fcntl.h>
-#include <time.h>
-#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 #define MAXSENSORS 16
 #define LOGLEN 512
@@ -348,6 +347,7 @@ main (int argc, char *argv[])
 	unveil ("/usr/share/terminfo", "r");
 	unveil (NULL, NULL);
 
+	// Configure the "display".
 	memset (&dpy, 0, sizeof (dpy));
 	dpy.ncpu = num_cpu ();
 	dpy.cpus = calloc (dpy.ncpu, sizeof (struct cpu_usage));
@@ -356,6 +356,7 @@ main (int argc, char *argv[])
 	dpy.running = true;
 	find_sensors ();
 
+	// Configure ncurses.
 	setlocale (LC_ALL, "");
 	initscr ();
 	cbreak ();
@@ -364,6 +365,7 @@ main (int argc, char *argv[])
 	keypad (stdscr, TRUE);
 	halfdelay (dpy.delay);
 
+	// Bootstrap the process.
 	entries = 0;
 	create_win (&dpy);
 	update (&dpy);