Sponsored Content
Full Discussion: While Loop Errors
Top Forums UNIX for Dummies Questions & Answers While Loop Errors Post 302636477 by itech4814 on Monday 7th of May 2012 01:03:00 PM
Old 05-07-2012
ok that worked. The purpose of my code is to repeat that menu until the user presses x or X. Now it is an infinite loop. I cannot figure out how to make it exit when the user presses X.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Boot loop errors caused by RC.CONF

Hello all! I am praying someone can help me. I have been trying to install dual nics on my FreeBSD box. In my attempts I edited my RC.CONF file. I must have editing something wrong, because during the boot sequence, my machine gets through bringing up most of the services then it stops and gets... (5 Replies)
Discussion started by: ezekiel61
5 Replies

2. UNIX for Advanced & Expert Users

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (0 Replies)
Discussion started by: mcastill66
0 Replies

3. AIX

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (2 Replies)
Discussion started by: mcastill66
2 Replies

4. UNIX for Dummies Questions & Answers

Major OS errors/Bash errors help!!!!

Hi all, dummy here.... I have major errors on entering the shell. On login I get: -bash: dircolors: command not found -bash: tr: command not found -bash: fgrep: command not found -bash: grep: command not found -bash: grep: command not found -bash: id: command not found -bash: [: =: unary... (12 Replies)
Discussion started by: wcmmlynn
12 Replies

5. Shell Programming and Scripting

Using variables created sequentially in a loop while still inside of the loop [bash]

I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends. As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

6. Shell Programming and Scripting

Null Handling in Until loop. . .loop won't stop

Hi Im running this script, which is supposed to find the max value build some tables and then stop running once all the tables are built. Thing is , it keeps assigning a null value to $h and then $g is null so it keep building tables i.e. testupdateNUL. How can I stop this? Here is what I have: ... (4 Replies)
Discussion started by: brandono66
4 Replies

7. Shell Programming and Scripting

BASH loop inside a loop question

Hi all Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies

8. Shell Programming and Scripting

Array Variable being Assigned Values in Loop, But Gone when Loop Completes???

Hello All, Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....? I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies

9. Shell Programming and Scripting

Reset while loop to loop same file multiple times

Hi, I want to read file multiple times. Right now i am using while loop but that is not working. ex. While read line do while read line2 do echo stmt1 #processing some data based on data., done < file2.txt done < file1.txt # This will have 10... (4 Replies)
Discussion started by: tmalik79
4 Replies

10. Shell Programming and Scripting

awk loop using array:wish to store array values from loop for use outside loop

Here's my code: awk -F '' 'NR==FNR { if (/time/ && $5>10) A=$2" "$3":"$4":"($5-01) else if (/time/ && $5<01) A=$2" "$3":"$4-01":"(59-$5) else if (/time/ && $5<=10) A=$2" "$3":"$4":0"($5-01) else if (/close/) { B=0 n1=n2; ... (2 Replies)
Discussion started by: klane
2 Replies
Reading key presses(3)						      BrlAPI						    Reading key presses(3)

NAME
Reading key presses - How to read key presses from the braille terminal. Data Structures struct brlapi_expandedKeyCode_t struct brlapi_describedKeyCode_t struct brlapi_range_t Macros #define brlapi_ignoreAllKeys() brlapi_ignoreKeys(brlapi_rangeType_all, NULL, 0) #define brlapi_acceptAllKeys() brlapi_acceptKeys(brlapi_rangeType_all, NULL, 0) #define BRLAPI_UC_ROW 0x2800UL #define brlapi__ignoreAllKeys(handle) brlapi__ignoreKeys(handle, brlapi_rangeType_all, NULL, 0) #define brlapi__acceptAllKeys(handle) brlapi__acceptKeys(handle, brlapi_rangeType_all, NULL, 0) Enumerations enum brlapi_rangeType_t { brlapi_rangeType_all, brlapi_rangeType_type, brlapi_rangeType_command, brlapi_rangeType_key, brlapi_rangeType_code } Functions int BRLAPI_STDCALL brlapi_expandKeyCode (brlapi_keyCode_t code, brlapi_expandedKeyCode_t *expansion) int BRLAPI_STDCALL brlapi_describeKeyCode (brlapi_keyCode_t code, brlapi_describedKeyCode_t *description) int BRLAPI_STDCALL brlapi_readKey (int wait, brlapi_keyCode_t *code) int BRLAPI_STDCALL brlapi__readKey (brlapi_handle_t *handle, int wait, brlapi_keyCode_t *code) int BRLAPI_STDCALL brlapi_ignoreKeys (brlapi_rangeType_t type, const brlapi_keyCode_t keys[], unsigned int count) int BRLAPI_STDCALL brlapi__ignoreKeys (brlapi_handle_t *handle, brlapi_rangeType_t type, const brlapi_keyCode_t keys[], unsigned int count) int BRLAPI_STDCALL brlapi_acceptKeys (brlapi_rangeType_t type, const brlapi_keyCode_t keys[], unsigned int count) int BRLAPI_STDCALL brlapi__acceptKeys (brlapi_handle_t *handle, brlapi_rangeType_t type, const brlapi_keyCode_t keys[], unsigned int count) int BRLAPI_STDCALL brlapi__ignoreAllKeys (brlapi_handle_t *handle) int BRLAPI_STDCALL brlapi__acceptAllKeys (brlapi_handle_t *handle) int BRLAPI_STDCALL brlapi_ignoreKeyRanges (brlapi_range_t ranges[], unsigned int count) int BRLAPI_STDCALL brlapi__ignoreKeyRanges (brlapi_handle_t *handle, brlapi_range_t ranges[], unsigned int count) int BRLAPI_STDCALL brlapi_acceptKeyRanges (brlapi_range_t ranges[], unsigned int count) int BRLAPI_STDCALL brlapi__acceptKeyRanges (brlapi_handle_t *handle, brlapi_range_t ranges[], unsigned int count) Detailed Description Once brlapi_enterTtyMode() has been called, the application can call brlapi_readKey() to read key presses. Either key codes (see Types and Defines fore BrlAPI Key Codes) or commands will be returned, depending on parameters given to brlapi_enterTtyMode(). Key presses are buffered, so that calling brlapi_readKey() in non-blocking mode from time to time should suffice. Macro Definition Documentation #define brlapi__acceptAllKeys(handle) brlapi__acceptKeys(handle, brlapi_rangeType_all, NULL, 0) #define brlapi__ignoreAllKeys(handle) brlapi__ignoreKeys(handle, brlapi_rangeType_all, NULL, 0) int BRLAPI_STDCALL brlapi_acceptAllKeys(void) brlapi_acceptKeys(brlapi_rangeType_all, NULL, 0) Accept all key presses from the braille keyboard This function asks the server to give all keys to the application, and not give them to brltty. Warning: after calling this function, make sure to call brlapi_ignoreKeys() for ignoring important keys like BRL_CMD_SWITCHVT_PREV/NEXT and such. int BRLAPI_STDCALL brlapi_ignoreAllKeys(void) brlapi_ignoreKeys(brlapi_rangeType_all, NULL, 0) Ignore all key presses from the braille keyboard This function asks the server to give all keys to brltty, rather than returning them to the application via brlapi_readKey(). #define BRLAPI_UC_ROW 0x2800UL Unicode braille row Enumeration Type Documentation enum brlapi_rangeType_t types of key ranges Enumerator: brlapi_rangeType_all all keys, code must be 0 brlapi_rangeType_type all keys of a given type brlapi_rangeType_command all keys of a given command block, i.e. matching the key type and command parts brlapi_rangeType_key a given key with any flags brlapi_rangeType_code a given key code Function Documentation int BRLAPI_STDCALL brlapi__acceptAllKeys (brlapi_handle_t *handle) int BRLAPI_STDCALL brlapi__acceptKeyRanges (brlapi_handle_t *handle, brlapi_range_tranges[], unsigned intcount) int BRLAPI_STDCALL brlapi__acceptKeys (brlapi_handle_t *handle, brlapi_rangeType_ttype, const brlapi_keyCode_tkeys[], unsigned intcount) int BRLAPI_STDCALL brlapi__ignoreAllKeys (brlapi_handle_t *handle) int BRLAPI_STDCALL brlapi__ignoreKeyRanges (brlapi_handle_t *handle, brlapi_range_tranges[], unsigned intcount) int BRLAPI_STDCALL brlapi__ignoreKeys (brlapi_handle_t *handle, brlapi_rangeType_ttype, const brlapi_keyCode_tkeys[], unsigned intcount) int BRLAPI_STDCALL brlapi__readKey (brlapi_handle_t *handle, intwait, brlapi_keyCode_t *code) int BRLAPI_STDCALL brlapi_acceptKeyRanges (brlapi_range_tranges[], unsigned intcount) Accept some key presses from the braille keyboard This function asks the server to return the provided key ranges (inclusive) to the application, and not give them to brltty. Parameters: ranges key ranges, which are inclusive count number of ranges Note: The given codes should be raw keycodes (i.e. some driver name was given to brlapi_enterTtyMode()) int BRLAPI_STDCALL brlapi_acceptKeys (brlapi_rangeType_ttype, const brlapi_keyCode_tkeys[], unsigned intcount) Accept some key presses from the braille keyboard This function asks the server to give the provided keys to the application, and not give them to brltty. Parameters: type type of keys to be ignored keys array of keys to be ignored count number of keys Note: The given codes should be brltty commands (NULL or '' was given to brlapi_enterTtyMode()) int BRLAPI_STDCALL brlapi_describeKeyCode (brlapi_keyCode_tcode, brlapi_describedKeyCode_t *description) Describe the components of a key code. Parameters: code the keycode to be described description pointer to the structure that receives the description Returns: 0 on success, -1 on error int BRLAPI_STDCALL brlapi_expandKeyCode (brlapi_keyCode_tcode, brlapi_expandedKeyCode_t *expansion) Expand the components of a key code Parameters: code the key code to be expanded expansion pointer to the structure that receives the components Returns: 0 on success, -1 on error int BRLAPI_STDCALL brlapi_ignoreKeyRanges (brlapi_range_tranges[], unsigned intcount) Ignore some key presses from the braille keyboard This function asks the server to give the provided key ranges to brltty, rather than returning them to the application via brlapi_readKey(). Parameters: ranges key ranges, which are inclusive count number of ranges Note: The given codes should be raw keycodes (i.e. some driver name was given to brlapi_enterTtyMode()) int BRLAPI_STDCALL brlapi_ignoreKeys (brlapi_rangeType_ttype, const brlapi_keyCode_tkeys[], unsigned intcount) Ignore some key presses from the braille keyboard This function asks the server to give the provided keys to brltty, rather than returning them to the application via brlapi_readKey(). Parameters: type type of keys to be ignored keys array of keys to be ignored count number of keys Note: The given codes should be brltty commands (NULL or '' was given to brlapi_enterTtyMode()) int BRLAPI_STDCALL brlapi_readKey (intwait, brlapi_keyCode_t *code) Read a key from the braille keyboard This function returns one key press's code. If NULL or '' was given to brlapi_enterTtyMode(), a brltty command is returned, as described in the documentation for brlapi_keyCode_t . It is hence pretty driver-independent, and should be used by default when no other option is possible. By default, all commands but those which restart drivers and switch virtual terminals are returned to the application and not to brltty. If the application doesn't want to see some command events, it should call brlapi_ignoreKeys() If some driver name was given to brlapi_enterTtyMode(), a raw keycode is returned, as specified by the terminal driver, usually in <brltty/brldefs-xy> where xy is the driver's code. It generally corresponds to the very code that the terminal tells to the driver. This should only be used by applications which are dedicated to a particular braille terminal. Hence, checking the terminal type thanks to a call to brlapi_getDriverName() before getting tty control is a pretty good idea. By default, all the keypresses will be passed to the client, none will go through brltty, so the application will have to handle console switching itself for instance. Parameters: wait tells whether the call should block until a key is pressed (1) or should only probe key presses (0); code holds the key code if a key press is indeed read. Returns: -1 on error or signal interrupt and *code is then undefined, 0 if block was 0 and no key was pressed so far, or 1 and *code holds the key code. Programming hints: If your application is only driven by braille command keypresses, you can just call brlapi_readKey(1, &code) so that it keeps blocking, waiting for keypresses. Else, you'll probably want to use the file descriptor returned by brlapi_openConnection() in your 'big polling loop'. For instance: o in a select() loop, just add it to the readfds and exceptfds file descriptor sets; o in a gtk or atspi application, use g_io_add_watch(fileDescriptor, G_IO_IN|G_IO_ERR|G_IO_HUP, f, data) for adding a callback called f; o in an Xt/Xaw/motif-based application, use XtAppAddInput(app_context, fileDescriptor, XtInputReadMask|XtInputExceptMask, f, data) o etc. and then, when you detect inbound trafic on the file descriptor, do something like this: while (brlapi_readKey(0, &code) { // process keycode code // ... } The while loop is needed for processing all pending key presses, else some of them may be left in libbrlapi's internal key buffer and you wouldn't get them immediately. Note: If the read is interrupted by a signal, brlapi_readKey() will return -1, brlapi_errno will be BRLAPI_ERROR_LIBCERR and errno will be EINTR. Author Generated automatically by Doxygen for BrlAPI from the source code. Version 1.0 Fri Jun 7 2013 Reading key presses(3)
All times are GMT -4. The time now is 09:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy