Your message dated Tue, 22 May 2018 19:00:40 +0000
with message-id <[email protected]>
and subject line Bug#224467: fixed in gnucap 1:0.36~20171003-1
has caused the Debian Bug report #224467,
regarding gnucap: patch to use getopt and print usage options
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
224467: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=224467
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gnucap
Version: 1:0.33-2
Severity: minor


Here's the patch. 

I had to change main() declaration (it's the string that's constant, not
the pointer) to make getopt work. -i and -b now act as (mutually
exclusive) flags, and the only non-flag option is a filename to read
on startup. Any other options give a usage message.



diff -pruN gnucap-0.33/src/declare.h gnucap-0.33.gutnik/src/declare.h
--- gnucap-0.33/src/declare.h   2002-11-05 23:47:50.000000000 -0800
+++ gnucap-0.33.gutnik/src/declare.h    2003-12-18 20:28:29.000000000 -0800
@@ -43,7 +43,7 @@ class OMSTREAM;
                void      setpixel(int,int,int);
                void      box(int,int,int,int,int);
                void      line(int,int,int,int,int);
-/* main     */ int       main(int,const char*[]);
+/* main     */ int       main(int,char* const []);
 /* plot     */ void      plottr(double);
                int       plopen(int,double,double,bool);
                void      plclose();
diff -pruN gnucap-0.33/src/main.cc gnucap-0.33.gutnik/src/main.cc
--- gnucap-0.33/src/main.cc     2002-11-05 23:47:54.000000000 -0800
+++ gnucap-0.33.gutnik/src/main.cc      2003-12-18 20:28:18.000000000 -0800
@@ -28,15 +28,15 @@
 #include "u_opt.h"
 #include "l_jmpbuf.h"
 /*--------------------------------------------------------------------------*/
-       int     main(int,const char*[]);
+       int     main(int argc, char * const argv[]);
 static void    sign_on(void);
 static void    read_startup_files(void);
-static void    process_cmd_line(int,const char*[]);
+static void    process_cmd_line(int, char* const[]);
 static void    finish(void);
 /*--------------------------------------------------------------------------*/
 extern JMP_BUF env;
 /*--------------------------------------------------------------------------*/
