Changeset 38cf544c for commands.c


Ignore:
Timestamp:
Jun 4, 2003, 12:04:54 AM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
96f8e5b
Parents:
fd93b41
Message:
Added the 'startup' and 'unstartup' commands
The $HOME/.owl directory is created on startup if it does not exist
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    rfd93b41 r38cf544c  
    159159              "are used print the value of all variables.\n"),
    160160
     161  OWLCMD_ARGS("startup", owl_command_startup, OWL_CTX_ANY,
     162              "run a command and set it to be run at every Owl startup",
     163              "startup <commands> ...",
     164              "Everything on the command line after the startup command\n"
     165              "is executed as a normal owl command and is also placed in\n"
     166              "a file so that the command is executed every time owl\n"
     167              "is started"),
     168
     169  OWLCMD_ARGS("unstartup", owl_command_unstartup, OWL_CTX_ANY,
     170              "remove a command from the list of those to be run at Owl startup",
     171              "unstartup <commands> ...",
     172              ""),
     173
    161174  OWLCMD_VOID("version", owl_command_version, OWL_CTX_ANY,
    162175              "print the version of the running owl", "", ""),
     
    201214              "add a buddy to a buddylist",
    202215              "addbuddy aim <screenname>",
    203               "Add the named buddy to your buddylist.  Eventually other protocols,"
    204               "such as zephyr, will also be able to use this command.  For now the"
     216              "Add the named buddy to your buddylist.  Eventually other protocols,\n"
     217              "such as zephyr, will also be able to use this command.  For now the\n"
    205218              "only available protocol is 'aim', specified as the first argument."),
    206219
     
    208221              "delete a buddy from a buddylist",
    209222              "delbuddy aim <screenname>",
    210               "Delete the named buddy to your buddylist.  Eventually other protocols,"
    211               "such as zephyr, will also be able to use this command.  For now the"
    212               "only available protocol is 'aim', specified as the first argument."),
     223              "Delete the named buddy to your buddylist.  Eventually other protocols,\n"
     224              "such as zephyr, will also be able to use this command.  For now the\n"
     225              "only available protocol is 'aim', specified as the first argument.\n"),
    213226
    214227  OWLCMD_ARGS("smartzpunt", owl_command_smartzpunt, OWL_CTX_INTERACTIVE,
     
    909922  owl_aim_delbuddy(argv[2]);
    910923  owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g));
     924
     925  return(NULL);
     926}
     927
     928char *owl_command_startup(int argc, char **argv, char *buff)
     929{
     930  char *ptr;
     931
     932  if (argc<2) {
     933    owl_function_makemsg("usage: %s <commands> ...", argv[0]);
     934    return(NULL);
     935  }
     936
     937  /* we'll be pedantic here, just in case this command gets another name
     938   *  (or is aliased) start after the first space on the line
     939   */
     940  ptr=strchr(buff, ' ');
     941  if (!ptr) {
     942    owl_function_makemsg("Parse error finding command for startup");
     943    return(NULL);
     944  }
     945
     946  owl_function_command(ptr+1);
     947  owl_function_addstartup(ptr+1);
     948
     949  return(NULL);
     950}
     951
     952char *owl_command_unstartup(int argc, char **argv, char *buff)
     953{
     954  char *ptr;
     955
     956  if (argc<2) {
     957    owl_function_makemsg("usage: %s <commands> ...", argv[0]);
     958    return(NULL);
     959  }
     960
     961  /* we'll be pedantic here, just in case this command gets another name
     962   *  (or is aliased) start after the first space on the line
     963   */
     964  ptr=strchr(buff, ' ');
     965  if (!ptr) {
     966    owl_function_makemsg("Parse error finding command for unstartup");
     967    return(NULL);
     968  }
     969
     970  owl_function_delstartup(ptr+1);
    911971
    912972  return(NULL);
Note: See TracChangeset for help on using the changeset viewer.