X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7+dev X-Exmh-Isig-CompType: comp X-Exmh-Isig-Folder: inbox From: "karl AT aspodata DOT se [via geda-user AT delorie DOT com]" To: geda-user AT delorie DOT com Subject: [geda-user] pcb -h segfaults Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_1680249995_3450" Message-Id: <20230331080934.01D9585F72C9@turkos.aspodata.se> Date: Fri, 31 Mar 2023 10:09:33 +0200 (CEST) X-Virus-Scanned: ClamAV using ClamSMTP Reply-To: geda-user AT delorie DOT com This is a multipart MIME message. --==_Exmh_1680249995_3450 Content-Type: text/plain; charset="utf-8" With ./configure --with-printer= --with-gui= --with-exporters= I get: $ src/pcb -h Segmentation fault $ Attached patch fixes that. Regards, /Karl Hammar --==_Exmh_1680249995_3450 Content-Type: text/plain; charset="utf-8" ; name="p2" Content-Description: p2 Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="p2" diff --git a/src/main.c b/src/main.c index a4646a39..cc968742 100644 --- a/src/main.c +++ b/src/main.c @@ -268,7 +268,7 @@ usage (void) int i; int n_printer =3D 0, n_gui =3D 0, n_exporter =3D 0; = - for (i =3D 0; hl[i]; i++) + for (i =3D 0; hl && hl[i]; i++) { if (hl[i]->gui) n_gui++; @@ -282,27 +282,27 @@ usage (void) u ("%s [-h|-V|--copyright]\t\t\tHelp, version, copyright", Progname); u ("%s [gui options] \t\tto edit", Progname); u ("Available GUI hid%s:", n_gui =3D=3D 1 ? "" : "s"); - for (i =3D 0; hl[i]; i++) + for (i =3D 0; hl && hl[i]; i++) if (hl[i]->gui) fprintf (stderr, "\t%-8s %s\n", hl[i]->name, hl[i]->description); u ("%s -p [printing options] \tto print", Progname); u ("Available printing hid%s:", n_printer =3D=3D 1 ? "" : "s"); - for (i =3D 0; hl[i]; i++) + for (i =3D 0; hl && hl[i]; i++) if (hl[i]->printer) fprintf (stderr, "\t%-8s %s\n", hl[i]->name, hl[i]->description); u ("%s -x hid [export options] \tto export", Progname); u ("Available export hid%s:", n_exporter =3D=3D 1 ? "" : "s"); - for (i =3D 0; hl[i]; i++) + for (i =3D 0; hl && hl[i]; i++) if (hl[i]->exporter) fprintf (stderr, "\t%-8s %s\n", hl[i]->name, hl[i]->description); = - for (i =3D 0; hl[i]; i++) + for (i =3D 0; hl && hl[i]; i++) if (hl[i]->gui) usage_hid (hl[i]); - for (i =3D 0; hl[i]; i++) + for (i =3D 0; hl && hl[i]; i++) if (hl[i]->printer) usage_hid (hl[i]); - for (i =3D 0; hl[i]; i++) + for (i =3D 0; hl && hl[i]; i++) if (hl[i]->exporter) usage_hid (hl[i]); = @@ -381,7 +381,7 @@ print_defaults () HID_Attribute *e; int i, n, hi; = - for (hi =3D 0; hl[hi]; hi++) + for (hi =3D 0; hl && hl[hi]; hi++) { HID *h =3D hl[hi]; if (h->gui) --==_Exmh_1680249995_3450--