mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
This commit makes various different improvements to the documentation:
- sh.1: Backported (with changes) mandoc warning fixes from ksh2020
for the ksh93(1) man page: <https://github.com/att/ast/pull/1406>
- Removed unnecessary spaces at the end of lines to fix a few other
mandoc warnings.
- Fixed various typos and capitalization errors in the documentation.
- ANNOUNCE: Document the addition of the ${.sh.pid} variable
(re: 9de65210
).
- libast/man/str*: Update the man pages for the libast str* functions
to improve how accurately each function is described.
- ksh93/README: Update regression test/compatibility notes to include
OpenBSD 7.0, FreeBSD 13.0 and WSL running Ubuntu 20.04.
- Change a few places to store the return value from strlen in a
size_t variable rather than signed int.
- comp/setlocale.c: To avoid confusion of two separate variables named
lang, the function local variable has been renamed to langidx.
106 lines
3.6 KiB
C
106 lines
3.6 KiB
C
/***********************************************************************
|
|
* *
|
|
* This software is part of the ast package *
|
|
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
|
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
|
* and is licensed under the *
|
|
* Eclipse Public License, Version 1.0 *
|
|
* by AT&T Intellectual Property *
|
|
* *
|
|
* A copy of the License is available at *
|
|
* http://www.eclipse.org/org/documents/epl-v10.html *
|
|
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
|
|
* *
|
|
* Information and Software Systems Research *
|
|
* AT&T Research *
|
|
* Florham Park NJ *
|
|
* *
|
|
* Glenn Fowler <gsf@research.att.com> *
|
|
* David Korn <dgk@research.att.com> *
|
|
* Phong Vo <kpv@research.att.com> *
|
|
* *
|
|
***********************************************************************/
|
|
/*
|
|
* Glenn Fowler
|
|
* AT&T Research
|
|
*
|
|
* command line option parse interface
|
|
*/
|
|
|
|
#ifndef _OPTION_H
|
|
#define _OPTION_H
|
|
|
|
#include <ast.h>
|
|
|
|
#define OPT_VERSION 20070319L
|
|
|
|
#define OPT_USER (1L<<16) /* first user flag bit */
|
|
|
|
struct Opt_s;
|
|
struct Optdisc_s;
|
|
|
|
typedef int (*Optinfo_f)(struct Opt_s*, Sfio_t*, const char*, struct Optdisc_s*);
|
|
|
|
typedef struct Optdisc_s
|
|
{
|
|
unsigned long version; /* OPT_VERSION */
|
|
unsigned long flags; /* OPT_* flags */
|
|
char* catalog; /* error catalog ID */
|
|
Optinfo_f infof; /* runtime info function */
|
|
} Optdisc_t;
|
|
|
|
/* NOTE: Opt_t member order fixed by a previous binary release */
|
|
|
|
#ifndef _OPT_PRIVATE_
|
|
#define _OPT_PRIVATE_ \
|
|
char pad[3*sizeof(void*)];
|
|
#endif
|
|
|
|
typedef struct Opt_s
|
|
{
|
|
int again; /* see optjoin() */
|
|
char* arg; /* {:,#} string argument */
|
|
char** argv; /* most recent argv */
|
|
int index; /* argv index */
|
|
char* msg; /* error/usage message buffer */
|
|
long num; /* OBSOLETE -- use number */
|
|
int offset; /* char offset in argv[index] */
|
|
char option[8]; /* current flag {-,+} + option */
|
|
char name[64]; /* current long name or flag */
|
|
Optdisc_t* disc; /* user discipline */
|
|
intmax_t number; /* # numeric argument */
|
|
unsigned char assignment; /* option arg assignment op */
|
|
unsigned char pads[sizeof(void*)-1];
|
|
_OPT_PRIVATE_
|
|
} Opt_t;
|
|
|
|
#if _BLD_ast && defined(__EXPORT__)
|
|
#define extern extern __EXPORT__
|
|
#endif
|
|
#if !_BLD_ast && defined(__IMPORT__)
|
|
#define extern extern __IMPORT__
|
|
#endif
|
|
|
|
extern Opt_t* _opt_infop_;
|
|
|
|
#define opt_info (*_opt_infop_)
|
|
|
|
#undef extern
|
|
|
|
#define optinit(d,f) (memset(d,0,sizeof(*(d))),(d)->version=OPT_VERSION,(d)->infof=(f),opt_info.disc=(d))
|
|
|
|
#if _BLD_ast && defined(__EXPORT__)
|
|
#define extern __EXPORT__
|
|
#endif
|
|
|
|
extern int optget(char**, const char*);
|
|
extern int optjoin(char**, ...);
|
|
extern char* opthelp(const char*, const char*);
|
|
extern char* optusage(const char*);
|
|
extern int optstr(const char*, const char*);
|
|
extern int optesc(Sfio_t*, const char*, int);
|
|
extern Opt_t* optctx(Opt_t*, Opt_t*);
|
|
|
|
#undef extern
|
|
|
|
#endif
|