diff -Nurd libgtop-2.28.0.orig/features.def libgtop-2.28.0/features.def
--- libgtop-2.28.0.orig/features.def	2009-04-18 19:29:49.000000000 -0400
+++ libgtop-2.28.0/features.def	2023-03-24 09:39:31.000000000 -0400
@@ -1,27 +1,27 @@
-void|cpu|ulong(total,user,nice,sys,idle,iowait,irq,softirq,frequency,xcpu_total[4],xcpu_user[4],xcpu_nice[4],xcpu_sys[4],xcpu_idle[4],xcpu_iowait[4],xcpu_irq[4],xcpu_softirq[4])
-void|mem|ulong(total,used,free,shared,buffer,cached,user,locked)
-void|swap|ulong(total,used,free,pagein,pageout)
-void|uptime|double(uptime,idletime)
-void|loadavg|double(loadavg[3]):ulong(nr_running,nr_tasks,last_pid)
-void|shm_limits|ulong(shmmax,shmmin,shmmni,shmseg,shmall)
-void|msg_limits|ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql)
-void|sem_limits|ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem)
-pid_t*|proclist|ulong(number,size,total)|long(which,arg)
-void|proc_state|str(cmd):char(state):ulong(uid,gid)|pid_t(pid)
-void|proc_uid|long(uid,euid,gid,egid,pid,ppid,pgrp,session,tty,tpgid,priority,nice)|pid_t(pid)
-void|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t(pid)
-void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_value,frequency,xcpu_utime[4],xcpu_stime[4])|pid_t(pid)
-void|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|pid_t(pid)
-void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid)
-void|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_stack)|pid_t(pid)
-char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len)
-glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid)
-glibtop_open_files_entry *|proc_open_files|ulong(number)|pid_t(pid)
-glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs)
-void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir
-void|netload|ulong(if_flags,mtu,subnet,address,packets_in,packets_out,packets_total,bytes_in,bytes_out,bytes_total,errors_in,errors_out,errors_total,collisions)|string|interface
-void|ppp|ulong(state,bytes_in,bytes_out)|ushort(device)
-char **|netlist|unsigned(number)
-char **|proc_wd|ulong(number),str(root),str(exe)|pid_t(pid)
-guint16*|proc_affinity|ulong(number),int(all)|pid_t(pid)
+void|cpu
+void|mem
+void|swap
+void|uptime
+void|loadavg
+void|shm_limits
+void|msg_limits
+void|sem_limits
+pid_t*|proclist|long(which,arg)
+void|proc_state|pid_t(pid)
+void|proc_uid|pid_t(pid)
+void|proc_mem|pid_t(pid)
+void|proc_time|pid_t(pid)
+void|proc_signal|pid_t(pid)
+void|proc_kernel|pid_t(pid)
+void|proc_segment|pid_t(pid)
+char *|proc_args|pid_t(pid):unsigned(max_len)
+glibtop_map_entry *|proc_map|pid_t(pid)
+glibtop_open_files_entry *|proc_open_files|pid_t(pid)
+glibtop_mountentry *|@mountlist|int(all_fs)
+void|@fsusage|string|mount_dir
+void|netload|string|interface
+void|ppp|ushort(device)
+char **|netlist
+char **|proc_wd|pid_t(pid)
+guint16*|proc_affinity|pid_t(pid)
 
diff -Nurd libgtop-2.28.0.orig/lib/lib.pl libgtop-2.28.0/lib/lib.pl
--- libgtop-2.28.0.orig/lib/lib.pl	2009-04-18 19:29:49.000000000 -0400
+++ libgtop-2.28.0/lib/lib.pl	2023-03-24 09:39:36.000000000 -0400
@@ -1,21 +1,8 @@
 #!/usr/bin/perl
 
