5 * The contents of this file are subject to the terms of the
6 * Common Development and Distribution License, Version 1.0 only
7 * (the "License"). You may not use this file except in compliance
10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 * or http://www.opensolaris.org/os/licensing.
12 * See the License for the specific language governing permissions
13 * and limitations under the License.
15 * When distributing Covered Code, include this CDDL HEADER in each
16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 * If applicable, add the following below this CDDL HEADER, with the
18 * fields enclosed by brackets "[]" replaced with your own identifying
19 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1994, by Sun Microsytems, Inc.
26 #pragma ident "%Z%%M% %I% %E% SMI"
39 char * qtstr (char * instr);
40 char * rgstr (char * instr);
43 ** we substitute i/o routines defined in main.c for the
44 ** standard fare. This allows us to support the "source"
45 ** function by redirecting the input stream from different
52 #define input() source_input()
53 #define unput(c) source_unput(c)
54 #define output(c) source_output(c)
58 IDCHAR ({IDFIRST}|[0-9])
63 #.* ; /* eat comments */
64 [ \t]+ ; /* eats whitespace */
66 \n { source_nl(); return NL; }
67 \\\n { source_nl(); } /* escaped newline */
71 add { yylval.intval = ADD; return (ADD); }
72 alloc { yylval.intval = ALLOC; return (ALLOC); }
73 buffer { yylval.intval = BUFFER; return (BUFFER); }
74 clear { yylval.intval = CLEAR; return (CLEAR); }
75 connect { yylval.intval = CONNECT; return (CONNECT); }
76 continue { yylval.intval = CONTINUE; return (CONTINUE); }
77 create { yylval.intval = CREATE; return (CREATE); }
78 dealloc { yylval.intval = DEALLOC; return (DEALLOC); }
79 delete { yylval.intval = DELETE; return (DELETE); }
80 disable { yylval.intval = DISABLE; return (DISABLE); }
81 enable { yylval.intval = ENABLE; return (ENABLE); }
82 fcns { yylval.intval = FCNS; return (FCNS); }
83 filter { yylval.intval = FILTER; return (FILTER); }
84 help { yylval.intval = HELP; return (HELP); }
85 history { yylval.intval = HISTORY; return (HISTORY); }
86 tracefile { yylval.intval = TRACEFILE; return (TRACEFILE); }
87 kill { yylval.intval = KILL; return (KILL); }
88 ktrace { yylval.intval = KTRACE; return (KTRACE); }
89 list { yylval.intval = LIST; return (LIST); }
90 off { yylval.intval = OFF; return (OFF); }
91 on { yylval.intval = ON; return (ON); }
92 pfilter { yylval.intval = PFILTER; return (PFILTER); }
93 probes { yylval.intval = PROBES; return (PROBES); }
94 quit { yylval.intval = QUIT; return (QUIT); }
95 resume { yylval.intval = RESUME; return (RESUME); }
96 sets { yylval.intval = SETS; return (SETS); }
97 source { yylval.intval = SOURCE; return (SOURCE); }
98 suspend { yylval.intval = SUSPEND; return (SUSPEND); }
99 trace { yylval.intval = TRACE; return (TRACE); }
100 untrace { yylval.intval = UNTRACE; return (UNTRACE); }
101 values { yylval.intval = VALUES; return (VALUES); }
103 ${ID} { yylval.strval = strdup(&yytext[1]); return SETNAME; }
104 &{ID} { yylval.strval = strdup(&yytext[1]); return FCNNAME; }
105 {ID} { yylval.strval = strdup(yytext); return IDENT; }
106 \'[^'\n]*\' { yylval.strval = qtstr(yytext); return VALSTR; }
108 \/([^/\\\n]|\\.)*\/ { yylval.strval = rgstr(yytext); return REGEXP; }
111 char scale = yytext[yyleng - 1];
112 yylval.intval = atoi(yytext);
113 if (scale == 'k' || scale == 'K')
114 yylval.intval *= 1024;
115 else if (scale == 'm' || scale == 'M')
116 yylval.intval *= 1024 * 1024;
120 . return (INVAL); /* barf on anything else */
124 /****************************************************************
125 qtstr() - shucks a quoted str, and copies it into new memory
126 ****************************************************************/
134 /* skip the leading quote in the copy */
135 ptr = strdup(&instr[1]);
137 /* null out the trailing quote */
138 indx = strlen(ptr) - 1;
139 indx = (indx < 0) ? 0 : indx;
146 /****************************************************************
147 rgstr() - shucks a decorated regular expression, and copies it
149 ****************************************************************/
157 /* skip the leading slash in the copy */
158 ptr = strdup(&instr[1]);
160 /* null out the trailing slash */
161 indx = strlen(ptr) - 1;
162 indx = (indx < 0) ? 0 : indx;