-int main(int argc, const char *argv[])
+int main(int argc, char * const argv[])
 {
   {
     SET_RUN_MODE xx(rBATCH);
@@ -98,20 +98,52 @@ static void read_startup_files(void)
   CMD::cmdproc("clear");
 }
 /*--------------------------------------------------------------------------*/
-static void process_cmd_line(int argc, const char *argv[])
+static void process_cmd_line(int argc, char * const argv[])
 {
+  int c; // Option character 
   char cmdbuf[BUFLEN];
-  {if ((argc > 2) && (strcasecmp(argv[1], "-i") == 0)) {
-    sprintf(cmdbuf, "get %s", argv[2]);
-    CMD::cmdproc(cmdbuf);
-  }else if ((argc > 2) && (strcasecmp(argv[1], "-b") == 0)) {
-    sprintf(cmdbuf, "< %s", argv[2]);
+  int batchflag=0; // Whether we're batched or not.
+
+  while ((c=getopt(argc, argv,"ibu")) != -1) {
+    switch (c) {
+      // -i just cancels batchflag; really, you probably never need
+      // this option.
+
+    case 'i':
+      //    sprintf(cmdbuf, "get %s", optarg);
+      //    CMD::cmdproc(cmdbuf);
+      batchflag=0;
+      break;
+
+    case 'b':
+      // -b right now just adds the command "end". It should disable asking
+      // questions during the run. Someday.
+      
+      //    sprintf(cmdbuf, "< %s", optarg);
+      //    CMD::cmdproc(cmdbuf);
+      batchflag=1;
+      break;
+    case 'u': 
+      // May as well print usage for unrecognized options too
+    default:
+      printf("options:\n"
+            " [-i] <filename>   interactive\n"
+            " -b <filename>     batchmode\n"
+            " -u                this usage summary\n"
+            " -b and -i are mutually exclusive. The last one set wins.\n"
+            );
+      CMD::cmdproc("end");
+      break;
+    }
+  }
+
+  if (argv[optind]) {
+    // Had an argument left
+    sprintf(cmdbuf, "get %s", argv[optind]);
     CMD::cmdproc(cmdbuf);
+  }
+  if (batchflag)
     CMD::cmdproc("end");
-  }else if (argc > 1) {
-    sprintf(cmdbuf, "get %s", argv[1]);
-    CMD::cmdproc(cmdbuf);
-  }}
 }
 /*--------------------------------------------------------------------------*/
 /* finish: clean up after a command



-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux omelette 2.4.20-1-686 #1 Sat Mar 22 13:16:21 EST 2003 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages gnucap depends on:
ii  libc6                     2.3.2.ds1-10   GNU C Library: Shared libraries an
ii  libgcc1                   1:3.3.2-4      GCC support library
ii  libncurses5               5.3.20030719-4 Shared libraries for terminal hand
ii  libreadline4              4.3-8          GNU readline and history libraries
ii  libstdc++5                1:3.3.2-4      The GNU Standard C++ Library v3

-- no debconf information



--- End Message ---
--- Begin Message ---
Source: gnucap
Source-Version: 1:0.36~20171003-1

We believe that the bug you reported is fixed in the latest version of
gnucap, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Felix Salfelder <[email protected]> (supplier of updated gnucap package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sun, 04 Mar 2018 04:14:08 +0000
Source: gnucap
Binary: libgnucap0 gnucap gnucap-common libgnucap-dev gnucap-default-plugins0
Architecture: source all amd64
Version: 1:0.36~20171003-1
Distribution: unstable
Urgency: medium
Maintainer: Debian Electronics Team 
<[email protected]>
Changed-By: Felix Salfelder <[email protected]>
Description:
 gnucap     - GNU Circuit Analysis package, main executable
 gnucap-common - GNU Circuit Analysis package, development headers
 gnucap-default-plugins0 - GNU Circuit Analysis package, default plugins
 libgnucap-dev - GNU Circuit Analysis package, development library
 libgnucap0 - GNU Circuit Analysis package, the library
Closes: 224467 693267 759987 831480 878364
Changes:
 gnucap (1:0.36~20171003-1) unstable; urgency=medium
 .
   * Split gnucap package into several packages
     This is required, as gnucap now provides a shared library.
   * libgnucap0 + libgnucap-dev (Closes: #224467)
     These packages contain the shared library and provide the files necessary
     to build/link against it, respectively. For example users can create their
     own binary programs to substitute the "gnucap" example executable provided
     in the "gnucap" package. Other packages may depend on libgnucap-dev, if
     they make use of the gnucap library, which will provide most gnucap
     functionality without the need to install all gnucap packages and files.
     (Closes: #224467)
   * Introduce gnucap-default-plugins0 package
     The plugins that were previous linked into the main executable are now
     shipped as a separate (optional) binary, the "default plugins". These are
     loaded by "gnucap", unless overridden in /etc/gnucap.rc (which does not
     exist by default). This package must hence be installed, if the
     functionality of the previous gnucap package is sought.
     The binary plugin is installed in a directory depending on the
     architecture and on the library soname it has been tested against.
   * gnucap-common package (Closes: #693267)
     Contains the development headers and build infrastructure. This package
     is architecture independent.
   * man pages for /usr/bin/gnucap and /usr/bin/gnucap-{conf,modelgen}. The
     upstream project makes no attempt in providing these, hence they are
     maintained here.
   * get-orig-source target, snapshotting upstream git
     There are no release tarballs, just tags, nowadays. These are equivalent
     to releases ("development snapshots"). This is new and was not required for
     previous tarball releases.
   * set sysconfdir to /etc, equivalent to --sysconfdir in autotools.
     There's the possibility to override things in /etc/gnucap.rc.
   * update d/copyright
   * move package to salsa (from alioth/pkg-electronics)
   * debian/control: Bump Standards-Version to 4.1.3
     Checked against
     https://www.debian.org/doc/packaging-manuals/upgrading-checklist.txt
     The seemingly relevant items do not require action.
     - 5.6.26 VCS-*, "https", for example
     - 10.2   plugins are in /usr/lib/triplet/gnucap0
     - 4.15   reproducibility not formally tested
     - 2.5    priority is optional
     - 8.1.1  invokes ldconfig.
     - 4.9.1  there is no doc (any more?) use wiki page instead
     - 5.2    control does not mention -dbg packages
   * bump compat to 11
     Now depend on dh >= 11. No action required, according to debhelper(7).
   * remove Wesley  J. Landaker and Hamish Moffatt from Uploaders as they not
     active anymore
     Thanking both for their work on the packages of gnucap in the past!
     (Closes: #759987, #831480)
   * adding a lintian override for http URL in watch file
     Lintian is complaining about the usage of http:// instead of https:// on
     the URL http://gnucap.org/archive/ in watch, a file for automatic checking
     for new upstream versions.
     gnucap.org isn't using the https protocol (yet or never will) and we need
     to use http here. Note that tarball releases are currently suspended, and
     git tags are used instead, so this might need more work.
 .
 .
   [ Helmut Grohne ]
   * Fix FTCBFS: Add gnucap:native to Build-Depends. (Closes: #878364)
Checksums-Sha1:
 f3a6a2cc9f07b5ddf143178f5f5a219cf95f5f9e 2342 gnucap_0.36~20171003-1.dsc
 f4f29704b3fb3265ad495eadc55ff84d9bc51565 794951 
gnucap_0.36~20171003.orig.tar.gz
 327fead36955db9d36eb01903084e0e1da95794c 23392 
gnucap_0.36~20171003-1.debian.tar.xz
 b3216eacafece2a044d590bf78de0c67db73cf61 80788 
gnucap-common_0.36~20171003-1_all.deb
 d4f59660d5925dcb121c637ec834a192f9e6538b 440356 
gnucap-default-plugins0_0.36~20171003-1_amd64.deb
 8b09c1446c02529986fa6daa14e981e93bbcaf3b 6878 
gnucap_0.36~20171003-1_amd64.buildinfo
 7ebddaee01baff3835502f69084a6c486eccc72c 135224 
gnucap_0.36~20171003-1_amd64.deb
 b87bf32b2e6db39b276f1631dbc96dc054a51671 19980 
libgnucap-dev_0.36~20171003-1_amd64.deb
 2dc45e35237f0138d2c9d8677f480cb314f26bdc 209200 
libgnucap0_0.36~20171003-1_amd64.deb
Checksums-Sha256:
 31950bac7266ab8ac54062d05c64089364bcd533ccda058f765ac7631dc6f957 2342 
gnucap_0.36~20171003-1.dsc
 9c38f3af860b8ad93db041696b2c993ec022e6f4f41284e907da712dd9f1a3f7 794951 
gnucap_0.36~20171003.orig.tar.gz
 44f827b8a127aa27f8c5297c57930a06055b67084d1e196fa735efdc5e95b509 23392 
gnucap_0.36~20171003-1.debian.tar.xz
 1d0016fb98ed522771067fb934ee86074db4798df9b2783f161d3bf2154c36ea 80788 
gnucap-common_0.36~20171003-1_all.deb
 6bec41be029da6a4b0b182261a14dfb9e161a965e676861d366a55adb11f93ea 440356 
gnucap-default-plugins0_0.36~20171003-1_amd64.deb
 f4383d134cdc9c04ba73391813066e1a7a6502d384c75f2808ebb50b98fdb572 6878 
gnucap_0.36~20171003-1_amd64.buildinfo
 93a5bf2cb4297d5f3e4135cedbf44683932108c3bfc081dcc89be49ca9474349 135224 
gnucap_0.36~20171003-1_amd64.deb
 69728c92a2c8023d1b83fe13e6442bdb9ac682c113c6b558ff37d84eb0fe1d66 19980 
libgnucap-dev_0.36~20171003-1_amd64.deb
 29433b7ba9ad0a0933475f58136c95f7f8a7df8ec8e2abf73d285223f18a96d5 209200 
libgnucap0_0.36~20171003-1_amd64.deb
Files:
 a4239c1bbb9a6e65e94a4160b2cf0824 2342 electronics optional 
gnucap_0.36~20171003-1.dsc
 21eca7fad9f8142d14e7b57248035d4a 794951 electronics optional 
gnucap_0.36~20171003.orig.tar.gz
 ce48e41f488dcbe71a21974d2a534342 23392 electronics optional 
gnucap_0.36~20171003-1.debian.tar.xz
 ea73b4e7ac7cbcad6916ab9e77db7900 80788 electronics optional 
gnucap-common_0.36~20171003-1_all.deb
 ac0d3766701be3d1821cc97fe588b793 440356 electronics optional 
gnucap-default-plugins0_0.36~20171003-1_amd64.deb
 29295e8764444013eca63ea140c287f8 6878 electronics optional 
gnucap_0.36~20171003-1_amd64.buildinfo
 1b7b4e13fa1b7b00bc7cbc7af4b8b24f 135224 electronics optional 
gnucap_0.36~20171003-1_amd64.deb
 736d0447e4ffd6ba17c7f064c7f01cee 19980 libdevel optional 
libgnucap-dev_0.36~20171003-1_amd64.deb
 071d2f6c584c8560416169cf590dcc66 209200 libs optional 
libgnucap0_0.36~20171003-1_amd64.deb

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEtw38bxNP7PwBHmKqgwFgFCUdHbAFAlr+394ACgkQgwFgFCUd
HbDjLBAAhjZEFhhZJJDGNjuAu4N+PInXGhhs1YMCI17aRyswm/gMQqUexWxYbvMN
UGNHhmJaWiVPjC/v6Kughl+5dDOT3lAjaAYa/P8xYiroME9utQsObKbbVmuX9fQN
VQjxA6KhrJYfdRnjtNzlTcB736TiYqngbt39pf66AQUAbxDSU09MXi/1ScDmkinG
ZOL6iOy557vcA6WUHhQyRfMfeRYkjwetraRvPx2kBq68QNhVewyZHf6u0iuNXPwt
AU48HbY0QoaZI079Wphsog4pZ3HPVNDxf8wZ0yMNPAl9Yumaxm4X7M6lwRe73AXa
nYZkkTnsU9ElWbbDPbXQe9lJAJXbWqq2RqrIlyQ4rHaNkGWUrErmFq4WOfYGWQRC
8SETdwG8fxR89WPDJi8KakL/WBRHf3XEIBZUNsY7ToZlsxzFAzOQBQ+x5VuLVsIS
8V2vb5ydTq12k9EwVu96H3/5NQMwstuRi56sws1rjKyge1TzUOToGpNZrn9AWmXb
B/J7oQoI4zpGaJvRyTUDiBL8ZdfKvLPWOt271O/R2Dp/7Vj+BmE800/imDuNafX1
rGnjhUvQSl+r1PXFmbCJm9tteGvAX8+1k1ixqMD+RJIuNSvFwfmvXu5wj4Xi3+mz
7RDnNOl4fjtKiF7bgKxtnqAx6vjTpcPxS2BkLhRGUWSFHYY7w9s=
=fluR
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to