summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--main.go6
-rw-r--r--scanner.go1
-rw-r--r--urlscanner.l2
4 files changed, 8 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 1575525..9454c8a 100644
--- a/Makefile
+++ b/Makefile
@@ -10,4 +10,4 @@ all: clean urlscanner.o scanner.go
urlscanner.o: urlscanner.h
clean:
- rm -f *.o $(APP) *.exe
+ $(RM) $(RMFLAGS) *.o $(APP) *.exe
diff --git a/main.go b/main.go
index fd2189f..fc55aeb 100644
--- a/main.go
+++ b/main.go
@@ -53,9 +53,12 @@ func main() {
return
}
+ var _haveAddr bool = false
+
for cnt, adr := range addrs {
if ipnet, ok := adr.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
if ipnet.IP.To4() != nil {
+ _haveAddr = true
if cnt > 1 {
fmt.Printf(" or http://%s:%s/", ipnet.IP.String(), port)
} else {
@@ -64,6 +67,9 @@ func main() {
}
}
}
+ if !_haveAddr {
+ fmt.Printf("http://127.0.0.1:%s (Info: No internet access detected)", port)
+ }
} else {
fmt.Print("http://" + *ip_f + ":" + port + "/")
}
diff --git a/scanner.go b/scanner.go
index 53a6aeb..9b35de3 100644
--- a/scanner.go
+++ b/scanner.go
@@ -2,7 +2,6 @@ package main
/*
#include <stdio.h>
-#include <stdlib.h>
#include "urlscanner.h"
*/
import "C"
diff --git a/urlscanner.l b/urlscanner.l
index 5f9acb6..79768b2 100644
--- a/urlscanner.l
+++ b/urlscanner.l
@@ -1,12 +1,12 @@
%option noyywrap
%option yylineno
%option nounput
-%option nodefault
%{
#include "urlscanner.h"
#include "string.h"
yystype yylval;
+#define YY_NO_INPUT
%}
%x ATAG_HREF