diff -urN binkd-0.9.2/README.ai binkd-0.9.2-ai-pl5/README.ai --- binkd-0.9.2/README.ai Thu Jan 1 03:00:00 1970 +++ binkd-0.9.2-ai-pl5/README.ai Sun Jul 5 12:22:32 1998 @@ -0,0 +1,35 @@ +ai-pl5, Binkd 0.9.2, 5 Jul 1998, Andy Igoshin + +Patch is available at: +ftp://ftp.vsu.ru/pub/linux/system/fido/binkd-0.9.2-ai-pl5.diff.gz + + + 1. Добавлена возможность отображения в строке процесса (ps -ax) типа сессии + и адреса, с кем соединение (в том числе для OS без setproctitle()). + Исправлена ошибка, делавшая невозможным ранее при включении этой + возможности перезапускать binkd по -SIGHUP. + Для включения этой возможности binkd должен быть скомпилирован с ключем + -DSETPROCTITLE . + + 2. Добавлена возможность указать binkd на/с каком конкретном ip адресе + (алиасе или интерфейсе) он должен отвечать/звонить (вызов bind()). + Для этого в binkd.cfg добавлена переменная `bindaddress', значением + которой должен быть ip адрес или `all'. В первом случае binkd работает + с указанного адреса, во втором, как обычно, со всех доступных + интерфейсов/алиасов. + Для включения этой возможности binkd должен быть скомпилирован с ключем + -DBINDADDRESS . + + 3. Добавлена обработка паролей из файла паролей Ifmail. Для этого + в binkd.cfg добавлена переменная `ifmail-passwd', значением которой + должен быть полный путь до файла паролей Ifmail. Эта переменная в + конфигурационном файле должна быть указана РАНЬШЕ, чем любые определения + `node'. Если необходимо указать, что для некой ноды пароль надо брать из + файла паролей Ifmail, запишите, например, так: + + node 2:5025/8 * *ifp + + , где `*ifp' - предопределенная комбинация символов, указывающая на + необходимость искать пароль для этой ноды в файле паролей Ifmail. + Для включения этой возможности binkd должен быть скомпилирован с ключем + -DIFMAIL_PASSWD . diff -urN binkd-0.9.2/binkd.c binkd-0.9.2-ai-pl5/binkd.c --- binkd-0.9.2/binkd.c Mon Nov 3 09:11:05 1997 +++ binkd-0.9.2-ai-pl5/binkd.c Sat Jul 4 15:36:17 1998 @@ -163,11 +163,25 @@ /* Config file name */ char *config = 0; +#ifdef SETPROCTITLE +int ARGC; +char **ARGV = NULL; + +int main (int argc, char *argv[], char **envp) +#else int main (int argc, char *argv[]) +#endif { char tmp[128]; int i; +#ifdef SETPROCTITLE + ARGC = argc; + ARGV = mkargv (argc, argv); + + initsetproctitle (argc, argv, envp); +#endif + for (i = 1; i < argc; ++i) { if (argv[i][0] == '-') @@ -325,9 +339,15 @@ Log (2, "killing %i", pidcmgr); kill (pidcmgr, 15); sleep (2); +#ifdef SETPROCTITLE + print_args (tmp, sizeof (tmp), ARGC - 1, ARGV + 1); + Log (2, "exec %s%s", ARGV[0], tmp); + if (execv (ARGV[0], ARGV) == -1) +#else print_args (tmp, sizeof (tmp), argc - 1, argv + 1); Log (2, "exec %s%s", argv[0], tmp); if (execv (argv[0], argv) == -1) +#endif Log (1, "execv: %s", strerror (errno)); } else diff -urN binkd-0.9.2/binkd.cfg binkd-0.9.2-ai-pl5/binkd.cfg --- binkd-0.9.2/binkd.cfg Thu Oct 23 07:19:42 1997 +++ binkd-0.9.2-ai-pl5/binkd.cfg Fri Jul 3 12:01:30 1998 @@ -37,6 +37,8 @@ #oport binkp #oblksize 4096 #timeout 60 +# Only if made with -DBINDADDRESS +#bindaddress all # # Delay calls and outbound rescans @@ -169,6 +171,11 @@ # #exec "my-freq-processor.exe /options *S" *.req #exec "my-pkt-unpacker.exe /options *S" *.pkt + +# +# Ifmail password file (Only if made with -DIFMAIL_PASSWD) +# +#ifmail-passwd /usr/local/etc/ifmail/passwd # # Include a file diff -urN binkd-0.9.2/client.c binkd-0.9.2-ai-pl5/client.c --- binkd-0.9.2/client.c Wed Nov 5 02:35:34 1997 +++ binkd-0.9.2-ai-pl5/client.c Fri Jul 3 11:01:15 1998 @@ -108,6 +108,11 @@ pidcmgr = 0; Log (4, "clientmgr started"); + +#ifdef SETPROCTITLE + setproctitle ("client manager"); +#endif + while (1) { FTN_NODE *r; @@ -206,7 +211,12 @@ int sockfd = INVALID_SOCKET; struct hostent he; struct hostent *hp; +#ifdef BINDADDRESS + struct sockaddr_in sin, cin; + int opt = 1; +#else struct sockaddr_in sin; +#endif struct in_addr defaddr; char **cp; char szDestAddr[FTN_ADDR_SZ + 1]; @@ -219,6 +229,10 @@ ftnaddress_to_str (szDestAddr, &node->fa); Log (2, "call to %s", szDestAddr); +#ifdef SETPROCTITLE + setproctitle ("call to %s", szDestAddr); +#endif + for (i = 1; sockfd == INVALID_SOCKET && (rc = get_host_and_port (i, host, &port, node->hosts, &node->fa)) != -1; ++i) @@ -265,12 +279,30 @@ Log (1, "socket: %s", TCPERR ()); return 0; } + +#ifdef BINDADDRESS + if ((bindaddress != NULL) && strcasecmp(bindaddress, "all") && strcasecmp(bindaddress, "any")) + { + if (setsockopt (sockfd, SOL_SOCKET, SO_REUSEADDR, + (char *) &opt, sizeof opt) == SOCKET_ERROR) + Log (1, "setsockopt (SO_REUSEADDR): %s", TCPERR ()); + cin.sin_addr.s_addr = inet_addr (bindaddress); + if (bind (sockfd, (struct sockaddr *) & cin, sizeof (cin)) != 0) + Log (0, "bind: %s", TCPERR ()); + } +#endif + sin.sin_addr = *((struct in_addr *) * cp); Log (4, port == DEF_PORT ? "trying %s..." : "trying %s, port %u...", inet_ntoa (sin.sin_addr), (unsigned) port); if (connect (sockfd, (struct sockaddr *) & sin, sizeof (sin)) == 0) { Log (4, "connected"); + +#ifdef SETPROCTITLE + setproctitle ("o %s [%s]", szDestAddr, hp->h_name); +#endif + break; } diff -urN binkd-0.9.2/mkfls/unix/Makefile.dep binkd-0.9.2-ai-pl5/mkfls/unix/Makefile.dep --- binkd-0.9.2/mkfls/unix/Makefile.dep Thu Oct 23 08:30:54 1997 +++ binkd-0.9.2-ai-pl5/mkfls/unix/Makefile.dep Fri Jul 3 11:01:16 1998 @@ -40,3 +40,4 @@ exitproc.o: exitproc.c Config.h sys.h bsy.h ftnaddr.h tools.h getw.h iphdr.h \ readcfg.h ftndom.h ftnnode.h binlog.h getw.o: getw.c getw.h +setproctitle.o: setproctitle.c diff -urN binkd-0.9.2/mkfls/unix/Makefile.in binkd-0.9.2-ai-pl5/mkfls/unix/Makefile.in --- binkd-0.9.2/mkfls/unix/Makefile.in Wed Nov 5 02:57:41 1997 +++ binkd-0.9.2-ai-pl5/mkfls/unix/Makefile.in Fri Jul 3 11:15:21 1998 @@ -1,11 +1,11 @@ # $Id: Makefile.in,v 1.4 1997/11/03 07:51:16 mff Exp $ CC=@CC@ AWK=@AWK@ -SRCS=binkd.c readcfg.c tools.c ftnaddr.c ftnq.c client.c server.c protocol.c bsy.c inbound.c breaksig.c branch.c unix/rename.c unix/getfree.c ftndom.c ftnnode.c srif.c pmatch.c readflo.c prothlp.c iptools.c run.c binlog.c exitproc.c getw.c +SRCS=binkd.c readcfg.c tools.c ftnaddr.c ftnq.c client.c server.c protocol.c bsy.c inbound.c breaksig.c branch.c unix/rename.c unix/getfree.c ftndom.c ftnnode.c srif.c pmatch.c readflo.c prothlp.c iptools.c run.c binlog.c exitproc.c getw.c setproctitle.c OBJS=${SRCS:.c=.o} AUTODEFS=@DEFS@ AUTOLIBS=@LIBS@ -DEFINES=$(AUTODEFS) -DHAVE_FORK -DUNIX -DOS="\"UNIX\"" +DEFINES=$(AUTODEFS) -DHAVE_FORK -DUNIX -DOS="\"UNIX\"" -DSETPROCTITLE -DBINDADDRESS -DIFMAIL_PASSWD CFLAGS=$(DEFINES) -Wall LIBS=$(AUTOLIBS) diff -urN binkd-0.9.2/protocol.c binkd-0.9.2-ai-pl5/protocol.c --- binkd-0.9.2/protocol.c Wed Nov 5 02:37:41 1997 +++ binkd-0.9.2-ai-pl5/protocol.c Fri Jul 3 11:01:16 1998 @@ -612,6 +612,9 @@ FTN_ADDR fa; FTN_NODE *n; char szFTNAddr[FTN_ADDR_SZ + 1]; +#ifdef SETPROCTITLE + char szFTNAddr_first[FTN_ADDR_SZ + 1]; +#endif s[sz] = 0; for (i = 1; (w = getwordx (s, i, 0)) != 0; ++i) @@ -629,10 +632,18 @@ free (w); ftnaddress_to_str (szFTNAddr, &fa); +#ifdef SETPROCTITLE + if (i == 1) strncpy (szFTNAddr_first, szFTNAddr, sizeof (szFTNAddr_first)); +#endif if (bsy_add (&fa, F_BSY)) { Log (2, "addr: %s", szFTNAddr); + +#ifdef SETPROCTITLE + setproctitle ("i %s [%s]", szFTNAddr_first, state->peer_name); +#endif + state->fa = realloc (state->fa, sizeof (FTN_ADDR) * ++state->nfa); assert (state->fa != 0); diff -urN binkd-0.9.2/readcfg.c binkd-0.9.2-ai-pl5/readcfg.c --- binkd-0.9.2/readcfg.c Thu Oct 23 07:46:06 1997 +++ binkd-0.9.2-ai-pl5/readcfg.c Sun Jul 5 11:59:25 1998 @@ -112,6 +112,24 @@ int send_if_pwd = 0; int tzoff = 0; char root_domain[MAXHOSTNAMELEN + 1] = "fidonet.net."; +#ifdef BINDADDRESS +char bindaddress[MAXIPADDRLEN + 1] = ""; +#endif +#ifdef IFMAIL_PASSWD +typedef struct st_ifp { + struct st_ifp *next; + char *node; + char *passwd; +} Ifp; + +static Ifp *ifp_list = NULL; +static Ifp *ifp_last = NULL; + +char ifmail_passwd[MAXPATHLEN + 1] = ""; +int ifmail_passwd_load = 0; + +static void ifp_free (void); +#endif #if defined (HAVE_VSYSLOG) && defined (HAVE_FACILITYNAMES) @@ -204,6 +222,12 @@ {"ftrans", read_rfrule, NULL, 0, 0}, {"send-if-pwd", read_bool, &send_if_pwd, 0, 0}, {"root-domain", read_string, root_domain, 0, MAXHOSTNAMELEN}, +#ifdef BINDADDRESS + {"bindaddress", read_string, bindaddress, 0, MAXIPADDRLEN}, +#endif +#ifdef IFMAIL_PASSWD + {"ifmail-passwd", read_string, ifmail_passwd, 'f', MAXPATHLEN}, +#endif {NULL, NULL, NULL, 0, 0} }; @@ -217,7 +241,13 @@ */ void readcfg (char *_path) { +#ifdef IFMAIL_PASSWD + ifmail_passwd_load = 0; +#endif readcfg0 (_path); +#ifdef IFMAIL_PASSWD + ifp_free (); +#endif if ((iport = find_port (siport)) == 0 || (oport = find_port (soport)) == 0) @@ -427,6 +457,105 @@ } } +#ifdef IFMAIL_PASSWD +static void ifp_free (void) +{ + Ifp *o, *p; + + if (ifp_list == NULL) + return; + + for (p=ifp_list, o=p; p; o=p, p=p->next) + { + free (o->next); o->next = NULL; + free (o->node); o->node = NULL; + free (o->passwd); o->passwd = NULL; + } + ifp_list = NULL; + ifp_last = NULL; + + return; +} + +static void ifp_init (char *ifmail_passwd) +{ + FILE *in; + char buf[MAXCFGLINE + 1]; + char *w, *w0, *w2; + Ifp *p; + + if (ifmail_passwd_load) + return; + if (ifp_list != NULL) + ifp_free(); + + if ((in = fopen (ifmail_passwd, "r")) == 0) + Log (0, "%s: %s", ifmail_passwd, strerror (errno)); + + while (!feof (in)) + { + if (!fgets (buf, sizeof (buf), in)) + break; + + if ((w = getword (buf, 1)) != 0) + { + if (!STRICMP (w, "password")) + { + if ((w0 = getword (buf, 2)) == 0) + break; + if ((w2 = getword (buf, 3)) == 0) + break; + + p = (Ifp *)malloc(sizeof(Ifp)); + p->next = NULL; + p->node = w0; + p->passwd = w2; + + if(ifp_list) + ifp_last->next = p; + else + ifp_list = p; + ifp_last = p; + } + free (w); w = NULL; + } + } + fclose (in); + + ifmail_passwd_load = 1; + return; +} + +static char *ifp_lookup (char *node) +{ + Ifp *p; + char _node[MAXCFGLINE + 1]; + + if (!ifmail_passwd_load) + ifp_init (ifmail_passwd); + + for (p=ifp_list; p; p=p->next) + { + if (!STRICMP(p->node, node)) + { + return p->passwd; + } + } + + strcpy (_node, node); + strtok (_node, "@"); + for (p=ifp_list; p; p=p->next) + { + if (!STRICMP(p->node, _node)) + { + return p->passwd; + } + } + + return NULL; +} +#endif + static void read_node_info (KEYWORD *key, char *s) { char *w[6]; @@ -466,6 +595,10 @@ if (w[2] && w[2][0] == 0) Log (0, "%s: %i: empty password", path, line); +#ifdef IFMAIL_PASSWD + else if (w[2] && !STRICMP (w[2], "*ifp")) + w[2] = ifp_lookup (w[0]); +#endif if (w[3] && w[3][0] != '-' && !isflvr (w[3][0])) Log (0, "%s: %i: %s: incorrect flavour", path, line, w[3]); check_dir_path (w[4]); @@ -476,7 +609,9 @@ for (i = 0; i < 6; ++i) if (w[i]) - free (w[i]); + { + free (w[i]); w[i] = NULL; + } } /* diff -urN binkd-0.9.2/readcfg.h binkd-0.9.2-ai-pl5/readcfg.h --- binkd-0.9.2/readcfg.h Thu Oct 23 07:44:20 1997 +++ binkd-0.9.2-ai-pl5/readcfg.h Fri Jul 3 13:37:49 1998 @@ -43,6 +43,9 @@ #define MAXSYSOPNAME 120 #define MAXLOCATIONNAME 120 #define MAXNODEINFO 120 +#ifdef BINDADDRESS +#define MAXIPADDRLEN 32 +#endif extern int nAddr; extern FTN_ADDR *pAddr; @@ -82,6 +85,13 @@ extern int percents; extern int tzoff; extern char root_domain[MAXHOSTNAMELEN + 1]; +#ifdef BINDADDRESS +extern char bindaddress[MAXIPADDRLEN + 1]; +#endif +#ifdef IFMAIL_PASSWD +extern char ifmail_passwd[MAXPATHLEN + 1]; +extern int ifmail_passwd_load; +#endif /* * Parses and reads the path as a config diff -urN binkd-0.9.2/server.c binkd-0.9.2-ai-pl5/server.c --- binkd-0.9.2/server.c Thu Oct 23 07:39:48 1997 +++ binkd-0.9.2-ai-pl5/server.c Fri Jul 3 11:01:16 1998 @@ -126,6 +126,10 @@ Log (4, "servmgr started"); +#ifdef SETPROCTITLE + setproctitle ("server manager"); +#endif + /* Store initial value for Binkd config's mtime */ checkcfg (); @@ -143,6 +147,13 @@ serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl (INADDR_ANY); serv_addr.sin_port = htons ((unsigned short) iport); + +#ifdef BINDADDRESS + if ((bindaddress != NULL) && strcasecmp(bindaddress, "all") && strcasecmp(bindaddress, "any")) + serv_addr.sin_addr.s_addr = inet_addr (bindaddress); + else + serv_addr.sin_addr.s_addr = htonl (INADDR_ANY); +#endif if (bind (sockfd, (struct sockaddr *) & serv_addr, sizeof (serv_addr)) != 0) Log (0, "bind: %s", TCPERR ()); diff -urN binkd-0.9.2/setproctitle.c binkd-0.9.2-ai-pl5/setproctitle.c --- binkd-0.9.2/setproctitle.c Thu Jan 1 03:00:00 1970 +++ binkd-0.9.2-ai-pl5/setproctitle.c Fri Jul 3 11:01:16 1998 @@ -0,0 +1,277 @@ +#include +#include + +#define MAXLINE 2048 +#define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf)) +#define newstr(s) strcpy(xalloc(strlen(s) + 1), s) + + +#ifdef __STDC__ + +#include + +#define VA_LOCAL_DECL va_list ap; +#define VA_START(f) va_start(ap, f) +#define VA_END va_end(ap) + +#else + +#include + +#define VA_LOCAL_DECL va_list ap; +#define VA_START(f) va_start(ap) +#define VA_END va_end(ap) + +#endif + +/* +** XALLOC -- Allocate memory and bitch wildly on failure. +** +** THIS IS A CLUDGE. This should be made to give a proper +** error -- but after all, what can we do? +** +** Parameters: +** sz -- size of area to allocate. +** +** Returns: +** pointer to data region. +** +** Side Effects: +** Memory is allocated. +*/ + +char * +xalloc(sz) + register int sz; +{ + register char *p; + + /* some systems can't handle size zero mallocs */ + if (sz <= 0) + sz = 1; + + p = malloc((unsigned) sz); +// if (p == NULL) +// { +// syserr("!Out of memory!!"); +// /* exit(EX_UNAVAILABLE); */ +// } + return (p); +} + +/* +** SETPROCTITLE -- set process title for ps +** +** Parameters: +** fmt -- a printf style format string. +** a, b, c -- possible parameters to fmt. +** +** Returns: +** none. +** +** Side Effects: +** Clobbers argv of our main procedure so ps(1) will +** display the title. +*/ + +#define SPT_NONE 0 /* don't use it at all */ +#define SPT_REUSEARGV 1 /* cover argv with title information */ +#define SPT_BUILTIN 2 /* use libc builtin */ +#define SPT_PSTAT 3 /* use pstat(PSTAT_SETCMD, ...) */ +#define SPT_PSSTRINGS 4 /* use PS_STRINGS->... */ +#define SPT_SYSMIPS 5 /* use sysmips() supported by NEWS-OS 6 */ +#define SPT_SCO 6 /* write kernel u. area */ +#define SPT_CHANGEARGV 7 /* write our own strings into argv[] */ + +#ifndef SPT_TYPE +# define SPT_TYPE SPT_REUSEARGV +#endif + +#if SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN + +# if SPT_TYPE == SPT_PSTAT +# include +# endif +# if SPT_TYPE == SPT_PSSTRINGS +# include +# include +# ifndef PS_STRINGS /* hmmmm.... apparently not available after all */ +# undef SPT_TYPE +# define SPT_TYPE SPT_REUSEARGV +# else +# ifndef NKPDE /* FreeBSD 2.0 */ +# define NKPDE 63 +typedef unsigned int *pt_entry_t; +# endif +# endif +# endif + +# if SPT_TYPE == SPT_PSSTRINGS || SPT_TYPE == SPT_CHANGEARGV +# define SETPROC_STATIC static +# else +# define SETPROC_STATIC +# endif + +# if SPT_TYPE == SPT_SYSMIPS +# include +# include +# endif + +# if SPT_TYPE == SPT_SCO +# include +# include +# include +# include +# if PSARGSZ > MAXLINE +# define SPT_BUFSIZE PSARGSZ +# endif +# endif + +# ifndef SPT_PADCHAR +# define SPT_PADCHAR ' ' +# endif + +# ifndef SPT_BUFSIZE +# define SPT_BUFSIZE MAXLINE +# endif + +#endif /* SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN */ + +/* +** Pointers for setproctitle. +** This allows "ps" listings to give more useful information. +*/ + +char **Argv = NULL; /* pointer to argument vector */ +char *LastArgv = NULL; /* end of argv */ + +void +initsetproctitle(argc, argv, envp) + int argc; + char **argv; + char **envp; +{ + register int i, envpsize = 0; + extern char **environ; + + /* + ** Move the environment so setproctitle can use the space at + ** the top of memory. + */ + + for (i = 0; envp[i] != NULL; i++) + envpsize += strlen(envp[i]) + 1; + environ = (char **) xalloc(sizeof (char *) * (i + 1)); + for (i = 0; envp[i] != NULL; i++) + environ[i] = newstr(envp[i]); + environ[i] = NULL; + + /* + ** Save start and extent of argv for setproctitle. + */ + + Argv = argv; + + /* + ** Find the last environment variable within sendmail's + ** process memory area. + */ + while (i > 0 && (envp[i - 1] < argv[0] || + envp[i - 1] > (argv[argc - 1] + + strlen(argv[argc - 1]) + 1 + envpsize))) + i--; + + if (i > 0) + LastArgv = envp[i - 1] + strlen(envp[i - 1]); + else + LastArgv = argv[argc - 1] + strlen(argv[argc - 1]); +} + +#if SPT_TYPE != SPT_BUILTIN + + +/*VARARGS1*/ +void +# ifdef __STDC__ +setproctitle(const char *fmt, ...) +# else +setproctitle(fmt, va_alist) + const char *fmt; + va_dcl +# endif +{ +# if SPT_TYPE != SPT_NONE + register char *p; + register int i; + SETPROC_STATIC char buf[SPT_BUFSIZE]; + VA_LOCAL_DECL +# if SPT_TYPE == SPT_PSTAT + union pstun pst; +# endif +# if SPT_TYPE == SPT_SCO + off_t seek_off; + static int kmem = -1; + static int kmempid = -1; + struct user u; +# endif + + p = buf; + + /* print sendmail: heading for grep */ + (void) strcpy(p, "binkd: "); + p += strlen(p); + + /* print the argument string */ + VA_START(fmt); + (void) vsnprintf(p, SPACELEFT(buf, p), fmt, ap); + VA_END; + + i = strlen(buf); + +# if SPT_TYPE == SPT_PSTAT + pst.pst_command = buf; + pstat(PSTAT_SETCMD, pst, i, 0, 0); +# endif +# if SPT_TYPE == SPT_PSSTRINGS + PS_STRINGS->ps_nargvstr = 1; + PS_STRINGS->ps_argvstr = buf; +# endif +# if SPT_TYPE == SPT_SYSMIPS + sysmips(SONY_SYSNEWS, NEWS_SETPSARGS, buf); +# endif +# if SPT_TYPE == SPT_SCO + if (kmem < 0 || kmempid != getpid()) + { + if (kmem >= 0) + close(kmem); + kmem = open(_PATH_KMEM, O_RDWR, 0); + if (kmem < 0) + return; + (void) fcntl(kmem, F_SETFD, 1); + kmempid = getpid(); + } + buf[PSARGSZ - 1] = '\0'; + seek_off = UVUBLK + (off_t) u.u_psargs - (off_t) &u; + if (lseek(kmem, (off_t) seek_off, SEEK_SET) == seek_off) + (void) write(kmem, buf, PSARGSZ); +# endif +# if SPT_TYPE == SPT_REUSEARGV + if (i > LastArgv - Argv[0] - 2) + { + i = LastArgv - Argv[0] - 2; + buf[i] = '\0'; + } + (void) strcpy(Argv[0], buf); + p = &Argv[0][i]; + while (p < LastArgv) + *p++ = SPT_PADCHAR; + Argv[1] = NULL; +# endif +# if SPT_TYPE == SPT_CHANGEARGV + Argv[0] = buf; + Argv[1] = 0; +# endif +# endif /* SPT_TYPE != SPT_NONE */ +} + +#endif /* SPT_TYPE != SPT_BUILTIN */ diff -urN binkd-0.9.2/tools.c binkd-0.9.2-ai-pl5/tools.c --- binkd-0.9.2/tools.c Thu Oct 23 07:32:52 1997 +++ binkd-0.9.2-ai-pl5/tools.c Sat Jul 4 15:30:59 1998 @@ -561,3 +561,22 @@ return os; } + +#ifdef SETPROCTITLE +char **mkargv (int argc, char **argv) +{ + int i; + char **p; + + p = (char **)calloc (argc + 1, sizeof(p)); + p[argc] = NULL; + + for (i = 0; i < argc; i++) + { + p[i] = (char *)malloc (strlen (argv[i]) + 1); + strcpy (p[i], argv[i]); + } + + return p; +} +#endif diff -urN binkd-0.9.2/tools.h binkd-0.9.2-ai-pl5/tools.h --- binkd-0.9.2/tools.h Thu Oct 23 07:27:18 1997 +++ binkd-0.9.2-ai-pl5/tools.h Sat Jul 4 15:36:35 1998 @@ -130,3 +130,9 @@ char *get_os_string (); #endif + +#ifdef SETPROCTITLE +char **mkargv (int, char **); +void initsetproctitle (int, char **, char **); +void setproctitle (const char *fmt, ...); +#endif