Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/lib/libdss/dss-null.h
1808 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 2002-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* *
19
***********************************************************************/
20
#pragma prototyped
21
22
/*
23
* null query
24
*/
25
26
static const char null_usage[] =
27
"[-1ls5P?\n@(#)$Id: dss null query (AT&T Research) 2002-12-10 $\n]"
28
USAGE_LICENSE
29
"[+PLUGIN?\findex\f]"
30
"[+DESCRIPTION?The \bdss\b \bnull\b query selects all records"
31
" but otherwise generates no output.]"
32
;
33
34
static int
35
null_beg(Cx_t* cx, Cxexpr_t* expr, void* data, Cxdisc_t* disc)
36
{
37
char** argv = (char**)data;
38
int errors = error_info.errors;
39
40
for (;;)
41
{
42
switch (optget(argv, null_usage))
43
{
44
case '?':
45
if (disc->errorf)
46
(*disc->errorf)(NiL, disc, ERROR_USAGE|4, "%s", opt_info.arg);
47
continue;
48
case ':':
49
if (disc->errorf)
50
(*disc->errorf)(NiL, disc, 2, "%s", opt_info.arg);
51
continue;
52
}
53
break;
54
}
55
if (error_info.errors > errors)
56
return -1;
57
argv += opt_info.index;
58
if (*argv)
59
{
60
if (disc->errorf)
61
(*disc->errorf)(NiL, disc, ERROR_USAGE|4, "%s", optusage(NiL));
62
return -1;
63
}
64
return 0;
65
}
66
67
#define QUERY_null \
68
{ \
69
"null", \
70
"select all records; generate no output", \
71
CXH, \
72
null_beg, \
73
0, \
74
0, \
75
0 \
76
}
77
78