MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl/samples/vstream/main.cpp:148–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146#endif
147
148int main(int argc acl_unused, char *argv[] acl_unused)
149{
150 char buf[256];
151 int i, c;
152 ACL_VSTRING *sbuf;
153 int flag = 0;
154
155 acl_lib_init();
156
157#if 0
158 return (vstream_server());
159#endif
160
161 for (i = 1; i < argc; i++) {
162 if (argv[i][0] != '-')
163 continue;
164 switch (argv[i][1]) {
165 case 's':
166 flag = 1;
167 break;
168 case 'c':
169 flag = 2;
170 break;
171 case 'a':
172 snprintf(addr, sizeof(addr), "%s", argv[i + 1]);
173 break;
174 case 't':
175 timeout = atoi(argv[i + 1]);
176 break;
177 case 'h':
178 usage(argv[0]);
179 exit (0);
180 default:
181 break;
182 }
183 }
184
185 if (flag == 1)
186 return (vstream_server());
187 if (flag == 2)
188 return (vstream_client());
189
190 sbuf = acl_vstring_alloc(256);
191 while (1) {
192 acl_vstream_fprintf(ACL_VSTREAM_OUT, "please input(quit on exit): ");
193 acl_vstream_gets_nonl(ACL_VSTREAM_IN, buf, sizeof(buf));
194 acl_vstream_fprintf(ACL_VSTREAM_ERR, "your input: %s\r\n", buf);
195 if (strcasecmp(buf, "quit") == 0 || strcasecmp(buf, "exit") == 0)
196 break;
197
198 acl_vstream_printf("please input: ");
199 c = acl_vstring_gets_nonl_bound(sbuf, ACL_VSTREAM_IN, 10);
200 if (c == ACL_VSTREAM_EOF)
201 break;
202 acl_vstream_printf("your input(len=%d): %s\r\n",
203 ACL_VSTRING_LEN(sbuf), acl_vstring_str(sbuf));
204 if (c == '\n')
205 continue;

Callers

nothing calls this directly

Calls 12

acl_lib_initFunction · 0.85
acl_vstring_allocFunction · 0.85
acl_vstream_fprintfFunction · 0.85
acl_vstream_gets_nonlFunction · 0.85
acl_vstream_printfFunction · 0.85
acl_vstring_gets_nonlFunction · 0.85
acl_vstring_freeFunction · 0.85
vstream_serverFunction · 0.70
usageFunction · 0.70
vstream_clientFunction · 0.70
endFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…