summaryrefslogtreecommitdiff
path: root/menu
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-05-03 17:32:15 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-05-03 17:32:15 -0700
commit28eecd8965aedbd75727fb0797a2e7033d5c54ee (patch)
tree1cac9ffc5f7fe7fd82d59b4accd7b8cf85762f74 /menu
parentf8c463722022008c8412a69f90576d2bf38818ed (diff)
downloadsyslinux-28eecd8965aedbd75727fb0797a2e7033d5c54ee.tar.gz
Across-the-board stealth whitespace cleanup
Diffstat (limited to 'menu')
-rw-r--r--menu/CHANGES13
-rw-r--r--menu/HISTORY8
-rw-r--r--menu/MANUAL145
-rw-r--r--menu/MENU_FORMAT87
-rw-r--r--menu/Makefile12
-rw-r--r--menu/README41
-rw-r--r--menu/TODO3
-rw-r--r--menu/adv_menu.tpl44
-rw-r--r--menu/complex.c25
-rw-r--r--menu/display.c2
-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
-rw-r--r--menu/menugen.py44
-rw-r--r--menu/password7
-rw-r--r--menu/simple.c16
-rw-r--r--menu/test.menu1
-rw-r--r--menu/test2.menu1
30 files changed, 424 insertions, 440 deletions
diff --git a/menu/CHANGES b/menu/CHANGES
index ed497ac7..cce21838 100644
--- a/menu/CHANGES
+++ b/menu/CHANGES
@@ -1,11 +1,11 @@
Changes in v1.2
---------------
-* Allowed menu's to have names. Submenu's can be referred to by names
- instead of their index in the menu system. This allows user to refer
+* Allowed menu's to have names. Submenu's can be referred to by names
+ instead of their index in the menu system. This allows user to refer
to submenus which are not yet part of the menusystem.
-* help pages can be longer than one screen
+* help pages can be longer than one screen
* menugen.py: Python script for converting .menu files to C source code
- .menu files can be used to descibe most static uses of menu system,
+ .menu files can be used to descibe most static uses of menu system,
including SubMenus, Checkboxes, RadioButtons, User Authentication and
Context sensitive help. You can also restrict use of certain items
to users with certain credentials.
@@ -13,7 +13,7 @@ Changes in v1.2
See MENU_FORMAT for the format of .menu files
* display.c32: Takes the name of the text file to display and displays it
- allowing user to scroll through the text.
+ allowing user to scroll through the text.
USAGE: display.c32 <filename>
@@ -24,10 +24,9 @@ Changes in v1.1
* Additional handler type: Keys handler
* Menuitem handlers now have a return value of type t_handler_return.
For all simple cases, you just return ACTION_VALID or ACTION_INVALID
- (For some types of menu items, handlers are ignored, and for
+ (For some types of menu items, handlers are ignored, and for
others the return value is ignored)
* add_menu takes an extra argument (to better control memory footprint)
You can just set it to -1 to choose the default value
* Now the menu system support long menu's using scroll bars.
* Support for passwords and context sensitive help is added.
-
diff --git a/menu/HISTORY b/menu/HISTORY
index 06d3360c..8e9beb3f 100644
--- a/menu/HISTORY
+++ b/menu/HISTORY
@@ -2,19 +2,19 @@
GCC & 32-bit code
-----------------
Due to the limitations of the COM file format,
-(64KB limit on memory footprint) the code has been changed
+(64KB limit on memory footprint) the code has been changed
so that the code compiles to a 32-bit COMBOOT program.
Since the code makes use of BIOS calls, this code cannot be
-compiled into a format which can execute under Linux. As a
+compiled into a format which can execute under Linux. As a
side effect, there is no nice way to debug this code. In order
to debug this code, you will have to run the code under syslinux.
GCC & 16-bit code
-----------------
-The code was ported to GCC by Peter Anvin.
+The code was ported to GCC by Peter Anvin.
OpenWatcom & 16-bit code
------------------------
Originally this code was written for the Openwatcom compiler
and generated .COM files, which could execute under DOS as well as
-SYSLINUX.
+SYSLINUX.
diff --git a/menu/MANUAL b/menu/MANUAL
index df8a4db6..4e70149c 100644
--- a/menu/MANUAL
+++ b/menu/MANUAL
@@ -6,14 +6,14 @@ For simple cases, you should start by using simple.c as a template.
complex.c illustrates most of the features available in the menu system.
Menu Features currently supported are:
-* menu items,
-* submenus,
+* menu items,
+* submenus,
* disabled items,
* checkboxes,
* invisible items (useful for dynamic menus), and
* Radio menus,
* Context sensitive help
-* Authenticated users
+* Authenticated users
The keys used are:
@@ -26,35 +26,35 @@ The keys used are:
1. Overview
-----------
-The code usually consists of many stages.
+The code usually consists of many stages.
* Configuring the menusytem
* Installing global handlers [optional]
- * Populating the menusystem
+ * Populating the menusystem
* Executing the menusystem
* Processing the result
1.1 Configuring the menusystem
------------------------------
-This includes setting the window the menu system should use,
+This includes setting the window the menu system should use,
the choice of colors, the title of the menu etc. In most functions
calls, a value of -1 indicates that the default value be used.
-For details about what the arguments are look at function
+For details about what the arguments are look at function
declarations in menu.h
<code>
// Choose the default title and setup default values for all attributes....
init_menusystem(NULL);
set_window_size(1,1,23,78); // Leave one row/col border all around
-
+
// Choose the default values for all attributes and char's
// -1 means choose defaults (Actually the next 4 lines are not needed)
- set_normal_attr (-1,-1,-1,-1);
- set_status_info (-1,-1);
- set_title_info (-1,-1);
+ set_normal_attr (-1,-1,-1,-1);
+ set_status_info (-1,-1);
+ set_title_info (-1,-1);
set_misc_info(-1,-1,-1,-1);
</code>
-
+
1.2 Populating the menusystem
-----------------------------
This involves adding a menu to the system, and the options which
@@ -71,14 +71,14 @@ should appear in the menu. An example is given below.
add_item("Exit ","Status String",OPT_EXITMENU,NULL,0);
</code>
-The call to add_menu has two arguments, the first being the title of
+The call to add_menu has two arguments, the first being the title of
the menu and the second an upper bound on the number of items in the menu.
Putting a -1, will use the default (see MENUSIZE in menu.h). If you try
-to add more items than specified, the extra items will not appear in
+to add more items than specified, the extra items will not appear in
the menu. The accuracy of this number affects the memory required
-to run the system.
+to run the system.
-If you do not want to keep track of the return values, you can also use
+If you do not want to keep track of the return values, you can also use
the following variant of add_menu
<code>
@@ -95,36 +95,36 @@ The third argument indicates the type of this menuitem. It is one of
the following
* OPT_RUN : executable content
- * OPT_EXITMENU : exits menu to parent
+ * OPT_EXITMENU : exits menu to parent
* OPT_SUBMENU : if selected, displays a submenu
* OPT_CHECKBOX : associates a boolean with this item which can be toggled
- * OPT_RADIOMENU: associates this with a radio menu.
- After execution, the data field of this item will point
+ * OPT_RADIOMENU: associates this with a radio menu.
+ After execution, the data field of this item will point
to the option selected.
* OPT_SEP : A menu seperator (visually divide menu into parts)
* OPT_RADIOITEM: this item is one of the options in a RADIOMENU
* OPT_INACTIVE : A disabled item (user cannot select this)
* OPT_INVISIBLE: This item will not be displayed.
-
-The fourth argument is the value of the data field always a string.
+
+The fourth argument is the value of the data field always a string.
Usually this string is just copied and nothing is done with it. Two
cases, where it is used.
In case of a radiomenu the input string is ignored and the "data" field
-points to the menuitem chosen (Dont forget to typecast this pointer to
+points to the menuitem chosen (Dont forget to typecast this pointer to
(t_menuitem *) when reading this info).
-In case of a submenu, this string if non-trivial is interpreted as the
+In case of a submenu, this string if non-trivial is interpreted as the
name of the submenu which should be linked there. This interpretation
-happens when the menu is first run and not when the menu system is being
-created. This allows the user to create the menusystem in an arbitrary
-order.
+happens when the menu is first run and not when the menu system is being
+created. This allows the user to create the menusystem in an arbitrary
+order.
-The fifth argument is a number whose meaning depends on the type of the
+The fifth argument is a number whose meaning depends on the type of the
item. For a CHECKBOX it should be 0/1 setting the initial state of the
checkbox. For a SUBMENU it should be the index of the menu which should
-be displayed if this option is chosen. Incase the data field is non-trivial,
+be displayed if this option is chosen. Incase the data field is non-trivial,
this number is ignored and computed later. For a RADIOMENU it should be the
index of the menu which contains all the options (All items in that menu
not of type RADIOITEM are ignored). For all other types, this
@@ -141,16 +141,16 @@ item which was selected by the user.
<code>
choice = showmenus(MAIN); // Initial menu is the one with index MAIN
- // or choice = showmenus(find_menu_num("main")); // Initial menu is the one named "main"
+ // or choice = showmenus(find_menu_num("main")); // Initial menu is the one named "main"
</code>
1.4 Processing the result
-------------------------
-This pointer will either be NULL (user hit Escape) or always point
+This pointer will either be NULL (user hit Escape) or always point
to a menuitem which can be "executed", i.e. it will be of type OPT_RUN.
-Usually at this point, all we need to do is to ask syslinux to run
+Usually at this point, all we need to do is to ask syslinux to run
the command associated with this menuitem. The following code executes
-the command stored in choice->data (there is no other use for the data
+the command stored in choice->data (there is no other use for the data
field, except for radiomenu's)
<code>
@@ -181,7 +181,7 @@ itself does not use this field in anyway.
----------
Every item also has a field called "helpid". It is meant to hold some
kind of identifier which can be referenced and used to generate
-a context sensitive help system. This can be set after a call to
+a context sensitive help system. This can be set after a call to
add_item as follows
<code>
add_item("selfloop","Status 2",OPT_SUBMENU,NULL,MAINMENU);
@@ -192,10 +192,10 @@ The first is the shortcut key for this entry. You can put -1 to ensure
that the shortcut key is not reset. The second is some unsigned integer.
If this value is 0xFFFF, then the helpid is not changed.
-2.3 Installing global handlers
+2.3 Installing global handlers
------------------------------
It is possible to register handlers for the menu system. These are
-user functions which are called by the menusystem in certain
+user functions which are called by the menusystem in certain
situations. Usually the handlers get a pointer to the menusystem
datastructure as well as a pointer to the current item selected.
Some handlers may get additional information. Some handlers are
@@ -208,7 +208,7 @@ Currently the menusystem support three types of global handlers
2.3.1 timeout handler
---------------------
-This is installed using a call to "reg_ontimeout(fn,numsteps,stepsize)"
+This is installed using a call to "reg_ontimeout(fn,numsteps,stepsize)"
function. fn is a pointer to a function which takes no arguments and
returns one of CODE_WAIT, CODE_ENTER, CODE_ESCAPE. This function is
called when numsteps*stepsize Centiseconds have gone by without any
@@ -220,9 +220,9 @@ the user hit ENTER or ESCAPE on the keyboard and acts accordingly.
2.3.2 Screen handler
--------------------
This is installed using a call to "reg_handler(HDLR_SCREEN,fn)". fn is
-a pointer to a function which takes a pointer to the menusystem
+a pointer to a function which takes a pointer to the menusystem
datastructure and the current item selected and returns nothing.
-This is called everytime a menu is drawn (i.e. everytime user changes
+This is called everytime a menu is drawn (i.e. everytime user changes
the current selection). This is meant for displaying any additional
information which reflects the current state of the system.
@@ -231,14 +231,14 @@ information which reflects the current state of the system.
This is installed using a call to "reg_handler(HDLR_KEYS,fn)". fn is
a pointer to a function which takes a pointer to the menusystem
datastructure, the current item and the scan code of a key and returns
-nothing. This function is called when the user presses a key which
-the menusystem does not know to dealwith. In any case, when this call
+nothing. This function is called when the user presses a key which
+the menusystem does not know to dealwith. In any case, when this call
returns the screen should not have changed in any way. Usually,
-one can change the active page and display any output needed and
+one can change the active page and display any output needed and
reset the active page when you return from this call.
complex.c implements a key_handler, which implements a simple
-context sensitive help system, by displaying the contents of a
+context sensitive help system, by displaying the contents of a
file whose name is based on the helpid of the active item.
Also, complex.c's handler allows certain users to make changes
@@ -246,9 +246,9 @@ to edit the commands associated with a menu item.
2.4 Installing item level handlers
----------------------------------
-In addition to global handlers, one can also install handlers for each
+In addition to global handlers, one can also install handlers for each
individual item. A handler for an individual item is a function which
-takes a pointer to the menusystem datastructure and a pointer to the
+takes a pointer to the menusystem datastructure and a pointer to the
current item and return a structure of type t_handler_return. Currently
it has two bit fields "valid" and "refresh".
@@ -261,39 +261,39 @@ For e.g. in a radiomenu handler, one can change the text displayed
on the menuitem depending on which choice was selected (see complex.c
for an example). The return values are ignored for RADIOMENU's.
-In case of RUN items: the return values are used as follows. If the
+In case of RUN items: the return values are used as follows. If the
return value of "valid" was false, then this user choice is ignored.
-This is useful if the handler has useful side effects. For e.g.
-complex.c has a Login item, whose handler always return INVALID. It
+This is useful if the handler has useful side effects. For e.g.
+complex.c has a Login item, whose handler always return INVALID. It
sets a global variable to the name of the user logged in, and enables
-some menu items, and makes some invisible items visible.
-
-* If the handler does not change the visibility status of any items,
- the handler should set "refresh" to 0.
-* If the handler changes the visibility status of items in the current
- menu set "refresh" to 1.
-* If you are changing the visibility status of items in menu's currently
- not displayed, then you can set "refresh" to 0.
+some menu items, and makes some invisible items visible.
+
+* If the handler does not change the visibility status of any items,
+ the handler should set "refresh" to 0.
+* If the handler changes the visibility status of items in the current
+ menu set "refresh" to 1.
+* If you are changing the visibility status of items in menu's currently
+ not displayed, then you can set "refresh" to 0.
* Changing the visibility status of items in another menu
- which is currently displayed, is not supported. If you do it,
- the screen contents may not reflect the change until you get to the
+ which is currently displayed, is not supported. If you do it,
+ the screen contents may not reflect the change until you get to the
menu which was changed. When you do get to that menu, you may notice
pieces of the old menu still on the screen.
-In case of CHECKBOXES: the return value of "valid" is ignored. Because,
+In case of CHECKBOXES: the return value of "valid" is ignored. Because,
the handler can change the value of checkbox if the user selected value
is not appropriate. only the value of "refresh" is honored. In this case
all the caveats in the previous paragraph apply.
-menu.h defines two instances of t_handler_return
-ACTION_VALID and ACTION_INVALID for common use. These set the valid flag
+menu.h defines two instances of t_handler_return
+ACTION_VALID and ACTION_INVALID for common use. These set the valid flag
to 1 and 0 respectively and the refresh flag to 0.
3. Things to look out for
-------------------------
-When you define the menu system, always declare it in the opposite
+When you define the menu system, always declare it in the opposite
order, i.e. all lower level menu's should be defined before the higher
-level menus. This is because in order to define the MAINMENU, you need
+level menus. This is because in order to define the MAINMENU, you need
to know the index assigned to all its submenus.
4. Additional Modules
@@ -308,22 +308,22 @@ handlers.
-------------
This module was written by Th. Gebhardt. This is basically a modification
of the DES crypt function obtained by removing the dependence of the
-original crypt function on C libraries. The following functions are
+original crypt function on C libraries. The following functions are
defined
- init_passwords(PWDFILE)
+ init_passwords(PWDFILE)
// Read in the password database from the file
- authenticate_user(user,pwd)
+ authenticate_user(user,pwd)
// Checks if user,pwd is valid
- isallowed(user,perm)
+ isallowed(user,perm)
// Checks if the user has a specified permission
- close_passwords()
+ close_passwords()
// Unloads password database from memory
See the sample password file for more details about the file format
and the implementation of permissions.
-See complex.c for a example of how to use this.
+See complex.c for a example of how to use this.
4.2 Help
--------
@@ -341,9 +341,8 @@ the hlp<NNNNN>.txt files and initialize the help system by specifying
the base directory.
The first line of this file assumed to be the title of the help screen.
-You can use ^N and ^O to change attributes absolutely and relatively,
-i.e. [^O]46 (i.e. Ctrl-O followed by chars 4 and 6) will set the
-attribute to 46, while [^N]08 will XOR the current attribute with
-specified number, thus in this case the first [^N]08 will turn on
+You can use ^N and ^O to change attributes absolutely and relatively,
+i.e. [^O]46 (i.e. Ctrl-O followed by chars 4 and 6) will set the
+attribute to 46, while [^N]08 will XOR the current attribute with
+specified number, thus in this case the first [^N]08 will turn on
highlighting and the second one will turn it off.
-
diff --git a/menu/MENU_FORMAT b/menu/MENU_FORMAT
index 4a294085..24cb02f8 100644
--- a/menu/MENU_FORMAT
+++ b/menu/MENU_FORMAT
@@ -1,25 +1,25 @@
-A .menu file can be used to describe basic menu structures which can be converted
-into C code which can then be compiled into a .c32 file for use with SYSLINUX.
-The format of a .menu file is similar to an ini file, but with important
+A .menu file can be used to describe basic menu structures which can be converted
+into C code which can then be compiled into a .c32 file for use with SYSLINUX.
+The format of a .menu file is similar to an ini file, but with important
differences.
-Lines starting with # and ; are treated as comments. Blank lines are used to
-separate the attributes of one menu item from another. Multiple blank lines are
+Lines starting with # and ; are treated as comments. Blank lines are used to
+separate the attributes of one menu item from another. Multiple blank lines are
equivalent to a single one. In other contexts Blank lines are not significant.
Menus
-----
Each menu declaration starts with a line containing the name of menu in [ ].
This is the "nickname" of the menu and should be different for different menus.
-This is not visible to the user of the menu system. The initial menu must
+This is not visible to the user of the menu system. The initial menu must
be called "main"
The menu declaration is followed by lines which set the attributes of the menu.
-This is followed by a blank line and followed by declaration of menu items in
+This is followed by a blank line and followed by declaration of menu items in
that menu.
-All lines which occur before the first menu declaration is considered as
-a global declaration.
+All lines which occur before the first menu declaration is considered as
+a global declaration.
Abstract Format
---------------
@@ -52,29 +52,29 @@ The overall format should look like this
GLOBAL SETTINGS
---------------
The following global settings are now supported. Many of the keywords
-accept what we call a "DOT COMMAND" as argument. Simply put they are
-instructions to the menu system to perform certain actions.
-The syntax and semantics of DOT COMMANDS are given later in the section
+accept what we call a "DOT COMMAND" as argument. Simply put they are
+instructions to the menu system to perform certain actions.
+The syntax and semantics of DOT COMMANDS are given later in the section
titled "DOT COMMANDS".
videomode: (default 0xFF) [Use with care]
The textmode in which the whole menu system should operate.
Must be a number (use 0x notation for hexadecimal).
- Lookup Ralph Brown Interrupt List and search for Video Mode
+ Lookup Ralph Brown Interrupt List and search for Video Mode
to find a number to put here.
- setting to 0xFF will mean, menu system will use the current
+ setting to 0xFF will mean, menu system will use the current
video mode.
-title:
+title:
The title of the whole menu system
top, left, bot, right: (default 0,0,21,79)
The area of the screen used by the menu system. The remaining
- part of the screen can be used by the user for anything.
+ part of the screen can be used by the user for anything.
helpdir: (default /isolinux/help)
- Location of the directory where help information is stored. The
+ Location of the directory where help information is stored. The
help files must be called "hlpNNNNN.txt" where NNNNN is the helpid.
pwdfile: (default /isolinux/passwd)
@@ -97,9 +97,9 @@ skipif: (default 0)
to be skipped all together (0 means menu system always runs). It can also
be a combination of "Alt","Ctrl","Shift","Caps","Ins","Scroll".
When menu system starts it checks if any of the specified keys are On/pressed.
- If true, the system exits immediately and executes the skipcmd.
+ If true, the system exits immediately and executes the skipcmd.
- e.g. setting it to "shift-alt-caps" means menu will be skipped if alt OR shift
+ e.g. setting it to "shift-alt-caps" means menu will be skipped if alt OR shift
is pressed OR caps is on. setting to "0" means menu will always run.
skipcmd: (default .exit)
@@ -109,29 +109,29 @@ skipcmd: (default .exit)
quits back to the boot prompt.
startfile: (default "")
- if non-empty the system will display the contents of this file before launching
- the menusystem. This happens only if the menusystem is not skipped. Can be used
+ if non-empty the system will display the contents of this file before launching
+ the menusystem. This happens only if the menusystem is not skipped. Can be used
to display licensing, usage or welcome messages. A file with given name
is expected to be found in the helpdir directory.
exitcmd: (default .exit)
valid terminal commands: .exit .repeat or any syslinux command
- The default command to execute when user quits the menu system.
+ The default command to execute when user quits the menu system.
exitcmdroot: (default =exitcmd)
Same as exitcmd except applies when current user has "root" privileges. If not
specified, it is assumed to be the same as exitcmd
-
+
timeout: (default 3000)
The amount of time (in multiple of 0.1 seconds) to wait for user keypress. If no
- key pressed for specified duration then the timeoutcmd is executed.
+ key pressed for specified duration then the timeoutcmd is executed.
totaltimeout: (default 0)
The total amount of time (in multiples of 0.1 seconds) the system will wait for
user to make a decision. If no decision has been made in the specified duration
totaltimeoutcmd will be executed
- NOTE: This does not include the time spent browsing the help system or
+ NOTE: This does not include the time spent browsing the help system or
the time taken for the user to enter his/her authentication credentials.
timeoutcmd: (default .beep)
@@ -157,7 +157,7 @@ row,col: [Usage not recomended]
ITEM ATTRIBUTES
---------------
-item:
+item:
The string displayed to the user. Characters enclosed in < > are highlighted.
shortcut: (default -1) valid values A-Za-z0-9 or -1 [Usage not recommended]
@@ -167,25 +167,25 @@ shortcut: (default -1) valid values A-Za-z0-9 or -1 [Usage not recommended]
info: (default same as data)
Additional textual information displayed in the status bar
-type:
+type:
the type of entry this item represents. This is one of the following:
run: choosing this will run something in SYSLINUX
use data to specify the actual command to execute
exitmenu: exit to parent menu
submenu: choosing will open up submenu
- use data to specify the "nickname" of the menu
+ use data to specify the "nickname" of the menu
which should come here
sep: Position a separator here
inactive: menu item is disabled
- checkbox: this is a checkbox
+ checkbox: this is a checkbox
use state to set initial state
invisible: User does not see this item
radioitem: One choice in a radiomenu
- radiomenu: Allow user to choose one of many choices
+ radiomenu: Allow user to choose one of many choices
(initial choice is always NULL)
login: Selecting this will allow user to login to system
-
+
data:
for run items, the syslinux command to execute
for submenus and radiomenus, nickname of menu
@@ -194,7 +194,7 @@ data:
ipappend:
ipappend flag to pass to PXELINUX (harmless for other variants of SYSLINUX)
- See syslinux documentation for meaning of the FLAGS
+ See syslinux documentation for meaning of the FLAGS
helpid: (default 65535 which is not a valid id)
associates a context for the help system.
@@ -208,9 +208,9 @@ perms: (default "")
then user needs the permission in order to open the submenu
argsmenu: (default "")
- Name of the menu to be scanned for setting additional arguments to
+ Name of the menu to be scanned for setting additional arguments to
pass to command line when this item is chosen for execution. Submenus
- of specified menu are also scanned. Only checkboxes and radiomenu's
+ of specified menu are also scanned. Only checkboxes and radiomenu's
are scanned. Items of other type in this menu is silently ignored.
@@ -221,32 +221,32 @@ Dot commands are basically instructions to the menu system to do certain things.
A "single command" is one of the following
[NT] A syslinux command (any DOT command not starting with a "." is assumed to be this)
-[NT] .beep [n]
-[NT] .help <file>
+[NT] .beep [n]
+[NT] .help <file>
[NT] .nop
[T] .exit or .quit (equivalent)
[T] .repeat or .wait or .ignore (all three are equivalent)
A dot command is a sequence of "single commands" separated by a "%". When a dot command
is executed the system executes all the given "single commands" in the specified order.
-All the commands marked "[T]" are terminal commands, i.e. when the system encounters
+All the commands marked "[T]" are terminal commands, i.e. when the system encounters
such a command it stops processing the dot command and returns the terminal command
-which caused the termination to the caller (who usually interprets the command
+which caused the termination to the caller (who usually interprets the command
appropriately).
-All commands marked with [NT] are non-terminal commands, i.e. once these commands are
-processed the system continues to process the remaining "single commands" specified in
+All commands marked with [NT] are non-terminal commands, i.e. once these commands are
+processed the system continues to process the remaining "single commands" specified in
the "DOT COMMAND".
Note: The case of a syslinux command is tricky. When executed, the command should never return
-(if the specified kernel exists) so the fact that we consider it a [NT] should be taken with
-a pinch of salt. However, if the syslinux command does return (in case of no kernel), then
+(if the specified kernel exists) so the fact that we consider it a [NT] should be taken with
+a pinch of salt. However, if the syslinux command does return (in case of no kernel), then
remaining "single commands" are processed. In particular "ker1 arg1 % ker2 arg2 % ker3 args"
has the effect of executing the first kernel which exists
.nop:
Does nothing.
-.beep:
+.beep:
.beep [n] produces a beep n times. n must be between 0 and 9. If not specified n=1.
(hence .beep 0 is equivalent to .nop)
.help:
@@ -260,4 +260,3 @@ The meaning of the Terminal commands can vary with the context in which it is us
a ".enter" or ".escape" does not have any meaning in the "onerrorcmd" context but it has a meaning
in the "ontimeout" context. In case the user gives a Terminal command which does not make sense, it
is upto the code (in this case adv_menu.tpl) to do what it pleases.
-
diff --git a/menu/Makefile b/menu/Makefile
index 8728dccc..727657fa 100644
--- a/menu/Makefile
+++ b/menu/Makefile
@@ -1,6 +1,6 @@
#ident "$Id$"
## -----------------------------------------------------------------------
-##
+##
## Copyright 2001-2005 H. Peter Anvin - All Rights Reserved
##
## This program is free software; you can redistribute it and/or modify
@@ -30,14 +30,14 @@ LUDIR = $(COM32DIR)/libutil
LDIR = $(COM32DIR)/lib
CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I$(LUDIR)/include -I$(COM32DIR)/include -Ilibmenu -D__COM32__
SFLAGS = -D__COM32__ -march=i386
-LDFLAGS = -T $(LDIR)/com32.ld
+LDFLAGS = -T $(LDIR)/com32.ld
OBJCOPY = objcopy
LIBGCC := $(shell $(CC) --print-libgcc)
LIBS = libmenu/libmenu.a $(LUDIR)/libutil_com.a $(LDIR)/libcom32.a $(LIBGCC)
LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
- libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
+ libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
CMENUS = $(patsubst %.c,%.c32,$(wildcard *.c))
IMENUS = $(patsubst %.menu,%.c32,$(wildcard *.menu))
@@ -58,9 +58,9 @@ MENUS = $(CMENUS) $(IMENUS)
%.o: %.c %.h
$(CC) $(CFLAGS) -c -o $@ $<
-.PRECIOUS: %.elf
+.PRECIOUS: %.elf
%.elf: %.o $(LIBS)
- $(LD) $(LDFLAGS) -o $@ $^
+ $(LD) $(LDFLAGS) -o $@ $^
%.c32: %.elf
$(OBJCOPY) -O binary $< $@
@@ -73,7 +73,7 @@ libmenu/libmenu.a: $(LIBMENU)
$(RANLIB) $@
tidy:
- rm -f *.o *.lo *.a *.lst *.elf
+ rm -f *.o *.lo *.a *.lst *.elf
libclean:
rm -f libmenu/*.o libmenu/*.a
diff --git a/menu/README b/menu/README
index b6cc2524..d585d2fa 100644
--- a/menu/README
+++ b/menu/README
@@ -8,25 +8,25 @@ original author.
To configure the menus, you need to set up a menu configuration file
to have the menu items you desire, then build the menu system using
make. You can use either simple.c or complex.c as a starting point
-for your own menu configuration file; If your menu system is only going
-to have entries corresponding to things which can be executed directly,
+for your own menu configuration file; If your menu system is only going
+to have entries corresponding to things which can be executed directly,
then you can create a file in ".menu" format instead of the C code.
See MENU_FORMAT for the syntax of .menu files
The resulting code is a 32-bit COMBOOT code, and hence can be executed
only under syslinux. You can use tools like bochs to help debug your
-code.
+code.
Menu Features currently supported are:
-* menu items,
-* submenus,
+* menu items,
+* submenus,
* disabled items,
* checkboxes,
* invisible items (useful for dynamic menus), and
* Radio menus,
* Context sensitive help
-* Authenticated users
+* Authenticated users
* Editing commands associated with items
The keys used are:
@@ -39,7 +39,7 @@ The keys used are:
Features
--------
-This is a general purpose menu system implemented using only BIOS calls,
+This is a general purpose menu system implemented using only BIOS calls,
so it can be executed in a COMBOOT environment as well. It is highly
customizable. Some features include:
@@ -49,30 +49,30 @@ customizable. Some features include:
Specify a window within which the menu system draws all its menu's.
It is upto the user to ensure that the menu's fit within the window.
* Positioning submenus
- By default, each submenu is positioned just below the corresponding
+ By default, each submenu is positioned just below the corresponding
entry of the parent menu. However, the user may position each menu
at a specific location of his choice. This is useful, when the menu's
have lots of options.
-* Registering handlers for each menu item
+* Registering handlers for each menu item
This is mainly used for checkboxes and radiomenu's, where a selection may
- result in disabling other menu items/checkboxes
+ result in disabling other menu items/checkboxes
* Global Screen Handler
This is called every time the menu is redrawn. The user can display
- additional information (usually outside the window where the menu is
+ additional information (usually outside the window where the menu is
being displayed). See the complex.c for an example, where the global
handler is used to display the choices made so far.
* Global Keys Handler
This is called every time the user presses a key which the menu
system does not understand. This can be used to display context
sensitive help. See complex.c for how to use this hook to implement
- a context sensitive help system as well as "On the fly" editing
- of commands associated with menus.
+ a context sensitive help system as well as "On the fly" editing
+ of commands associated with menus.
* Shortcut Keys
- With each item one can register a shortcut key from [A-Za-z0-9].
+ With each item one can register a shortcut key from [A-Za-z0-9].
Pressing a key within that range, will take you to the next item
with that shortcut key (so you can have multiple items with the
- same shortcut key). The default shortcut key for each item, is
- the lower case version of the first char of the item in the range
+ same shortcut key). The default shortcut key for each item, is
+ the lower case version of the first char of the item in the range
[A-Za-z0-9].
* Escape Keys
Each item entry can have a substring enclosed in < and >. This part
@@ -80,17 +80,16 @@ customizable. Some features include:
if an item has a <, then the first char inside < and > in the range
[A-Za-z0-9] is converted to lower case and set as the shortcut key.
* Ontimeout handler
- The user can register an ontimeout handler, which gets called if
+ The user can register an ontimeout handler, which gets called if
no key has been pressed for a user specific amount of time (default 5 min).
For an example see the complex.c file.
Credits
-------
-* The Watcom developers and Peter Anvin for figuring out an OS
+* The Watcom developers and Peter Anvin for figuring out an OS
independent startup code.
-* Thomas for porting the crypt function and removing all C library
+* Thomas for porting the crypt function and removing all C library
dependencies
-* Peter Anvin for porting the code to GCC
+* Peter Anvin for porting the code to GCC
- Murali (gmurali+guicd@cs.uchicago.edu)
-
diff --git a/menu/TODO b/menu/TODO
index 52d3d5fb..d2ee82c4 100644
--- a/menu/TODO
+++ b/menu/TODO
@@ -1,3 +1,2 @@
* Write COMBOOT code to read .menu files and parse them directly
- - take the name of menu file to parse from commandline
-
+ - take the name of menu file to parse from commandline
diff --git a/menu/adv_menu.tpl b/menu/adv_menu.tpl
index f2bf79c2..6ce4acf8 100644
--- a/menu/adv_menu.tpl
+++ b/menu/adv_menu.tpl
@@ -1,7 +1,7 @@
All the lines in this file not in between --something BEGINS-- and --something ENDS--
is ignored completely and will not make it into the generated C file
-This file has sections of C code each section delimited by --secname BEGINS--
+This file has sections of C code each section delimited by --secname BEGINS--
and --secname ENDS--. In the generated C code certain section may be used multiple
times. Currently the different section which must be defined are
@@ -11,15 +11,15 @@ Any additional sections you define will be processed but will probably not make
to the C code if you do not modify menugen.py to use it.
header and footer go through unmolested. The remaining are % substituted using
-python rules. Basically it means %(var)s gets replaced by the value of the variable
+python rules. Basically it means %(var)s gets replaced by the value of the variable
"var" which is a processed form of what is read from the .menu file
-NOTE: There is absolutely no C code in the python script, so you are free to
+NOTE: There is absolutely no C code in the python script, so you are free to
modify this template to suit your needs
--header BEGINS--
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2006 Murali Krishnan Ganapathy - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -54,7 +54,7 @@ typedef t_xtra *pt_xtra; // Pointer to extra datastructure
// Types of dot commands for which caller takes responsibility of handling
// In some case some commands may not make sense, it is up to the caller
// to handle cases which do not make sense
-typedef enum {QUIT_CMD, REPEAT_CMD, ENTER_CMD, ESCAPE_CMD} t_dotcmd;
+typedef enum {QUIT_CMD, REPEAT_CMD, ENTER_CMD, ESCAPE_CMD} t_dotcmd;
/*----------------- Global Variables */
@@ -89,7 +89,7 @@ char * strip(char *str)
{
char *p,*s,*e;
if (!str) return NULL;
- p = str;
+ p = str;
s = NULL;
e = NULL;
while (*p) {
@@ -103,10 +103,10 @@ char * strip(char *str)
return s;
}
-// executes a list of % separated commands
+// executes a list of % separated commands
// non-dot commands are assumed to be syslinux commands
// All syslinux commands are appended with the contents of kerargs
-// If it fails (kernel not found) then the next one is tried in the
+// If it fails (kernel not found) then the next one is tried in the
// list
// returns QUIT_CMD or RPT_CMD
t_dotcmd execdotcmd(const char *cmd, char *defcmd, const char *kerargs)
@@ -124,11 +124,11 @@ t_dotcmd execdotcmd(const char *cmd, char *defcmd, const char *kerargs)
p = strchr(next,'%');
if (p) {
*p--='\0'; next=p+2;
- while (*p == ' ') p--;
+ while (*p == ' ') p--;
*(++p)='\0'; // remove trailing spaces
} else {
if (*defcmd) { // execute defcmd next
- next=defcmd;
+ next=defcmd;
defcmd=NULL; // exec def cmd only once
} else next=NULL;
}
@@ -147,7 +147,7 @@ t_dotcmd execdotcmd(const char *cmd, char *defcmd, const char *kerargs)
while (*args == ' ') args++; // skip over spaces
}
if ( (strcmp(curr,".exit")==0) ||
- (strcmp(curr,".quit")==0)
+ (strcmp(curr,".quit")==0)
)
return QUIT_CMD;
if ( (strcmp(curr,".repeat")==0) ||
@@ -156,7 +156,7 @@ t_dotcmd execdotcmd(const char *cmd, char *defcmd, const char *kerargs)
)
return RPT_CMD;
if (strcmp(curr,".beep")==0) {
- if ((args) && ('0' <= args[0]) && (args[0] <= '9'))
+ if ((args) && ('0' <= args[0]) && (args[0] <= '9'))
ctr = args[0]-'0';
else ctr=1;
for (;ctr>0; ctr--) beep();
@@ -173,9 +173,9 @@ TIMEOUTCODE timeout(const char *cmd)
t_dotcmd c;
c = execdotcmd(cmd,".wait",NULL);
switch(c) {
- case ENTER_CMD:
+ case ENTER_CMD:
return CODE_ENTER;
- case ESCAPE_CMD:
+ case ESCAPE_CMD:
return CODE_ESCAPE;
default:
return CODE_WAIT;
@@ -204,7 +204,7 @@ void keys_handler(t_menusystem *ms, t_menuitem *mi,unsigned int scancode)
// and user has privileges to edit it, edit it in place.
if (((scancode & 0xFF) == 0x09) && (mi->action == OPT_RUN) &&
(EDIT_ROW < getnumrows()) && (EDIT_ROW > 0) &&
- (isallowed(username,"editcmd") || isallowed(username,"root"))) {
+ (isallowed(username,"editcmd") || isallowed(username,"root"))) {
nc = getnumcols();
// User typed TAB and has permissions to edit command line
gotoxy(EDIT_ROW,1,ms->menupage);
@@ -240,7 +240,7 @@ t_handler_return login_handler(t_menusystem *ms, t_menuitem *mi)
if (authenticate_user(login,pwd))
{
- strcpy(username,login);
+ strcpy(username,login);
strcpy(logoutstr,"<L>ogout ");
strcat(logoutstr,username);
mi->item = logoutstr; // Change item to read "Logout"
@@ -328,7 +328,7 @@ void set_xtra(pt_menuitem mi, const char *argsmenu, const char *perms, unsigned
if (!bad_argsmenu) {
xtra->argsmenu = (char *) malloc(sizeof(char)*(strlen(argsmenu)+1));
strcpy(xtra->argsmenu,argsmenu);
- }
+ }
if (!bad_perms) {
xtra->perms = (char *) malloc(sizeof(char)*(strlen(perms)+1));
strcpy(xtra->perms,perms);
@@ -343,7 +343,7 @@ int main(void)
char exitcmd[MAX_CMD_LINE_LENGTH];
char exitcmdroot[MAX_CMD_LINE_LENGTH];
char onerrcmd[MAX_CMD_LINE_LENGTH];
- char startfile[MAX_CMD_LINE_LENGTH];
+ char startfile[MAX_CMD_LINE_LENGTH];
char *ecmd; // effective exit command or onerrorcmd
char skipbits;
char skipcmd[MAX_CMD_LINE_LENGTH];
@@ -364,7 +364,7 @@ int main(void)
strcpy(exitcmd,"%(exitcmd)s");
strcpy(exitcmdroot,"%(exitcmdroot)s");
// If not specified exitcmdroot = exitcmd
- if (exitcmdroot[0] == '\0') strcpy(exitcmdroot,exitcmd);
+ if (exitcmdroot[0] == '\0') strcpy(exitcmdroot,exitcmd);
// Timeout stuff
timeout = %(timeout)s;
strcpy(timeoutcmd,"%(timeoutcmd)s");
@@ -410,7 +410,7 @@ int main(void)
if (getshiftflags() & skipbits) { // we must skip the menu altogther and execute skipcmd
dotrv = execdotcmd(skipcmd,".beep%.exit",NULL); // Worst case we beep and exit
if (dotrv == QUIT_CMD) quit = 1;
- }
+ }
// Switch vide mode if required
if (vmode != 0xFF) setvideomode(vmode);
@@ -442,10 +442,10 @@ int main(void)
}
}
-// Deallocate space used and quit
+// Deallocate space used and quit
close_passwords();
close_help();
- close_menusystem();
+ close_menusystem();
return 0;
}
diff --git a/menu/complex.c b/menu/complex.c
index dc4cbce3..94627c4f 100644
--- a/menu/complex.c
+++ b/menu/complex.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
@@ -76,7 +76,7 @@ void keys_handler(t_menusystem *ms, t_menuitem *mi,unsigned int scancode)
// If user hit TAB, and item is an "executable" item
// and user has privileges to edit it, edit it in place.
if (((scancode & 0xFF) == 0x09) && (mi->action == OPT_RUN) &&
- (isallowed(username,"editcmd") || isallowed(username,"root"))) {
+ (isallowed(username,"editcmd") || isallowed(username,"root"))) {
nc = getnumcols();
// User typed TAB and has permissions to edit command line
gotoxy(EDITPROMPT,1,ms->menupage);
@@ -109,7 +109,7 @@ t_handler_return login_handler(t_menusystem *ms, t_menuitem *mi)
if (authenticate_user(login,pwd))
{
- strcpy(username,login);
+ strcpy(username,login);
mi->item = logoutstr; // Change item to read "Logout"
}
else strcpy(username,GUEST_USER);
@@ -125,7 +125,7 @@ t_handler_return login_handler(t_menusystem *ms, t_menuitem *mi)
prepopt->action = OPT_INACTIVE;
secret->action = OPT_INVISIBLE;
}
- else
+ else
{
prepopt->action = OPT_SUBMENU;
prepopt->itemdata.radiomenunum = PREPMENU;
@@ -195,7 +195,7 @@ t_handler_return checkbox_handler(t_menusystem *ms, t_menuitem *mi)
(void)ms; /* Unused */
if (mi->action != OPT_CHECKBOX) return ACTION_INVALID;
-
+
if (strcmp(mi->data,"baseurl") == 0) flags.baseurl = (mi->itemdata.checked ? 1 : 0);
if (strcmp(mi->data,"winrepair") == 0) {
if (mi->itemdata.checked)
@@ -226,7 +226,7 @@ t_handler_return checkbox_handler(t_menusystem *ms, t_menuitem *mi)
}
/*
- Clears keyboard buffer and then
+ Clears keyboard buffer and then
wait for stepsize*numsteps milliseconds for user to press any key
checks for keypress every stepsize milliseconds.
Returns: 1 if user pressed a key (not read from the buffer),
@@ -261,12 +261,12 @@ int main()
init_help("/isolinux/help");
init_menusystem(NULL);
set_window_size(1,1,20,78); // Leave some space around
-
+
// Choose the default values for all attributes and char's
// -1 means choose defaults (Actually the next 4 lines are not needed)
- //set_normal_attr (-1,-1,-1,-1);
+ //set_normal_attr (-1,-1,-1,-1);
//set_status_info (-1,-1); // Display status on the last line
- //set_title_info (-1,-1);
+ //set_title_info (-1,-1);
//set_misc_info(-1,-1,-1,-1);
// Register the menusystem handler
@@ -275,7 +275,7 @@ int main()
// Register the ontimeout handler, with a time out of 10 seconds
reg_ontimeout(ontimeout,1000,0);
- NETMENU = add_menu(" Init Network ",-1);
+ NETMENU = add_menu(" Init Network ",-1);
none = add_item("<N>one","Dont start network",OPT_RADIOITEM,"no ",0);
dhcp = add_item("<d>hcp","Use DHCP",OPT_RADIOITEM,"dhcp ",0);
stat = add_item("<s>tatic","Use static IP I will specify later",OPT_RADIOITEM,"static ",0);
@@ -356,7 +356,7 @@ int main()
add_item("<8>","A",OPT_RUN,"A",0);
add_item("<9>","A",OPT_RUN,"A",0);
- MAIN = add_menu(" Main Menu ",8);
+ MAIN = add_menu(" Main Menu ",8);
curr = add_item(loginstr,"Login as a privileged user",OPT_RUN,NULL,0);
set_item_options(-1,23);
curr->handler = &login_handler;
@@ -416,9 +416,8 @@ int main()
// Deallocate space used for these data structures
close_passwords();
close_help();
- close_menusystem();
+ close_menusystem();
// Return to prompt
return 0;
}
-
diff --git a/menu/display.c b/menu/display.c
index a9bf70e1..5391d7fd 100644
--- a/menu/display.c
+++ b/menu/display.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
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
diff --git a/menu/menugen.py b/menu/menugen.py
index 78ea3160..70ec1f87 100644
--- a/menu/menugen.py
+++ b/menu/menugen.py
@@ -3,12 +3,12 @@
import sys, re, getopt
class Menusystem:
-
+
types = {"run" : "OPT_RUN",
- "inactive" : "OPT_INACTIVE",
+ "inactive" : "OPT_INACTIVE",
"checkbox" : "OPT_CHECKBOX",
- "radiomenu": "OPT_RADIOMENU",
- "sep" : "OPT_SEP",
+ "radiomenu": "OPT_RADIOMENU",
+ "sep" : "OPT_SEP",
"invisible": "OPT_INVISIBLE",
"radioitem": "OPT_RADIOITEM",
"exitmenu" : "OPT_EXITMENU",
@@ -26,18 +26,18 @@ class Menusystem:
"perms" : "", # permission required to execute this entry
"_updated" : None, # has this dictionary been updated
"type" : "run" }
-
+
menu_init = { "title" : "",
"row" : "0xFF", # let system decide position
- "col" : "0xFF",
+ "col" : "0xFF",
"_updated" : None,
"name" : "" }
system_init ={ "videomode" : "0xFF",
"title" : "Menu System",
- "top" : "1",
- "left" : "1" ,
- "bot" : "21",
+ "top" : "1",
+ "left" : "1" ,
+ "bot" : "21",
"right":"79",
"helpdir" : "/isolinux/help",
"pwdfile" : "",
@@ -97,7 +97,7 @@ class Menusystem:
self.menus[-1][0].update(self.menu)
self.init_menu()
if self.entry["_updated"]:
- if not self.entry["info"]:
+ if not self.entry["info"]:
self.entry["info"] = self.entry["data"]
if not self.menus:
print "Error before line %d" % self.lineno
@@ -143,7 +143,7 @@ class Menusystem:
if name == "skipcondn":
try: # is skipcondn a number?
a = int(value)
- except: # it is a "-" delimited sequence
+ except: # it is a "-" delimited sequence
value = value.lower()
parts = [ self.shift_flags.get(x.strip(),None) for x in value.split("-") ]
self.system["skipcondn"] = " | ".join(filter(None, parts))
@@ -160,7 +160,7 @@ class Menusystem:
if self.state == "menu":
err = self.set_menu(name,value)
# change state to entry it menu returns error
- if err:
+ if err:
err = None
self.state = "item"
if self.state == "item":
@@ -176,7 +176,7 @@ class Menusystem:
entry["type"] = self.types[entry["type"]]
if entry["type"] == "login": #special type
fd.write(self.templates["login"] % entry)
- else:
+ else:
fd.write(self.templates["item"] % entry)
def print_menu(self,menu,fd):
@@ -184,7 +184,7 @@ class Menusystem:
fd.write(self.templates["menu"] % menu)
if (menu["row"] != "0xFF") or (menu["col"] != "0xFF"):
fd.write(' set_menu_pos(%(row)s,%(col)s);\n' % menu)
-
+
def output(self,filename):
curr_template = None
@@ -208,29 +208,29 @@ class Menusystem:
if not curr_template: continue # lines between templates are ignored
contents.append(line)
ifd.close()
-
+
missing = None
for x in self.reqd_templates:
if not self.templates.has_key(x): missing = x
if missing:
print "Template %s required but not defined in %s" % (missing,self.code_template_filename)
-
+
if filename == "-":
fd = sys.stdout
else: fd = open(filename,"w")
self.foundmain = None
- fd.write(self.templates["header"])
+ fd.write(self.templates["header"])
fd.write(self.templates["system"] % self.system)
for (menu,items) in self.menus:
self.print_menu(menu,fd)
for entry in items: self.print_entry(entry,fd)
- fd.write(self.templates["footer"])
+ fd.write(self.templates["footer"])
fd.close()
if not self.foundmain:
print "main menu not found"
print self.menus
sys.exit(1)
-
+
def input(self,filename):
if filename == "-":
fd = sys.stdin
@@ -255,7 +255,7 @@ class Menusystem:
self.state = "menu"
self.add_menu(line[1:-1])
continue
-
+
# add property of current entry
pos = line.find("=") # find the first = in string
if pos < 0:
@@ -290,7 +290,7 @@ def main():
print "Unknown options %s" % args
usage()
for o,a in opts:
- if o in ["-i","--input"]:
+ if o in ["-i","--input"]:
ifile = a
elif o in ["-o", "--output"]:
ofile = a
@@ -305,5 +305,3 @@ def main():
if __name__ == "__main__":
main()
-
-
diff --git a/menu/password b/menu/password
index 00fc7cb8..3caffe22 100644
--- a/menu/password
+++ b/menu/password
@@ -1,19 +1,18 @@
-# This file should be available as /isolinux/password
+# This file should be available as /isolinux/password
# for complex.c to use.
#
# All lines starting with # and empty lines are ignored
#
# All non-comment lines here are of the form
# USERNAME:PWDHASH:PERM1:PERM2:...:
-#
+#
# where USERNAME is maximum of 12 chars,
# PWDHASH is maximum of 40 chars (DES ENCRYPTED)
# PERM1,... are arbitrary strings
#
-# The current lines correspond to
+# The current lines correspond to
# user1:secret1, user2:secret2, user3:secret3
user1:LcMRo3YZGtP0c:editcmd
user2:FqewzyxP78a7A:
user3:MKjmc.IHoXBNU:root
-
diff --git a/menu/simple.c b/menu/simple.c
index 8277c5ea..92e8ab12 100644
--- a/menu/simple.c
+++ b/menu/simple.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
@@ -28,21 +28,21 @@ int main(void)
// Choose the default title and setup default values for all attributes....
init_menusystem(NULL);
set_window_size(1,1,23,78); // Leave one row/col border all around
-
+
// Choose the default values for all attributes and char's
// -1 means choose defaults (Actually the next 4 lines are not needed)
- //set_normal_attr (-1,-1,-1,-1);
- //set_status_info (-1,-1);
- //set_title_info (-1,-1);
+ //set_normal_attr (-1,-1,-1,-1);
+ //set_status_info (-1,-1);
+ //set_title_info (-1,-1);
//set_misc_info(-1,-1,-1,-1);
-
+
// menuindex = add_named_menu("name"," Menu Title ",-1);
// add_item("Item string","Status String",TYPE,"any string",NUM)
// TYPE = OPT_RUN | OPT_EXITMENU | OPT_SUBMENU | OPT_CHECKBOX | OPT_INACTIVE
// "any string" useful for storing kernel names
// In case of OPT_SUBMENU, "any string" can be set to "name" of menu to be linked
// in which case value NUM is ignored
- // NUM = index of submenu if OPT_SUBMENU,
+ // NUM = index of submenu if OPT_SUBMENU,
// 0/1 default checked state if OPT_CHECKBOX
// unused otherwise.
@@ -57,7 +57,7 @@ int main(void)
add_item("Windows Rescue","winresc",OPT_RUN,"winresc",0);
add_item("Exit this menu","Go one level up",OPT_EXITMENU,"exit",0);
- add_named_menu("main"," Main Menu ",-1);
+ add_named_menu("main"," Main Menu ",-1);
add_item("Prepare","prep",OPT_RUN,"prep",0);
add_item("Rescue options...","Troubleshoot a system",OPT_SUBMENU,"rescue",0);
add_item("Testing...","Options to test hardware",OPT_SUBMENU,"testing",0);
diff --git a/menu/test.menu b/menu/test.menu
index 66b26584..061c548e 100644
--- a/menu/test.menu
+++ b/menu/test.menu
@@ -58,4 +58,3 @@ data="testing"
item="Exit this menu"
info="Go one level up"
type=exitmenu
-
diff --git a/menu/test2.menu b/menu/test2.menu
index 02e63b39..4570dc2c 100644
--- a/menu/test2.menu
+++ b/menu/test2.menu
@@ -140,4 +140,3 @@ data="testing"
item="<E>xit to prompt"
info="Exit the menu system"
type=exitmenu
-