5 "@(#)getargs.c 2.71 17/07/16 Copyright 1985, 1988, 1994-2017 J. Schilling";
88#define RNAME(a) (retnames[(a)-RETMIN])
106 int *,
char *
const **,
115#define isfmtspec(c) (strchr(fmtspecs, c) != NULL)
137 props->ga_oflags = 0;
150 props->ga_oflags = 0;
167getargs(
int *pac,
char *
const **pav,
const char *
fmt, ...)
260 for (; ; (*pac)--, (*pav)++) {
295 for (; ; (*pac)--, (*pav)++) {
323 for (; ; (*pac)--, (*pav)++) {
397 register char *
const **pav;
412 for (; *pac > 0; (*pac)--, (*pav)++) {
435 register char *
const **pav;
439 register const char *argp = *pargp;
442 if (argp[0] ==
'-') {
457 if (argp[1] ==
'-' && argp[2] ==
'\0') {
474 if (argp[0] !=
'-') {
505 register const char *argp;
510 register const char *
fmt = (
const char *)vfmt;
515 int singlecharflag = 0;
523 char *
const *spav = *pav;
525 void *curarg = (
void *)0;
533 if (argp[0] ==
'-') {
541 if (argp[0] ==
'-') {
547 if (argp[1] ==
'\0') {
583 if (
fmt[0] !=
'\0' &&
584 (
fmt[1] ==
',' ||
fmt[1] ==
'+' ||
585 fmt[1] ==
'~' ||
fmt[1] ==
'%' ||
fmt[1] ==
'\0'))
591 for (; *
fmt;
fmt++, argp++) {
613 if (*argp ==
'+' && argp == sargp)
622 }
else if (*argp !=
'\0' && haseql) {
650 if ((!hasdash && argp != sargp) || *
fmt !=
'&')
661 if (!haseql && *argp !=
'\0' &&
662 (
fmt[0] ==
'*' ||
fmt[0] ==
'#' ||
663 fmt[0] ==
'?' ||
fmt[0] ==
'&') &&
684 }
else if (*
fmt == *argp) {
685 if (argp[1] ==
'\0' &&
686 (
fmt[1] ==
'\0' ||
fmt[1] ==
',')) {
689 *((
int *)curarg) =
TRUE;
700 while (*
fmt !=
',' && *
fmt !=
'\0') {
702 if ((*
fmt ==
'&' || *
fmt ==
'~') &&
728 if (singlecharflag && !doubledash &&
734 if (singlecharflag && !doubledash &&
746 if (
fmt[1] ==
',' ||
fmt[1] ==
'+' ||
fmt[1] ==
'\0')
753 if (*argp ==
'\0' &&
fmt[1] !=
'_') {
764 else if (
fmt[1] ==
' ')
768 *((
const char **)curarg) = argp;
774 if (*argp ==
'\0' &&
fmt[1] !=
'_') {
785 else if (
fmt[1] ==
' ')
793 if (argp[0] !=
'\0' && argp[1] !=
'\0')
797 *((
char *)curarg) = *argp;
818 if (
fmt[1] ==
'l' ||
fmt[1] ==
'L') {
819 if (
fmt[2] ==
'l' ||
fmt[2] ==
'L') {
821 *((
Llong *)curarg) += 1;
825 *((
long *)curarg) += 1;
828 }
else if (
fmt[1] ==
's' ||
fmt[1] ==
'S') {
830 *((
short *)curarg) += 1;
832 }
else if (
fmt[1] ==
'c' ||
fmt[1] ==
'C') {
834 *((
char *)curarg) += 1;
837 if (
fmt[1] ==
'i' ||
fmt[1] ==
'I')
840 *((
int *)curarg) += 1;
857 else if (*
fmt ==
'0')
864 if (
fmt[1] ==
'l' ||
fmt[1] ==
'L') {
865 if (
fmt[2] ==
'l' ||
fmt[2] ==
'L') {
871 *((
long *)curarg) =
val;
874 }
else if (
fmt[1] ==
's' ||
fmt[1] ==
'S') {
876 *((
short *)curarg) =
val;
878 }
else if (
fmt[1] ==
'c' ||
fmt[1] ==
'C') {
880 *((
char *)curarg) =
val;
883 if (
fmt[1] ==
'i' ||
fmt[1] ==
'I')
886 *((
int *)curarg) =
val;
893 if (*argp ==
'\0' &&
fmt[1] !=
'_') {
904 else if (
fmt[1] ==
' ')
915 while (*
fmt !=
',' && *
fmt !=
'\0') {
916 if ((*
fmt ==
'&' || *
fmt ==
'~') &&
929 if (
fmt[1] ==
'l' ||
fmt[1] ==
'L') {
930 if (
fmt[2] ==
'l' ||
fmt[2] ==
'L') {
936 *((
long *)curarg) =
val;
939 }
else if (
fmt[1] ==
's' ||
fmt[1] ==
'S') {
943 }
else if (
fmt[1] ==
'c' ||
fmt[1] ==
'C') {
948 if (
fmt[1] ==
'i' ||
fmt[1] ==
'I')
951 *((
int *)curarg) = (
int)
val;
965 if (*argp ==
'\0' &&
fmt[1] !=
'_') {
976 if (*
fmt ==
'&' &&
fmt[1] ==
'_')
978 else if (
fmt[1] ==
' ')
1006 ret = ((*(getpargfun)curarg) (argp, funarg,
1036 register const char *argp;
1043 register const char *
fmt = (
const char *)vfmt;
1049 register sflags *rsf = sf;
1050 register int nsf = 0;
1051 register const char *
p = argp;
1053 register void *curarg = (
void *)0;
1054 getpargfun curfun = 0;
1088 curfun = (getpargfun)curarg;
1091 for (
i = 0;
i <
sizeof (
fl);
i++) {
1095 for (
i = 0;
i < nsf;
i++) {
1119 (
fmt[1] ==
',' ||
fmt[1] ==
'+' ||
1120 fmt[1] ==
'~' ||
fmt[1] ==
'%' ||
fmt[1] ==
'\0') &&
1122 for (
i = 0;
i < nsf;
i++) {
1123 if (rsf[
i].
c == *
fmt) {
1124 if (
fmt[1] ==
'+') {
1127 if (
fmt[1] ==
',' ||
1130 }
else if ((
fmt[1] ==
'l' ||
1145 }
else if (
fmt[1] ==
'%') {
1150 else if (
fmt[1] ==
'1')
1153 if (
fmt[1] ==
',' ||
1156 }
else if ((
fmt[1] ==
'l' ||
1171 }
else if (
fmt[1] ==
'~') {
1180 rsf[
i].
curfun = (
void *)curfun;
1194 while (*
fmt !=
',' && *
fmt !=
'\0') {
1199 if ((*
fmt ==
'&' || *
fmt ==
'~') &&
1217 curfun = (getpargfun)curarg;
1230 for (
p = argp; *
p;
p++) {
1236 if (
type == (
char)-1) {
1243 *((
int *)rsf[
i].curarg) =
TRUE;
1244 }
else if (
type ==
'i' ||
type ==
'I') {
1246 *((
int *)rsf[
i].curarg) += 1;
1248 *((
int *)rsf[
i].curarg) = rsf[
i].
val;
1249 }
else if (
type ==
'l' ||
type ==
'L') {
1251 *((
long *)rsf[
i].curarg) += 1;
1253 *((
long *)rsf[
i].curarg) = rsf[
i].
val;
1254 }
else if (
type ==
'Q') {
1256 *((
Llong *)rsf[
i].curarg) += 1;
1259 }
else if (
type ==
's' ||
type ==
'S') {
1261 *((
short *)rsf[
i].curarg) += 1;
1263 *((
short *)rsf[
i].curarg) = rsf[
i].
val;
1264 }
else if (
type ==
'c' ||
type ==
'C') {
1266 *((
char *)rsf[
i].curarg) += 1;
1268 *((
char *)rsf[
i].curarg) = rsf[
i].
val;
1269 }
else if (
type ==
'~') {
1277 if (rsf[
i].curfun ==
NULL)
1279 ret = ((*(getpargfun)rsf[
i].curfun) (
"",
1305 if (
c ==
',' ||
c ==
'\0') {
1322 register const char *
str;
1324 register unsigned char c;
1326 for (
c = (
unsigned char)*
str;
1338 if (err < RETMIN || err >
RETMAX)
1339 return (
"Illegal arg error");
char * strchr(const char *String, int ch)
char * astoll(const char *s, Llong *l)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
#define GAF_DELIM_DASHDASH
#define GAF_POSIX_DEFAULT
GLuint GLuint GLsizei GLenum type
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
EXPORT void raisecond(char *signame, long arg2) const
static const WCHAR props[]