mirror of
https://github.com/nmap/nmap.git
synced 2025-12-15 20:29:03 +00:00
Reduce use of utils.h for error functions
This commit is contained in:
@@ -140,7 +140,6 @@
|
||||
#include <dnet.h>
|
||||
#include "nbase.h"
|
||||
#include "NmapOps.h"
|
||||
#include "utils.h"
|
||||
#include "nmap.h"
|
||||
#include "nmap_error.h"
|
||||
|
||||
|
||||
1
main.cc
1
main.cc
@@ -135,6 +135,7 @@
|
||||
#include "nmap.h"
|
||||
#include "NmapOps.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
|
||||
#ifdef MTRACE
|
||||
#include "mcheck.h"
|
||||
|
||||
@@ -143,6 +143,14 @@ extern NmapOps o;
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
char *strerror(int errnum) {
|
||||
static char buf[1024];
|
||||
sprintf(buf, "your system is too old for strerror of errno %d\n", errnum);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
void fatal(const char *fmt, ...) {
|
||||
time_t timep;
|
||||
struct timeval tv;
|
||||
|
||||
@@ -170,6 +170,10 @@ NORETURN void pfatal(const char *err, ...)
|
||||
void gh_perror(const char *err, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
char *strerror(int errnum);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -138,6 +138,7 @@
|
||||
#include "tcpip.h"
|
||||
#include "Target.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
#include "FPEngine.h"
|
||||
#include "FingerPrintResults.h"
|
||||
#include <dnet.h>
|
||||
|
||||
@@ -129,8 +129,6 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/* $Id: osscan.h 3636 2006-07-04 23:04:56Z fyodor $ */
|
||||
|
||||
#ifndef OSSCAN2_H
|
||||
#define OSSCAN2_H
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@
|
||||
#include "FingerPrintResults.h"
|
||||
#include "tcpip.h"
|
||||
#include "Target.h"
|
||||
#include "nmap_error.h"
|
||||
#include "utils.h"
|
||||
#include "xml.h"
|
||||
#include "nbase.h"
|
||||
|
||||
2
output.h
2
output.h
@@ -171,7 +171,7 @@
|
||||
|
||||
#include "scan_lists.h"
|
||||
#ifndef NOLUA
|
||||
#include "nse_main.h"
|
||||
class ScriptResults;
|
||||
#endif
|
||||
#include <nsock.h>
|
||||
class PortList;
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
#include "nbase.h"
|
||||
#include "payload.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
|
||||
extern NmapOps o;
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
#include "Target.h"
|
||||
#include "targets.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
|
||||
#include "struct_ip.h"
|
||||
|
||||
|
||||
@@ -133,7 +133,10 @@
|
||||
#ifndef SCAN_ENGINE_CONNECT_H
|
||||
#define SCAN_ENGINE_CONNECT_H
|
||||
|
||||
#include "scan_engine.h"
|
||||
#include <nbase.h>
|
||||
class UltraProbe;
|
||||
class UltraScanInfo;
|
||||
class HostScanStats;
|
||||
|
||||
UltraProbe *sendConnectScanProbe(UltraScanInfo *USI, HostScanStats *hss,
|
||||
u16 destport, u8 tryno, u8 pingseq);
|
||||
|
||||
@@ -133,7 +133,10 @@
|
||||
#ifndef SCAN_ENGINE_RAW_H
|
||||
#define SCAN_ENGINE_RAW_H
|
||||
|
||||
#include "scan_engine.h"
|
||||
#include <nbase.h>
|
||||
class UltraProbe;
|
||||
class UltraScanInfo;
|
||||
class HostScanStats;
|
||||
#include <vector>
|
||||
|
||||
class Target;
|
||||
|
||||
@@ -138,6 +138,7 @@
|
||||
#include "nsock.h"
|
||||
#include "Target.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
#include "protocols.h"
|
||||
#include "scan_lists.h"
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@
|
||||
#include "scan_engine.h"
|
||||
#include "nmap_dns.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
#include "xml.h"
|
||||
|
||||
extern NmapOps o;
|
||||
|
||||
1
tcpip.cc
1
tcpip.cc
@@ -139,6 +139,7 @@
|
||||
#include "NmapOps.h"
|
||||
#include "Target.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
#include "libnetutil/netutil.h"
|
||||
|
||||
#include "struct_ip.h"
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
#include "timing.h"
|
||||
#include "NmapOps.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
#include "xml.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
9
utils.cc
9
utils.cc
@@ -131,6 +131,7 @@
|
||||
|
||||
#include "nmap.h"
|
||||
#include "utils.h"
|
||||
#include "nmap_error.h"
|
||||
#include "NmapOps.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
@@ -191,14 +192,6 @@ void nmap_hexdump(unsigned char *cp, unsigned int length) {
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
char *strerror(int errnum) {
|
||||
static char buf[1024];
|
||||
sprintf(buf, "your system is too old for strerror of errno %d\n", errnum);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Like the perl equivalent, removes the terminating newline from string IF one
|
||||
exists. It then returns the POSSIBLY MODIFIED string. */
|
||||
char *chomp(char *string) {
|
||||
|
||||
11
utils.h
11
utils.h
@@ -137,8 +137,7 @@
|
||||
#endif
|
||||
|
||||
#include "nbase.h"
|
||||
|
||||
#include "nmap_error.h"
|
||||
#include <assert.h>
|
||||
|
||||
/* Arithmatic difference modulo 2^32 */
|
||||
#ifndef MOD_DIFF
|
||||
@@ -161,9 +160,7 @@
|
||||
/* Return num if it is between min and max. Otherwise return min or max
|
||||
(whichever is closest to num). */
|
||||
template<class T> T box(T bmin, T bmax, T bnum) {
|
||||
if (bmin > bmax)
|
||||
fatal("box(%d, %d, %d) called (min,max,num)", (int) bmin, (int) bmax, (int) bnum);
|
||||
// assert(bmin <= bmax);
|
||||
assert(bmin <= bmax);
|
||||
if (bnum >= bmax)
|
||||
return bmax;
|
||||
if (bnum <= bmin)
|
||||
@@ -190,10 +187,6 @@ void bintohexstr(char *buf, int buflen, char *src, int srclen);
|
||||
|
||||
u8 *parse_hex_string(char *str, size_t *outlen);
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
char *strerror(int errnum);
|
||||
#endif
|
||||
|
||||
int cpe_get_part(const char *cpe);
|
||||
|
||||
char *mmapfile(char *fname, int *length, int openflags);
|
||||
|
||||
Reference in New Issue
Block a user