Skip to content

Commit

Permalink
fix for stuck process left when terminal closed
Browse files Browse the repository at this point in the history
  • Loading branch information
ColumPaget committed Jun 18, 2020
1 parent a128322 commit 144b4c8
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 35 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
VERSION=1.4
VERSION=1.5
CC=gcc
LIBS= libUseful-4/libUseful.a
LIBS= -lUseful -lz -lcrypto -lssl
FLAGS=-g -O2 -DVERSION=\"$(VERSION)\"

OBJ=common.o net.o runcommand.o iw.o wireless_tools.o wpa_supplicant.o wifi.o interactive.o settings.o

all: $(OBJ) libUseful-4/libUseful.a
all: $(OBJ)
$(CC) $(FLAGS) -oterm_wifi $(OBJ) main.c $(LIBS)

libUseful-4/libUseful.a:
Expand Down Expand Up @@ -40,7 +40,7 @@ settings.o: settings.h settings.c common.h


clean:
rm *.o libUseful-4/*.o libUseful-4/*.a libUseful-4/*.so
rm term_wifi *.o libUseful-4/*.o libUseful-4/*.a libUseful-4/*.so

test:
echo "no tests"
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.4
VERSION=1.5
CC=@CC@
LIBS=@LDFLAGS@ @LIBS@ @STATIC_LIBS@
FLAGS=@CFLAGS@ -DVERSION=\"$(VERSION)\"
Expand Down Expand Up @@ -40,7 +40,7 @@ settings.o: settings.h settings.c common.h


clean:
rm *.o libUseful-4/*.o libUseful-4/*.a libUseful-4/*.so
rm term_wifi *.o libUseful-4/*.o libUseful-4/*.a libUseful-4/*.so

test:
echo "no tests"
84 changes: 62 additions & 22 deletions config.log
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ ./configure
$ ./configure --enable-ssl --with-system-libuseful

## --------- ##
## Platform. ##
## --------- ##

hostname = lattitude
uname -m = i686
uname -r = 5.6.10-p4-smp
hostname = hplap
uname -m = x86_64
uname -r = 5.6.5-64
uname -s = Linux
uname -v = #35 SMP Wed May 27 02:15:27 UTC 2020
uname -v = #6 SMP Sun Apr 19 22:31:45 BST 2020

/usr/bin/uname -p = unknown
/bin/uname -X = unknown
Expand All @@ -34,19 +34,32 @@ PATH: /usr/X11R7/bin
PATH: /bin
PATH: /usr/games/bin
PATH: .
PATH: /opt/Csound-6.05/bin
PATH: /opt/Drawing/bin
PATH: /opt/FLTK/bin
PATH: /opt/GTK/bin
PATH: /opt/LibreCAD/bin
PATH: /opt/Python-2.7.13/bin
PATH: /opt/Python-2.7.15/bin
PATH: /opt/Python-3.6.2/bin
PATH: /opt/Qt5/bin
PATH: /opt/SDL/bin
PATH: /opt/SDL2/bin
PATH: /opt/boinc_client-7.14.2/bin
PATH: /opt/games/bin
PATH: /opt/git-2.24.0/bin
PATH: /opt/ghostscript-9.22/bin
PATH: /opt/git-2.16.2/bin
PATH: /opt/lua-5.3.4/bin
PATH: /opt/luajid-2.0.4/bin
PATH: /opt/mujs-1.0.3/bin
PATH: /opt/netpbm-10.66.02/bin
PATH: /opt/opengl/bin
PATH: /opt/perl-5.24.1/bin
PATH: /opt/qemu-3.1.0/bin
PATH: /opt/qemu-3.1.0_SDL/bin
PATH: /opt/tcl-8.6.10/bin
PATH: /opt/wine-5.9/bin
PATH: /opt/qemu-2.8.1_SDL_build/bin
PATH: /opt/ruby-2.5.0/bin
PATH: /opt/schily/bin
PATH: /opt/tcl-8.6.8/bin
PATH: /opt/timekeeper/bin
PATH: /opt/wine-5.0/bin


## ----------- ##
Expand All @@ -58,7 +71,7 @@ configure:1938: found /usr/bin/gcc
configure:1949: result: gcc
configure:2178: checking for C compiler version
configure:2187: gcc --version >&5
gcc (GCC) 8.3.0
gcc (GCC) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Expand All @@ -67,11 +80,11 @@ configure:2198: $? = 0
configure:2187: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/8.3.0/lto-wrapper
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/8.1.0/lto-wrapper
Target: i486-pc-linux-gnu
Configured with: ../gcc-8.3.0-src/configure --enable-languages=c,c++,go --disable-nls --disable-multilib --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu
Configured with: ../gcc-8.1.0-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-languages=c,c++,go --disable-nls --disable-multilib
Thread model: posix
gcc version 8.3.0 (GCC)
gcc version 8.1.0 (GCC)
configure:2198: $? = 0
configure:2187: gcc -V >&5
gcc: error: unrecognized command line option '-V'
Expand Down Expand Up @@ -228,6 +241,26 @@ configure: failed program was:
configure:3188: gcc -c -g -O2 conftest.c >&5
configure:3188: $? = 0
configure:3196: result: 64
configure:3291: checking for OpenSSLVerifyCallback in -lUseful
configure:3316: gcc -o conftest -g -O2 conftest.c -lUseful -lssl -lcrypto -lz >&5
configure:3316: $? = 0
configure:3325: result: yes
configure:3328: checking for SSL_new in -lssl
configure:3353: gcc -o conftest -g -O2 conftest.c -lssl -lcrypto -lz >&5
configure:3353: $? = 0
configure:3362: result: yes
configure:3373: checking for ERR_load_CRYPTO_strings in -lcrypto
configure:3398: gcc -o conftest -g -O2 conftest.c -lcrypto -lz -lssl >&5
configure:3398: $? = 0
configure:3407: result: yes
configure:3418: checking for inflate in -lz
configure:3443: gcc -o conftest -g -O2 conftest.c -lz -lcrypto -lssl >&5
configure:3443: $? = 0
configure:3452: result: yes
configure:3466: checking for GetToken in -lUseful
configure:3491: gcc -o conftest -g -O2 conftest.c -lUseful -lz -lcrypto -lssl >&5
configure:3491: $? = 0
configure:3500: result: yes
configure:3705: creating ./config.status

## ---------------------- ##
Expand All @@ -243,11 +276,9 @@ generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_COMMANDS =
$ ./config.status

on lattitude
on hplap

config.status:725: creating Makefile
configure:4776: === configuring in libUseful-4 (/home/colum/term_wifi/libUseful-4)
configure:4839: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local' --cache-file=/dev/null --srcdir=.

## ---------------- ##
## Cache variables. ##
Expand All @@ -273,6 +304,11 @@ ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_header_stdc=yes
ac_cv_lib_Useful_GetToken=yes
ac_cv_lib_Useful_OpenSSLVerifyCallback=yes
ac_cv_lib_crypto_ERR_load_CRYPTO_strings=yes
ac_cv_lib_ssl_SSL_new=yes
ac_cv_lib_z_inflate=yes
ac_cv_objext=o
ac_cv_path_EGREP='/bin/grep -E'
ac_cv_path_GREP=/bin/grep
Expand All @@ -292,7 +328,7 @@ CC='gcc'
CFLAGS='-g -O2'
CPP='gcc -E'
CPPFLAGS=''
DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64'
DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBZ=1 -DHAVE_LIBUSEFUL=1'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
Expand All @@ -301,7 +337,7 @@ EXEEXT=''
GREP='/bin/grep'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBS='-lUseful -lz -lcrypto -lssl '
LTLIBOBJS=''
OBJEXT='o'
PACKAGE_BUGREPORT=''
Expand All @@ -313,7 +349,7 @@ PACKAGE_VERSION=''
PATH_SEPARATOR=':'
SET_MAKE=''
SHELL='/bin/sh'
STATIC_LIBS='libUseful-4/libUseful.a'
STATIC_LIBS=''
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build_alias=''
Expand All @@ -338,7 +374,7 @@ program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
subdirs=' libUseful-4'
subdirs=''
sysconfdir='${prefix}/etc'
target_alias=''

Expand All @@ -355,5 +391,9 @@ target_alias=''
#define PACKAGE_URL ""
#define STDC_HEADERS 1
#define _FILE_OFFSET_BITS 64
#define HAVE_LIBSSL 1
#define HAVE_LIBCRYPTO 1
#define HAVE_LIBZ 1
#define HAVE_LIBUSEFUL 1

configure: exit 0
12 changes: 6 additions & 6 deletions config.status
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ $config_files
Report bugs to the package provider."

ac_cs_config=""
ac_cs_config="'--enable-ssl' '--with-system-libuseful'"
ac_cs_version="\
config.status
configured by ./configure, generated by GNU Autoconf 2.69,
Expand Down Expand Up @@ -495,7 +495,7 @@ if $ac_cs_silent; then
fi

if $ac_cs_recheck; then
set X /bin/sh './configure' $ac_configure_extra_args --no-create --no-recursion
set X /bin/sh './configure' '--enable-ssl' '--with-system-libuseful' $ac_configure_extra_args --no-create --no-recursion
shift
$as_echo "running CONFIG_SHELL=/bin/sh $*" >&6
CONFIG_SHELL='/bin/sh'
Expand Down Expand Up @@ -583,8 +583,8 @@ echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
cat >>"$ac_tmp/subs1.awk" <<\_ACAWK &&
S["LTLIBOBJS"]=""
S["LIBOBJS"]=""
S["subdirs"]=" libUseful-4"
S["STATIC_LIBS"]="libUseful-4/libUseful.a"
S["subdirs"]=""
S["STATIC_LIBS"]=""
S["EGREP"]="/bin/grep -E"
S["GREP"]="/bin/grep"
S["CPP"]="gcc -E"
Expand All @@ -599,12 +599,12 @@ S["CC"]="gcc"
S["target_alias"]=""
S["host_alias"]=""
S["build_alias"]=""
S["LIBS"]=""
S["LIBS"]="-lUseful -lz -lcrypto -lssl "
S["ECHO_T"]=""
S["ECHO_N"]="-n"
S["ECHO_C"]=""
S["DEFS"]="-DPACKAGE_NAME=\\\"\\\" -DPACKAGE_TARNAME=\\\"\\\" -DPACKAGE_VERSION=\\\"\\\" -DPACKAGE_STRING=\\\"\\\" -DPACKAGE_BUGREPORT=\\\"\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1"\
" -D_FILE_OFFSET_BITS=64"
" -D_FILE_OFFSET_BITS=64 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBZ=1 -DHAVE_LIBUSEFUL=1"
S["mandir"]="${datarootdir}/man"
S["localedir"]="${datarootdir}/locale"
S["libdir"]="${exec_prefix}/lib"
Expand Down
7 changes: 6 additions & 1 deletion interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,12 @@ while (1)
TerminalPutStr("~B~w s:Scan again d:disconnect escape-escape:exit~>~0", StdIO);

ch=TerminalReadChar(StdIO);
if (ch==ESCAPE) break;
if (ch==STREAM_CLOSED)
{
//stdin/terminal closed, exit gracefully
exit(0);
}
else if (ch==ESCAPE) break;
else if (ch=='s') InteractiveWifiScan(Dev, Menu);
else if (ch=='d') NetDown(Dev);
else if (ch=='f')
Expand Down
Binary file removed term_wifi
Binary file not shown.

0 comments on commit 144b4c8

Please sign in to comment.