MCPcopy Create free account
hub / github.com/F-Stack/f-stack / debugnet_parse_ddb_cmd

Function debugnet_parse_ddb_cmd

freebsd/net/debugnet.c:926–1071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

924}
925
926int
927debugnet_parse_ddb_cmd(const char *cmd, struct debugnet_ddb_config *result)
928{
929 struct ifnet *ifp;
930 int t, error;
931 bool want_ifp;
932 char ch;
933
934 struct my_inet_opt opt_client = {
935 .printname = "client",
936 .result = &result->dd_client,
937 },
938 opt_server = {
939 .printname = "server",
940 .result = &result->dd_server,
941 },
942 opt_gateway = {
943 .printname = "gateway",
944 .result = &result->dd_gateway,
945 },
946 *cur_inet_opt;
947
948 ifp = NULL;
949 memset(result, 0, sizeof(*result));
950
951 /*
952 * command [space] [-] [opt] [[space] [optarg]] ...
953 *
954 * db_command has already lexed 'command' for us.
955 */
956 t = db_read_token_flags(DRT_WSPACE);
957 if (t == tWSPACE)
958 t = db_read_token_flags(DRT_WSPACE);
959
960 while (t != tEOL) {
961 if (t != tMINUS) {
962 db_printf("%s: Bad syntax; expected '-', got %d\n",
963 cmd, t);
964 goto usage;
965 }
966
967 t = db_read_token_flags(DRT_WSPACE);
968 if (t != tIDENT) {
969 db_printf("%s: Bad syntax; expected tIDENT, got %d\n",
970 cmd, t);
971 goto usage;
972 }
973
974 if (strlen(db_tok_string) > 1) {
975 db_printf("%s: Bad syntax; expected single option "
976 "flag, got '%s'\n", cmd, db_tok_string);
977 goto usage;
978 }
979
980 want_ifp = false;
981 cur_inet_opt = NULL;
982 switch ((ch = db_tok_string[0])) {
983 default:

Callers 1

netdump_client.cFile · 0.85

Calls 6

memsetFunction · 0.85
db_read_token_flagsFunction · 0.85
db_printfFunction · 0.85
ifunitFunction · 0.85
dn_parse_optarg_ipv4Function · 0.85
db_skip_to_eolFunction · 0.85

Tested by

no test coverage detected