Commit graph

62 commits

Author SHA1 Message Date
b14f5276ab Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-28 16:21:34 +01:00
bb467c335d Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-02 14:33:48 +01:00
df4925d696 Update copyright notice 2013-01-12 17:45:01 +01:00
1118f1c0ca Update copyright notice 2012-06-10 10:52:22 +02:00
98cd2a3a70 Update known contributors comments 2011-04-14 20:21:23 +02:00
7e2008e7f4 License upgrade to GPL version 3 or later
Why upgrade?  I'm not a lawyer, but here's my take on the differences
to version 2:

* Software patents: better protection against abuse of patents to
  prevent users from exercising the rights under the GPL.  I doubt
  we'll get hit with a patent suit, but it's a good move just on
  general principles.

* License compatibility: compatible with more free licenses, i.e. can
  "steal" more free software for use in Empire.  I don't expect to steal
  much, but it's nice to have the option.

* Definition of "source code": modernization of some details for today's
  networked world, to make it easier to distribute the software.  Not
  really relevant to us now, as we normally distribute full source code.

* Tivoization: this is about putting GPL-licensed software in hardware,
  then make the hardware refuse to run modified software.  "Neat" trick
  to effectively deny its users their rights under the GPL.  Abuse was
  "pioneered" by TiVo (popular digital video recorders).  GPLv3 forbids
  it.  Unlikely to become a problem for us.

* Internationalization: more careful wording, to harden the license
  outside the US.  The lawyers tell us it better be done that way.

* License violations: friendlier way to deal with license violations.
  This has come out of past experience enforcing the GPL.

* Additional permissions: Probably not relevant to us.

Also include myself in the list of principal authors.
2011-04-12 21:20:58 +02:00
373651359e Coding style fixes, mostly indentation and whitespace 2010-06-20 18:36:38 +02:00
73e25ff21e Update copyright notice 2010-01-19 08:40:17 +01:00
798af5b45b Revamp client's Windows POSIX compatibility code
Unlike POSIX sockets, Windows sockets are not file descriptors, but
"OS handles", with a completely separate set of functions.

However, Windows can create a file descriptor for a socket, and return
a file descriptor's underlying handle.  Use that instead of our gross
hacks to keep up the illusion that sockets are file descriptors.
Slightly dirty: we put file descriptors into fd_set.  Works because
both boil down to int.  Change w32_select(), w32_socket(),
w32_connect(), w32_recv(), w32_writev_socket(), w32_send() to take and
return only file descriptors, and map to sockets internally.  Replace
w32_close_socket() by w32_close(), and drop the close() macro hackery
that made tcp_connect(), host_connect() use w32_close_socket().  New
fd_is_socket().

Windows provides select()-like functions only for handles.  Because of
that, the client used a handle for reading script files, and stored it
in file descriptor input_fd.  Drop this dirty hack, use a file
descriptor instead.  Works because we can get its underlying handle.
Remove the dirty macro hackery that made play(), ring_from_file() and
doexecute() unwittingly work with a handle.  Remove w32_openhandle()
and w32_close_handle().  Replace w32_readv_handle() by w32_readv_fd().
Update w32_select().

Remove w32_openfd(), it's not really needed.

The old code stuffed WSA error codes into errno, which doesn't work.
Use new w32_set_winsock_errno() to convert & stuff.

Fix signed vs. unsigned warnings in Windows client.

Move the struct sigaction replacement next to the sigaction()
replacement.

Rename sysdep_init() to w32_sysdep_init() for consistency.
2009-11-30 19:44:21 +01:00
35ef345ecb Update copyright notice 2009-02-08 09:33:18 +01:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
bac5345914 (redir_authorized, doexecute): Change diagnostics to talk about batch
files instead of script files, to match info execute.
2007-12-13 21:36:25 +00:00
Ron Koenderink
f082ef9fa6 (w32_getpw, w32_socket, w32_connect, w32_recv, w32_send,
w32_writev_socket, w32_close_socket, getpass, w32_openfd,
w32_openhandle, w32_readv_handle, w32_close_handle,
sysdep_init, sysdep_stdin_init, w32_select, w32_signal_handler,
sigaction, stdin_read_thread, w32_ring_from_file_to_bounce_buf)
[_WIN32]: New w32 equivalent functions for POSIX functions.
(recvline, sendcmd, tcp_connect, hostconnect, getpass,
main, intr, play, ring_to_file, ring_from_file, doexecute,
doredir) [_WIN32]: Use new WIN32 equivalent functions.
(main) [_WIN32]: Add sysdep_init() to support system dependent
initialization for equivalence functions.
(play) [_WIN32]: Add sysdef_stdin_init() to support system
dependent initialization for reading stdin.
(recv_input, play) [_WIN32]: Replace the calls to ring_to_file()
and select() with WIN32 specific enhanced versions.

