=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** src/usr.bin/tmux/cmd.c 2009/06/04 23:34:32 1.2 --- src/usr.bin/tmux/cmd.c 2009/07/07 21:23:22 1.3 *************** *** 1,4 **** ! /* $OpenBSD: cmd.c,v 1.2 2009/06/04 23:34:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd.c,v 1.3 2009/07/07 21:23:22 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 105,111 **** const struct cmd_entry **entryp, *entry; struct cmd *cmd; char s[BUFSIZ]; ! int opt; *cause = NULL; if (argc == 0) { --- 105,111 ---- const struct cmd_entry **entryp, *entry; struct cmd *cmd; char s[BUFSIZ]; ! int opt, ambiguous = 0; *cause = NULL; if (argc == 0) { *************** *** 117,122 **** --- 117,123 ---- for (entryp = cmd_table; *entryp != NULL; entryp++) { if ((*entryp)->alias != NULL && strcmp((*entryp)->alias, argv[0]) == 0) { + ambiguous = 0; entry = *entryp; break; } *************** *** 124,136 **** if (strncmp((*entryp)->name, argv[0], strlen(argv[0])) != 0) continue; if (entry != NULL) ! goto ambiguous; entry = *entryp; /* Bail now if an exact match. */ if (strcmp(entry->name, argv[0]) == 0) break; } if (entry == NULL) { xasprintf(cause, "unknown command: %s", argv[0]); return (NULL); --- 125,139 ---- if (strncmp((*entryp)->name, argv[0], strlen(argv[0])) != 0) continue; if (entry != NULL) ! ambiguous = 1; entry = *entryp; /* Bail now if an exact match. */ if (strcmp(entry->name, argv[0]) == 0) break; } + if (ambiguous) + goto ambiguous; if (entry == NULL) { xasprintf(cause, "unknown command: %s", argv[0]); return (NULL);