updated dialog(1) replacement for ports
Eitan Adler
lists at eitanadler.com
Thu Dec 2 17:00:18 UTC 2010
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
More information about the freebsd-ports
mailing list