-$[ = 1;			# set array base to 1
 $, = ' ';		# set output field separator
 $\ = "\n";		# set output record separator
 
-sub toupper {
-    local($_) = @_;
-    tr/a-z/A-Z/;
-    return $_;
-}
-
-sub tolower {
-    local($_) = @_;
-    tr/A-Z/a-z/;
-    return $_;
-}
-
 print '/* lib.c */';
 print "/* This is a generated file.  Please modify `lib.pl' */";
 print '';
@@ -86,9 +73,9 @@
 sub output {
     local($line) = @_;
     @line_fields = split(/\|/, $line, 9999);
-    $retval = $line_fields[1];
-    $feature = $line_fields[2];
-    $param_def = $line_fields[4];
+    $retval = $line_fields[0];
+    $feature = $line_fields[1];
+    $param_def = $line_fields[2];
 
     $orig = $feature;
     $feature =~ s/^@//;
@@ -106,16 +93,16 @@
     }
 
     if ($param_def eq 'string') {
-	$call_param = ', ' . $line_fields[5];
+	$call_param = ', ' . $line_fields[3];
 	$param_buf = '';
 	$buf_set = '';
 	$param_decl = ",\n            " . $space . '    const char *' .
 
-	  $line_fields[5];
-	$send_ptr = "\n\tconst void *send_ptr = " . $line_fields[5] . ';';
+	  $line_fields[3];
+	$send_ptr = "\n\tconst void *send_ptr = " . $line_fields[3] . ';';
 	$send_size = "\n\tconst size_t send_size =\n\t\tstrlen (" .
 
-	  $line_fields[5] . ') + 1;';
+	  $line_fields[3] . ') + 1;';
     }
     else {
 	$call_param = '';
@@ -126,9 +113,9 @@
 	$buf_set = '';
 	$nr_params = (@params = split(/:/, $param_def, 9999));
 	if ($nr_params) {
-	    $param_buf = "\n\tstruct {\n";
+	    $param_buf = "\t\tstruct {\n";
 	}
-	for ($param = 1; $param <= $nr_params; $param++) {
+	for ($param = 0; $param < $nr_params; $param++) {
 	    $list = $params[$param];
 	    $type = $params[$param];
 	    $type =~ s/\(.*//;
@@ -137,13 +124,13 @@
 	    $count = (@fields = split(/,/, $list, 9999));
 
 	    if ($count > 0) {
-		for ($field = 1; $field <= $count; $field++) {
-		    $param_buf .= "\t\t$convert{$type} buf_$fields[$field];\n";
-		    $buf_set .= "\tparam_buf.buf_$fields[$field] = $fields[$field];\n";
+		for ($field = 0; $field < $count; $field++) {
+		    $param_buf .= "\t\t\t$convert{$type} buf_$fields[$field];\n";
+		    $buf_set .= "\t\tparam_buf.buf_$fields[$field] = $fields[$field];\n";
 		}
 	    }
 
-	    for ($field = 1; $field <= $count; $field++) {
+	    for ($field = 0; $field < $count; $field++) {
 		if ($param_decl eq '') {
 		    $param_decl = ",\n            " . $space . '    ';
 		}
@@ -155,19 +142,19 @@
 		  $fields[$field];
 		$call_param = $call_param . ', ' . $fields[$field];
 		if ($send_ptr eq '') {
-		    $send_ptr = "\n\tconst void *send_ptr = &param_buf;";
+		    $send_ptr = "\t\tconst void *send_ptr = &param_buf;";
 		}
 	    }
 	}
 	if ($nr_params) {
-	    $param_buf .= "\t} param_buf;";
-	    $send_size  = "\n\tconst size_t send_size = sizeof param_buf;";
+	    $param_buf .= "\t\t} param_buf;\n";
+	    $send_size  = "\t\tconst size_t send_size = sizeof param_buf;";
 	}
 	else {
-	    $send_size = "\n\tconst size_t send_size = 0;";
+	    $send_size = "\t\tconst size_t send_size = 0;";
 	}
 	if ($send_ptr eq '') {
-	    $send_ptr = "\n\tconst void *send_ptr = NULL;";
+	    $send_ptr = "\t\tconst void *send_ptr = NULL;";
 	}
     }
 
@@ -175,17 +162,15 @@
 
       $feature . ' *buf' . $param_decl . ')';
 
-    print "{" . $param_buf;
+    print "{";
 
-    print $send_ptr . '' . $send_size;
     if ($retval !~ /^void$/) {
 	print "\t" . $retval . ' retval = (' . $retval . ') 0;';
     }
-    print $buf_set;
 
     print "\tglibtop_init_r (&server, (1 << GLIBTOP_SYSDEPS_" .
 
-      &toupper($feature) . '), 0);';
+      uc($feature) . '), 0);';
 
     print '';
     print "\t/* If neccessary, we ask the server for the requested";
@@ -195,12 +180,21 @@
     print "\tif ((server->flags & _GLIBTOP_INIT_STATE_SERVER) &&";
     print "\t    (server->features & (1 << GLIBTOP_SYSDEPS_" .
 
-      &toupper($feature) . ')))';
+      uc($feature) . ')))';
     print "\t{";
 
+    if ($param_buf) {
+        print $param_buf;
+        print $buf_set;
+    }
+
+    print $send_ptr;
+    print $send_size;
+    print '';
+
     print "\t\t" . $prefix . 'glibtop_call_l (server, GLIBTOP_CMND_' .
 
-      &toupper($feature) . ',';
+      uc($feature) . ',';
     print "\t\t\t\t" . $prefix_space . 'send_size, send_ptr,';
     print "\t\t\t\t" . $prefix_space . 'sizeof (glibtop_' . $feature .
 
@@ -209,7 +203,7 @@
     print "\t} else {";
 
     if ($orig !~ /^@/) {
-	print '#if (!GLIBTOP_SUID_' . &toupper($feature) . ')';
+	print '#if (!GLIBTOP_SUID_' . uc($feature) . ')';
     }
     print "\t\t" . $prefix . 'glibtop_get_' . $feature . '_s (server, buf' .
 
