core: do parsing in the main, put all in struct general fix: code support port > 1024
32 lines
592 B
C
32 lines
592 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include "scan.h"
|
|
|
|
typedef enum {
|
|
// long options
|
|
FL_HELP,
|
|
FL_PORTS,
|
|
FL_IP,
|
|
FL_FILE,
|
|
FL_SPEEDUP,
|
|
FL_TYPE,
|
|
FL_MAXRETRIES,
|
|
FL_TTL,
|
|
// short options
|
|
FL_FAST,
|
|
} e_flag;
|
|
|
|
struct option_lst {
|
|
e_flag flag;
|
|
char *arg;
|
|
struct option_lst *next;
|
|
};
|
|
|
|
struct option_lst *parse_options(int ac, char *const *av);
|
|
char *get_option_arg(const struct option_lst *options, e_flag flag);
|
|
e_scantype parse_type(const char *arg);
|
|
void free_options(struct option_lst *options);
|
|
int parsing(struct scan *general, const struct option_lst *options); |