options.c (182300) | options.c (200956) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/bin/sh/options.c 182300 2008-08-27 20:16:06Z stefanf $"); | 39__FBSDID("$FreeBSD: head/bin/sh/options.c 200956 2009-12-24 18:41:14Z jilles $"); |
40 41#include <signal.h> 42#include <unistd.h> 43#include <stdlib.h> 44 45#include "shell.h" 46#define DEFINE_OPTIONS 47#include "options.h" --- 501 unchanged lines hidden (view full) --- 549 * 550 * Standard option processing (a la getopt) for builtin routines. The 551 * only argument that is passed to nextopt is the option string; the 552 * other arguments are unnecessary. It return the character, or '\0' on 553 * end of input. 554 */ 555 556int | 40 41#include <signal.h> 42#include <unistd.h> 43#include <stdlib.h> 44 45#include "shell.h" 46#define DEFINE_OPTIONS 47#include "options.h" --- 501 unchanged lines hidden (view full) --- 549 * 550 * Standard option processing (a la getopt) for builtin routines. The 551 * only argument that is passed to nextopt is the option string; the 552 * other arguments are unnecessary. It return the character, or '\0' on 553 * end of input. 554 */ 555 556int |
557nextopt(char *optstring) | 557nextopt(const char *optstring) |
558{ | 558{ |
559 char *p, *q; | 559 char *p; 560 const char *q; |
560 char c; 561 562 if ((p = optptr) == NULL || *p == '\0') { 563 p = *argptr; 564 if (p == NULL || *p != '-' || *++p == '\0') 565 return '\0'; 566 argptr++; 567 if (p[0] == '-' && p[1] == '\0') /* check for "--" */ --- 18 unchanged lines hidden --- | 561 char c; 562 563 if ((p = optptr) == NULL || *p == '\0') { 564 p = *argptr; 565 if (p == NULL || *p != '-' || *++p == '\0') 566 return '\0'; 567 argptr++; 568 if (p[0] == '-' && p[1] == '\0') /* check for "--" */ --- 18 unchanged lines hidden --- |