Alphabetized lv_api_do functions

This commit is contained in:
Jesse Gardner 2021-03-22 19:29:18 -07:00
parent fe078c2598
commit 3825d6594b
1 changed files with 24 additions and 24 deletions

View File

@ -130,24 +130,17 @@ return 0
#-------------------# #-------------------#
#=========================================================================# #=========================================================================#
lv_api_do_open () lv_api_do_close ()
# DESCRIPTION: Open lv_api_do in background # DESCRIPTION: Tell lv_api_do to exit and close the extra pipe
# INPUT: None # INPUT: None
# OUTPUT: Return 0 on success, exit on failure # OUTPUT: None
# PARAMETERS: None # PARAMETERS: None
#=========================================================================# #=========================================================================#
{ {
declare -g lv_api_temp; echo "exit" >&4
lv_api_temp="$(mktemp -d )" || temp_error exec 4>&-
mkfifo "${lv_api_temp}/lv_api_do_fifo" || fifo_error exec 4<&-
exec 4<>"${lv_api_temp}/lv_api_do_fifo" rm -rf "${lv_api_temp:?}"
${QQ2_DIR}/lv_api_do <&4 >&3 2>/dev/null &
local check
read -r check <&3
[[ "$check" == "$CONN_BAD" ]] && lv_api_do_bad_conn
[[ "$check" == "$CONN_GOOD" ]] || unexpected_error lv_api_do_open
return 0 return 0
} }
#=========================================================================# #=========================================================================#
@ -181,17 +174,24 @@ done
return 0 return 0
} }
#=========================================================================# #=========================================================================#
lv_api_do_close () lv_api_do_open ()
# DESCRIPTION: Tell lv_api_do to exit and close the extra pipe # DESCRIPTION: Open lv_api_do in background
# INPUT: None # INPUT: None
# OUTPUT: None # OUTPUT: Return 0 on success, exit on failure
# PARAMETERS: None # PARAMETERS: None
#=========================================================================# #=========================================================================#
{ {
echo "exit" >&4 declare -g lv_api_temp;
exec 4>&- lv_api_temp="$(mktemp -d )" || temp_error
exec 4<&- mkfifo "${lv_api_temp}/lv_api_do_fifo" || fifo_error
rm -rf "${lv_api_temp:?}" exec 4<>"${lv_api_temp}/lv_api_do_fifo"
${QQ2_DIR}/lv_api_do <&4 >&3 2>/dev/null &
local check
read -r check <&3
[[ "$check" == "$CONN_BAD" ]] && lv_api_do_bad_conn
[[ "$check" == "$CONN_GOOD" ]] || unexpected_error lv_api_do_open
return 0 return 0
} }