mirror of
https://github.com/nmap/nmap.git
synced 2026-10-14 22:37:30 +00:00
patch by Kris Katterjohn to Amiga system to use atexit rather than some macro hack
This commit is contained in:
parent
705123dd29
commit
7224f4a52d
6 changed files with 10 additions and 31 deletions
22
main.cc
22
main.cc
|
|
@ -117,20 +117,21 @@
|
|||
struct Library *SocketBase = NULL, *MiamiBase = NULL, *MiamiBPFBase = NULL, *MiamiPCapBase = NULL;
|
||||
static const char ver[] = "$VER:" NMAP_NAME " v"NMAP_VERSION " [Amiga.sf]";
|
||||
|
||||
BOOL OpenLibs(void) {
|
||||
if(!( MiamiBase = OpenLibrary(MIAMINAME,21))) return FALSE;
|
||||
if(!( SocketBase = OpenLibrary("bsdsocket.library", 4))) return FALSE;
|
||||
if(!( MiamiBPFBase = OpenLibrary(MIAMIBPFNAME,3))) return FALSE;
|
||||
if(!(MiamiPCapBase = OpenLibrary(MIAMIPCAPNAME,5))) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CloseLibs(void) {
|
||||
static void CloseLibs(void) {
|
||||
if ( MiamiPCapBase ) CloseLibrary( MiamiPCapBase );
|
||||
if ( MiamiBPFBase ) CloseLibrary( MiamiBPFBase );
|
||||
if ( SocketBase ) CloseLibrary( SocketBase );
|
||||
if ( MiamiBase ) CloseLibrary( MiamiBase );
|
||||
}
|
||||
|
||||
static BOOL OpenLibs(void) {
|
||||
if(!( MiamiBase = OpenLibrary(MIAMINAME,21))) return FALSE;
|
||||
if(!( SocketBase = OpenLibrary("bsdsocket.library", 4))) return FALSE;
|
||||
if(!( MiamiBPFBase = OpenLibrary(MIAMIBPFNAME,3))) return FALSE;
|
||||
if(!(MiamiPCapBase = OpenLibrary(MIAMIPCAPNAME,5))) return FALSE;
|
||||
atexit(CloseLibs);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* global options */
|
||||
|
|
@ -401,9 +402,6 @@ int main(int argc, char *argv[], char *envp[]) {
|
|||
}
|
||||
arg_parse_free(myargv);
|
||||
}
|
||||
#ifdef __amigaos__
|
||||
CloseLibs();
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
|
|||
4
nmap.cc
4
nmap.cc
|
|
@ -119,10 +119,6 @@ extern char *optarg;
|
|||
extern int optind;
|
||||
extern NmapOps o; /* option structure */
|
||||
|
||||
#ifdef __amigaos__
|
||||
extern void CloseLibs(void);
|
||||
#endif
|
||||
|
||||
/* parse the --scanflags argument. It can be a number >=0 or a string consisting of TCP flag names like "URGPSHFIN". Returns -1 if the argument is invalid. */
|
||||
static int parse_scanflags(char *arg) {
|
||||
int flagval = 0;
|
||||
|
|
|
|||
|
|
@ -147,7 +147,4 @@ struct addrinfo {
|
|||
struct addrinfo *ai_next; /* next structure in linked list */
|
||||
};
|
||||
|
||||
|
||||
#define exit(x); {CloseLibs();exit(x);}
|
||||
|
||||
#endif /* _NMAP_AMIGAOS_H_ */
|
||||
|
|
|
|||
|
|
@ -108,10 +108,6 @@ extern NmapOps o;
|
|||
#include <windows.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef __amigaos__
|
||||
extern void CloseLibs(void);
|
||||
#endif
|
||||
|
||||
void fatal(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
|
|
|||
|
|
@ -576,10 +576,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
#ifdef __amigaos__
|
||||
extern void CloseLibs(void);
|
||||
#endif
|
||||
|
||||
bool ultrascan_port_pspec_update(UltraScanInfo *USI, HostScanStats *hss,
|
||||
const probespec *pspec, int newstate);
|
||||
|
||||
|
|
|
|||
4
tcpip.cc
4
tcpip.cc
|
|
@ -133,10 +133,6 @@
|
|||
|
||||
extern NmapOps o;
|
||||
|
||||
#ifdef __amigaos__
|
||||
extern void CloseLibs(void);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include "pcap-int.h"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue