scripts/config: sync with linux upstream
[openwrt.git] / scripts / config / lxdialog / inputbox.c
index 21404a0..d58de1d 100644 (file)
@@ -42,7 +42,7 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
  * Display a dialog box for inputing a string
  */
 int dialog_inputbox(const char *title, const char *prompt, int height, int width,
-                    const char *init)
+                   const char *init)
 {
        int i, x, y, box_y, box_x, box_width;
        int input_x = 0, key = 0, button = -1;
@@ -56,14 +56,14 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
                strcpy(instr, init);
 
 do_resize:
-       if (getmaxy(stdscr) <= (height - 2))
+       if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN))
                return -ERRDISPLAYTOOSMALL;
-       if (getmaxx(stdscr) <= (width - 2))
+       if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN))
                return -ERRDISPLAYTOOSMALL;
 
        /* center dialog box on screen */
-       x = (COLS - width) / 2;
-       y = (LINES - height) / 2;
+       x = (getmaxx(stdscr) - width) / 2;
+       y = (getmaxy(stdscr) - height) / 2;
 
        draw_shadow(stdscr, y, x, height, width);