Makefile.in: update dependencies with new files.
Make.mk: Add using of getopt.c and getopt.h
from src/lib/w32 directory.  Add getopt.c and getopt.h
to tar for client.
2007-12-11 22:00:25 +00:00
a46c7656d2 (servercmd): Fix telegram info prompt. Broken in rev. 1.37. 2007-12-08 17:42:16 +00:00
ab368ce23b (servcmd): Fix recognition of empty C_INFORM broken in rev. 1.37. 2007-12-08 14:27:35 +00:00
c09d449204 Reject unexpected redirections:
(redir_authorized): New parameter expected, reject when zero.
(doredir): Pass !redir_fp, do not close it.  Before, an unexpected
redirection silently replaced the existing one.
(dopipe): Pass !redir_fp.  Before, an unexpected redirection silently
replaced the existing one, leaking its FILE.
(doexecute): Pass 1.
2007-11-29 06:04:30 +00:00
a29a8f43ab Refactor redirection data structure, no functional change:
(redir_is_pipe): New.
(doredir, dopipe): Set it.
(pipe_fp): Remove.  Users changed to use redir_fp and redir_is_pipe.
2007-11-29 05:31:55 +00:00
bde3d0c17d (prompt, servercmd): Move C_PROMPT code from prompt() to the only call
site that passes C_PROMPT.  No functional change.
2007-11-29 05:17:54 +00:00
e6882c1e7f (servercmd, prompt, doexecute): Refactor: collect control of
executing, input_fd and send_eof in servercmd().  No functional
change.
2007-11-28 07:17:20 +00:00
2dbc45eff7 Flaws in the Empire protocol make redirections within execute next to
impossible to implement correctly, and nested execute practically
useless (#116377).  Catch and refuse those:
(executing): New.
(doexecute, prompt): Set and clear it.
(redir_authorized): Reject if set.
(doexecute, play): Don't signal doexecute() failure through input_fd,
because that screws up up when we're executing already.  Increment
send_eof in doexecute() instead.
(send_eof): External linkage.
2007-11-28 07:10:27 +00:00
02a9af06a0 Fix redirections with execute. Redirection consumed the remembered
input, and execute couldn't find it and mistakenly raised the
tampering deity alarm.  Closes #804644:
(saved_bytes): New.
(save_input): Set it.
(forget_input): New.
(seen_input): Don't discard, return a value for forget_input().
(save_input): Return a value for forget_input(), just because it makes
sense.
(input_to_forget, redir_authorized, prompt): Save value of
seen_input() to new input_to_forget in redir_authorized(), pass it to
forget_input() in prompt().
2007-11-18 09:41:59 +00:00
72b01c8ba1 (redir_authorized): New, factored out of users in prepraration of next
changeset.
(doredir, dopipe, doexecute): Use it.
2007-11-18 09:32:16 +00:00
aef5b18c1e (doexecute): Fix to set input_fd on failure, so that play() terminates
the execute correctly.  Closes #723756.
2007-11-17 18:57:06 +00:00
0e506556c2 (doredir): Open the file with mode 0666 instead of 0600, for
consistency with redirections in pipes.  Users should use umask to
restrict permissions.
2007-11-17 14:36:03 +00:00
8b7d0b915d Rewrite much of client's playing phase code:
(EOF_COOKIE, INTR_COOKIE, input_fd, send_intr, recv_output)
(recv_input, intr, play): New playing phase code.  No native Windows
support yet.  Sends just one EOF cookie on EOF on standard input
instead of up to three.  Old servers (before recvclient.c rev. 1.16)
fail to terminate the session when they receive an EOF cookie at an
argument prompt.  The session then hangs; use SIGINT to get out.  No
longer blocks on sending input, which could deadlock the session.
Closes #827090.  Fixes error handling for select().  Fixes race
condition that could cause server output to be discarded on EOF on
standard input.
(main): Replace old playing phase code by a call to play().
(intr, sock, interrupt, handleintr): Replaced by play(), remove.
[_WIN32] (hStdIn): Ditto.
(auxfp): New.
(servercmd, prompt, doexecute): Remove parameter auxfi, use auxfp.
(eight_bit_clean): Move to servcmd.c.
(servercmd): Work on a single non-C_DATA line instead of getting lines
from an ioqueue.
(servercmd, output, screen, outch): Deal with all ids in servercmd()
rather than some there and some in output().  Don't treat C_NOECHO,
C_ABORT, C_CMDERR, C_BADCMD specially.  Fix C_FLASH and C_EXIT to
ignore redirections; they used to ignore them only for some parts.
Replace output() by outch(), fold screen into outch().
(servercmd): Truncate long prompts and telegram infos to prevent
buffer overflow.
(prompt): Use new parameters code, prompt, teles instead of global
variables mode, the_prompt, num_teles.
(num_teles, the_prompt, mode, nbtu, nmin): Remove.
(prompt): Don't write an empty line before argument prompts to auxfp.
(servercmd): Don't strip newline from redirections and execute,
doredir(), dopipe() and doexecute() need it now.
(doredir, dopipe, doexecute): Use new seen_input() instead of gettag().
(doexecute): Set input_fd and leave reading the script file to play().
(serverio, termio, sendeof): Replaced by play(), remove.
(LBUF_LEN_MAX, lbuf, lbuf_init, lbuf_len, lbuf_full, lbuf_line)
(lbuf_putc): New.
(RING_SIZE, ring, ring_init, ring_len, ring_space, ring_peek)
(ring_getc, ring_putc, ring_putm, ring_discard, ring_search)
(ring_from_file, ring_to_file): New.
(clear_recent_input, save_input, seen_input): New.
(MAX): New.
(ioqueue, io, ioq_init, ioq_dequeue, ioq_read, ioq_write, ioq_qsize)
(ioq_drain, ioq_gets, ioqtobuf, enqueuecc, dequeuecc): Unused, remove.
(QEMPTY, qelem, insque, remque, initque): Unused, remove.
(tagstruct, taglist, io_init, gettag): Unused, remove.
2007-11-17 14:17:38 +00:00
43d66c7d87 (doexecute): Use fname(). Simplify convoluted logic. Fix check for
empty argument.  Improve error messages.
2007-11-17 09:41:16 +00:00
2456a71acf (dopipe): Check whether argument starts with '|'. Simplify convoluted
logic.  Improve error messages.
2007-11-17 09:10:29 +00:00
17d6997d4e (fname): New.
(doredir): Use it.  Check whether argument starts with '>'.  Simplify
convoluted logic.  Improve error messages.  Check value of fdopen().
2007-11-17 09:08:57 +00:00
09e7abbd0d (output): Remove unused parameter eol. Caller changed. 2007-08-24 17:05:18 +00:00
198b7760d8 (exec_fd): Useless junk inherited all the way from BSD Empire 1.1.
Remove.
2007-08-18 09:24:05 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
4c4fdca42b Line breaks and other formatting issues. No functional changes. 2006-05-21 13:05:24 +00:00
2ae6be9af6 (num_teles, redir_fp, pipe_fp, exec_fd, sendeof, prompt, command)
(ac_intercept, all_missiles, ac_planedamage, ac_doflak, ac_landflak)
(ac_shipflak, ac_fireflak, can_fly, do_evade, att_calcodds)
(emp_setbitmap, lnd_hit_mine, conditions, get_wp, daemonize): Internal
linkage.
2006-05-20 13:54:45 +00:00
f5a9284867 Update known contributors comment. 2006-02-24 21:35:27 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
Ron Koenderink
733f747a36 (output): Remove C_FLUSH from output() as C_FLUSH is dealt with
by servercmd() and output() is not called from servercmd() with a
code of C_FLUSH.
2005-11-13 12:23:17 +00:00
Ron Koenderink
b7be1fe113 (servercmd): Remove newline for C_INFORM, C_FLUSH,
C_REDIR, C_PIPE and C_EXECUTE.
Fixes the problem created when the newline was left in io_gets().
2005-11-12 20:16:07 +00:00
Ron Koenderink
0918d3c3fc (io_gets, output): Remove the removal of \n in io_gets() and the
readdition of it in output().
2005-11-12 16:40:38 +00:00
Ron Koenderink
89e2b3b481 (servercmd, io_gets, output): Fix client to read lines longer than
1024 bytes from the server.  Closes #1223255.
2005-11-12 14:20:46 +00:00
Ron Koenderink
6304f3b482 (doexecute) [_WIN32]: Open the exec file in text mode.
The exec file contains the user commands created by text editor.
2005-09-24 13:34:39 +00:00
Ron Koenderink
02693bb59b (prompt,dopipe) [_WIN32]: Enable the pipe capability. 2005-07-23 21:44:00 +00:00
fbf9f15bbb (getsose): Port from obsolete termcap to terminfo. The old code
manually stripped off padding, which is evil.  The new code does
nothing when the stdout is not connected to a terminal.
(SO, smso, SE, rmso): Rename, static linkage.
(putso, putse): New.
(screen): Use it.
2005-06-04 13:03:16 +00:00
Ron Koenderink
05a4eae605 (output,screen): In ASCII mode, remove standout bit if the client
does not support standout mode.
In UTF8 mode, remove SO/SI characters if the client does not support
standout mode.
2005-05-29 16:22:14 +00:00
e2fe05be18 Clean up the previous revision. No functional changes. 2005-05-28 08:25:28 +00:00
7ef7aa83b8 Client UTF-8 support.
(login): New parameter utf8.  If set, request option utf-8 from
server.
(expect, recvline): Split recvline() out of expect().  Replace or
remove some unhelpful diagnostics.
(eight_bit_clean): New.
(screen): If eight_bit_clean is set, highlighting is switched with
SO/SI.  Else characters with MSB set are highlighted.
(main): New option -u to request UTF-8 and set eight_bit_clean.
2005-05-27 17:00:25 +00:00
647783f652 (servercmd): Parsed BTUs into nmin and minutes into nbtu. Fix. No
functional change.
2005-05-07 08:47:32 +00:00