getopt.c (165906) | getopt.c (221358) |
---|---|
1/* 2 * Copyright (c) 1987, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1987, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/lib/libstand/getopt.c 165906 2007-01-09 01:02:06Z imp $"); | 31__FBSDID("$FreeBSD: head/lib/libstand/getopt.c 221358 2011-05-03 04:44:50Z rodrigc $"); |
32 33#if defined(LIBC_SCCS) && !defined(lint) 34static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; 35#endif /* LIBC_SCCS and not lint */ 36 37#include "stand.h" 38#include <string.h> 39 --- 7 unchanged lines hidden (view full) --- 47#define BADARG (int)':' 48#define EMSG "" 49 50/* 51 * getopt -- 52 * Parse argc/argv argument vector. 53 */ 54int | 32 33#if defined(LIBC_SCCS) && !defined(lint) 34static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; 35#endif /* LIBC_SCCS and not lint */ 36 37#include "stand.h" 38#include <string.h> 39 --- 7 unchanged lines hidden (view full) --- 47#define BADARG (int)':' 48#define EMSG "" 49 50/* 51 * getopt -- 52 * Parse argc/argv argument vector. 53 */ 54int |
55getopt(nargc, nargv, ostr) 56 int nargc; 57 char * const *nargv; 58 const char *ostr; | 55getopt(int nargc, char * const *nargv, const char *ostr) |
59{ 60 static char *place = EMSG; /* option letter processing */ 61 char *oli; /* option letter list index */ 62 63 if (optreset || !*place) { /* update scanning pointer */ 64 optreset = 0; 65 if (optind >= nargc || *(place = nargv[optind]) != '-') { 66 place = EMSG; --- 45 unchanged lines hidden --- | 56{ 57 static char *place = EMSG; /* option letter processing */ 58 char *oli; /* option letter list index */ 59 60 if (optreset || !*place) { /* update scanning pointer */ 61 optreset = 0; 62 if (optind >= nargc || *(place = nargv[optind]) != '-') { 63 place = EMSG; --- 45 unchanged lines hidden --- |