Changeset cdc6ff1


Ignore:
Timestamp:
Aug 22, 2008, 12:22:37 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
da466e0
Parents:
680ada9
Message:
Implement a getfilter command to get the text of a filter.
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    rb1fd36e rcdc6ff1  
    712712              "returns the value of a variable",
    713713              "getvar <varname>", ""),
     714
     715  OWLCMD_ARGS("getfilter", owl_command_getfilter, OWL_CTX_INTERACTIVE,
     716              "returns the definition of a filter",
     717              "getfilter <filtername>", ""),
    714718
    715719  OWLCMD_ARGS("getstyle", owl_command_getstyle, OWL_CTX_INTERACTIVE,
     
    24612465}
    24622466
     2467char *owl_command_getfilter(int argc, char **argv, char *buf)
     2468{
     2469  owl_filter *f;
     2470  if (argc != 2) {
     2471    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
     2472    return NULL;
     2473  }
     2474  f = owl_global_get_filter(&g, argv[1]);
     2475  if (!f) {
     2476    return NULL;
     2477  }
     2478  return owl_filter_print(f);
     2479}
     2480
    24632481char *owl_command_search(int argc, char **argv, char *buff)
    24642482{
  • filter.c

    r0504f63 rcdc6ff1  
    214214char* owl_filter_print(owl_filter *f)
    215215{
    216   GString *out = g_string_new(owl_filter_get_name(f));
    217 
    218   g_string_append(out, ": ");
     216  GString *out = g_string_new("");
    219217
    220218  if (f->fgcolor!=OWL_COLOR_DEFAULT) {
     
    256254
    257255  ret = !strcmp(buffa, buffb);
     256  ret = ret && !strcmp(owl_filter_get_name(a),
     257                       owl_filter_get_name(b));
    258258
    259259  owl_free(buffa);
  • functions.c

    r57cf4f9 rcdc6ff1  
    25242524{
    25252525  owl_filter *f;
    2526   char *buff;
     2526  char *buff, *tmp;
    25272527
    25282528  f=owl_global_get_filter(&g, name);
     
    25312531    return;
    25322532  }
    2533   buff = owl_filter_print(f);
     2533  tmp = owl_filter_print(f);
     2534  buff = owl_sprintf("%s: %s", owl_filter_get_name(f), tmp);
    25342535  owl_function_popless_text(buff);
    25352536  owl_free(buff);
     2537  owl_free(tmp);
    25362538}
    25372539
Note: See TracChangeset for help on using the changeset viewer.