summaryrefslogtreecommitdiffstats
path: root/call/call.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed spelling erorrs.HEADmasterThomas Osterried2023-05-131-1/+1
| | | | Signed-off-by: Thomas Osterried <dl9sau@darc.de>
* Moved setsockopt section behind bind().Thomas Osterried2022-05-131-16/+21
| | | | | | | | | Reason: kernel overwrites general and device specific settings after bind(). Thus all setsockopt-changes will be lost. Newer kernels should notice users about this. Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
* In setsockopt section:Thomas Osterried2022-05-021-10/+10
| | | | | | | | | | | if user requests EAX25 (option -me) and specifies a window size (> 7), call failed, because kernel checks if socket is in eax25 mode when setting window size > 7. -> setsockopt(...AX25_EXTSEQ...) has to be called before setsockopt(...AX25_WINDOW...) => Moved the etsockopt(...AX25_EXTSEQ...) in the code part in front of setsockopt(...AX25_WINDOW...) Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
* call: Remove unused arguments from sevenplname()Ralf Baechle2017-08-031-5/+2
| | | | | | | | | | | | | | | | This fixes the following warnings: gcc -DHAVE_CONFIG_H -I. -I.. -O2 -Wall -Wunused-parameter -flto -MT call.o -MD -MP -MF .deps/call.Tpo -c -o call.o call.c [...] call.c: In function ‘sevenplname’: call.c:1910:52: warning: unused parameter ‘buf’ [-Wunused-parameter] int *logfile, char parms[], int parmsbytes, char buf[], ^~~ call.c:1911:7: warning: unused parameter ‘bytes’ [-Wunused-parameter] int bytes) ^~~~~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* treewide: Kill assignments in if conditions.Ralf Baechle2017-08-031-35/+41
| | | | | | | | | | | | | | | | | | | Somewhat hard to read and the code base already has many overlong lines Found with below spatch files: @parens@ expression E, F, G; binary operator X; statement S; @@ - if ((E = F) X G) + E = F; + if (E X G) S Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Fix possible buffer overflow.Ralf Baechle2017-07-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | When downloading a file with a very long filename the 80 byte buffer used by start_ab_download() might overflow. Increase the buffer to a sufficient size and switch to using snprintf for double safety. This also fixes the following warnings: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -MT call.o -MD -MP -MF .deps/call.Tpo -c -o call.o call.c call.c: In function ‘cmd_call’: call.c:1008:33: warning: ‘%s’ directive writing up to 254 bytes into a region of size 62 [-Wformat-overflow=] sprintf(s, "filename : %s", gp->file_name); ^~ call.c:1008:3: note: ‘sprintf’ output between 19 and 273 bytes into a destination of size 80 sprintf(s, "filename : %s", gp->file_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ call.c:1022:30: warning: ‘%s’ directive writing up to 254 bytes into a region of size 65 [-Wformat-overflow=] sprintf(s, "Unable to open %s", gp->file_name); ^~ call.c:1022:3: note: ‘sprintf’ output between 16 and 270 bytes into a destination of size 80 sprintf(s, "Unable to open %s", gp->file_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Fix use of glibc feature selection macrosRalf Baechle2017-07-261-2/+4
| | | | | | | | __USE_XOPEN should not be used directly by application code. Other feature selection macros must be defined before inclusion of any system header files. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* the curses terminal connection displays the destination call inThomas Osterried2017-02-111-0/+3
| | | | | the upper left. call comes from commandline arg. Ensure to write it in upper case.
* call: Sort out initialization of t_win variables.Ralf Baechle2017-01-311-2/+6
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Fix error check on iconv's return value.Ralf Baechle2017-01-311-1/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Sort out variable and function declarations.Ralf Baechle2017-01-311-16/+18
| | | | | | | | | | - Make static what can be made static. - Add declaration where they were missing. - Don't define variables in headers. - Move declaations to the proper locations. - Pick up declarations from the proper headers. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Fix further abuse of 0 as NULL pointer.Ralf Baechle2017-01-311-25/+25
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Fix argument of time() to time(NULL).Ralf Baechle2017-01-311-3/+3
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Remove unused definition of MAXCMDLEN.Ralf Baechle2016-02-121-1/+0
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Have exactly one empty line following functions.Ralf Baechle2016-02-121-12/+3
| | | | | | Replace sequences of multiple empty lines to just one. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Move statline() to make declaration unnecessary.Ralf Baechle2016-02-121-42/+41
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Put statements following if() or while on separate line.Ralf Baechle2016-02-121-48/+85
| | | | | | Put while of do {} while loop on the line of the closing brace. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Have a blank separate a closing parenthesis and opening brace.Ralf Baechle2016-02-121-39/+39
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Avoid multiple statements or definitions in one line.Ralf Baechle2016-02-121-13/+28
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Don't use C++ comments.Ralf Baechle2016-02-121-81/+131
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Format with tabs instead of blanks.Ralf Baechle2016-02-121-133/+133
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Make static what can be made static.Ralf Baechle2016-02-121-31/+31
| | | | | | | | But leave remotecommand() to avoid a warning about the function being unused. It currently is unused because its sole caller is commented out. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Remove unused function writemsg().Ralf Baechle2016-02-121-30/+0
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Nuke trailing whitespace.Ralf Baechle2016-02-121-48/+48
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Remove initializations to 0 of global variables.Ralf Baechle2016-02-121-5/+5
| | | | | | | | C guarantees initialization to zero for global variables but putting those variables into the .bss section. An explicit initialization however will put the variable into the .data section where it will inflate the executable. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* UTF-8 support for call.Thomas Osterried2016-02-111-265/+745
| | | | | | | | | | | | | | | | | | | | | Patch by Cathryn Mataga. 1. Now supports UTF8 or IBM850 as the encoding style over AX25. 1a. Attention was paid to make sure that wide characters worked with East Asian fonts. 2. Now the screen can be resized. correctly. The program no longer crashes when it is resized. 3. Added a scrollback buffer. Use the up and down arrow keys or the page up/page down keys to scroll through history. After the screen begins scrolling, press 'up arrow' to view history. 4. Many visual quirks have been fixed. This version is now dependent on iconv and wide character versions of ncurses, which I think should be everywhere these days. Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
* call: Fix race condition between select(2) and signal delivery.Ralf Baechle2015-06-101-6/+13
| | | | | | | | | | | | | | If a signal is delivered between the start of the main select loop and select might wait for a long time. Fixing this with select is not possible so switch to pselect. Unlike select pselect akes a struct timespec pointer as its argument so rewrite the related infrastructure to work with struct timespec instead of struct timeval. For now the race did only affect the SIGQUIT delivery. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Call: Fix parsing of the argument of the -T option.Ralf Baechle2015-06-101-9/+12
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Don't reinstall SIGQUIT signal handler.Ralf Baechle2015-06-101-1/+0
| | | | | | | This is Linux software so we don't have to deal with this kind of UNIX V7 or SVR3 braindamage of resetting the signal handlers. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Rewrite excessivly long select call for readability.Ralf Baechle2015-06-101-2/+9
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Harden against compiler overoptimization.Ralf Baechle2015-06-101-1/+1
| | | | | | | A compiler won't know that the interrupted variable can be changed behind its back in a signal handler so it might do clever overoptimizations. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Call: Handle select(2) returning EINTR.Ralf Baechle2015-06-101-5/+8
| | | | | | | | | | | | | | This may happen when call is running in curses mode, and the terminal window is resized which results in a SIGWINCH sent. Ncurses as normally configured on Linux distributions will have installed a handler. If as it is the most likely case, the select call will be interrupted by the signal, select will return EINTR and call will exit. Note that this doesn't mean it's now a good idea to resize the window. Call will still not handle the screen size change properly and the output will look ugly and missformatted. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Reformat consistently. Strictly whitespace changes only.Ralf Baechle2015-05-021-69/+69
| | | | | | | Indentation by tabs only. Move case labels in switches are on the same level as the switch keyword. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Remove pointless return statements at the end of void functions.Ralf Baechle2015-05-021-3/+0
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Remove parenthesis around arguments of return statements.Ralf Baechle2015-05-021-20/+20
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Use tabs for indentation, not spaces.Ralf Baechle2015-05-021-21/+21
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Remove useless initializations to 0 or NULL.Ralf Baechle2015-05-021-5/+5
| | | | | | | They only inflate the .data section of the binary. Initializations to FALSE are still left to do. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* Nuke trailing whitespace.Ralf Baechle2015-05-021-2/+2
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Fix warning about set but not used variable.Ralf Baechle2013-06-171-2/+2
| | | | | | | | | | gcc -DHAVE_CONFIG_H -I. -I.. -O2 -Wall -Wno-pointer-sign -MT call.o -MD -MP -MF .deps/call.Tpo -c -o call.o call.c call.c: In function ‘wrdstatw’: call.c:482:9: warning: variable ‘x’ set but not used [-Wunused-but-set-variable] mv -f .deps/call.Tpo .deps/call.Po Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* call: Fix warning about set but unused variable.Ralf Baechle2013-06-171-2/+0
| | | | | | | call.c:1590:6: warning: variable ‘extrach’ set but not used [-Wunused-but-set-va riable] Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* bugfix: buffer overflow in call.c.Thomas Osterried2012-10-281-2/+2
| | | | | | | | | | | | If the call sign you connect to has 9 characters (i.E. DL9SAU-10), then call segfaults. idString in the ncruses mode routine start_screen() was dimensioned too short, and the auther had the fatal assumtion that a call is 8 characters long (and not 9), and he did limit the length in sprintf with ... %n.ns This is an old bug. Obviously, ubuntu 12.04 and 12.10 introduced better runtime checks into potential buffer overflows.
* - Important bugfix (call did not work properly after my last patch)Thomas Osterried2009-11-111-140/+211
| | | | | | | | | - Better error handling on read() == -1 and write() == -1. Previously, the return value was not honored correctly - and could cause unexpected results. - New option "-R": Disable all remote commands like autobin (#BIN#), 7plus downloads, //echo, etc. This is useful for scripting where you just don't like the remote site to trigger uncaught conditions here.
* fix: on read through closed pipe, call did endless select(),Thomas Osterried2009-08-241-16/+59
| | | | | | | | read() = 0, wht consumed 100% CPU power. New options: -W: waits after EOF on stdin. Useful for scripting, for waiting for data coming via fd 3 (ax25 connection) -T secs: idle timout after secs seconds.
* Remove use of backwards compatibility header name.Ralf Baechle2009-06-211-12/+0
| | | | | | Glibc as old as 2.2 provides working headers under the right name and if not libax25 would install headers under the right name so this has become redundant and ugly.
* Fix build error caused by variable definition after statement.Ralf Baechle2009-06-061-1/+2
|
* fixed segfault issueThomas Osterried2009-04-151-10/+10
|
* call writes messages to stdout using printf(). it writes dataThomas Osterried2009-03-191-8/+33
| | | | | | | | | | | from the ax25 connection using write(0). everything was fine as long as call wrote to stdout. If instead we use output redirection to a file or stdout (> foo, | bar), then the messages like "Connected to.." appeared at the end of the connection. I guess it's a glibc issue that printf (whih is buffered) behaves different when stdout is redirected. Fixed using fflush() after each printf().
* removed debug codeThomas Osterried2009-01-251-2/+0
|
* fixed segfault issue by parsing unexpected bin headers.Thomas Osterried2009-01-251-28/+39
|
* revised linemodeThomas Osterried2009-01-241-33/+1
|