Files
Arquivotheca.Solaris-2.5/lib/libeti/menu/scale.c
seta75D 7c4988eac0 Init
2021-10-11 19:38:01 -03:00

51 lines
1.0 KiB
C
Executable File

/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)scale.c 1.2 92/07/14 SMI" /* SVr4.0 1.2 */
#include "private.h"
/* Calculate the numbers of rows and columns needed to display */
/* the menu */
void
_scale (m)
MENU *m;
{
register int width;
if (Items(m) && IthItem(m, 0)) {
/* Get the width of one column */
width = MaxName(m) + Marklen(m);
if (ShowDesc(m) && MaxDesc(m)) {
width += MaxDesc(m) + 1;
}
Itemlen(m) = width;
/* Multiply this by the number of columns */
width = width * Cols(m);
/* Add in the number of spaces between columns */
width += Cols(m) - 1;
Width(m) = width;
}
}
int
scale_menu (m, r, c)
register MENU *m;
register int *r, *c;
{
if (!m) {
return E_BAD_ARGUMENT;
}
if (Items(m) && IthItem(m, 0)) {
*r = Height(m);
*c = Width(m);
return E_OK;
}
return E_NOT_CONNECTED;
}