Date: Thu, 2 Dec 2010 11:59:44 -0500 From: Eitan Adler <lists@eitanadler.com> To: freebsd ports <freebsd-ports@freebsd.org> Subject: Re: updated dialog(1) replacement for ports Message-ID: <AANLkTin%2BrnWa02PEZ9YOuiX_84oOnvZvPaPnPE44TY-=@mail.gmail.com> In-Reply-To: <20101202160617.GD83341@libertas.local.camdensoftware.com> References: <AANLkTim--0fKfdZqRNeWAwAWfNATjhnFOh5gZGx-0_qT@mail.gmail.com> <20101202160617.GD83341@libertas.local.camdensoftware.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Thank you for your comments > Every keystroke causes the screen to completely repaint. This can't be fully helped. Any valid key stroke is going to cause this. However I did make invalid keystrokes skip the repainting. > If I accidentally leave off --port name, it core dumps. Heh - I didn't test usage mistakes very well because its intended to be handled by the ports system, not the end user. Attached patch does fix it though: diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -11,3 +11,4 @@ 87f7ea83a8b57330e68a3c955204b7ae18f72225 3c192430abada995516ba1f949482b419affab98 version13 c12889c6ed8bdcb0085a4c5f40dc6b9fa749f29a version14 49685446bbb2cb7f9f437ff857d1cf4e87dc05e7 version15 +71c308f419475f9ccbbacd9ffd08b60dc88ca646 version16 diff --git a/dialog4ports.c b/dialog4ports.c --- a/dialog4ports.c +++ b/dialog4ports.c @@ -395,6 +395,9 @@ parseArguments(const int argc, char * ar } #endif + if (arginfo->portname == NULL) + errx(EX_USAGE,"Port name is required"); + if (arginfo->nElements == 0) errx(EX_USAGE,"We need at least one option"); @@ -442,14 +445,15 @@ printFileToWindow(WINDOW * const win, co */ void usage(void) { - fprintf(stderr,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n", + fprintf(stderr,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", "--port portname", "[--port-comment 'port comment']", "[--licence name of default licence]", "[--licence-text filename of licence]", "--option optionName=description [--hfile filename]", "--radio optionName=description=option1#option2 [--hfile filename]", - "--input optionName=description [--hfile filename]" + "--input optionName=description [--hfile filename]", + "please note that this program is intended to be used by the ports system - not the end user" ); } @@ -879,6 +883,8 @@ main(int argc, char* argv[]) case 27: /* ESCAPE */ weWantMore = false; break; + default: + continue; } /* this rereads the file each time. perhaps it could be cached? -- Eitan Adler
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTin%2BrnWa02PEZ9YOuiX_84oOnvZvPaPnPE44TY-=>