mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Fix stupid GNU getopt behaviour.
This commit is contained in:
parent
44b368e220
commit
df2b3bcf44
@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.40 2008-09-25 20:08:51 nicm Exp $
|
||||
# $Id: GNUmakefile,v 1.41 2008-09-25 23:28:12 nicm Exp $
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
@ -91,6 +91,11 @@ SRCS+= compat/strlcpy.c compat/strlcat.c compat/strtonum.c compat/fgetln.c
|
||||
CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
|
||||
-DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM -DNO_SETPROCTITLE \
|
||||
-DNO_QUEUE_H -DNO_TREE_H -DUSE_PTY_H -DNO_FGETLN -std=c99
|
||||
|
||||
# GNU, as usual, decided on the insance default. So their stupid extensions
|
||||
# are default and POSIX-compliance is optional (!).
|
||||
CFLAGS+= -DGETOPT_PREFIX="\"+\""
|
||||
|
||||
LIBS+= -lrt -lutil
|
||||
endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-bind-key.c,v 1.15 2008-06-05 21:54:47 nicm Exp $ */
|
||||
/* $Id: cmd-bind-key.c,v 1.16 2008-09-25 23:28:12 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -60,7 +60,7 @@ cmd_bind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
self->data = data = xmalloc(sizeof *data);
|
||||
data->cmd = NULL;
|
||||
|
||||
while ((opt = getopt(argc, argv, "")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "")) != EOF) {
|
||||
switch (opt) {
|
||||
default:
|
||||
goto usage;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-generic.c,v 1.12 2008-06-29 07:04:30 nicm Exp $ */
|
||||
/* $Id: cmd-generic.c,v 1.13 2008-09-25 23:28:12 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -44,7 +44,7 @@ cmd_target_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
cmd_target_init(self, 0);
|
||||
data = self->data;
|
||||
|
||||
while ((opt = getopt(argc, argv, "dkt:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "dkt:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
if (self->entry->flags & CMD_DFLAG) {
|
||||
@ -166,7 +166,7 @@ cmd_srcdst_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
cmd_srcdst_init(self, 0);
|
||||
data = self->data;
|
||||
|
||||
while ((opt = getopt(argc, argv, "dks:t:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "dks:t:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
if (self->entry->flags & CMD_DFLAG) {
|
||||
@ -299,7 +299,7 @@ cmd_buffer_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
cmd_buffer_init(self, 0);
|
||||
data = self->data;
|
||||
|
||||
while ((opt = getopt(argc, argv, "b:dkt:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "b:dkt:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'b':
|
||||
if (data->buffer == -1) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-new-session.c,v 1.30 2008-06-21 10:19:36 nicm Exp $ */
|
||||
/* $Id: cmd-new-session.c,v 1.31 2008-09-25 23:28:12 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -75,7 +75,7 @@ cmd_new_session_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
self->entry->init(self, 0);
|
||||
data = self->data;
|
||||
|
||||
while ((opt = getopt(argc, argv, "ds:n:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "ds:n:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
data->flag_detached = 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-new-window.c,v 1.24 2008-06-18 16:39:15 nicm Exp $ */
|
||||
/* $Id: cmd-new-window.c,v 1.25 2008-09-25 23:28:12 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -76,7 +76,7 @@ cmd_new_window_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
self->entry->init(self, 0);
|
||||
data = self->data;
|
||||
|
||||
while ((opt = getopt(argc, argv, "dt:n:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "dt:n:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
data->flag_detached = 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-send-keys.c,v 1.13 2008-06-20 17:31:48 nicm Exp $ */
|
||||
/* $Id: cmd-send-keys.c,v 1.14 2008-09-25 23:28:12 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -67,7 +67,7 @@ cmd_send_keys_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
data->nkeys = 0;
|
||||
data->keys = NULL;
|
||||
|
||||
while ((opt = getopt(argc, argv, "t:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "t:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 't':
|
||||
if (data->target == NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-set-option.c,v 1.41 2008-09-10 18:59:29 nicm Exp $ */
|
||||
/* $Id: cmd-set-option.c,v 1.42 2008-09-25 23:28:12 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -104,7 +104,7 @@ cmd_set_option_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
data->option = NULL;
|
||||
data->value = NULL;
|
||||
|
||||
while ((opt = getopt(argc, argv, "t:s:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "t:s:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 't':
|
||||
if (data->target == NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-set-window-option.c,v 1.11 2008-06-29 07:04:30 nicm Exp $ */
|
||||
/* $Id: cmd-set-window-option.c,v 1.12 2008-09-25 23:28:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -66,7 +66,7 @@ cmd_set_window_option_parse(
|
||||
data->option = NULL;
|
||||
data->value = NULL;
|
||||
|
||||
while ((opt = getopt(argc, argv, "t:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "t:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 't':
|
||||
if (data->target == NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-show-options.c,v 1.6 2008-09-10 18:59:29 nicm Exp $ */
|
||||
/* $Id: cmd-show-options.c,v 1.7 2008-09-25 23:28:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -67,7 +67,7 @@ cmd_show_options_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
data->target = NULL;
|
||||
data->flag_global = 1;
|
||||
|
||||
while ((opt = getopt(argc, argv, "t:s:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "t:s:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 't':
|
||||
if (data->target == NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-switch-client.c,v 1.11 2008-06-23 22:26:52 nicm Exp $ */
|
||||
/* $Id: cmd-switch-client.c,v 1.12 2008-09-25 23:28:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -63,7 +63,7 @@ cmd_switch_client_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
data->name = NULL;
|
||||
data->target = NULL;
|
||||
|
||||
while ((opt = getopt(argc, argv, "c:t:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "c:t:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'c':
|
||||
data->name = xstrdup(optarg);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-unbind-key.c,v 1.13 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-unbind-key.c,v 1.14 2008-09-25 23:28:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -57,7 +57,7 @@ cmd_unbind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
|
||||
self->data = data = xmalloc(sizeof *data);
|
||||
|
||||
while ((opt = getopt(argc, argv, "")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "")) != EOF) {
|
||||
switch (opt) {
|
||||
default:
|
||||
goto usage;
|
||||
|
4
cmd.c
4
cmd.c
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd.c,v 1.63 2008-08-28 17:45:25 nicm Exp $ */
|
||||
/* $Id: cmd.c,v 1.64 2008-09-25 23:28:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -162,7 +162,7 @@ cmd_parse(int argc, char **argv, char **cause)
|
||||
|
||||
optind = 1;
|
||||
if (entry->parse == NULL) {
|
||||
while ((opt = getopt(argc, argv, "")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "")) != EOF) {
|
||||
switch (opt) {
|
||||
default:
|
||||
goto usage;
|
||||
|
4
tmux.c
4
tmux.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.c,v 1.76 2008-09-25 20:08:56 nicm Exp $ */
|
||||
/* $Id: tmux.c,v 1.77 2008-09-25 23:28:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -179,7 +179,7 @@ main(int argc, char **argv)
|
||||
|
||||
flags = 0;
|
||||
path = NULL;
|
||||
while ((opt = getopt(argc, argv, "2df:qS:uVv")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, GETOPT_PREFIX "2df:qS:uVv")) != EOF) {
|
||||
switch (opt) {
|
||||
case '2':
|
||||
flags |= IDENTIFY_256COLOURS;
|
||||
|
6
tmux.h
6
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.189 2008-09-25 20:08:56 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.190 2008-09-25 23:28:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -58,6 +58,10 @@
|
||||
|
||||
extern const char *__progname;
|
||||
|
||||
#ifndef GETOPT_PREFIX
|
||||
#define GETOPT_PREFIX ""
|
||||
#endif
|
||||
|
||||
#ifndef INFTIM
|
||||
#define INFTIM -1
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user