Added Copyright headers.
[src/xds/xds-gdb.git] / main.go
diff --git a/main.go b/main.go
index d907a44..81b9154 100644 (file)
--- a/main.go
+++ b/main.go
@@ -1,4 +1,23 @@
-// xds-gdb: a wrapper on gdb tool for X(cross) Development System.
+/*
+ * Copyright (C) 2017 "IoT.bzh"
+ * Author Sebastien Douheret <sebastien@iot.bzh>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * xds-gdb: a wrapper on gdb tool for X(cross) Development System.
+ */
+
 package main
 
 import (
@@ -43,7 +62,7 @@ var logFileInitial = "/tmp/xds-gdb.log"
 
 // Application details
 const (
-       appCopyright    = "Apache-2.0"
+       appCopyright    = "Copyright (C) 2017 IoT.bzh - Apache-2.0"
        defaultLogLevel = "warning"
 )
 
@@ -123,7 +142,7 @@ func main() {
                },
                EnvVar{
                        Name:        "XDS_LOGFILE",
-                       Usage:       "logging file",
+                       Usage:       "logging file (default: " + logFileInitial + ")",
                        Destination: &logFile,
                },
                EnvVar{
@@ -360,7 +379,7 @@ endloop:
                                sc := bufio.NewScanner(reader)
                                for sc.Scan() {
                                        data := sc.Text()
-                                       iosk.Emit(apiv1.ExecInferiorInEvent, data+"\n")
+                                       iosk.Emit(xaapiv1.ExecInferiorInEvent, data+"\n")
                                        log.Debugf("Inferior IN: <%v>", data)
                                }
                                if sc.Err() != nil {
@@ -461,9 +480,7 @@ endloop:
                        for {
                                sig := <-sigs
 
-                               // FIXME: skip Window Changed signal for now
-                               if sig == syscall.SIGWINCH {
-                                       log.Debugf("SKIP signal Window Changed")
+                               if isIgnoredSignal(sig) {
                                        return
                                }
 
@@ -524,9 +541,10 @@ func loadConfigEnvFile(confFile, gdbCmdFile string) (map[string]string, string,
                                path.Join(curDir, "target"),
                                path.Join(u.HomeDir, ".config", "xds"),
                        } {
-                               confFile = path.Join(d, xdsEnvFile)
-                               log.Infof("Search config in %s", confFile)
-                               if common.Exists(confFile) {
+                               cf := path.Join(d, xdsEnvFile)
+                               log.Infof("Search config in %s", cf)
+                               if common.Exists(cf) {
+                                       confFile = cf
                                        break
                                }
                        }