summaryrefslogtreecommitdiff
path: root/menu/libmenu
diff options
context:
space:
mode:
Diffstat (limited to 'menu/libmenu')
-rw-r--r--menu/libmenu/com32io.c9
-rw-r--r--menu/libmenu/com32io.h20
-rw-r--r--menu/libmenu/des.c33
-rw-r--r--menu/libmenu/des.h1
-rw-r--r--menu/libmenu/help.c18
-rw-r--r--menu/libmenu/help.h2
-rw-r--r--menu/libmenu/menu.c189
-rw-r--r--menu/libmenu/menu.h56
-rw-r--r--menu/libmenu/passwords.c10
-rw-r--r--menu/libmenu/passwords.h4
-rw-r--r--menu/libmenu/scancodes.h4
-rw-r--r--menu/libmenu/syslnx.c9
-rw-r--r--menu/libmenu/syslnx.h6
-rw-r--r--menu/libmenu/tui.c36
-rw-r--r--menu/libmenu/tui.h18
15 files changed, 205 insertions, 210 deletions
diff --git a/menu/libmenu/com32io.c b/menu/libmenu/com32io.c
index 33f0c3e6..31aec5df 100644
--- a/menu/libmenu/com32io.c
+++ b/menu/libmenu/com32io.c
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -35,7 +35,7 @@ void setdisppage(char num) // Set the display page to specified number
__intcall(0x10,&inreg,&outreg);
}
-char getdisppage() // Get current display page
+char getdisppage() // Get current display page
{
REG_AH(inreg) = 0x0f;
__intcall(0x10,&inreg,&outreg);
@@ -74,7 +74,7 @@ void beep()
{
REG_AH(inreg) = 0x0E;
REG_AL(inreg) = 0x07;
- REG_BH(inreg) = 0;
+ REG_BH(inreg) = 0;
__intcall(0x10,&inreg,&outreg);
}
@@ -96,7 +96,7 @@ char inputc(char * scancode)
if (scancode) *scancode = REG_AH(outreg);
return REG_AL(outreg);
}
-
+
void getcursorshape(char *start, char *end)
{
char page = getdisppage();
@@ -144,4 +144,3 @@ unsigned char getcharat(char page)
__intcall(0x16,&inreg,&outreg);
return REG_AL(outreg);
}
-
diff --git a/menu/libmenu/com32io.h b/menu/libmenu/com32io.h
index 26bec0fc..78ce72fa 100644
--- a/menu/libmenu/com32io.h
+++ b/menu/libmenu/com32io.h
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
/* BIOS Assisted output routines */
-void cswprint(const char *str, char attr, char left);
+void cswprint(const char *str, char attr, char left);
// Print a C str (NUL-terminated) respecting the left edge of window
// i.e. \n in str will move cursor to column left
// Print a C str (NUL-terminated)
@@ -31,11 +31,11 @@ static inline void csprint(const char *str, char attr)
cswprint(str,attr,0);
}
-void cprint(char chr,char attr,unsigned int times, char disppage); // Print a char
+void cprint(char chr,char attr,unsigned int times, char disppage); // Print a char
void setdisppage(char num); // Set the display page to specified number
-char getdisppage(); // Get current display page
+char getdisppage(); // Get current display page
void gotoxy(char row,char col, char page);
@@ -44,7 +44,7 @@ void getpos(char * row, char * col, char page);
char inputc(char * scancode); // Return ASCII char by val, and scancode by reference
static inline void putch(char x, char attr, char page)
-{
+{
cprint(x,attr,1,page);
}
@@ -52,7 +52,7 @@ void setcursorshape(char start,char end); // Set cursor shape
void getcursorshape(char *start,char *end); // Get shape for current page
// Get char displayed at current position in specified page
-unsigned char getcharat(char page);
+unsigned char getcharat(char page);
static inline void cursoroff(void) /* Turns off cursor */
{
@@ -90,10 +90,10 @@ static inline void scrollup(void) //Scroll up display screen by one line
{
scrollupwindow(0,0,getnumrows(),getnumcols(),0x07,1);
}
-
+
void setvideomode(char mode); // Set the video mode.
-static inline char getvideomode(void) // Get the current video mode
+static inline char getvideomode(void) // Get the current video mode
{
return readbiosb(0x449);
}
@@ -105,8 +105,8 @@ void beep(); // A Bell
unsigned char checkkbdbuf(); // Check to see if there is kbd buffer is non-empty?
static inline void clearkbdbuf() // Clear the kbd buffer (how many chars removed?)
-{
+{
while (checkkbdbuf()) inputc(NULL);
-}
+}
#endif
diff --git a/menu/libmenu/des.c b/menu/libmenu/des.c
index 6309453e..d8060598 100644
--- a/menu/libmenu/des.c
+++ b/menu/libmenu/des.c
@@ -70,7 +70,7 @@
typedef unsigned long my_u_int32_t;
typedef unsigned char my_u_char_t;
-/* Re-entrantify me -- all this junk needs to be in
+/* Re-entrantify me -- all this junk needs to be in
* struct crypt_data to make this really reentrant... */
static my_u_char_t inv_key_perm[64];
static my_u_char_t inv_comp_perm[56];
@@ -94,8 +94,8 @@ static my_u_int32_t old_rawkey0, old_rawkey1;
static my_u_int32_t common[8][256];
#endif
-/* Static stuff that stays resident and doesn't change after
- * being initialized, and therefore doesn't need to be made
+/* Static stuff that stays resident and doesn't change after
+ * being initialized, and therefore doesn't need to be made
* reentrant. */
static my_u_char_t init_perm[64], final_perm[64];
static my_u_char_t m_sbox[4][4096];
@@ -229,7 +229,7 @@ static const my_u_char_t bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02,
// static const my_u_int32_t *bits28, *bits24;
-static int
+static int
ascii_to_bin(char ch)
{
if (ch > 'z')
@@ -317,7 +317,7 @@ des_init(void)
* and for the key initial and compression permutations.
*/
-#ifndef LOWSPACE
+#ifndef LOWSPACE
for (k = 0; k < 8; k++) {
for (i = 0; i < 256; i++) {
*(il = &ip_maskl[k][i]) = 0L;
@@ -376,7 +376,7 @@ des_init(void)
for (i = 0; i < 32; i++)
un_pbox[pbox[i] - 1] = (my_u_char_t)i;
-#ifndef LOWSPACE
+#ifndef LOWSPACE
for (b = 0; b < 4; b++)
for (i = 0; i < 256; i++) {
*(p = &psbox[b][i]) = 0L;
@@ -397,7 +397,7 @@ setup_ip_maskl(void)
{
int i, j, k, inbit, obit;
my_u_int32_t *il;
-
+
for (k = 0; k < 8; k++) {
for (i = 0; i < 256; i++) {
*(il = &common[k][i]) = 0L;
@@ -417,7 +417,7 @@ setup_ip_maskr(void)
{
int i, j, k, inbit, obit;
my_u_int32_t *ir;
-
+
for (k = 0; k < 8; k++) {
for (i = 0; i < 256; i++) {
*(ir = &common[k][i]) = 0L;
@@ -451,7 +451,7 @@ setup_fp_maskl(void)
}
}
}
-
+
static void
setup_fp_maskr(void)
{
@@ -471,7 +471,7 @@ setup_fp_maskr(void)
}
}
}
-
+
static void
setup_key_perm_maskl(void)
{
@@ -515,7 +515,7 @@ setup_key_perm_maskr(void)
}
}
}
-
+
static void
setup_comp_maskl(void)
{
@@ -565,7 +565,7 @@ setup_psbox(void)
{
int i, j, b;
my_u_int32_t *p;
-
+
for (b = 0; b < 4; b++)
for (i = 0; i < 256; i++) {
*(p = &common[b][i]) = 0L;
@@ -645,7 +645,7 @@ des_setkey(const char *key)
* Do key permutation and split into two 28-bit subkeys.
*/
-#ifdef LOWSPACE
+#ifdef LOWSPACE
setup_key_perm_maskl();
k0 = common[0][rawkey0 >> 25]
| common[1][(rawkey0 >> 17) & 0x7f]
@@ -695,7 +695,7 @@ des_setkey(const char *key)
t0 = (k0 << shifts) | (k0 >> (28 - shifts));
t1 = (k1 << shifts) | (k1 >> (28 - shifts));
-#ifdef LOWSPACE
+#ifdef LOWSPACE
setup_comp_maskl();
de_keysl[15 - round] =
en_keysl[round] = common[0][(t0 >> 21) & 0x7f]
@@ -773,7 +773,7 @@ do_des( my_u_int32_t l_in, my_u_int32_t r_in, my_u_int32_t *l_out, my_u_int32_t
/*
* Do initial permutation (IP).
*/
-
+
#ifdef LOWSPACE
setup_ip_maskl();
l = common[0][l_in >> 24]
@@ -1046,7 +1046,7 @@ char *crypt(const char *key, const char *setting)
*/
output[9] = '\0';
p = (my_u_char_t *)output + strlen(output);
- } else
+ } else
#endif
{
/*
@@ -1099,4 +1099,3 @@ char *crypt(const char *key, const char *setting)
return(output);
}
-
diff --git a/menu/libmenu/des.h b/menu/libmenu/des.h
index a03e58a7..67fc6b70 100644
--- a/menu/libmenu/des.h
+++ b/menu/libmenu/des.h
@@ -6,4 +6,3 @@
extern char *crypt (const char *key, const char *salt);
#endif
-
diff --git a/menu/libmenu/help.c b/menu/libmenu/help.c
index 0727a380..c71cd266 100644
--- a/menu/libmenu/help.c
+++ b/menu/libmenu/help.c
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -23,7 +23,7 @@ char * findline(char*buffer,int count)
{
int ctr;
char *p= buffer-1;
-
+
if (count < 1) return buffer;
for (ctr=0; ctr < count; ctr++) {
p = strchr(p+1,'\n');
@@ -51,16 +51,16 @@ void printtext(char*buf, int from)
char *p,*f;
char right,bot,nlines;
- // clear window to print
+ // clear window to print
right = getnumcols() - HELP_RIGHT_MARGIN;
bot = getnumrows() - HELP_BOTTOM_MARGIN;
nlines = bot-HELP_BODY_ROW+1;
- scrollupwindow(HELP_BODY_ROW,HELP_LEFT_MARGIN,bot,right,0x07,nlines);
+ scrollupwindow(HELP_BODY_ROW,HELP_LEFT_MARGIN,bot,right,0x07,nlines);
f = findline(buf,from);
if (!f) return; // nothing to print
if (*f=='\n') f++; // start of from+1st line
- p = findline(f,nlines);
+ p = findline(f,nlines);
if (p && (*p=='\n')) *p = '\0'; // change to NUL
gotoxy(HELP_BODY_ROW,HELP_LEFT_MARGIN,HELPPAGE);
cswprint(f,0x07,HELP_LEFT_MARGIN);
@@ -72,7 +72,7 @@ void showhelp(const char *filename)
char nc,nr,ph;
char *title,*text;
union { char *buffer; void *vbuf; } buf; // This is to avoild type-punning issues
-
+
char line[512];
size_t size;
char scan;
@@ -95,7 +95,7 @@ void showhelp(const char *filename)
cls();
return;
}
-
+
rv = loadfile(filename,(void **)&buf.vbuf, &size); // load entire file into memory
if (rv < 0) { // Error reading file or no such file
sprintf(line, "Error reading file or file not found\n file=%s",filename);
@@ -123,11 +123,11 @@ void showhelp(const char *filename)
while(scan != ESCAPE) {
printtext(text,curr_line);
gotoxy(HELP_BODY_ROW-1,nc-HELP_RIGHT_MARGIN,HELPPAGE);
- if (curr_line > 0)
+ if (curr_line > 0)
putch(HELP_MORE_ABOVE,0x07,HELPPAGE);
else putch(' ',0x07,HELPPAGE);
gotoxy(nr-HELP_BOTTOM_MARGIN+1,nc-HELP_RIGHT_MARGIN,HELPPAGE);
- if (curr_line < numlines - ph)
+ if (curr_line < numlines - ph)
putch(HELP_MORE_BELOW,0x07,HELPPAGE);
else putch(' ',0x07,HELPPAGE);
diff --git a/menu/libmenu/help.h b/menu/libmenu/help.h
index 77db9909..06832d84 100644
--- a/menu/libmenu/help.h
+++ b/menu/libmenu/help.h
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
diff --git a/menu/libmenu/menu.c b/menu/libmenu/menu.c
index 31831d2f..841e59ca 100644
--- a/menu/libmenu/menu.c
+++ b/menu/libmenu/menu.c
@@ -25,10 +25,10 @@ char EMPTYSTR[] = "";
/* Forward declarations */
int calc_visible(pt_menu menu,int first);
-int next_visible(pt_menu menu,int index);
-int prev_visible(pt_menu menu,int index);
-int next_visible_sep(pt_menu menu,int index);
-int prev_visible_sep(pt_menu menu,int index);
+int next_visible(pt_menu menu,int index);
+int prev_visible(pt_menu menu,int index);
+int next_visible_sep(pt_menu menu,int index);
+int prev_visible_sep(pt_menu menu,int index);
int calc_first_early(pt_menu menu,int curr);
int calc_first_late(pt_menu menu,int curr);
int isvisible(pt_menu menu,int first, int curr);
@@ -56,7 +56,7 @@ char getch(char *scan)
if (checkkbdbuf()) return inputc(scan);
sleep(ms->tm_stepsize);
if ( (ms->tm_total_timeout == 0) || (ms->ontotaltimeout==NULL))
- continue; // Dont bother with calculations if no handler
+ continue; // Dont bother with calculations if no handler
ms->tm_sofar_timeout += ms->tm_stepsize;
if (ms->tm_sofar_timeout >= ms->tm_total_timeout) {
th = ms->ontotaltimeout;
@@ -91,7 +91,7 @@ void printmenuitem(const char *str,uchar* attr)
getpos(&row,&col,page);
while ( *str ) {
- switch (*str)
+ switch (*str)
{
case '\b':
--col;
@@ -129,17 +129,17 @@ void printmenuitem(const char *str,uchar* attr)
}
}
-int find_shortcut(pt_menu menu,uchar shortcut, int index)
+int find_shortcut(pt_menu menu,uchar shortcut, int index)
// Find the next index with specified shortcut key
{
int ans;
pt_menuitem mi;
// Garbage in garbage out
- if ((index <0) || (index >= menu->numitems)) return index;
+ if ((index <0) || (index >= menu->numitems)) return index;
ans = index+1;
// Go till end of menu
- while (ans < menu->numitems)
+ while (ans < menu->numitems)
{
mi = menu->items[ans];
if ((mi->action == OPT_INVISIBLE) || (mi->action == OPT_SEP)
@@ -171,7 +171,7 @@ void printmenu(pt_menu menu, int curr, uchar top, uchar left, uchar first)
uchar *attr; // attribute attr
char sep[MENULEN];// and inbetween the item or a seperator is printed
pt_menuitem ci;
-
+
numitems = calc_visible(menu,first);
if (numitems > menu->menuheight) numitems = menu->menuheight;
@@ -181,7 +181,7 @@ void printmenu(pt_menu menu, int curr, uchar top, uchar left, uchar first)
drawbox(top-1,left-3,top+numitems,left+menuwidth,
ms->menupage,ms->normalattr[NOHLITE],ms->menubt);
memset(sep,ms->box_horiz,menuwidth); // String containing the seperator string
- sep[menuwidth-1] = 0;
+ sep[menuwidth-1] = 0;
// Menu title
x = (menuwidth - strlen(menu->title) - 1) >> 1;
gotoxy(top-1,left+x,ms->menupage);
@@ -194,7 +194,7 @@ void printmenu(pt_menu menu, int curr, uchar top, uchar left, uchar first)
row++;
if (row >= numitems) break; // Already have enough number of items
// Setup the defaults now
- lchar[0] = fchar[0] = ' ';
+ lchar[0] = fchar[0] = ' ';
lchar[1] = fchar[1] = '\0'; // fchar and lchar are just spaces
str = ci->item; // Pointer to item string
attr = (x==curr ? ms->reverseattr : ms->normalattr); // Normal attributes
@@ -234,7 +234,7 @@ void printmenu(pt_menu menu, int curr, uchar top, uchar left, uchar first)
csprint(lchar,attr[NOHLITE]); // Print last part
}
// Check if we need to MOREABOVE and MOREBELOW to be added
- // reuse x
+ // reuse x
row = 0;
x = next_visible_sep(menu,0); // First item
if (! isvisible(menu,first,x)) // There is more above
@@ -259,8 +259,8 @@ void printmenu(pt_menu menu, int curr, uchar top, uchar left, uchar first)
if (ms->handler) ms->handler(ms,menu->items[curr]);
}
-// Difference between this and regular menu, is that only
-// OPT_INVISIBLE, OPT_SEP are honoured
+// Difference between this and regular menu, is that only
+// OPT_INVISIBLE, OPT_SEP are honoured
void printradiomenu(pt_menu menu, int curr, uchar top, uchar left, int first)
{
int x,row; // x = index, row = position from top
@@ -270,7 +270,7 @@ void printradiomenu(pt_menu menu, int curr, uchar top, uchar left, int first)
uchar *attr; // all in the attribute attr
char sep[MENULEN];// and inbetween the item or a seperator is printed
pt_menuitem ci;
-
+
numitems = calc_visible(menu,first);
if (numitems > menu->menuheight) numitems = menu->menuheight;
@@ -280,7 +280,7 @@ void printradiomenu(pt_menu menu, int curr, uchar top, uchar left, int first)
drawbox(top-1,left-3,top+numitems,left+menuwidth,
ms->menupage,ms->normalattr[NOHLITE],ms->menubt);
memset(sep,ms->box_horiz,menuwidth); // String containing the seperator string
- sep[menuwidth-1] = 0;
+ sep[menuwidth-1] = 0;
// Menu title
x = (menuwidth - strlen(menu->title) - 1) >> 1;
gotoxy(top-1,left+x,ms->menupage);
@@ -294,10 +294,10 @@ void printradiomenu(pt_menu menu, int curr, uchar top, uchar left, int first)
if (row > numitems) break;
// Setup the defaults now
fchar[0] = RADIOUNSEL; fchar[1]='\0'; // Unselected ( )
- lchar[0] = '\0'; // Nothing special after
+ lchar[0] = '\0'; // Nothing special after
str = ci->item; // Pointer to item string
attr = ms->normalattr; // Always same attribute
- fchar[0] = (x==curr ? RADIOSEL : RADIOUNSEL);
+ fchar[0] = (x==curr ? RADIOSEL : RADIOUNSEL);
switch (ci->action) // set up attr,str,fchar,lchar for everything
{
case OPT_INACTIVE:
@@ -321,7 +321,7 @@ void printradiomenu(pt_menu menu, int curr, uchar top, uchar left, int first)
csprint(lchar,attr[NOHLITE]); // Print last part
}
// Check if we need to MOREABOVE and MOREBELOW to be added
- // reuse x
+ // reuse x
row = 0;
x = next_visible_sep(menu,0); // First item
if (! isvisible(menu,first,x)) // There is more above
@@ -364,7 +364,7 @@ pt_menuitem getradiooption(pt_menu menu, uchar top, uchar left, uchar startopt)
uchar asc,scan;
uchar numitems;
pt_menuitem ci; // Current item
-
+
numitems = calc_visible(menu,0);
// Setup status line
gotoxy(ms->minrow+ms->statline,ms->mincol,ms->menupage);
@@ -382,7 +382,7 @@ pt_menuitem getradiooption(pt_menu menu, uchar top, uchar left, uchar startopt)
{
printradiomenu(menu,curr,top,left,first);
ci = menu->items[curr];
-
+
asc = getch(&scan);
switch (scan)
{
@@ -408,7 +408,7 @@ pt_menuitem getradiooption(pt_menu menu, uchar top, uchar left, uchar startopt)
break;
case DNARROW:
curr = next_visible(menu,curr+1);
- if (! isvisible(menu,first,curr))
+ if (! isvisible(menu,first,curr))
first = calc_first_late(menu,curr);
break;
case LTARROW:
@@ -431,7 +431,7 @@ pt_menuitem getradiooption(pt_menu menu, uchar top, uchar left, uchar startopt)
tmp = find_shortcut(menu,asc,curr);
if ((tmp > curr) && (! isvisible(menu,first,tmp)))
first = calc_first_late(menu,tmp);
- if (tmp < curr)
+ if (tmp < curr)
first = calc_first_early(menu,tmp);
curr = tmp;
}
@@ -458,13 +458,13 @@ pt_menuitem getmenuoption(pt_menu menu, uchar top, uchar left, uchar startopt)
uchar numitems;
pt_menuitem ci; // Current item
t_handler_return hr; // Return value of handler
-
+
numitems = calc_visible(menu,0);
// Setup status line
gotoxy(ms->minrow+ms->statline,ms->mincol,ms->menupage);
cprint(ms->spacechar,ms->statusattr[NOHLITE],ms->numcols,ms->menupage);
- // Initialise current menu item
+ // Initialise current menu item
curr = next_visible(menu,startopt);
gotoxy(ms->minrow+ms->statline,ms->mincol,ms->menupage);
@@ -501,7 +501,7 @@ pt_menuitem getmenuoption(pt_menu menu, uchar top, uchar left, uchar startopt)
break;
case DNARROW:
curr = next_visible(menu,curr+1);
- if (! isvisible(menu,first,curr))
+ if (! isvisible(menu,first,curr))
first = calc_first_late(menu,curr);
break;
case LTARROW:
@@ -519,17 +519,17 @@ pt_menuitem getmenuoption(pt_menu menu, uchar top, uchar left, uchar startopt)
if (ci->action == OPT_RADIOMENU) return ci;
if (ci->handler != NULL) // Do we have a handler
{
- hr = ci->handler(ms,ci);
+ hr = ci->handler(ms,ci);
if (hr.refresh) // Do we need to refresh
{
// Cleanup menu using old number of items
- cleanupmenu(menu,top,left,numitems);
+ cleanupmenu(menu,top,left,numitems);
// Recalculate the number of items
numitems = calc_visible(menu,0);
// Reprint the menu
printmenu(menu,curr,top,left,first);
}
- if (hr.valid) return ci;
+ if (hr.valid) return ci;
}
else return ci;
break;
@@ -538,11 +538,11 @@ pt_menuitem getmenuoption(pt_menu menu, uchar top, uchar left, uchar startopt)
ci->itemdata.checked = !ci->itemdata.checked;
if (ci->handler != NULL) // Do we have a handler
{
- hr = ci->handler(ms,ci);
+ hr = ci->handler(ms,ci);
if (hr.refresh) // Do we need to refresh
{
// Cleanup menu using old number of items
- cleanupmenu(menu,top,left,numitems);
+ cleanupmenu(menu,top,left,numitems);
// Recalculate the number of items
numitems = calc_visible(menu,0);
// Reprint the menu
@@ -559,7 +559,7 @@ pt_menuitem getmenuoption(pt_menu menu, uchar top, uchar left, uchar startopt)
tmp = find_shortcut(menu,asc,curr);
if ((tmp > curr) && (! isvisible(menu,first,tmp)))
first = calc_first_late(menu,tmp);
- if (tmp < curr)
+ if (tmp < curr)
first = calc_first_early(menu,tmp);
curr = tmp;
}
@@ -601,7 +601,7 @@ pt_menuitem runmenusystem(uchar top, uchar left, pt_menu cmenu, uchar startopt,
startover:
// Set the menu height
cmenu->menuheight = ms->maxrow - top-3;
- if (cmenu->menuheight > ms->maxmenuheight)
+ if (cmenu->menuheight > ms->maxmenuheight)
cmenu->menuheight = ms->maxmenuheight;
if (menutype == NORMALMENU)
opt = getmenuoption(cmenu,top,left,startopt);
@@ -615,13 +615,13 @@ pt_menuitem runmenusystem(uchar top, uchar left, pt_menu cmenu, uchar startopt,
return NULL;
}
// Are we done with the menu system?
- if ((opt->action != OPT_SUBMENU) && (opt->action != OPT_RADIOMENU))
+ if ((opt->action != OPT_SUBMENU) && (opt->action != OPT_RADIOMENU))
{
cleanupmenu(cmenu,top,left,calc_visible(cmenu,0));
return opt; // parent cleanup other menus
}
// Either radiomenu or submenu
- // Do we have a valid menu number? The next hack uses the fact that
+ // Do we have a valid menu number? The next hack uses the fact that
// itemdata.submenunum = itemdata.radiomenunum (since enum data type)
if (opt->itemdata.submenunum >= ms->nummenus) // This is Bad....
{
@@ -648,7 +648,7 @@ pt_menuitem runmenusystem(uchar top, uchar left, pt_menu cmenu, uchar startopt,
if (opt->action == OPT_RADIOMENU)
{
if (choice != NULL) opt->data = (void *)choice; // store choice in data field
- if (opt->handler != NULL) opt->handler(ms,opt);
+ if (opt->handler != NULL) opt->handler(ms,opt);
choice = NULL; // Pretend user hit esc
}
if (choice==NULL) // User hit Esc in submenu
@@ -672,7 +672,7 @@ uchar find_menu_num(const char *name)
if (name == NULL) return (uchar)(-1);
for (i=0; i < ms->nummenus; i++)
- {
+ {
m = ms->menus[i];
if ((m->name) && (strcmp(m->name,name)==0)) return i;
}
@@ -695,7 +695,7 @@ void fix_submenus()
for (j=0; j < m->numitems; j++)
{
mi = m->items[j];
- // if submenu with non-trivial data string
+ // if submenu with non-trivial data string
// again using hack that itemdata is a union data type
if ( mi->data && ((mi->action == OPT_SUBMENU) || (mi->action == OPT_RADIOMENU)) )
mi->itemdata.submenunum = find_menu_num (mi->data);
@@ -710,15 +710,15 @@ pt_menuitem showmenus(uchar startmenu)
pt_menuitem rv;
uchar oldpage,tpos;
- fix_submenus(); // Fix submenu numbers incase nick names were used
+ fix_submenus(); // Fix submenu numbers incase nick names were used
// Setup screen for menusystem
oldpage = getdisppage();
setdisppage(ms->menupage);
cls();
- clearwindow(ms->minrow, ms->mincol, ms->maxrow, ms->maxcol,
+ clearwindow(ms->minrow, ms->mincol, ms->maxrow, ms->maxcol,
ms->menupage, ms->fillchar, ms->fillattr);
- tpos = (ms->numcols - strlen(ms->title) - 1) >> 1; // center it on line
+ tpos = (ms->numcols - strlen(ms->title) - 1) >> 1; // center it on line
gotoxy(ms->minrow,ms->mincol,ms->menupage);
cprint(ms->tfillchar,ms->titleattr,ms->numcols,ms->menupage);
gotoxy(ms->minrow,ms->mincol+tpos,ms->menupage);
@@ -727,8 +727,8 @@ pt_menuitem showmenus(uchar startmenu)
cursoroff(); // Doesn't seem to work?
- // Go, main menu cannot be a radio menu
- rv = runmenusystem(ms->minrow+MENUROW, ms->mincol+MENUCOL,
+ // Go, main menu cannot be a radio menu
+ rv = runmenusystem(ms->minrow+MENUROW, ms->mincol+MENUCOL,
ms->menus[(unsigned int)startmenu], 0, NORMALMENU);
// Hide the garbage we left on the screen
@@ -742,15 +742,15 @@ pt_menuitem showmenus(uchar startmenu)
pt_menusystem init_menusystem(const char *title)
{
int i;
-
+
ms = NULL;
ms = (pt_menusystem) malloc(sizeof(t_menusystem));
if (ms == NULL) return NULL;
ms->nummenus = 0;
// Initialise all menu pointers
- for (i=0; i < MAXMENUS; i++) ms->menus[i] = NULL;
-
- ms->title = (char *)malloc(TITLELEN+1);
+ for (i=0; i < MAXMENUS; i++) ms->menus[i] = NULL;
+
+ ms->title = (char *)malloc(TITLELEN+1);
if (title == NULL)
strcpy(ms->title,TITLESTR); // Copy string
else strcpy(ms->title,title);
@@ -759,7 +759,7 @@ pt_menusystem init_menusystem(const char *title)
ms->tm_stepsize = TIMEOUTSTEPSIZE;
ms->tm_numsteps = TIMEOUTNUMSTEPS;
- ms->normalattr[NOHLITE] = NORMALATTR;
+ ms->normalattr[NOHLITE] = NORMALATTR;
ms->normalattr[HLITE] = NORMALHLITE;
ms->reverseattr[NOHLITE] = REVERSEATTR;
@@ -777,7 +777,7 @@ pt_menusystem init_menusystem(const char *title)
ms->statline = STATLINE;
ms->tfillchar= TFILLCHAR;
ms->titleattr= TITLEATTR;
-
+
ms->fillchar = FILLCHAR;
ms->fillattr = FILLATTR;
ms->spacechar= SPACECHAR;
@@ -787,9 +787,9 @@ pt_menusystem init_menusystem(const char *title)
// Initialise all handlers
ms->handler = NULL;
- ms->keys_handler = NULL;
+ ms->keys_handler = NULL;
ms->ontimeout=NULL; // No timeout handler
- ms->tm_total_timeout = 0;
+ ms->tm_total_timeout = 0;
ms->tm_sofar_timeout = 0;
ms->ontotaltimeout = NULL;
@@ -809,8 +809,8 @@ pt_menusystem init_menusystem(const char *title)
// How many entries per menu can we display at a time
ms->maxmenuheight = ms->maxrow - ms->minrow - 3;
- if (ms->maxmenuheight > MAXMENUHEIGHT)
- ms->maxmenuheight= MAXMENUHEIGHT;
+ if (ms->maxmenuheight > MAXMENUHEIGHT)
+ ms->maxmenuheight= MAXMENUHEIGHT;
// Set up the look of the box
set_box_type(MENUBOXTYPE);
@@ -862,19 +862,19 @@ void set_box_type(boxtype bt)
ms->menubt = bt;
bxc = getboxchars(bt);
ms->box_horiz = bxc[BOX_HORIZ]; // The char used to draw top line
- ms->box_ltrt = bxc[BOX_LTRT];
- ms->box_rtlt = bxc[BOX_RTLT];
+ ms->box_ltrt = bxc[BOX_LTRT];
+ ms->box_rtlt = bxc[BOX_RTLT];
}
-void set_menu_options(uchar maxmenuheight)
+void set_menu_options(uchar maxmenuheight)
{
if (maxmenuheight != 0xFF) ms->maxmenuheight = maxmenuheight;
}
// Set the window which menusystem should use
-void set_window_size(uchar top, uchar left, uchar bot, uchar right)
+void set_window_size(uchar top, uchar left, uchar bot, uchar right)
{
-
+
uchar nr,nc;
if ((top > bot) || (left > right)) return; // Sorry no change will happen here
nr = getnumrows();
@@ -942,15 +942,15 @@ void unreg_ontotaltimeout()
}
-int next_visible(pt_menu menu, int index)
+int next_visible(pt_menu menu, int index)
{
int ans;
if (index < 0) ans = 0 ;
else if (index >= menu->numitems) ans = menu->numitems-1;
else ans = index;
- while ((ans < menu->numitems-1) &&
- ((menu->items[ans]->action == OPT_INVISIBLE) ||
- (menu->items[ans]->action == OPT_SEP)))
+ while ((ans < menu->numitems-1) &&
+ ((menu->items[ans]->action == OPT_INVISIBLE) ||
+ (menu->items[ans]->action == OPT_SEP)))
ans++;
return ans;
}
@@ -961,21 +961,21 @@ int prev_visible(pt_menu menu, int index) // Return index of prev visible
if (index < 0) ans = 0;
else if (index >= menu->numitems) ans = menu->numitems-1;
else ans = index;
- while ((ans > 0) &&
+ while ((ans > 0) &&
((menu->items[ans]->action == OPT_INVISIBLE) ||
- (menu->items[ans]->action == OPT_SEP)))
+ (menu->items[ans]->action == OPT_SEP)))
ans--;
return ans;
}
-int next_visible_sep(pt_menu menu, int index)
+int next_visible_sep(pt_menu menu, int index)
{
int ans;
if (index < 0) ans = 0 ;
else if (index >= menu->numitems) ans = menu->numitems-1;
else ans = index;
- while ((ans < menu->numitems-1) &&
- (menu->items[ans]->action == OPT_INVISIBLE))
+ while ((ans < menu->numitems-1) &&
+ (menu->items[ans]->action == OPT_INVISIBLE))
ans++;
return ans;
}
@@ -986,8 +986,8 @@ int prev_visible_sep(pt_menu menu, int index) // Return index of prev visible
if (index < 0) ans = 0;
else if (index >= menu->numitems) ans = menu->numitems-1;
else ans = index;
- while ((ans > 0) &&
- (menu->items[ans]->action == OPT_INVISIBLE))
+ while ((ans > 0) &&
+ (menu->items[ans]->action == OPT_INVISIBLE))
ans--;
return ans;
}
@@ -996,7 +996,7 @@ int calc_visible(pt_menu menu,int first)
{
int ans,i;
- if (menu == NULL) return 0;
+ if (menu == NULL) return 0;
ans = 0;
for (i=first; i < menu->numitems; i++)
if (menu->items[i]->action != OPT_INVISIBLE) ans++;
@@ -1033,8 +1033,8 @@ int calc_first_early(pt_menu menu,int curr)
nv = calc_visible(menu,0);
if (nv <= menu->menuheight) return 0;
- // Start with curr and go back till >= menu->menuheight
- // items are visible
+ // Start with curr and go back till >= menu->menuheight
+ // items are visible
nv = calc_visible(menu,curr); // Already nv of them are visible
ans = curr;
for (i=0; i < menu->menuheight - nv; i++)
@@ -1043,7 +1043,7 @@ int calc_first_early(pt_menu menu,int curr)
}
// Create a new menu and return its position
-uchar add_menu(const char *title, int maxmenusize)
+uchar add_menu(const char *title, int maxmenusize)
{
int num,i;
pt_menu m;
@@ -1063,15 +1063,15 @@ uchar add_menu(const char *title, int maxmenusize)
else m->maxmenusize = maxmenusize;
m->items = (pt_menuitem *) malloc(sizeof(pt_menuitem)*(m->maxmenusize));
for (i=0; i < m->maxmenusize; i++) m->items[i] = NULL;
-
+
m->title = (char *)malloc(MENULEN+1);
if (title)
{
if (strlen(title) > MENULEN - 2)
strcpy(m->title,TITLELONG);
- else strcpy(m->title,title);
+ else strcpy(m->title,title);
}
- else strcpy(m->title,EMPTYSTR);
+ else strcpy(m->title,EMPTYSTR);
m ->menuwidth = strlen(m->title);
ms->nummenus ++;
return ms->nummenus - 1;
@@ -1091,12 +1091,12 @@ void set_menu_name(const char *name) // Set the "name" of this menu
if (name)
{
m->name = (char *)malloc(strlen(name)+1);
- strcpy(m->name,name);
+ strcpy(m->name,name);
}
}
// Create a new named menu and return its position
-uchar add_named_menu(const char * name, const char *title, int maxmenusize)
+uchar add_named_menu(const char * name, const char *title, int maxmenusize)
{
add_menu(title,maxmenusize);
set_menu_name(name);
@@ -1133,8 +1133,8 @@ pt_menuitem add_sep() // Add a separator to current menu
}
// Add item to the "current" menu
-pt_menuitem add_item(const char *item, const char *status, t_action action,
- const char *data, uchar itemdata)
+pt_menuitem add_item(const char *item, const char *status, t_action action,
+ const char *data, uchar itemdata)
{
pt_menuitem mi;
pt_menu m;
@@ -1155,21 +1155,21 @@ pt_menuitem add_item(const char *item, const char *status, t_action action,
if (item) {
if (strlen(item) > MENULEN) {
- strcpy(mi->item,ITEMLONG);
+ strcpy(mi->item,ITEMLONG);
} else {
- strcpy(mi->item,item);
+ strcpy(mi->item,item);
}
if (strlen(mi->item) > m->menuwidth) m->menuwidth = strlen(mi->item);
- } else strcpy(mi->item,EMPTYSTR);
+ } else strcpy(mi->item,EMPTYSTR);
if (status) {
if (strlen(status) > STATLEN) {
- strcpy(mi->status,STATUSLONG);
+ strcpy(mi->status,STATUSLONG);
} else {
- strcpy(mi->status,status);
+ strcpy(mi->status,status);
}
- } else strcpy(mi->status,EMPTYSTR);
-
+ } else strcpy(mi->status,EMPTYSTR);
+
mi->action=action;
str = mi->item;
mi->shortcut = 0;
@@ -1178,7 +1178,7 @@ pt_menuitem add_item(const char *item, const char *status, t_action action,
// Find the first char in [A-Za-z0-9] after ENABLEHLITE and not arg to control char
while (*str)
{
- if (*str == ENABLEHLITE)
+ if (*str == ENABLEHLITE)
{
inhlite=1;
}
@@ -1186,8 +1186,8 @@ pt_menuitem add_item(const char *item, const char *status, t_action action,
{
inhlite = 0;
}
- if ( (inhlite == 1) &&
- (((*str >= 'A') && (*str <= 'Z')) ||
+ if ( (inhlite == 1) &&
+ (((*str >= 'A') && (*str <= 'Z')) ||
((*str >= 'a') && (*str <= 'z')) ||
((*str >= '0') && (*str <= '9'))))
{
@@ -1201,9 +1201,9 @@ pt_menuitem add_item(const char *item, const char *status, t_action action,
if (data) {
if (strlen(data) > ACTIONLEN) {
- strcpy(mi->data,ACTIONLONG);
+ strcpy(mi->data,ACTIONLONG);
} else {
- strcpy(mi->data,data);
+ strcpy(mi->data,data);
}
} else strcpy(mi->data,EMPTYSTR);
@@ -1234,7 +1234,7 @@ void set_item_options(uchar shortcut,int helpid)
pt_menuitem mi;
pt_menu m;
- m = (ms->menus[ms->nummenus-1]);
+ m = (ms->menus[ms->nummenus-1]);
if (m->numitems <= 0) return;
mi = m->items[(unsigned int) m->numitems-1];
@@ -1297,4 +1297,3 @@ void gen_append_line(const char *menu_name,char *line)
if (menunum < 0) return; // No such menu
append_line_helper(menunum,line);
}
-
diff --git a/menu/libmenu/menu.h b/menu/libmenu/menu.h
index ba03c299..446b3adb 100644
--- a/menu/libmenu/menu.h
+++ b/menu/libmenu/menu.h
@@ -35,7 +35,7 @@
* Could just quit the menu program
* beep and return.
- TIMEOUTSTEPSIZE is the interval for which the program sleeps without checking for
+ TIMEOUTSTEPSIZE is the interval for which the program sleeps without checking for
any keystroke. So increasing this will make the response of the system slow.
Decreasing this will make a lot of interrupt calls using up your CPU. Default
value of TIMEOUTSTEPSIZE of 0.1 seconds should be right in most cases.
@@ -43,7 +43,7 @@
TIMEOUTNUMSTEPS of 3000 corresponds to a wait time of 300 seconds or 5 minutes
*/
-#define TIMEOUTSTEPSIZE 10
+#define TIMEOUTSTEPSIZE 10
#define TIMEOUTNUMSTEPS 30000L
// Attributes
@@ -100,17 +100,17 @@
// Other Chars
#define SUBMENUCHAR 175 // This is >> symbol
-#define RADIOMENUCHAR '>' // > symbol for radio menu?
+#define RADIOMENUCHAR '>' // > symbol for radio menu?
#define EXITMENUCHAR 174 // This is << symbol
#define CHECKED 251 // Check mark
#define UNCHECKED 250 // Light bullet
-#define RADIOSEL '.' // Current Radio Selection
+#define RADIOSEL '.' // Current Radio Selection
#define RADIOUNSEL ' ' // Radio option not selected
typedef unsigned char uchar;
// Types of menu's
-#define NORMALMENU 1
+#define NORMALMENU 1
#define RADIOMENU 2
typedef enum {OPT_INACTIVE, OPT_SUBMENU, OPT_RUN, OPT_EXITMENU, OPT_CHECKBOX,
@@ -133,16 +133,16 @@ typedef struct {
unsigned int reserved:6; // For future expansion
} t_handler_return;
-t_handler_return ACTION_VALID,ACTION_INVALID; // Specific values
+t_handler_return ACTION_VALID,ACTION_INVALID; // Specific values
typedef t_handler_return (*t_item_handler)(struct s_menusystem *, struct s_menuitem *);
typedef void (*t_menusystem_handler)(struct s_menusystem *, struct s_menuitem *);
typedef void (*t_keys_handler)(struct s_menusystem *, struct s_menuitem *,
- unsigned int scancode);
+ unsigned int scancode);
// Last parameter = HIGH BYTE = scan code , LOW BYTE = ASCII CODE
-typedef enum {HDLR_SCREEN, HDLR_KEYS } t_handler;
-// Types of handlers for menu system
+typedef enum {HDLR_SCREEN, HDLR_KEYS } t_handler;
+// Types of handlers for menu system
// TIMEOUT is the list of possible values which can be returned by the handler
// instructing the menusystem what to do. The default is CODE_WAIT
@@ -152,9 +152,9 @@ typedef TIMEOUTCODE (*t_timeout_handler)(void);
typedef struct s_menuitem {
char *item;
char *status;
- char *data; // string containing kernel to run.. but...
+ char *data; // string containing kernel to run.. but...
// for radio menu's this is a pointer to the item selected or NULL (initially)
- // for submenu's this string could be name of menu
+ // for submenu's this string could be name of menu
void * extra_data; // Any other data user can point to
unsigned int helpid; // Used for Context sensitive help
t_item_handler handler; // Pointer to function of type menufn
@@ -162,8 +162,8 @@ typedef struct s_menuitem {
t_itemdata itemdata; // Data depends on action value
uchar shortcut; // one of [A-Za-z0-9] shortcut for this menu item
uchar index; // Index within the menu array
- uchar parindex; // Index of the menu in which this item appears.
-
+ uchar parindex; // Index of the menu in which this item appears.
+
} t_menuitem;
typedef t_menuitem *pt_menuitem; // Pointer to type menuitem
@@ -171,7 +171,7 @@ typedef t_menuitem *pt_menuitem; // Pointer to type menuitem
typedef struct s_menu {
pt_menuitem *items; // pointer to array of pointer to menuitems
char *title; // Title string for menu
- char *name; // menu can be referred to by this string
+ char *name; // menu can be referred to by this string
int maxmenusize; // the size of array allocated
uchar numitems; // how many items do we actually have
uchar menuwidth;
@@ -183,11 +183,11 @@ typedef t_menu *pt_menu; // Pointer to type menu
typedef struct s_menusystem {
pt_menu menus[MAXMENUS];
- char *title;
- t_menusystem_handler handler; // Menu system handler
+ char *title;
+ t_menusystem_handler handler; // Menu system handler
t_keys_handler keys_handler; // Handler for unknown keys
t_timeout_handler ontimeout; // Timeout handler
- unsigned long tm_numsteps;
+ unsigned long tm_numsteps;
// Time to wait for key press=numsteps * stepsize milliseconds
unsigned int tm_stepsize; // Timeout step size (in milliseconds)
// Total timeout max time spent idle before we call handler
@@ -211,11 +211,11 @@ typedef struct s_menusystem {
uchar shadowattr;
uchar statline;
uchar menupage;
- uchar maxrow,minrow,numrows; // Number of rows in the window
+ uchar maxrow,minrow,numrows; // Number of rows in the window
uchar maxcol,mincol,numcols; // Number of columns in the window
// Menu box look
- boxtype menubt; // What type of boxes should be drawn
+ boxtype menubt; // What type of boxes should be drawn
char box_horiz,box_ltrt,box_rtlt; // Some chars of the box, for redrawing portions of the box
} t_menusystem;
@@ -224,7 +224,7 @@ typedef t_menusystem *pt_menusystem; // Pointer to type menusystem
pt_menuitem showmenus(uchar startmenu);
-pt_menusystem init_menusystem(const char *title);
+pt_menusystem init_menusystem(const char *title);
void close_menusystem(); // Deallocate memory used
@@ -241,14 +241,14 @@ void set_box_type(boxtype bt);
void set_window_size(uchar top, uchar left, uchar bot, uchar right); // Set the window which menusystem should use
-void set_menu_options(uchar maxmenuheight);
+void set_menu_options(uchar maxmenuheight);
// maximum height of a menu
void reg_handler(t_handler htype, void * handler); // Register handler
-void unreg_handler( t_handler htype);
+void unreg_handler( t_handler htype);
-void reg_ontimeout(t_timeout_handler, unsigned int numsteps, unsigned int stepsize);
+void reg_ontimeout(t_timeout_handler, unsigned int numsteps, unsigned int stepsize);
// Set timeout handler, set 0 for default values.
// So stepsize=0 means numsteps is measured in centiseconds.
void unreg_ontimeout();
@@ -261,22 +261,22 @@ void unreg_ontotaltimeout();
uchar find_menu_num(const char *name);
// Create a new menu and return its position
-uchar add_menu(const char *title, int maxmenusize);
+uchar add_menu(const char *title, int maxmenusize);
// Create a named menu and return its position
-uchar add_named_menu(const char *name, const char *title, int maxmenusize);
+uchar add_named_menu(const char *name, const char *title, int maxmenusize);
void set_menu_pos(uchar row,uchar col); // Set the position of this menu.
-// Add item to the "current" menu
+// Add item to the "current" menu
pt_menuitem add_item(const char *item, const char *status, t_action action, const char *data, uchar itemdata);
// Set shortcut key and help id
void set_item_options(uchar shortcut,int helpid);
// Set the shortcut key for the current item
-static inline void set_shortcut(uchar shortcut)
-{
+static inline void set_shortcut(uchar shortcut)
+{
set_item_options(shortcut,0xFFFF);
}
diff --git a/menu/libmenu/passwords.c b/menu/libmenu/passwords.c
index f3855b47..40b5c49f 100644
--- a/menu/libmenu/passwords.c
+++ b/menu/libmenu/passwords.c
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
#include <stdio.h>
#include "tui.h"
-#define MAX_LINE 512
+#define MAX_LINE 512
// Max line length in a pwdfile
p_pwdentry userdb[MAX_USERS]; // Array of pointers
int numusers; // Actual number of users
@@ -78,7 +78,7 @@ void init_passwords(const char *filename)
for (i=0; i < MAX_USERS; i++) userdb[i] = NULL;
numusers = 0;
-
+
if ( !filename ) return; // No filename specified
f = fopen(filename,"r");
@@ -103,7 +103,7 @@ void init_passwords(const char *filename)
*p = '\0';
pwdhash = p+1;
if (*pwdhash == 0) continue; // Malformed line (no password specified)
- p = strchr(pwdhash,':');
+ p = strchr(pwdhash,':');
if (p == NULL) { // No perms specified
perms = NULL;
} else {
@@ -111,7 +111,7 @@ void init_passwords(const char *filename)
perms = p+1;
if (*perms == 0) perms = NULL;
}
- // At this point we have user,pwdhash and perms setup
+ // At this point we have user,pwdhash and perms setup
userdb[numusers] = (p_pwdentry)malloc(sizeof(pwdentry));
strcpy(userdb[numusers]->username,user);
strcpy(userdb[numusers]->pwdhash,pwdhash);
diff --git a/menu/libmenu/passwords.h b/menu/libmenu/passwords.h
index 1e68e3e2..00e5702d 100644
--- a/menu/libmenu/passwords.h
+++ b/menu/libmenu/passwords.h
@@ -1,6 +1,6 @@
#ifndef _PASSWORDS_H_
#define _PASSWORDS_H_
-
+
char authenticate_user(const char * username, const char* pwd);
char isallowed(const char *username, const char * perm);
@@ -16,7 +16,7 @@ void close_passwords();
typedef struct {
char username[USERNAME_LENGTH+1];
- char pwdhash[PWDHASH_LENGTH+1];
+ char pwdhash[PWDHASH_LENGTH+1];
char *perms; // pointer to string containing ":" delimited permissions
} pwdentry;
diff --git a/menu/libmenu/scancodes.h b/menu/libmenu/scancodes.h
index 6048c7e3..d3f625a6 100644
--- a/menu/libmenu/scancodes.h
+++ b/menu/libmenu/scancodes.h
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -81,6 +81,6 @@
#define ALT_PRESSED (1<<3)
#define CTRL_PRESSED (1<<2)
// actually 1<<1 is Left Shift, 1<<0 is right shift
-#define SHIFT_PRESSED (1<<1 | 1 <<0)
+#define SHIFT_PRESSED (1<<1 | 1 <<0)
#endif
diff --git a/menu/libmenu/syslnx.c b/menu/libmenu/syslnx.c
index 76961194..d2b0aef4 100644
--- a/menu/libmenu/syslnx.c
+++ b/menu/libmenu/syslnx.c
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -21,9 +21,9 @@ char issyslinux(void)
REG_EAX(inreg) = 0x00003000;
REG_EBX(inreg) = REG_ECX(inreg) = REG_EDX(inreg) = 0xFFFFFFFF;
__intcall(0x21,&inreg,&outreg);
- return (REG_EAX(outreg) == 0x59530000) &&
+ return (REG_EAX(outreg) == 0x59530000) &&
(REG_EBX(outreg) == 0x4c530000) &&
- (REG_ECX(outreg) == 0x4e490000) &&
+ (REG_ECX(outreg) == 0x4e490000) &&
(REG_EDX(outreg) == 0x58550000);
}
@@ -66,7 +66,7 @@ void runsyslinuximage(const char*cmd, long ipappend)
// Function 16h not supported Fall back to runcommand
if (numfun < 0x16) runsyslinuxcmd(cmd);
// Try the Run Kernel Image function
- // Split command line into
+ // Split command line into
strcpy(__com32.cs_bounce,cmd);
ptr = __com32.cs_bounce;
// serach for first space or end of string
@@ -86,4 +86,3 @@ void runsyslinuximage(const char*cmd, long ipappend)
__intcall(0x22,&inreg,&outreg); // If successful does not return
}
-
diff --git a/menu/libmenu/syslnx.h b/menu/libmenu/syslnx.h
index cd159aec..755b9690 100644
--- a/menu/libmenu/syslnx.h
+++ b/menu/libmenu/syslnx.h
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -15,7 +15,7 @@
#include <com32.h>
-//Macros which help user not have to remember the structure of register
+//Macros which help user not have to remember the structure of register
// Data structure
#define REG_AH(x) ((x).eax.b[1])
@@ -59,6 +59,6 @@ void syslinux_idle(void); /* Call syslinux idle loop */
/* Run command line with ipappend, returns if kernel image not found
If syslinux version too old, then defaults to runsyslinuxcmd */
-void runsyslinuximage(const char*cmd, long ipappend);
+void runsyslinuximage(const char*cmd, long ipappend);
#endif
diff --git a/menu/libmenu/tui.c b/menu/libmenu/tui.c
index 617b7312..cb8c1936 100644
--- a/menu/libmenu/tui.c
+++ b/menu/libmenu/tui.c
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2006 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@ char eolstr[] = "\n$";
// showoldvalue <> 0 implies currentvalue displayed first
// If showoldvalue <> 0 then caller responsibility to ensure that
// str is NULL terminated.
-void getuserinput(char *stra, unsigned int size, unsigned int password,
+void getuserinput(char *stra, unsigned int size, unsigned int password,
unsigned int showoldvalue)
{
unsigned char c,scan;
@@ -61,7 +61,7 @@ void getuserinput(char *stra, unsigned int size, unsigned int password,
// Invariants: p is the current char
// col is the corresponding column on the screen
if (password == 0) // Not a password, print initial value
- {
+ {
gotoxy(row,col,page);
csprint(str,GETSTRATTR);
}
@@ -73,7 +73,7 @@ void getuserinput(char *stra, unsigned int size, unsigned int password,
break;
}
fudge = 0;
- // if scan code is regognized do something
+ // if scan code is regognized do something
// else if char code is recognized do something
// else ignore
switch(scan) {
@@ -86,13 +86,13 @@ void getuserinput(char *stra, unsigned int size, unsigned int password,
case LTARROW:
if (p > str) p--;
break;
- case CTRLLT:
+ case CTRLLT:
if (p==str) break;
- if (*p == ' ')
+ if (*p == ' ')
while ((p > str) && (*p == ' ')) p--;
else {
if (*(p-1) == ' ') {
- p--;
+ p--;
while ((p > str) && (*p == ' ')) p--;
}
}
@@ -101,9 +101,9 @@ void getuserinput(char *stra, unsigned int size, unsigned int password,
case RTARROW:
if (p < last) p++;
break;
- case CTRLRT:
+ case CTRLRT:
if (*p==0) break; // At end of string
- if (*p != ' ')
+ if (*p != ' ')
while ((*p!=0) && (*p != ' ')) p++;
while ((*p!=0) && ((*p == ' ') && (*(p+1) != ' '))) p++;
if (*p==' ') p++;
@@ -136,7 +136,7 @@ void getuserinput(char *stra, unsigned int size, unsigned int password,
p = str; *p=0; last = str;
break;
default: // Handle insert and overwrite mode
- if ((c >= ' ') && (c < 128) &&
+ if ((c >= ' ') && (c < 128) &&
((unsigned int)(p-str) < size-1) ) {
if (insmode == 0) { // Overwrite mode
if (p==last) last++;
@@ -186,7 +186,7 @@ void cswprint(const char *str,char attr,char left)
nc = getnumcols();
getpos(&row,&col,page);
while ( *str ) {
- switch (*str)
+ switch (*str)
{
case '\b':
--col;
@@ -205,9 +205,9 @@ void cswprint(const char *str,char attr,char left)
case CHABSATTR: // change attribute (absolute)
cha = *(str+1);
chb = *(str+2);
- if ((((cha >= '0') && (cha <= '9')) ||
+ if ((((cha >= '0') && (cha <= '9')) ||
((cha >= 'A') && (cha <= 'F'))) &&
- (((chb >= '0') && (chb <= '9')) ||
+ (((chb >= '0') && (chb <= '9')) ||
((chb >= 'A') && (chb <= 'F')))) // Next two chars are legal
{
if ((cha >= 'A') && (cha <= 'F'))
@@ -282,7 +282,7 @@ unsigned char * getboxchars(boxtype bt)
{
switch (bt)
{
- case BOX_SINSIN:
+ case BOX_SINSIN:
return SINSIN_CHARS;
break;
case BOX_DBLDBL:
@@ -302,12 +302,12 @@ unsigned char * getboxchars(boxtype bt)
}
// Draw box and lines
-void drawbox(char top,char left,char bot, char right,
+void drawbox(char top,char left,char bot, char right,
char page, char attr,boxtype bt)
{
unsigned char *box_chars; // pointer to array of box chars
unsigned char x;
-
+
box_chars = getboxchars(bt);
// Top border
gotoxy(top,left,page);
@@ -333,7 +333,7 @@ void drawbox(char top,char left,char bot, char right,
}
}
-void drawhorizline(char top, char left, char right, char page, char attr,
+void drawhorizline(char top, char left, char right, char page, char attr,
boxtype bt, char dumb)
{
unsigned char start,end;
@@ -351,7 +351,7 @@ void drawhorizline(char top, char left, char right, char page, char attr,
{
gotoxy(top,left,page);
cprint(box_chars[BOX_LTRT],attr,1,page);
- gotoxy(top,right,page);
+ gotoxy(top,right,page);
cprint(box_chars[BOX_RTLT],attr,1,page);
}
}
diff --git a/menu/libmenu/tui.h b/menu/libmenu/tui.h
index affdc2e4..92f93863 100644
--- a/menu/libmenu/tui.h
+++ b/menu/libmenu/tui.h
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -25,21 +25,21 @@
#define BELL 0x07
// CHRELATTR = ^N, CHABSATTR = ^O
-#define CHABSATTR 15
+#define CHABSATTR 15
#define CHRELATTR 14
-void clearwindow(char top, char left, char bot, char right,
+void clearwindow(char top, char left, char bot, char right,
char page, char fillchar, char fillattr);
void cls(void); /* Clears the entire current screen page */
-// Generic user input,
+// Generic user input,
// password = 0 iff chars echoed on screen
// showoldvalue <> 0 iff current displayed for editing
-void getuserinput(char *str, unsigned int size,
+void getuserinput(char *str, unsigned int size,
unsigned int password, unsigned int showoldvalue);
-static inline void getstring(char *str, unsigned int size)
+static inline void getstring(char *str, unsigned int size)
{
getuserinput(str,size,0,0);
}
@@ -65,8 +65,8 @@ static inline void getpwd(char * str, unsigned int size)
#define BOX_LEFT 0x5
#define BOX_RIGHT 0x5
#define BOX_VERT 0x5 // LEFT=RIGHT=VERT
-#define BOX_LTRT 0x6
-#define BOX_RTLT 0x7
+#define BOX_LTRT 0x6
+#define BOX_RTLT 0x7
#define BOX_TOPBOT 0x8
#define BOX_BOTTOP 0x9
#define BOX_MIDDLE 0xA
@@ -75,7 +75,7 @@ typedef enum {BOX_SINSIN,BOX_DBLDBL, BOX_SINDBL, BOX_DBLSIN} boxtype;
unsigned char * getboxchars(boxtype bt);
-void drawbox(char top,char left,char bot, char right,
+void drawbox(char top,char left,char bot, char right,
char page, char attr,boxtype bt);
// Draw a horizontal line