MCPcopy Create free account
hub / github.com/SimHacker/micropolis / tcpServerObjectConfig

Function tcpServerObjectConfig

micropolis-activity/src/tk/tktcp.c:1681–1794  ·  view source on GitHub ↗
(clientData, interp, argc, argv)

Source from the content-addressed store, hash-verified

1679 * It may be called from tcpServerCommand when the server is
1680 * first being created, or else from tcpServerObjectCmd if the
1681 * server object is called with the "config" option.
1682 *
1683 * In any case, the arguments are expected to contain zero or
1684 * more of the following:
1685 *
1686 * -port <number>
1687 * Requests that the server listen at a specific port.
1688 * Default is whatever the system assigns.
1689 *
1690 * -command <string>
1691 * Specifies the initial command used when a client
1692 * first connects to the server. The command is
1693 * concatenated with the name of a "server-client" object
1694 * that identifies the client, and then called:
1695 * command client
1696 * Default is "tcp login"
1697 *
1698 * -raw
1699 * Puts the server in raw socket mode.
1700 *
1701 * Result:
1702 * A standard TCL result.
1703 */
1704
1705static int
1706tcpServerObjectConfig (clientData, interp, argc, argv)
1707 ClientData clientData;
1708 Tcl_Interp * interp;
1709 int argc;
1710 char * * argv;
1711{
1712
1713 register Tcp_ServerData * server = (Tcp_ServerData *) clientData;
1714
1715 int status;
1716 int unixStatus;
1717
1718 /* On entry, argc shows one plus the number of parameters. Argv[-1] */
1719 /* and argv[0] give the command that got us here: either "tcp */
1720 /* server" or else "serverName config" */
1721
1722 int a;
1723 unsigned length;
1724 int c;
1725
1726 /* Step through the parameters */
1727
1728 for (a = 1; a < argc; ++a) {
1729 char * arg = argv [a];
1730
1731 if (arg [0] != '-') {
1732 Tcl_AppendResult (interp, argv [-1], ": bad option \"", arg,
1733 "\" -- each option must begin with a hyphen.",
1734 (char *) NULL);
1735 return TCL_ERROR;
1736 } else {
1737
1738 length = strlen (++arg);

Callers 2

tcpServerCommandFunction · 0.85
tcpServerObjectConfigCmdFunction · 0.85

Calls 3

Tcl_AppendResultFunction · 0.85
Tcl_GetIntFunction · 0.85
Tcl_SetResultFunction · 0.85

Tested by

no test coverage detected