Changeset ed2412d


Ignore:
Timestamp:
Feb 21, 2003, 11:30:23 AM (22 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:
2e6d137
Parents:
7933748
Message:
Made M-n work on classes and instances with spaces in them
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r7933748 red2412d  
    2727        Added a 'loadsubs' command to eventually phase out the 'load-subs'
    2828          command
     29        Made M-n work on classes and instances with spaces in them
    2930
    30311.2.8
  • functions.c

    r7933748 red2412d  
    19651965  owl_filter *f;
    19661966  char *argbuff, *filtname;
     1967  char *tmpclass, *tmpinstance;
    19671968  int len;
    19681969
     
    19781979    sprintf(filtname, "class-%s-instance-%s", class, instance);
    19791980  }
     1981  /* downcase it */
    19801982  downstr(filtname);
    1981 
     1983  /* turn spaces into hyphens */
     1984  owl_util_tr(filtname, ' ', '.');
     1985 
    19821986  /* if it already exists then go with it.  This lets users override */
    19831987  if (owl_global_get_filter(&g, filtname)) {
    1984     return filtname;
     1988    return(filtname);
    19851989  }
    19861990
    19871991  /* create the new filter */
    19881992  argbuff=owl_malloc(len+20);
    1989   sprintf(argbuff, "( class ^%s$ )", class);
     1993  tmpclass=owl_strdup(class);
     1994  owl_util_tr(tmpclass, ' ', '.');
    19901995  if (instance) {
    1991     sprintf(argbuff, "%s and ( instance ^%s$ )", argbuff, instance);
    1992   }
     1996    tmpinstance=owl_strdup(instance);
     1997    owl_util_tr(tmpinstance, ' ', '.');
     1998  }
     1999  sprintf(argbuff, "( class ^%s$ )", tmpclass);
     2000  if (instance) {
     2001    sprintf(argbuff, "%s and ( instance ^%s$ )", argbuff, tmpinstance);
     2002  }
     2003  owl_free(tmpclass);
     2004  if (instance) owl_free(tmpinstance);
    19932005
    19942006  f=owl_malloc(sizeof(owl_filter));
     
    19992011
    20002012  owl_free(argbuff);
    2001   return filtname;
     2013  return(filtname);
    20022014}
    20032015
     
    20162028  /* if it already exists then go with it.  This lets users override */
    20172029  if (owl_global_get_filter(&g, filtname)) {
    2018     return filtname;
     2030    return(filtname);
    20192031  }
    20202032
     
    20372049  owl_free(shortuser);
    20382050
    2039   return filtname;
     2051  return(filtname);
    20402052}
    20412053
  • util.c

    r7e3e00a red2412d  
    507507}
    508508
     509void owl_util_tr(char *buff, char a, char b) {
     510  /* replace all instances of character a in buff with the character
     511     b.  buff must be null terminated */
     512  int i;
     513
     514  owl_function_debugmsg("In: %s", buff);
     515  for (i=0; buff[i]!='\0'; i++) {
     516    if (buff[i]==a) buff[i]=b;
     517  }
     518  owl_function_debugmsg("Out: %s", buff);
     519}
    509520
    510521int owl_util_string_to_color(char *color) {
Note: See TracChangeset for help on using the changeset viewer.