Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r67b959c ra16d7e5  
    5050              "zlog in will send a login notification, zlog out will send a\n"
    5151              "logout notification.  By default a login notification is sent\n"
    52               "when owl is started and a logout notification is sent when owl\n"
     52              "when BarnOwl is started and a logout notification is sent when owl\n"
    5353              "is exited.  This behavior can be changed with the 'startuplogin'\n"
    5454              "and 'shutdownlogout' variables.  If a tty is specified for zlog in\n"
    55               "then the owl variable 'tty' will be set to that string, causing\n"
     55              "then the BarnOwl variable 'tty' will be set to that string, causing\n"
    5656              "it to be used as the zephyr location tty.\n"),
    5757
    5858  OWLCMD_VOID("quit", owl_command_quit, OWL_CTX_ANY,
    59               "exit owl",
     59              "exit BarnOwl",
    6060              "",
    61               "Exit owl and run any shutdown activities."),
     61              "Exit BarnOwl and run any shutdown activities."),
    6262  OWLCMD_ALIAS("exit", "quit"),
    6363  OWLCMD_ALIAS("q",    "quit"),
     
    180180
    181181  OWLCMD_ARGS("startup", owl_command_startup, OWL_CTX_ANY,
    182               "run a command and set it to be run at every Owl startup",
     182              "run a command and set it to be run at every BarnOwl startup",
    183183              "startup <commands> ...",
    184184              "Everything on the command line after the startup command\n"
    185               "is executed as a normal owl command and is also placed in\n"
    186               "a file so that the command is executed every time owl\n"
     185              "is executed as a normal BarnOwl command and is also placed in\n"
     186              "a file so that the command is executed every time BarnOwl\n"
    187187              "is started"),
    188188
    189189  OWLCMD_ARGS("unstartup", owl_command_unstartup, OWL_CTX_ANY,
    190               "remove a command from the list of those to be run at Owl startup",
     190              "remove a command from the list of those to be run at BarnOwl startup",
    191191              "unstartup <commands> ...",
    192192              ""),
    193193
    194194  OWLCMD_VOID("version", owl_command_version, OWL_CTX_ANY,
    195               "print the version of the running owl", "", ""),
     195              "print the version of the running BarnOwl", "", ""),
    196196
    197197  OWLCMD_ARGS("subscribe", owl_command_subscribe, OWL_CTX_ANY,
     
    204204              "only be temporary, i.e., it will not be written to\n"
    205205              "the subscription file and will therefore not be\n"
    206               "present the next time owl is started.\n"),
     206              "present the next time BarnOwl is started.\n"),
    207207  OWLCMD_ALIAS("sub", "subscribe"),
    208208
     
    216216              "only be temporary, i.e., it will not be updated in\n"
    217217              "the subscription file and will therefore not be\n"
    218               "in effect the next time owl is started.\n"),
     218              "in effect the next time BarnOwl is started.\n"),
    219219  OWLCMD_ALIAS("unsub", "unsubscribe"),
    220220
     
    234234
    235235  OWLCMD_ARGS("source", owl_command_source, OWL_CTX_ANY,
    236               "execute owl commands from a file",
     236              "execute BarnOwl commands from a file",
    237237              "source <filename>",
    238               "Execute the owl commands in <filename>.\n"),
     238              "Execute the BarnOwl commands in <filename>.\n"),
    239239
    240240  OWLCMD_ARGS("aim", owl_command_aim, OWL_CTX_INTERACTIVE,
     
    305305 
    306306  OWLCMD_ARGS("help", owl_command_help, OWL_CTX_INTERACTIVE,
    307               "display help on using owl",
     307              "display help on using BarnOwl",
    308308              "help [command]", ""),
    309309
     
    418418
    419419  OWLCMD_VOID("suspend", owl_command_suspend, OWL_CTX_ANY,
    420               "suspend owl", "", ""),
     420              "suspend BarnOwl", "", ""),
    421421
    422422  OWLCMD_ARGS("echo", owl_command_echo, OWL_CTX_ANY,
     
    509509
    510510  OWLCMD_VOID("about", owl_command_about, OWL_CTX_INTERACTIVE,
    511               "print information about owl", "", ""),
     511              "print information about BarnOwl", "", ""),
    512512
    513513  OWLCMD_VOID("status", owl_command_status, OWL_CTX_ANY,
    514               "print status information about the running owl", "", ""),
     514              "print status information about the running BarnOwl", "", ""),
    515515 
    516516  OWLCMD_ARGS("zlocate", owl_command_zlocate, OWL_CTX_INTERACTIVE,
     
    590590              "The other usages listed above are abbreviated forms that simply set\n"
    591591              "the filter of the current view. The -d option allows you to write a\n"
    592               "filter expression that will be dynamically created by owl and then\n"
     592              "filter expression that will be dynamically created by BarnOwl and then\n"
    593593              "applied as the view's filter\n"
    594594              "SEE ALSO: filter, viewclass, viewuser\n"),
     
    676676              "for formatting messages.\n\n"
    677677              "Show variables will list the names of all variables.\n\n"
    678               "Show errors will show a list of errors encountered by Owl.\n\n"
     678              "Show errors will show a list of errors encountered by BarnOwl.\n\n"
    679679              "SEE ALSO: filter, view, alias, bindkey, help\n"),
    680680 
     
    693693              "current view.\n"),
    694694  OWLCMD_ALIAS("del", "delete"),
    695 
    696   OWLCMD_ARGS("delete-and-expunge", owl_command_delete_and_expunge, OWL_CTX_INTERACTIVE,
    697               "delete a message",
    698               "delete-and-expunge [-id msgid] [-q | --quiet]",
    699               "If no message id is specified the current message is deleted.\n"
    700               "Otherwise the message with the given message id is deleted.\n"
    701               "If --quiet is specified, then there is no message displayed on\n"
    702               "success.\n"),
    703   OWLCMD_ALIAS("delx", "delete-and-expunge"),
    704695
    705696  OWLCMD_ARGS("undelete", owl_command_undelete, OWL_CTX_INTERACTIVE,
     
    15811572  int  silent=0;
    15821573  int requirebool=0;
     1574  owl_variable *v;
    15831575
    15841576  if (argc == 1) {
     
    16031595    return NULL;
    16041596  }
    1605   owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, requirebool);
     1597
     1598  v = owl_variable_get_var(owl_global_get_vardict(&g), var);
     1599  if (v == NULL) {
     1600    if (!silent) owl_function_error("Unknown variable '%s'", var);
     1601  } else if (requirebool && owl_variable_get_type(v) != OWL_VARIABLE_BOOL) {
     1602    if (!silent) owl_function_error("Variable '%s' is not a boolean", var);
     1603  } else {
     1604    owl_variable_set_fromstring(v, val, !silent);
     1605  }
    16061606  return NULL;
    16071607}
     
    16091609char *owl_command_unset(int argc, const char *const *argv, const char *buff)
    16101610{
     1611  owl_variable *v;
    16111612  const char *var, *val;
    16121613  int  silent=0;
     
    16231624    return NULL;
    16241625  }
    1625   owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, 1);
     1626
     1627  v = owl_variable_get_var(owl_global_get_vardict(&g), var);
     1628  if (v == NULL) {
     1629    if (!silent) owl_function_error("Unknown variable '%s'", var);
     1630  } else if (owl_variable_get_type(v) != OWL_VARIABLE_BOOL) {
     1631    if (!silent) owl_function_error("Variable '%s' is not a boolean", var);
     1632  } else {
     1633    owl_variable_set_fromstring(v, val, !silent);
     1634  }
    16261635  return NULL;
    16271636}
     
    16311640  const char *var;
    16321641  char *value;
     1642  const owl_variable *v;
    16331643
    16341644  if (argc==1) {
     
    16421652  var=argv[1];
    16431653   
    1644   value = owl_variable_get_tostring(owl_global_get_vardict(&g), var);
    1645   if (value) {
    1646     owl_function_makemsg("%s = '%s'", var, value);
     1654  v = owl_variable_get_var(owl_global_get_vardict(&g), var);
     1655  if (v) {
     1656    value = owl_variable_get_tostring(v);
     1657    if (value == NULL)
     1658      owl_function_makemsg("%s = <null>", var);
     1659    else
     1660      owl_function_makemsg("%s = '%s'", var, value);
    16471661    g_free(value);
    16481662  } else {
     
    23402354}
    23412355
    2342 char *owl_command_delete_and_expunge(int argc, const char *const *argv, const char *buff)
    2343 {
    2344   bool exclaim_success = true;
    2345 
    2346   if (argc > 1 && (!strcmp(argv[1], "-q") || !strcmp(argv[1], "--quiet"))) {
    2347     exclaim_success = false;
    2348     argc--;
    2349     argv++;
    2350   } else if (!strcmp(argv[argc - 1], "-q") || !strcmp(argv[argc - 1], "--quiet")) {
    2351     exclaim_success = false;
    2352     argc--;
    2353   }
    2354 
    2355   if (argc == 1) {
    2356     owl_function_delete_and_expunge_cur(exclaim_success);
    2357     return NULL;
    2358   }
    2359 
    2360   if (argc == 3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) {
    2361     owl_function_delete_and_expunge_by_id(atoi(argv[2]), exclaim_success);
    2362     return NULL;
    2363   }
    2364 
    2365   owl_function_makemsg("Unknown arguments to delete-and-expunge command");
    2366   return NULL;
    2367 }
    2368 
    23692356char *owl_command_undelete(int argc, const char *const *argv, const char *buff)
    23702357{
     
    25112498  } else if(argc == 2) {
    25122499    /* Handle :unpunt <number> */
    2513     if(unpunt && (i=atoi(argv[1])) !=0) {
     2500    if (unpunt && (i = atoi(argv[1])) > 0) {
    25142501      i--;      /* Accept 1-based indexing */
    25152502      if (i < fl->len) {
     
    25412528}
    25422529
    2543 char *owl_command_getvar(int argc, const char *const *argv, const char *buff)
    2544 {
     2530CALLER_OWN char *owl_command_getvar(int argc, const char *const *argv, const char *buff)
     2531{
     2532  const owl_variable *v;
    25452533  if (argc != 2) {
    25462534    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
    25472535    return NULL;
    25482536  }
    2549   return owl_variable_get_tostring(owl_global_get_vardict(&g), argv[1]);
     2537  v = owl_variable_get_var(owl_global_get_vardict(&g), argv[1]);
     2538  if (v == NULL) return NULL;
     2539  return owl_variable_get_tostring(v);
    25502540}
    25512541
Note: See TracChangeset for help on using the changeset viewer.