Fixed small bug.
[ir-tcl-moved-to-github.git] / ir-tcl.c
index e08c595..efccf01 100644 (file)
--- a/ir-tcl.c
+++ b/ir-tcl.c
@@ -5,7 +5,13 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: ir-tcl.c,v $
- * Revision 1.98  1997-04-13 18:57:20  adam
+ * Revision 1.100  1997-05-01 15:04:05  adam
+ * Added ir-log command.
+ *
+ * Revision 1.99  1997/04/30 07:24:47  adam
+ * Spell fix of an error message.
+ *
+ * Revision 1.98  1997/04/13 18:57:20  adam
  * Better error reporting and aligned with Tcl/Tk style.
  * Rework of notifier code with Tcl_File handles.
  *
@@ -1200,7 +1206,7 @@ static int do_connect (void *obj, Tcl_Interp *interp,
         if ((r=cs_connect (p->cs_link, addr)) < 0)
         {
             ir_tcl_disconnect (p);
-            Tcl_AppendResult (interp, "conncet fail", NULL);
+            Tcl_AppendResult (interp, "connect fail", NULL);
             return ir_tcl_error_exec (interp, argc, argv);
         }
         ir_select_add (cs_fileno (p->cs_link), p);
@@ -3424,7 +3430,7 @@ static int ir_scan_obj_mk (ClientData clientData, Tcl_Interp *interp,
 /* ------------------------------------------------------- */
 
 /* 
- * ir_log_proc: set yaz log level
+ * ir_log_init_proc: set yaz log level
  */
 static int ir_log_init_proc (ClientData clientData, Tcl_Interp *interp,
                              int argc, char **argv)
@@ -3444,6 +3450,25 @@ static int ir_log_init_proc (ClientData clientData, Tcl_Interp *interp,
     return TCL_OK;
 }
 
+/* 
+ * ir_log_proc: log yaz message
+ */
+static int ir_log_proc (ClientData clientData, Tcl_Interp *interp,
+                        int argc, char **argv)
+{
+    int mask;
+    if (argc != 3)
+    {
+        Tcl_AppendResult (interp, wrongArgs, *argv,
+                          " level string\"", NULL);
+        return TCL_OK;
+    }
+    mask = log_mask_str_x (argv[1], 0);
+    logf (mask, "%s", argv[1], mask, argv[2]);
+    return TCL_OK;
+}
+
+
 /* ------------------------------------------------------- */
 static void ir_initResponse (void *obj, Z_InitResponse *initrs)
 {
@@ -4106,6 +4131,8 @@ EXPORT (int,Irtcl_Init) (Tcl_Interp *interp)
                        (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
     Tcl_CreateCommand (interp, "ir-log-init", ir_log_init_proc,
                        (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+    Tcl_CreateCommand (interp, "ir-log", ir_log_proc,
+                       (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }