mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
NO_ASPRINTF.
This commit is contained in:
parent
be53d7f298
commit
b7cefe4b6e
@ -1,4 +1,4 @@
|
|||||||
# $Id: GNUmakefile,v 1.24 2008-06-18 20:11:25 nicm Exp $
|
# $Id: GNUmakefile,v 1.25 2008-06-18 20:12:19 nicm Exp $
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ ifeq ($(shell uname),SunOS)
|
|||||||
INCDIRS+= -Icompat
|
INCDIRS+= -Icompat
|
||||||
SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c
|
SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c
|
||||||
CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
|
CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
|
||||||
-DNO_DAEMON -DNO_FORKPTY -DNO_PROGNAME
|
-DNO_DAEMON -DNO_FORKPTY -DNO_PROGNAME -DNO_ASPRINTF
|
||||||
LDFLAGS+= -L/opt/csw/lib
|
LDFLAGS+= -L/opt/csw/lib
|
||||||
LIBS+= -lsocket -lnsl
|
LIBS+= -lsocket -lnsl
|
||||||
endif
|
endif
|
||||||
|
56
compat/asprintf.c
Normal file
56
compat/asprintf.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/* $Id: asprintf.c,v 1.1 2008-06-18 20:12:19 nicm Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "tmux.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
asprintf(char **ret, const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
va_start(ap, format);
|
||||||
|
n = vasprintf(ret, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return (n);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
vasprintf(char **ret, const char *format, va_list ap)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if ((n = vsnprintf(NULL, 0, format, ap)) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
*ret = xmalloc(n + 1);
|
||||||
|
if ((n = vsnprintf(*ret, n + 1, format, ap)) < 0) {
|
||||||
|
xfree(*ret);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (n);
|
||||||
|
|
||||||
|
error:
|
||||||
|
*ret = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
8
tmux.h
8
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.149 2008-06-18 20:11:25 nicm Exp $ */
|
/* $Id: tmux.h,v 1.150 2008-06-18 20:12:19 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -780,6 +780,12 @@ int daemon(int, int);
|
|||||||
pid_t forkpty(int *, char *, struct termios *, struct winsize *);
|
pid_t forkpty(int *, char *, struct termios *, struct winsize *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_ASPRINTF
|
||||||
|
/* asprintf.c */
|
||||||
|
int asprintf(char **, const char *, ...);
|
||||||
|
int vasprintf(char **, const char *, va_list);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* tmux.c */
|
/* tmux.c */
|
||||||
extern volatile sig_atomic_t sigwinch;
|
extern volatile sig_atomic_t sigwinch;
|
||||||
extern volatile sig_atomic_t sigterm;
|
extern volatile sig_atomic_t sigterm;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user