getopt_long.c (127734) | getopt_long.c (131710) |
---|---|
1/* $OpenBSD: getopt_long.c,v 1.16 2004/02/04 18:17:25 millert Exp $ */ | 1/* $OpenBSD: getopt_long.c,v 1.17 2004/06/03 18:46:52 millert Exp $ */ |
2/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ 3 4/* 5 * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. --- 47 unchanged lines hidden (view full) --- 57 */ 58 59#if 0 60#if defined(LIBC_SCCS) && !defined(lint) 61static char *rcsid = "$OpenBSD: getopt_long.c,v 1.16 2004/02/04 18:17:25 millert Exp $"; 62#endif /* LIBC_SCCS and not lint */ 63#endif 64#include <sys/cdefs.h> | 2/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ 3 4/* 5 * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. --- 47 unchanged lines hidden (view full) --- 57 */ 58 59#if 0 60#if defined(LIBC_SCCS) && !defined(lint) 61static char *rcsid = "$OpenBSD: getopt_long.c,v 1.16 2004/02/04 18:17:25 millert Exp $"; 62#endif /* LIBC_SCCS and not lint */ 63#endif 64#include <sys/cdefs.h> |
65__FBSDID("$FreeBSD: head/lib/libc/stdlib/getopt_long.c 127734 2004-04-01 22:32:28Z ache $"); | 65__FBSDID("$FreeBSD: head/lib/libc/stdlib/getopt_long.c 131710 2004-07-06 13:58:45Z ache $"); |
66 67#include <err.h> 68#include <errno.h> 69#include <getopt.h> 70#include <stdlib.h> 71#include <string.h> 72 73#define GNU_COMPATIBLE /* Be more compatible, configure's use us! */ --- 492 unchanged lines hidden (view full) --- 566 warnx(recargchar, optchar); 567 optopt = optchar; 568 return (BADARG); 569 } else 570 optarg = nargv[optind]; 571 } else if (!(flags & FLAG_PERMUTE)) { 572 /* 573 * If permutation is disabled, we can accept an | 66 67#include <err.h> 68#include <errno.h> 69#include <getopt.h> 70#include <stdlib.h> 71#include <string.h> 72 73#define GNU_COMPATIBLE /* Be more compatible, configure's use us! */ --- 492 unchanged lines hidden (view full) --- 566 warnx(recargchar, optchar); 567 optopt = optchar; 568 return (BADARG); 569 } else 570 optarg = nargv[optind]; 571 } else if (!(flags & FLAG_PERMUTE)) { 572 /* 573 * If permutation is disabled, we can accept an |
574 * optional arg separated by whitespace. | 574 * optional arg separated by whitespace so long 575 * as it does not start with a dash (-). |
575 */ | 576 */ |
576 if (optind + 1 < nargc) | 577 if (optind + 1 < nargc && *nargv[optind + 1] != '-') |
577 optarg = nargv[++optind]; 578 } 579 place = EMSG; 580 ++optind; 581 } 582 /* dump back option letter */ 583 return (optchar); 584} --- 57 unchanged lines hidden --- | 578 optarg = nargv[++optind]; 579 } 580 place = EMSG; 581 ++optind; 582 } 583 /* dump back option letter */ 584 return (optchar); 585} --- 57 unchanged lines hidden --- |