From: mlichvar Date: Thu, 12 Oct 2006 14:31:16 +0000 (+0000) Subject: - add topleft option (patch from debian) X-Git-Tag: r0-52-4~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45bffa7f95d38f5ac0bb46ad12f9e6b43ec51b1a;p=thirdparty%2Fnewt.git - add topleft option (patch from debian) --- diff --git a/whiptail.1 b/whiptail.1 index 1d2e63d..8dc50b7 100644 --- a/whiptail.1 +++ b/whiptail.1 @@ -1,4 +1,4 @@ -.TH WHIPTAIL 1 "20 September 2004" "Whiptail Version 0.51.6" +.TH WHIPTAIL 1 "12 October 2006" "Whiptail Version 0.52.3" .SH NAME whiptail \- display dialog boxes from shell scripts .SH SYNOPSIS @@ -40,6 +40,9 @@ whiptail \- display dialog boxes from shell scripts [ .B \-\-scrolltext ] +[ +.B \-\-topleft +] .B box-options .SH DESCRIPTION .B whiptail @@ -105,6 +108,9 @@ string to be displayed on the backdrop, at the top of the screen. .BI \-\-scrolltext Force the display of a vertical scrollbar. .TP +.BI \-\-topleft +Put window in top-left corner. +.TP .B Box Options .TP .BI \-\-yesno " text height width" diff --git a/whiptail.c b/whiptail.c index 8a821b7..b036170 100644 --- a/whiptail.c +++ b/whiptail.c @@ -48,7 +48,7 @@ static void usage(int err) { "\t--gauge \n" "Options: (depend on box-option)\n" "\t--clear clear screen on exit\n" - "\t-defaultno default no button\n" + "\t--defaultno default no button\n" "\t--default-item set default string\n" "\t--fb use full buttons\n" "\t--nocancel no cancel button\n" @@ -57,7 +57,8 @@ static void usage(int err) { "\t--output-fd output to fd, not stdout\n" "\t--title display title\n" "\t--backtitle <backtitle> display backtitle\n" - "\t--scrolltext force verical scrollbars\n\n")); + "\t--scrolltext force verical scrollbars\n" + "\t--topleft put window in top-left corner\n\n")); exit(err ? DLG_ERROR : 0 ); } @@ -339,6 +340,7 @@ int main(int argc, const char ** argv) { int separateOutput = 0; int fullButtons = 0; int outputfd = 2; + int topLeft = 0; FILE *output = stderr; const char * result; const char ** selections, ** next; @@ -367,6 +369,7 @@ int main(int argc, const char ** argv) { { "separate-output", '\0', 0, &separateOutput, 0 }, { "title", '\0', POPT_ARG_STRING, &title, 0 }, { "textbox", '\0', 0, 0, OPT_TEXTBOX }, + { "topleft", '\0', 0, &topLeft, 0 }, { "yesno", '\0', 0, 0, OPT_YESNO }, { "passwordbox", '\0', 0, 0, OPT_PASSWORDBOX }, { "output-fd", '\0', POPT_ARG_INT, &outputfd, 0 }, @@ -501,8 +504,8 @@ int main(int argc, const char ** argv) { width -= 2; height -= 2; - newtOpenWindow((SLtt_Screen_Cols - width) / 2, - (SLtt_Screen_Rows - height) / 2, width, height, title); + newtOpenWindow(topLeft ? 1 : (SLtt_Screen_Cols - width) / 2, + topLeft ? 1 : (SLtt_Screen_Rows - height) / 2, width, height, title); if (backtitle) newtDrawRootText(0, 0, backtitle);