Diff
Not logged in

Differences From:

File src/th_main.c part of check-in [68c24b1857] - Progress toward getting ticket handling to work. by drh on 2008-05-16 18:11:39. [view]

To:

File src/th_main.c part of check-in [46e6a03232] - Get rudimentary ticket editing working. by drh on 2008-05-16 18:57:59. [view]

@@ -140,8 +140,49 @@
   return TH_OK;
 }
 
 /*
+** TH command:      htmlize STRING
+**
+** Escape all characters of STRING which have special meaning in HTML.
+** Return a new string result.
+*/
+static int htmlizeCmd(
+  Th_Interp *interp,
+  void *p,
+  int argc,
+  const unsigned char **argv,
+  int *argl
+){
+  char *zOut;
+  if( argc!=2 ){
+    return Th_WrongNumArgs(interp, "htmlize STRING");
+  }
+  zOut = htmlize((char*)argv[1], argl[1]);
+  Th_SetResult(interp, (unsigned char*)zOut, -1);
+  free(zOut);
+  return TH_OK;
+}
+
+/*
+** TH command:      date
+**
+** Return a string which is the current time and date.
+*/
+static int dateCmd(
+  Th_Interp *interp,
+  void *p,
+  int argc,
+  const unsigned char **argv,
+  int *argl
+){
+  char *zOut = db_text("??", "SELECT datetime('now')");
+  Th_SetResult(interp, (unsigned char*)zOut, -1);
+  free(zOut);
+  return TH_OK;
+}
+
+/*
 ** TH command:     hascap STRING
 **
 ** Return true if the user has all of the capabilities listed in STRING.
 */
@@ -260,8 +301,10 @@
     {"combobox",      comboboxCmd,          0},
     {"enable_output", enableOutputCmd,      0},
     {"linecount",     linecntCmd,           0},
     {"hascap",        hascapCmd,            0},
+    {"htmlize",       htmlizeCmd,           0},
+    {"date",          dateCmd,              0},
     {"html",          putsCmd,              0},
     {"puts",          putsCmd,       (void*)1},
     {"wiki",          wikiCmd,              0},
   };