Changeset 8d9217d in mainline for uspace/app/pcapctl/main.c
- Timestamp:
- 2024-03-20T17:06:29Z (9 months ago)
- Children:
- 384f081
- Parents:
- 78edb5e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/pcapctl/main.c
r78edb5e r8d9217d 40 40 41 41 #define NAME "pcapctl" 42 #define DEFAULT_DEV_NUM 0 42 43 43 44 //pcapctl_sess_t* sess = NULL; … … 45 46 static errno_t start_dumping(const char *svc_name, const char *name) 46 47 { 47 pcapctl_sess_t *sess = NULL;48 pcapctl_sess_t *sess = NULL; 48 49 errno_t rc = pcapctl_dump_open(svc_name, &sess); 49 50 if (rc != EOK) { … … 59 60 static errno_t stop_dumping(const char *svc_name) 60 61 { 61 pcapctl_sess_t *sess = NULL;62 pcapctl_sess_t *sess = NULL; 62 63 errno_t rc = pcapctl_dump_open(svc_name, &sess); 63 64 if (rc != EOK) { … … 69 70 } 70 71 71 static void list_devs(void) { 72 static void list_devs(void) 73 { 72 74 pcapctl_list(); 73 75 } … … 76 78 { 77 79 printf("Usage:\n" 78 79 80 81 82 83 84 85 86 87 80 NAME " list \n" 81 "\tList of devices\n" 82 NAME " start --device= | -d <device number from list> <outfile>\n" 83 "\tPackets dumped from device will be written to <outfile>\n" 84 NAME " stop --device= | -d <device>\n" 85 "\tDumping from <device> stops\n" 86 NAME " start <outfile>\n" 87 "\tPackets dumped from the 1st device from the list will be written to <outfile>\n" 88 NAME " --help | -h\n" 89 "\tShow this application help.\n"); 88 90 } 89 91 … … 94 96 return 1; 95 97 } else { 96 /** help */98 /** help */ 97 99 if (str_cmp(argv[1], "--help") == 0 || str_cmp(argv[1], "-h") == 0) { 98 100 usage(); 99 101 return 0; 100 /** list*/102 /** list */ 101 103 } else if (str_cmp(argv[1], "list") == 0) { 102 104 list_devs(); 103 105 return 0; 104 /** start with/out devnum */106 /** start with/out devnum */ 105 107 } else if (str_cmp(argv[1], "start") == 0) { 106 108 if (argc == 3) { 107 109 start_dumping((char *)"0", argv[2]); 108 110 return 0; 109 } 110 else if (argc == 4) { 111 } else if (argc == 4) { 111 112 start_dumping(argv[2], argv[3]); 112 113 return 0; … … 115 116 return 1; 116 117 } 117 /** Stop with/out devnum */118 /** Stop with/out devnum */ 118 119 } else if (str_cmp(argv[1], "stop") == 0) { 119 120 if (argc == 2) { … … 121 122 fprintf(stdout, "Dumping was stopped\n"); 122 123 return 0; 123 } 124 else if (argc == 3) { 124 } else if (argc == 3) { 125 125 126 126 stop_dumping(argv[2]);
Note:
See TracChangeset
for help on using the changeset viewer.