From nobody Mon Jan 16 17:34:02 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NwfJp46XHz2svxf; Mon, 16 Jan 2023 17:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NwfJp3WnXz3M8k; Mon, 16 Jan 2023 17:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673890442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+enbWWsI6TAs5TSs9ajNOh3ADNunVy+MBFri+Yr9/Eg=; b=RiqwPetjzOpcwy5FswG+RPZ7dQHlEpnEcn9Qv/OYn4mD7i5UItBpsLwEiQvo7/XsuxoTwP YeXWX5zJFtOZf9wdYNAvDiTnc1/OzliYqywS+NrJ+oyCCnmArlFs/gs+rE4EnAl9oHKcz8 JblBMDPMiGF4dT9XxwaRyiGyKxrTCA6VO9zrxYcA6NtVZFrQf2LS3zRYrmlDGzPu227frk kmCe2wEAQOChqSVZRZekpV1GgpYRzOYoWk/npuveKc6Ty8wq1ZpaDQUIvPtmJPV8oUzcvJ OTvv3dAvKxQcPZiUCUOHVvXW9HtjcRyC2UgaGeQjQ0L21p3Y0V91byjv9ZKszw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673890442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+enbWWsI6TAs5TSs9ajNOh3ADNunVy+MBFri+Yr9/Eg=; b=pS/34/MoelRogJ8fh8r7jn2Pu+WOK+3/LrmvmPmQQSehUjyVyzohjHUTUFe2y51lT7yMoK w1rpobPbKOjyzVmfWGwULUyv5Dhog9/NitJlOFEw6bne1LY9cLr2+mbfes+i4tAZaglLTP 2WD90GP9ws859SPhJ4wQMFA1U1rPKWmby06wqQX2L0yKFQHO7lgA0iQM/BNjdwhASk/9ay tO1FNlkKG3H35HbQtSNmrkY1KX+HqZVBFGbLuuvg4xSzzdKcwOQdaNlLbXloH/Z7J3DdtA Jt/YnER2AhEA0MZLcVAcgrMg9YsbI17JK4PausyfBJgTqpBkTgZc54zk+NtsFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673890442; a=rsa-sha256; cv=none; b=opn0L3qz1vXFliI5ZWo5j+CR4Xhyvpowel3DHpIMCsRZvTaWHouOwRnd8aiCwbIKV6vo1b 2scbPfzYfuu1poOIiDsZ+3iYhcaAyxUc7qLJQlGyJrfzmNCGdl8ZeCXp95QcVKOJtyh8Zd mSkL03wy+7PtIyifkALdhcLt8wr3r46asGG/B59xPELoFuV7tnGNLr67RswJINbQFBw50K /T6WzZObVJsybca7EKtjXlSm2L1QVxqoZ5JhBLqj/PfYsYO8SCAaJL8E3FVSt+6xnAuJbo sHfIQzpi5oWUw6dfWa5qMQtKGTlCzFM0W/vDibGmiLJvfh2kh453gS2jqfKp3Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NwfJp2ZJBz1DxV; Mon, 16 Jan 2023 17:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30GHY2kx006322; Mon, 16 Jan 2023 17:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30GHY2Kp006321; Mon, 16 Jan 2023 17:34:02 GMT (envelope-from git) Date: Mon, 16 Jan 2023 17:34:02 GMT Message-Id: <202301161734.30GHY2Kp006321@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Mikael Urankar Subject: git: 82f36772565d - main - net/pload: Fix command-line args and unit display. List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mikael X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82f36772565dc3bcf17661df5ac8360c85fe426c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mikael: URL: https://cgit.FreeBSD.org/ports/commit/?id=82f36772565dc3bcf17661df5ac8360c85fe426c commit 82f36772565dc3bcf17661df5ac8360c85fe426c Author: J.R. Oldroyd AuthorDate: 2023-01-16 16:56:29 +0000 Commit: Mikael Urankar CommitDate: 2023-01-16 17:33:55 +0000 net/pload: Fix command-line args and unit display. This patch updates the port to fix the fact that the code calls XtAppInitialize() which eats the command-line args and so causes ps(1) to not display them. The command-line args are now saved before and restored after the call to XtAppInitialize(). Also, correct the display of the units of total byte counts to show as "B", "kB", "GB" etc, rather than the imprecise/incorrect "b", "k", "G" etc. PR: 267710 Approved by: J.R. Oldroyd (maintainer) --- net/pload/Makefile | 2 +- net/pload/files/patch-Imakefile | 31 ++--- .../{patch-ioctl_stats.c => patch-ioctl__stat.c} | 10 +- net/pload/files/patch-pload.c | 147 +++++++++++---------- net/pload/files/patch-pload.man | 8 +- 5 files changed, 95 insertions(+), 103 deletions(-) diff --git a/net/pload/Makefile b/net/pload/Makefile index 31de8211bf6f..6aab9b94341c 100644 --- a/net/pload/Makefile +++ b/net/pload/Makefile @@ -1,6 +1,6 @@ PORTNAME= pload PORTVERSION= 0.9.5 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= net sysutils MASTER_SITES= http://opal.com/src/pload/ LOCAL/pav diff --git a/net/pload/files/patch-Imakefile b/net/pload/files/patch-Imakefile index ae8cc75f98c7..09a8cdabf97c 100644 --- a/net/pload/files/patch-Imakefile +++ b/net/pload/files/patch-Imakefile @@ -1,20 +1,11 @@ -diff -c Imakefile.orig Imakefile -*** Imakefile.orig Tue Feb 1 02:11:24 2000 ---- Imakefile Tue Aug 3 10:02:12 2004 -*************** -*** 15,21 **** - - ComplexProgramTarget(pload) - -! distclean: clean - $(RM) Makefile osdefs.mk core \ - pload-$(VER).tar.gz \ - pload-$(VER)-1.i386.rpm \ ---- 15,21 ---- - - ComplexProgramTarget(pload) - -! distclean:: clean - $(RM) Makefile osdefs.mk core \ - pload-$(VER).tar.gz \ - pload-$(VER)-1.i386.rpm \ +--- Imakefile.orig 2000-02-01 07:11:24 UTC ++++ Imakefile +@@ -15,7 +15,7 @@ DEFINES = -DVERSION="\"Pload version $(VER)\"" $(OSDEF + + ComplexProgramTarget(pload) + +-distclean: clean ++distclean:: clean + $(RM) Makefile osdefs.mk core \ + pload-$(VER).tar.gz \ + pload-$(VER)-1.i386.rpm \ diff --git a/net/pload/files/patch-ioctl_stats.c b/net/pload/files/patch-ioctl__stat.c similarity index 91% rename from net/pload/files/patch-ioctl_stats.c rename to net/pload/files/patch-ioctl__stat.c index 83962721b2c9..ad980130e51a 100644 --- a/net/pload/files/patch-ioctl_stats.c +++ b/net/pload/files/patch-ioctl__stat.c @@ -1,5 +1,5 @@ ---- ioctl_stat.c.orig 2000-02-01 02:11:24.000000000 -0500 -+++ ioctl_stat.c 2009-06-15 15:30:03.000000000 -0400 +--- ioctl_stat.c.orig 2000-02-01 07:11:24 UTC ++++ ioctl_stat.c @@ -30,6 +30,12 @@ #include /* open */ #include /* ioctl */ @@ -26,7 +26,7 @@ # endif /* linux && __GLIBC__ < 2 */ #else /* STREAMS */ /* Solaris, SunOS, OSF/1, SVR4 */ # include -@@ -61,8 +69,18 @@ +@@ -61,8 +69,18 @@ void getsocket(if_data *ifd) void ioctl_stat(if_data *ifd) { struct ifreq ifr; @@ -46,7 +46,7 @@ if (!ifd->s) getsocket(ifd); memset(&ifr, 0, sizeof(ifr)); -@@ -76,7 +94,9 @@ +@@ -76,7 +94,9 @@ void ioctl_stat(if_data *ifd) return; } @@ -56,7 +56,7 @@ #ifdef linux req.stats_ptr = (caddr_t) &req.stats; -@@ -84,18 +104,36 @@ +@@ -84,18 +104,36 @@ void ioctl_stat(if_data *ifd) #define ifr_name ifr__name #endif diff --git a/net/pload/files/patch-pload.c b/net/pload/files/patch-pload.c index 0fb88df906b1..9c6c17263337 100644 --- a/net/pload/files/patch-pload.c +++ b/net/pload/files/patch-pload.c @@ -1,73 +1,74 @@ -diff -c pload.c.orig pload.c -*** pload.c.orig Tue Feb 1 02:11:24 2000 ---- pload.c Wed Sep 22 13:13:46 2004 -*************** -*** 596,608 **** - void do_total(char *b, double total) - { - if (total < 1024.0) -! sprintf(b, "%s%0.0f b", b, total); - else if (total < (1024.0*1024.0)) -! sprintf(b, "%s%0.2f k", b, total/1024.0); - else if (total < (1024.0*1024.0*1024.0)) -! sprintf(b, "%s%0.2f M", b, total/1024.0/1024.0); - else -! sprintf(b, "%s%0.2f G", b, total/1024.0/1024.0/1024.0); - - return; - } ---- 596,608 ---- - void do_total(char *b, double total) - { - if (total < 1024.0) -! sprintf(b, "%s%0.0f B", b, total); - else if (total < (1024.0*1024.0)) -! sprintf(b, "%s%0.2f kB", b, total/1024.0); - else if (total < (1024.0*1024.0*1024.0)) -! sprintf(b, "%s%0.2f MB", b, total/1024.0/1024.0); - else -! sprintf(b, "%s%0.2f GB", b, total/1024.0/1024.0/1024.0); - - return; - } -*************** -*** 610,622 **** - void do_rate(char *b, double rate) - { - if (rate < 1024.0) -! sprintf(b, "%s%0.0f b/s",b, rate); - else if (rate < (1024.0*1024.0)) -! sprintf(b, "%s%0.2f k/s",b, rate/1024.0); - else if (rate < (1024.0*1024.0*1024.0)) -! sprintf(b, "%s%0.2f M/s",b, rate/1024.0/1024.0); - else -! sprintf(b, "%s%0.2f G/s", b, rate/1024.0/1024.0/1024.0); - return; - } - ---- 610,622 ---- - void do_rate(char *b, double rate) - { - if (rate < 1024.0) -! sprintf(b, "%s%0.0f B/s",b, rate); - else if (rate < (1024.0*1024.0)) -! sprintf(b, "%s%0.2f kB/s",b, rate/1024.0); - else if (rate < (1024.0*1024.0*1024.0)) -! sprintf(b, "%s%0.2f MB/s",b, rate/1024.0/1024.0); - else -! sprintf(b, "%s%0.2f GB/s", b, rate/1024.0/1024.0/1024.0); - return; - } - -*************** -*** 643,648 **** ---- 643,651 ---- - break; - case 'M': - do_rate(buff, max); -+ break; -+ case 'd': -+ sprintf(buff, "%s", resources.device); - break; - case '%': /* literal % */ - i = strlen(buff); +--- pload.c.orig 2000-02-01 07:11:24 UTC ++++ pload.c +@@ -285,6 +285,13 @@ static XtResource pload_resources[] = { + /************* Main () ******************/ + int main (int argc, char *argv[]) + { ++ char *orig_argv[64]; ++ int i; ++ ++ /* save original argv pointers */ ++ for(i = 0; argv[i]; i++) ++ orig_argv[i] = argv[i]; ++ + Progname = argv[0]; + + toplevel = XtAppInitialize ( +@@ -301,6 +308,11 @@ int main (int argc, char *argv[]) + and exit */ + if (argc != 1) Usage(); + ++ /* XtAppInitialize() eats the arguments, so restore original ++ argv so that ps(1) shows the command line */ ++ for(i = 0; orig_argv[i]; i++) ++ argv[i] = orig_argv[i]; ++ + XtGetApplicationResources( + toplevel, /* widget */ + (XtPointer) &resources, /* where to put */ +@@ -596,27 +608,26 @@ void CheckForWMExit( Widget w, + void do_total(char *b, double total) + { + if (total < 1024.0) +- sprintf(b, "%s%0.0f b", b, total); ++ sprintf(b, "%s%0.0f B", b, total); + else if (total < (1024.0*1024.0)) +- sprintf(b, "%s%0.2f k", b, total/1024.0); ++ sprintf(b, "%s%0.2f kiB", b, total/1024.0); + else if (total < (1024.0*1024.0*1024.0)) +- sprintf(b, "%s%0.2f M", b, total/1024.0/1024.0); ++ sprintf(b, "%s%0.2f MiB", b, total/1024.0/1024.0); + else +- sprintf(b, "%s%0.2f G", b, total/1024.0/1024.0/1024.0); +- ++ sprintf(b, "%s%0.2f GiB", b, total/1024.0/1024.0/1024.0); + return; + } + + void do_rate(char *b, double rate) + { + if (rate < 1024.0) +- sprintf(b, "%s%0.0f b/s",b, rate); ++ sprintf(b, "%s%0.0f B/s",b, rate); + else if (rate < (1024.0*1024.0)) +- sprintf(b, "%s%0.2f k/s",b, rate/1024.0); ++ sprintf(b, "%s%0.2f kiB/s",b, rate/1024.0); + else if (rate < (1024.0*1024.0*1024.0)) +- sprintf(b, "%s%0.2f M/s",b, rate/1024.0/1024.0); ++ sprintf(b, "%s%0.2f MiB/s",b, rate/1024.0/1024.0); + else +- sprintf(b, "%s%0.2f G/s", b, rate/1024.0/1024.0/1024.0); ++ sprintf(b, "%s%0.2f GiB/s", b, rate/1024.0/1024.0/1024.0); + return; + } + +@@ -643,6 +654,9 @@ void make_label(char *fmt, unsigned long total, double + break; + case 'M': + do_rate(buff, max); ++ break; ++ case 'd': ++ strcat(buff, resources.device); + break; + case '%': /* literal % */ + i = strlen(buff); diff --git a/net/pload/files/patch-pload.man b/net/pload/files/patch-pload.man index 61c502ef5e87..c943c6ca8bc1 100644 --- a/net/pload/files/patch-pload.man +++ b/net/pload/files/patch-pload.man @@ -1,5 +1,5 @@ ---- pload.man.orig Tue Feb 1 02:11:24 2000 -+++ pload.man Wed Sep 22 16:44:12 2004 +--- pload.man.orig 2000-02-01 07:11:24 UTC ++++ pload.man @@ -18,7 +18,7 @@ .TH PLOAD 1 "" "January 2000" @@ -9,7 +9,7 @@ .SH SYNOPSIS .ta 6n -@@ -30,9 +30,9 @@ +@@ -30,9 +30,9 @@ pload \- display ppp throughput statistics in an X win [-iformat \fIfmt\fP] [-oformat \fIfmt\fP] .SH DESCRIPTION @@ -22,7 +22,7 @@ .SH OPTIONS .PP -@@ -144,7 +144,7 @@ +@@ -144,7 +144,7 @@ Display \fImessage\fP in the labels when offline. The .TP 8 .B \-iformat \fIfmt\fP Use string \fIfmt\fP for the inbound label. The \fIfmt\fP string will be displayed