Changes in / [93ee554:34509d5]


Ignore:
Files:
1 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    r2bdfed9 r702aee7  
    4545#AUTOGEN=$(GEN_C)
    4646
    47 HEADERS=$(GEN_H) owl.h config.h test.h
     47HEADERS=$(GEN_H) owl.h config.h
    4848
    4949%.o: %.c $(HEADERS)
     
    127127        ${INSTALL} -d ${DESTDIR}${datadir}/lib
    128128        ${INSTALL} -d ${DESTDIR}${datadir}/modules
    129         tar -C perl/lib --exclude .svn -cf - . | tar -C ${DESTDIR}${datadir}/lib -xf -
     129        tar -C perl/lib --exclude .svn -c . | tar -C ${DESTDIR}${datadir}/lib -x
    130130        for i in $(PERL_MODULES); do \
    131131                ${INSTALL_DATA} perl/modules/$$i/$$i.par ${DESTDIR}${datadir}/modules/$$i.par; \
  • commands.c

    rfa4f9c3 r987ff51  
    132132  OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE,
    133133              "send an AIM message",
    134               "aimwrite <user> [-m <message...>]",
    135               "Send an aim message to a user.\n\n"
    136               "The following options are available:\n\n"
    137               "-m    Specifies a message to send without prompting.\n"),
     134              "aimzwrite <user>",
     135              "Send an aim message to a user.\n"),
    138136
    139137  OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE,
     
    282280              "suppressed to be received again.\n\n"
    283281              "SEE ALSO:  zpunt, show zpunts\n"),
    284 
    285   OWLCMD_ARGS("punt", owl_command_punt, OWL_CTX_ANY,
    286               "suppress an arbitrary filter",
    287               "punt <filter-name>",
    288               "punt <filter-text (multiple words)>\n"
    289               "The punt command will supress message to the specified\n"
    290               "filter\n\n"
    291               "SEE ALSO:  unpunt, zpunt, show zpunts\n"),
    292 
    293   OWLCMD_ARGS("unpunt", owl_command_unpunt, OWL_CTX_ANY,
    294               "remove an entry from the punt list",
    295               "zpunt <filter-name>\n"
    296               "zpunt <filter-text>\n"
    297               "zpunt <number>\n",
    298               "The unpunt command will remove an entry from the puntlist.\n"
    299               "The first two forms correspond to the first two forms of the :punt\n"
    300               "command. The latter allows you to remove a specific entry from the\n"
    301               "the list (see :show zpunts)\n\n"
    302               "SEE ALSO:  punt, zpunt, zunpunt, show zpunts\n"),
    303282
    304283  OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE,
     
    18881867char *owl_command_aimwrite(int argc, char **argv, char *buff)
    18891868{
    1890   char *newbuff, *recip, **myargv;
    1891   int i, j, myargc;
    1892   owl_message *m;
     1869  char *newbuff;
     1870  int i, j;
    18931871 
    18941872  if (!owl_global_is_aimloggedin(&g)) {
     
    19001878    owl_function_makemsg("Not enough arguments to the aimwrite command.");
    19011879    return(NULL);
    1902   }
    1903 
    1904   myargv=argv;
    1905   if (argc<0) {
    1906     owl_function_error("Unbalanced quotes in aimwrite");
    1907     return(NULL);
    1908   }
    1909   myargc=argc;
    1910   if (myargc && *(myargv[0])!='-') {
    1911     myargc--;
    1912     myargv++;
    1913   }
    1914   while (myargc) {
    1915     if (!strcmp(myargv[0], "-m")) {
    1916       if (myargc<2) {
    1917         break;
    1918       }
    1919 
    1920       /* Once we have -m, gobble up everything else on the line */
    1921       myargv++;
    1922       myargc--;
    1923       newbuff=owl_malloc(1);
    1924       newbuff=owl_strdup("");
    1925       while (myargc) {
    1926         newbuff=realloc(newbuff, strlen(newbuff)+strlen(myargv[0])+5);
    1927         strcat(newbuff, myargv[0]);
    1928         strcat(newbuff, " ");
    1929         myargc--;
    1930         myargv++;
    1931       }
    1932       newbuff[strlen(newbuff)-1]='\0'; /* remove last space */
    1933 
    1934       recip=owl_malloc(strlen(argv[0])+5);
    1935       sprintf(recip, "%s ", argv[1]);
    1936       owl_aim_send_im(recip, newbuff);
    1937       m=owl_function_make_outgoing_aim(newbuff, recip);
    1938       if (m) {
    1939           owl_global_messagequeue_addmsg(&g, m);
    1940       } else {
    1941           owl_function_error("Could not create outgoing AIM message");
    1942       }
    1943 
    1944       owl_free(recip);
    1945       owl_free(newbuff);
    1946       return(NULL);
    1947     } else {
    1948       /* we don't care */
    1949       myargv++;
    1950       myargc--;
    1951     }
    19521880  }
    19531881
     
    22142142    char *filename;
    22152143   
    2216     filename=owl_global_get_startupfile(&g);
     2144    filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
    22172145    owl_function_popless_file(filename);
     2146    owl_free(filename);
    22182147  } else if (!strcmp(argv[1], "errors")) {
    22192148    owl_function_showerrs();
     
    23652294  return NULL;
    23662295}
     2296
    23672297
    23682298void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type)
     
    24152345}
    24162346
    2417 char *owl_command_punt(int argc, char **argv, char *buff)
    2418 {
    2419   owl_command_punt_unpunt(argc, argv, buff, 0);
    2420   return NULL;
    2421 }
    2422 
    2423 char *owl_command_unpunt(int argc, char **argv, char *buff)
    2424 {
    2425   owl_command_punt_unpunt(argc, argv, buff, 1);
    2426   return NULL;
    2427 }
    2428 
    2429 void owl_command_punt_unpunt(int argc, char ** argv, char *buff, int unpunt)
    2430 {
    2431   owl_list * fl;
    2432   owl_filter * f;
    2433   char * text;
    2434   int i;
    2435 
    2436   fl = owl_global_get_puntlist(&g);
    2437   if(argc == 1) {
    2438     owl_function_show_zpunts();
    2439   }
    2440 
    2441   if(argc == 2) {
    2442     /* Handle :unpunt <number> */
    2443     if(unpunt && (i=atoi(argv[1])) !=0) {
    2444       i--;      /* Accept 1-based indexing */
    2445       if(i < owl_list_get_size(fl)) {
    2446         f = (owl_filter*)owl_list_get_element(fl, i);
    2447         owl_list_remove_element(fl, i);
    2448         owl_filter_free(f);
    2449         return;
    2450       } else {
    2451         owl_function_error("No such filter number: %d", i+1);
    2452       }
    2453     }
    2454     text = owl_sprintf("filter %s", argv[1]);
    2455   } else {
    2456     text = skiptokens(buff, 1);
    2457   }
    2458 
    2459   owl_function_punt(text, unpunt);
    2460 }
    2461 
    2462 
    24632347char *owl_command_getview(int argc, char **argv, char *buff)
    24642348{
     
    25852469  owl_message *m;
    25862470  owl_view *v;
    2587   char *cmd;
    25882471
    25892472  v = owl_global_get_current_view(&g);
     
    26042487    return;
    26052488  }
    2606   cmd = owl_message_get_attribute_value(m, "yescommand");
     2489  char * cmd = owl_message_get_attribute_value(m, "yescommand");
    26072490  if(!cmd) {
    26082491    owl_function_error("No yes command!");
     
    26192502  owl_message *m;
    26202503  owl_view *v;
    2621   char *cmd;
    26222504
    26232505  v = owl_global_get_current_view(&g);
     
    26382520    return;
    26392521  }
    2640   cmd = owl_message_get_attribute_value(m, "nocommand");
     2522  char * cmd = owl_message_get_attribute_value(m, "nocommand");
    26412523  if(!cmd) {
    26422524    owl_function_error("No no command!");
  • configure.in

    r34509d5 r34509d5  
    3333
    3434dnl Check for kerberosIV include
    35 AC_MSG_CHECKING(for kerberosIV)
     35AC_MSG_CHECKING(for /usr/include/kerberosIV)
    3636if test -d /usr/include/kerberosIV; then
    3737        CFLAGS=${CFLAGS}\ -I/usr/include/kerberosIV
    3838        CPPFLAGS=${CPPFLAGS}\ -I/usr/include/kerberosIV
    39         AC_MSG_RESULT(yes)
    40 elif test -d /usr/local/include/kerberosIV; then
    41         CFLAGS=${CFLAGS}\ -I/usr/local/include/kerberosIV
    42         CPPFLAGS=${CPPFLAGS}\ -I/usr/local/include/kerberosIV
    4339        AC_MSG_RESULT(yes)
    4440else
     
    106102fi
    107103
    108 dnl Add LDFLAGS for embedded perl
     104dnl Add LDFLAGS for embeded perl
    109105FOO=`perl -MExtUtils::Embed -e ldopts`
    110106echo Adding perl LDFLAGS ${FOO}
     
    121117
    122118dnl Checks for typedefs, structures, and compiler characteristics.
     119AC_CHECK_FILE(/usr/share/terminfo, AC_DEFINE(TERMINFO, "/usr/share/terminfo", [Have terminfo]),
     120  AC_CHECK_FILE(/usr/share/lib/terminfo, AC_DEFINE(TERMINFO, "/usr/share/lib/terminfo", [Have terminfo]),
     121  AC_MSG_ERROR(No terminfo found for this system)))
    123122
    124123AC_SUBST(XSUBPPDIR)
  • debian/control

    rc7172b3 r8d1a33f  
    33Priority: optional
    44Maintainer: Sam Hartman <hartmans@debian.org>
    5 Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev, zip
     5Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev
    66Standards-Version: 3.5.2
    77
     
    1212Description: A curses-based tty Jabber and Zephyr client.
    1313 An alternative standalone (doesn't use zwgc) Zephyr (instant
    14  messaging) client.  Also supports AIM and Jabber.
     14 messaging) client.  Also supports Jabber.
    1515 Much of the functionality is written in Perl, which is supported as
    1616 an extension language.
    1717 .
    18  This is a fork of ktools software's owl Zephyr/AIM client
     18 ktools software -- The 'k' is for Quality!
  • dict.c

    r1cf3f8d3 r0138478  
    152152  char *av="aval", *bv="bval", *cv="cval", *dv="dval";
    153153
    154   printf("# BEGIN testing owl_dict\n");
     154  printf("BEGIN testing owl_dict\n");
    155155  FAIL_UNLESS("create", 0==owl_dict_create(&d));
    156156  FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", (void*)bv, owl_dict_noop_free));
     
    179179  owl_dict_free_all(&d, NULL);
    180180
    181   //  if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
    182   printf("# END testing owl_dict (%d failures)\n", numfailed);
     181  if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
     182  printf("END testing owl_dict (%d failures)\n", numfailed);
    183183  return(numfailed);
    184184}
  • filter.c

    rad15610 rd791cdb  
    6363static owl_filterelement * owl_filter_parse_primitive_expression(int argc, char **argv, int *next)
    6464{
    65   owl_filterelement *fe, *op;
     65  if(!argc) return NULL;
     66
     67  owl_filterelement * fe = owl_malloc(sizeof(owl_filterelement));
     68  owl_filterelement *op;
     69
     70  owl_filterelement_create(fe);
    6671  int i = 0, skip;
    67 
    68   if(!argc) return NULL;
    69 
    70   fe = owl_malloc(sizeof(owl_filterelement));
    71   owl_filterelement_create(fe);
    7272
    7373  if(!strcasecmp(argv[i], "(")) {
     
    118118{
    119119  int i = 0, skip;
    120   owl_filterelement * op1 = NULL, * op2 = NULL, *tmp;
     120  owl_filterelement * op1 = NULL, * op2 = NULL;
    121121
    122122  op1 = owl_filter_parse_primitive_expression(argc-i, argv+i, &skip);
     
    129129    op2 = owl_filter_parse_primitive_expression(argc-i-1, argv+i+1, &skip);
    130130    if(!op2) goto err;
    131     tmp = owl_malloc(sizeof(owl_filterelement));
     131    owl_filterelement * tmp = owl_malloc(sizeof(owl_filterelement));
    132132    if(!strcasecmp(argv[i], "and")) {
    133133      owl_filterelement_create_and(tmp, op1, op2);
     
    204204int owl_filter_message_match(owl_filter *f, owl_message *m)
    205205{
    206   int ret;
    207206  if(!f->root) return 0;
    208   ret = owl_filterelement_match(f->root, m);
     207  int ret = owl_filterelement_match(f->root, m);
    209208  if(f->polarity) ret = !ret;
    210209  return ret;
     
    284283  int failed = 0;
    285284  if(owl_filter_init_fromstring(&f, "test-filter", filt)) {
    286     printf("not ok can't parse %s\n", filt);
     285    printf("\tFAIL: parse %s\n", filt);
    287286    failed = 1;
    288287    goto out;
     
    290289  ok = owl_filter_message_match(&f, m);
    291290  if((shouldmatch && !ok) || (!shouldmatch && ok)) {
    292     printf("not ok match %s (got %d, expected %d)\n", filt, ok, shouldmatch);
     291    printf("\tFAIL: match %s (got %d, expected %d)\n", filt, ok, shouldmatch);
    293292    failed = 1;
    294293  }
     
    296295  owl_filter_free(&f);
    297296  if(!failed) {
    298     printf("ok %s %s\n", shouldmatch ? "matches" : "doesn't match", filt);
     297    printf("\tok  : %s %s\n", shouldmatch ? "matches" : "doesn't match", filt);
    299298  }
    300299  return failed;
     
    306305
    307306int owl_filter_regtest(void) {
     307  owl_list_create(&(g.filterlist));
    308308  int numfailed=0;
    309309  owl_message m;
    310   owl_filter f1, f2, f3, f4;
    311 
    312   owl_list_create(&(g.filterlist));
    313310  owl_message_init(&m);
    314311  owl_message_set_type_zephyr(&m);
     
    348345  TEST_FILTER("true and false or false", 0);
    349346
     347  owl_filter f1, f2, f3, f4;
     348
    350349  owl_filter_init_fromstring(&f1, "f1", "class owl");
    351350  owl_global_add_filter(&g, &f1);
  • functions.c

    r34509d5 r34509d5  
    580580
    581581  if (i>owl_view_get_size(v)-1) i=owl_view_get_size(v)-1;
    582   if (i<0) i=0;
    583582
    584583  if (!found) {
     
    849848{
    850849  int ret, ret2;
    851   char *foo, *path;
     850  char *foo;
    852851
    853852  if (file==NULL) {
    854853    ret=owl_zephyr_loadsubs(NULL, 0);
    855854  } else {
    856     path = owl_util_makepath(file);
    857     ret=owl_zephyr_loadsubs(path, 1);
    858     free(path);
     855    ret=owl_zephyr_loadsubs(file, 1);
    859856  }
    860857
     
    20602057      /* if it's a zephyr we sent, send it out the same way again */
    20612058      if (owl_message_is_direction_out(m)) {
    2062           buff = owl_strdup(owl_message_get_zwriteline(m));
     2059        owl_function_zwrite_setup(owl_message_get_zwriteline(m));
     2060        owl_global_set_buffercommand(&g, owl_message_get_zwriteline(m));
     2061        return;
     2062      }
     2063
     2064      /* Special case a personal reply to a webzephyr user on a class */
     2065      if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {
     2066        class=OWL_WEBZEPHYR_CLASS;
     2067        inst=owl_message_get_sender(m);
     2068        to=OWL_WEBZEPHYR_PRINCIPAL;
     2069      } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {
     2070        /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */
     2071        class=OWL_WEBZEPHYR_CLASS;
     2072        inst=owl_message_get_instance(m);
     2073        to=OWL_WEBZEPHYR_PRINCIPAL;
     2074      } else if (owl_message_is_loginout(m)) {
     2075        /* Normal LOGIN/LOGOUT messages */
     2076        class="MESSAGE";
     2077        inst="PERSONAL";
     2078        to=owl_message_get_sender(m);
     2079      } else if (type==1) {
     2080        /* Personal reply */
     2081        class="MESSAGE";
     2082        inst="PERSONAL";
     2083        to=owl_message_get_sender(m);
    20632084      } else {
    2064 
    2065         /* Special case a personal reply to a webzephyr user on a class */
    2066         if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {
    2067           class=OWL_WEBZEPHYR_CLASS;
    2068           inst=owl_message_get_sender(m);
    2069           to=OWL_WEBZEPHYR_PRINCIPAL;
    2070         } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {
    2071           /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */
    2072           class=OWL_WEBZEPHYR_CLASS;
    2073           inst=owl_message_get_instance(m);
    2074           to=OWL_WEBZEPHYR_PRINCIPAL;
    2075         } else if (owl_message_is_loginout(m)) {
    2076           /* Normal LOGIN/LOGOUT messages */
    2077           class="MESSAGE";
    2078           inst="PERSONAL";
    2079           to=owl_message_get_sender(m);
    2080         } else if (type==1) {
    2081           /* Personal reply */
    2082           class="MESSAGE";
    2083           inst="PERSONAL";
    2084           to=owl_message_get_sender(m);
    2085         } else {
    2086           /* General reply */
    2087           class=owl_message_get_class(m);
    2088           inst=owl_message_get_instance(m);
    2089           to=owl_message_get_recipient(m);
    2090           cc=owl_message_get_cc_without_recipient(m);
    2091           if (!strcmp(to, "") || !strcmp(to, "*")) {
    2092             to="";
    2093           } else if (to[0]=='@') {
    2094             /* leave it, to get the realm */
    2095           } else {
    2096             to=owl_message_get_sender(m);
    2097           }
    2098         }
    2099 
    2100         /* create the command line */
    2101         if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {
    2102           buff=owl_strdup("zcrypt");
    2103         } else {
    2104           buff = owl_strdup("zwrite");
    2105         }
    2106         if (strcasecmp(class, "message")) {
    2107           buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));
    2108           owl_free(oldbuff);
    2109         }
    2110         if (strcasecmp(inst, "personal")) {
    2111           buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));
    2112           owl_free(oldbuff);
    2113         }
    2114         if (*to != '\0') {
    2115           char *tmp, *oldtmp, *tmp2;
    2116           tmp=short_zuser(to);
    2117           if (cc) {
    2118             tmp = owl_util_uniq(oldtmp=tmp, cc, "-");
    2119             owl_free(oldtmp);
    2120             buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);
    2121             owl_free(oldbuff);
    2122           } else {
    2123             if (owl_global_is_smartstrip(&g)) {
    2124               tmp2=tmp;
    2125               tmp=owl_zephyr_smartstripped_user(tmp2);
    2126               owl_free(tmp2);
    2127             }
    2128             buff = owl_sprintf("%s %s", oldbuff=buff, tmp);
    2129             owl_free(oldbuff);
    2130           }
    2131           owl_free(tmp);
    2132         }
    2133         if (cc) owl_free(cc);
     2085        /* General reply */
     2086        class=owl_message_get_class(m);
     2087        inst=owl_message_get_instance(m);
     2088        to=owl_message_get_recipient(m);
     2089        cc=owl_message_get_cc_without_recipient(m);
     2090        if (!strcmp(to, "") || !strcmp(to, "*")) {
     2091          to="";
     2092        } else if (to[0]=='@') {
     2093          /* leave it, to get the realm */
     2094        } else {
     2095          to=owl_message_get_sender(m);
     2096        }
    21342097      }
     2098       
     2099      /* create the command line */
     2100      if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {
     2101        buff=owl_strdup("zcrypt");
     2102      } else {
     2103        buff = owl_strdup("zwrite");
     2104      }
     2105      if (strcasecmp(class, "message")) {
     2106        buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));
     2107        owl_free(oldbuff);
     2108      }
     2109      if (strcasecmp(inst, "personal")) {
     2110        buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));
     2111        owl_free(oldbuff);
     2112      }
     2113      if (*to != '\0') {
     2114        char *tmp, *oldtmp, *tmp2;
     2115        tmp=short_zuser(to);
     2116        if (cc) {
     2117          tmp = owl_util_uniq(oldtmp=tmp, cc, "-");
     2118          owl_free(oldtmp);
     2119          buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);
     2120          owl_free(oldbuff);
     2121        } else {
     2122          if (owl_global_is_smartstrip(&g)) {
     2123            tmp2=tmp;
     2124            tmp=owl_zephyr_smartstripped_user(tmp2);
     2125            owl_free(tmp2);
     2126          }
     2127          buff = owl_sprintf("%s %s", oldbuff=buff, tmp);
     2128          owl_free(oldbuff);
     2129        }
     2130        owl_free(tmp);
     2131      }
     2132      if (cc) owl_free(cc);
    21352133    } else if (owl_message_is_type_aim(m)) {
    21362134      /* aim */
     
    25592557  for (i=0; i<j; i++) {
    25602558    f=owl_list_get_element(fl, i);
    2561     snprintf(buff, sizeof(buff), "[% 2d] ", i+1);
    2562     owl_fmtext_append_normal(&fm, buff);
    25632559    owl_filter_print(f, buff);
    25642560    owl_fmtext_append_normal(&fm, buff);
     
    26262622  sprintf(argbuff, "class ^(un)*%s(\\.d)*$", tmpclass);
    26272623  if (tmpinstance) {
    2628     sprintf(argbuff, "%s and ( instance ^(un)*%s(\\.d)*$ )", argbuff, tmpinstance);
     2624    sprintf(argbuff, "%s and ( instance ^%s(\\.d)*$ )", argbuff, tmpinstance);
    26292625  }
    26302626  owl_free(tmpclass);
     
    26742670
    26752671  argbuff=owl_malloc(strlen(longuser)+1000);
    2676   sprintf(argbuff, "( type ^zephyr$ and filter personal and ");
     2672  sprintf(argbuff, "( type ^zephyr$ and ( class ^message$ and instance ^personal$ and ");
    26772673  sprintf(argbuff, "%s ( ( direction ^in$ and sender ^%s$ ) or ( direction ^out$ and recipient ^%s$ ) ) )", argbuff, longuser, longuser);
    2678   sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) )", argbuff, longuser);
     2674  sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) ) )", argbuff, longuser);
    26792675
    26802676  owl_filter_init_fromstring(f, filtname, argbuff);
     
    28042800  owl_message *m;
    28052801  char *zperson, *filtname=NULL;
    2806   char *argv[1];
    28072802 
    28082803  v=owl_global_get_current_view(&g);
     
    28362831  /* narrow personal and login messages to the sender or recip as appropriate */
    28372832  if (owl_message_is_type_zephyr(m)) {
    2838     if (owl_message_is_personal(m) || owl_message_is_loginout(m)) {
     2833    if (owl_message_is_private(m) || owl_message_is_loginout(m)) {
    28392834      if (owl_message_is_direction_in(m)) {
    28402835        zperson=short_zuser(owl_message_get_sender(m));
     
    28632858
    28642859  /* pass it off to perl */
     2860  char *argv[1];
    28652861  if(type) {
    28662862    argv[0] = "-i";
     
    30203016void owl_function_zpunt(char *class, char *inst, char *recip, int direction)
    30213017{
     3018  owl_filter *f;
     3019  owl_list *fl;
    30223020  char *buff;
    30233021  char *quoted;
    3024 
     3022  int ret, i, j;
     3023
     3024  fl=owl_global_get_puntlist(&g);
     3025
     3026  /* first, create the filter */
     3027  f=owl_malloc(sizeof(owl_filter));
    30253028  buff=owl_malloc(strlen(class)+strlen(inst)+strlen(recip)+100);
    30263029  strcpy(buff, "class");
     
    30533056    owl_free(quoted);
    30543057  }
    3055 
    3056   owl_function_punt(buff, direction);
     3058 
     3059  owl_function_debugmsg("About to filter %s", buff);
     3060  ret=owl_filter_init_fromstring(f, "punt-filter", buff);
    30573061  owl_free(buff);
    3058 }
    3059 
    3060 void owl_function_punt(char *filter, int direction)
    3061 {
    3062   owl_filter *f;
    3063   owl_list *fl;
    3064   int ret, i, j;
    3065   fl=owl_global_get_puntlist(&g);
    3066 
    3067   /* first, create the filter */
    3068   f=malloc(sizeof(owl_filter));
    3069 
    3070   owl_function_debugmsg("About to filter %s", filter);
    3071   ret=owl_filter_init_fromstring(f, "punt-filter", filter);
    30723062  if (ret) {
    30733063    owl_function_error("Error creating filter for zpunt");
     
    30803070  for (i=0; i<j; i++) {
    30813071    if (owl_filter_equiv(f, owl_list_get_element(fl, i))) {
    3082       owl_function_debugmsg("found an equivalent punt filter");
    30833072      /* if we're punting, then just silently bow out on this duplicate */
    30843073      if (direction==0) {
     
    30913080        owl_filter_free(owl_list_get_element(fl, i));
    30923081        owl_list_remove_element(fl, i);
    3093         owl_filter_free(f);
    30943082        return;
    30953083      }
     
    30973085  }
    30983086
    3099   owl_function_debugmsg("punting");
    31003087  /* If we're punting, add the filter to the global punt list */
    31013088  if (direction==0) {
     
    34743461  char *filename;
    34753462
    3476   filename=owl_global_get_startupfile(&g);
     3463  filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
    34773464  file=fopen(filename, "a");
    34783465  if (!file) {
    34793466    owl_function_error("Error opening startupfile for new command");
     3467    owl_free(filename);
    34803468    return;
    34813469  }
     
    34833471  /* delete earlier copies */
    34843472  owl_util_file_deleteline(filename, buff, 1);
     3473  owl_free(filename);
    34853474
    34863475  /* add this line */
     
    34943483{
    34953484  char *filename;
    3496   filename=owl_global_get_startupfile(&g);
     3485  filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
    34973486  owl_util_file_deleteline(filename, buff, 1);
     3487  owl_free(filename);
    34983488}
    34993489
     
    35073497
    35083498  if (!filename) {
    3509     filename=owl_global_get_startupfile(&g);
     3499    filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
    35103500    file=fopen(filename, "r");
     3501    owl_free(filename);
    35113502  } else {
    35123503    file=fopen(filename, "r");
  • global.c

    r34509d5 r34509d5  
    1818  struct hostent *hent;
    1919  char hostname[MAXHOSTNAMELEN];
    20   char *cd;
    2120
    2221  g->malloced=0;
     
    8786  g->homedir=owl_strdup(getenv("HOME"));
    8887
    89   g->confdir = NULL;
    90   g->startupfile = NULL;
    91   cd = owl_sprintf("%s/%s", g->homedir, OWL_CONFIG_DIR);
    92   owl_global_set_confdir(g, cd);
    93   owl_free(cd);
    94 
    9588  owl_messagelist_create(&(g->msglist));
    9689  owl_mainwin_init(&(g->mw));
     
    326319}
    327320
    328 char *owl_global_get_confdir(owl_global *g) {
    329   if (g->confdir) return(g->confdir);
    330   return("/");
    331 }
    332 
    333 /*
    334  * Setting this also sets startupfile to confdir/startup
    335  */
    336 void owl_global_set_confdir(owl_global *g, char *cd) {
    337   free(g->confdir);
    338   g->confdir = owl_strdup(cd);
    339   free(g->startupfile);
    340   g->startupfile = owl_sprintf("%s/startup", cd);
    341 }
    342 
    343 char *owl_global_get_startupfile(owl_global *g) {
    344   if(g->startupfile) return(g->startupfile);
    345   return("/");
    346 }
    347 
    348321int owl_global_get_direction(owl_global *g) {
    349322  return(g->direction);
  • keys.c

    r8938188 r51c57f8  
    180180  BIND_CMD("M-<",         "popless:scroll-to-top", "");
    181181
    182   BIND_CMD("END",         "popless:scroll-to-bottom", "");
    183182  BIND_CMD(">",           "popless:scroll-to-bottom", "");
    184183  BIND_CMD("M->",         "popless:scroll-to-bottom", "");
  • message.c

    r34509d5 r34509d5  
    2727owl_fmtext_cache * owl_message_next_fmtext() /*noproto*/
    2828{
    29     owl_fmtext_cache * f = fmtext_cache_next;
    3029    if(fmtext_cache_next->message != NULL) {
    3130        owl_message_invalidate_format(fmtext_cache_next->message);
    3231    }
     32    owl_fmtext_cache * f = fmtext_cache_next;
    3333    fmtext_cache_next++;
    3434    if(fmtext_cache_next - fmtext_cache == OWL_FMTEXT_CACHE_SIZE)
     
    121121    p=owl_list_get_element(&(m->attributes), i);
    122122    buff=owl_sprintf("  %-15.15s: %-35.35s\n", owl_pair_get_key(p), owl_pair_get_value(p));
    123     if(buff == NULL) {
    124       buff=owl_sprintf("  %-15.15s: %-35.35s\n", owl_pair_get_key(p), "<error>");
    125       if(buff == NULL)
    126         buff=owl_strdup("   <error>\n");
    127     }
    128123    owl_fmtext_append_normal(fm, buff);
    129124    owl_free(buff);
     
    422417char *owl_message_get_text(owl_message *m)
    423418{
    424   owl_message_format(m);
    425419  return(owl_fmtext_get_text(&(m->fmtext->fmtext)));
    426420}
     
    572566
    573567int owl_message_is_answered(owl_message *m) {
    574   char *q;
    575568  if(!owl_message_is_question(m)) return 0;
    576   q = owl_message_get_attribute_value(m, "question");
     569  char * q = owl_message_get_attribute_value(m, "question");
    577570  if(!q) return 0;
    578571  return !strcmp(q, "answered");
     
    820813  struct hostent *hent;
    821814  char *ptr, *tmp, *tmp2;
    822   int len;
    823815
    824816  owl_message_init(m);
     
    849841    owl_message_set_opcode(m, "");
    850842  }
    851   owl_message_set_zsig(m, owl_zephyr_get_zsig(n, &len));
     843  owl_message_set_zsig(m, n->z_message);
    852844
    853845  if ((ptr=strchr(n->z_recipient, '@'))!=NULL) {
  • obarray.c

    r535d68b rdb90f03  
    8080  owl_obarray_init(&oa);
    8181
    82   printf("# BEGIN testing owl_obarray\n");
     82  printf("BEGIN testing owl_obarray\n");
    8383
    8484  p = owl_obarray_insert(&oa, "test");
     
    9696  FAIL_UNLESS("Didn't find a string that isn't there", p == NULL);
    9797
    98   printf("# END testing owl_obarray (%d failures)\n", numfailed);
     98  printf("END testing owl_obarray (%d failures)\n", numfailed);
    9999
    100100  return numfailed;
  • owl.c

    r34509d5 r34509d5  
    6565owl_global g;
    6666
    67 char * owl_get_datadir() {
    68     char * datadir = getenv("BARNOWL_DATA_DIR");
    69     if(datadir != NULL)
    70         return strchr(datadir, '=') + 1;
    71     return DATADIR;
    72 }
    73 
    7467int main(int argc, char **argv, char **env)
    7568{
     
    8174  struct sigaction sigact;
    8275  char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE];
    83   char *confdir;
    8476  owl_filter *f;
    8577  owl_style *s;
     
    9688  argvsave=argv;
    9789  configfile=NULL;
    98   confdir = NULL;
    9990  tty=NULL;
    10091  debug=0;
     
    114105    } else if (!strcmp(argv[0], "-c")) {
    115106      if (argc<2) {
    116         fprintf(stderr, "Too few arguments to -c\n");
    117         usage();
    118         exit(1);
     107        fprintf(stderr, "Too few arguments to -c\n");
     108        usage();
     109        exit(1);
    119110      }
    120111      configfile=argv[1];
     
    123114    } else if (!strcmp(argv[0], "-t")) {
    124115      if (argc<2) {
    125         fprintf(stderr, "Too few arguments to -t\n");
    126         usage();
    127         exit(1);
     116        fprintf(stderr, "Too few arguments to -t\n");
     117        usage();
     118        exit(1);
    128119      }
    129120      tty=argv[1];
    130       argv+=2;
    131       argc-=2;
    132     } else if (!strcmp(argv[0], "-s")){
    133       if (argc<2) {
    134         fprintf(stderr, "Too few arguments to -s\n");
    135         usage();
    136         exit(1);
    137       }
    138       confdir = argv[1];
    139121      argv+=2;
    140122      argc-=2;
     
    149131      argc--;
    150132    } else if (!strcmp(argv[0], "-v")) {
    151       printf("This is barnowl version %s\n", OWL_VERSION_STRING);
     133      printf("This is owl version %s\n", OWL_VERSION_STRING);
    152134      exit(0);
    153135    } else {
     
    181163  /* screen init */
    182164  if (!getenv("TERMINFO")) {
    183     owl_function_debugmsg("startup: Not setting TERMINFO");
     165    sprintf(buff, "TERMINFO=%s", TERMINFO);
     166    putenv(buff);
     167    owl_function_debugmsg("startup: setting TERMINFO to %s", TERMINFO);
    184168  } else {
    185169    owl_function_debugmsg("startup: leaving TERMINFO as %s from envrionment", getenv("TERMINFO"));
     
    211195  /* owl global init */
    212196  owl_global_init(&g);
    213   if (debug) owl_global_set_debug_on(&g);
    214   if (confdir) owl_global_set_confdir(&g, confdir);
     197    if (debug) owl_global_set_debug_on(&g);
    215198  owl_function_debugmsg("startup: first available debugging message");
    216199  owl_global_set_startupargs(&g, argcsave, argvsave);
     
    234217  /* create the owl directory, in case it does not exist */
    235218  owl_function_debugmsg("startup: creating owl directory, if not present");
    236   dir=owl_global_get_confdir(&g);
     219  dir=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);
    237220  mkdir(dir, S_IRWXU);
     221  owl_free(dir);
    238222
    239223  /* set the tty, either from the command line, or by figuring it out */
     
    279263  owl_function_debugmsg("startup: creating default filters");
    280264  f=owl_malloc(sizeof(owl_filter));
    281   owl_filter_init_fromstring(f, "personal", "isprivate ^true$ and ( not type ^zephyr$"
    282                              " or ( class ^message and"
    283                              " ( instance ^personal$ or instance ^urgent$ ) ) )");
     265  owl_filter_init_fromstring(f, "personal", "isprivate ^true$");
    284266  owl_list_append_element(owl_global_get_filterlist(&g), f);
    285267
     
    551533    j=wgetch(typwin);
    552534    if (j==ERR) {
    553       usleep(10000);
     535      usleep(10);
    554536    } else {
    555537      owl_global_update_lastinputtime(&g);
     
    718700void usage()
    719701{
    720   fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING);
    721   fprintf(stderr, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
     702  fprintf(stderr, "Owl version %s\n", OWL_VERSION_STRING);
     703  fprintf(stderr, "Usage: owl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-t <ttyname>]\n");
    722704  fprintf(stderr, "  -n      don't load zephyr subscriptions\n");
    723705  fprintf(stderr, "  -d      enable debugging\n");
    724706  fprintf(stderr, "  -D      enable debugging and delete previous debug file\n");
    725   fprintf(stderr, "  -v      print the Barnowl version number and exit\n");
     707  fprintf(stderr, "  -v      print the Owl version number and exit\n");
    726708  fprintf(stderr, "  -h      print this help message\n");
    727709  fprintf(stderr, "  -c      specify an alternate config file\n");
    728   fprintf(stderr, "  -s      specify an alternate config dir (default ~/.owl)\n");
    729710  fprintf(stderr, "  -t      set the tty name\n");
    730711}
  • owl.h

    r34509d5 r34509d5  
    6464#ifdef OWL_PERL
    6565typedef void WINDOW;
    66 /* logout is defined in FreeBSD. */
    67 #define logout logout_
    6866#include <perl.h>
    69 #undef logout
    7067#include "XSUB.h"
    7168#else
     
    563560  char *thishost;
    564561  char *homedir;
    565   char *confdir;
    566   char *startupfile;
    567562  int direction;
    568563  int zaway;
  • perl/lib/BarnOwl/ModuleLoader.pm

    rbe98ba5 r9de39410  
    66use lib (BarnOwl::get_data_dir() . "/modules/");
    77use PAR (BarnOwl::get_data_dir() . "/modules/*.par");
    8 use PAR (BarnOwl::get_config_dir() . "/modules/*.par");
     8use PAR ($ENV{HOME} . "/.owl/modules/*.par");
    99
    1010sub load_all {
    1111    my %modules;
    1212    my @modules;
    13 
    14     my @moddirs = ();
    15     push @moddirs, BarnOwl::get_data_dir() . "/modules";
    16     push @moddirs, BarnOwl::get_config_dir() . "/modules";
    1713   
    18     for my $dir (@moddirs) {
     14    for my $dir ( BarnOwl::get_data_dir() . "/modules",
     15                  $ENV{HOME} . "/.owl/modules" ) {
    1916        opendir(my $dh, $dir) or next;
    2017        while(defined(my $f = readdir($dh))) {
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    r892568b rf032974  
    581581      or die("Usage: jmuc join MUC [-p password] [-a account]");
    582582
    583     die("Error: Must specify a fully-qualified MUC name (e.g. barnowl\@conference.mit.edu)\n")
    584         unless $muc =~ /@/;
    585583    $muc = Net::Jabber::JID->new($muc);
    586584    $jid = Net::Jabber::JID->new($jid);
     
    588586
    589587    $conn->getConnectionFromJID($jid)->MUCJoin(JID      => $muc,
    590                                                Password => $password,
    591                                                History  => {
    592                                                    MaxChars => 0
    593                                                   });
     588                                                  Password => $password,
     589                                                  History  => {
     590                                                      MaxChars => 0
     591                                                     });
    594592    return;
    595593}
     
    601599    die("Usage: jmuc part MUC [-a account]") unless $muc;
    602600
    603     if($conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc)) {
    604         queue_admin_msg("$jid has left $muc.");
    605     } else {
    606         die("Error: Not joined to $muc");
    607     }
     601    $conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc);
     602    queue_admin_msg("$jid has left $muc.");
    608603}
    609604
     
    644639    my $m = shift;
    645640    my @jids = $m->Presence();
    646 
    647     my $presence = "JIDs present in " . $m->BaseJID;
    648     if($m->Anonymous) {
    649         $presence .= " [anonymous MUC]";
    650     }
    651     $presence .= "\n\t";
    652     $presence .= join("\n\t", map {pp_jid($m, $_);} @jids) . "\n";
    653     return $presence;
    654 }
    655 
    656 sub pp_jid {
    657     my ($m, $jid) = @_;
    658     my $nick = $jid->GetResource;
    659     my $full = $m->GetFullJID($jid);
    660     if($full && $full ne $nick) {
    661         return "$nick ($full)";
    662     } else {
    663         return "$nick";
    664     }
     641    return "JIDs present in " . $m->BaseJID . "\n\t"
     642      . join("\n\t", map {$_->GetResource}@jids) . "\n";
    665643}
    666644
     
    926904                              sid => $sid } );
    927905    $jhash{type} = 'admin';
    928    
    929906    BarnOwl::queue_message( BarnOwl::Message->new(%jhash) );
    930907}
     
    11571134    }
    11581135    elsif ( $jtype eq 'normal' ) {
    1159         $props{replycmd}  = "";
     1136        $props{replycmd}  = undef;
    11601137        $props{private} = 1;
    11611138    }
    11621139    elsif ( $jtype eq 'headline' ) {
    1163         $props{replycmd} = "";
     1140        $props{replycmd} = undef;
    11641141    }
    11651142    elsif ( $jtype eq 'error' ) {
    1166         $props{replycmd} = "";
     1143        $props{replycmd} = undef;
    11671144        $props{body}     = "Error "
    11681145          . $props{error_code}
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm

    r892568b r3c455b4  
    5252Leave a MUC. The MUC is specified in the same form as L</FindMUC>
    5353
    54 Returns true if successful, false if this connection was not in the
    55 named MUC.
    56 
    5754=cut
    5855
     
    6461    $muc->Leave();
    6562    $self->{_BARNOWL_MUCS} = [grep {$_->BaseJID ne $muc->BaseJID} $self->MUCs];
    66     return 1;
    6763}
    6864
  • perl/modules/Jabber/lib/Net/Jabber/MUC.pm

    r892568b rc2bed55  
    6464    $self->{JID} = $args{jid};
    6565    $self->{PRESENCE} = { };
    66     $self->{ANONYMOUS} = 1;
    6766
    6867    bless($self, $class);
     
    189188        delete $self->{PRESENCE}->{$from->GetJID('full')};
    190189    } elsif($type eq 'available') {
    191         $self->{PRESENCE}->{$from->GetJID('full')} = {ROOMNICK => $from};
    192         my $x = $presence->GetX('http://jabber.org/protocol/muc#user');
    193         if($x && $x->DefinedItem()) {
    194             my $item = $x->GetItem();
    195             if($item->DefinedJID()) {
    196                 $self->{PRESENCE}->{$from->GetJID('full')}->{FULLJID} = $item->GetJID();
    197                 $self->{ANONYMOUS} = 0;
    198             }
    199         }
     190        $self->{PRESENCE}->{$from->GetJID('full')} = $from;
    200191    }
    201192}
     
    216207}
    217208
    218 =head2 GetFullJID roomjid
    219 
    220 Given the roomnick of a user in the MUC, return their full NIC if the
    221 MUC makes it available. If the MUC is anonymous or the user does not
    222 exist in the MUC, return undef.
    223 
    224 =cut
    225 
    226 sub GetFullJID {
    227     my $self = shift;
    228     my $jid = shift;
    229 
    230     $jid = $jid->GetJID('full') if UNIVERSAL::isa($jid, 'Net::Jabber::JID');
    231     my $pres = $self->{PRESENCE}->{$jid};
    232     return unless $pres;
    233     return $pres->{FULLJID};
    234 }
    235 
    236209=head2 Presence
    237210
     
    242215sub Presence {
    243216    my $self = shift;
    244     return map {$_->{ROOMNICK}} values %{$self->{PRESENCE}};
    245 }
    246 
    247 =head2 Anonymous
    248 
    249 Returns true if the MUC is anonymous (hides participants real JIDs)
    250 
    251 =cut
    252 
    253 sub Anonymous {
    254     my $self = shift;
    255     return $self->{ANONYMOUS};
     217    return values %{$self->{PRESENCE}};
    256218}
    257219
  • perl/modules/Jabber/lib/XML/Stream.pm

    r5073972 rc2bed55  
    11611161    }
    11621162
    1163     # 08.04.05(Fri) slipstream@yandex.ru for compapility with ejabberd since it reuses stream id
    1164     delete($self->{SIDS}->{$currsid}) unless ($currsid eq $sid);
     1163    delete($self->{SIDS}->{$currsid});
    11651164
    11661165    if (exists($self->GetRoot($sid)->{version}) &&
  • perlconfig.c

    rad15610 rf6b319c  
    137137  char *key,*val;
    138138  HV * hash;
    139   struct tm tm;
    140139
    141140  hash = (HV*)SvRV(msg);
     
    163162    } else if (!strcmp(key, "time")) {
    164163      m->timestr = owl_strdup(val);
     164      struct tm tm;
    165165      strptime(val, "%a %b %d %T %Y", &tm);
    166166      m->time = mktime(&tm);
     
    445445  int i, count;
    446446  char * ret = NULL;
    447   SV *rv;
    448447  STRLEN n_a;
    449448  dSP;
     
    468467    if(count != 1)
    469468      croak("Perl command %s returned more than one value!", cmd->name);
    470     rv = POPs;
     469    SV * rv = POPs;
    471470    if(SvTRUE(rv)) {
    472471      ret = owl_strdup(SvPV(rv, n_a));
     
    489488  SV *cb = (SV*)(e->cbdata);
    490489  unsigned int n_a;
    491   dSP;
    492 
    493490  if(cb == NULL) {
    494491    owl_function_error("Perl callback is NULL!");
    495492  }
     493
     494  dSP;
    496495
    497496  ENTER;
     
    517516void owl_perlconfig_mainloop()
    518517{
    519   dSP;
    520518  if (!owl_perlconfig_is_function("BarnOwl::Hooks::_mainloop_hook"))
    521519    return;
     520  dSP ;
    522521  PUSHMARK(SP) ;
    523522  call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
  • perlglue.xs

    rb363d83 r13a3c1db  
    199199get_data_dir ()
    200200        CODE:
    201                 RETVAL = (char *) owl_get_datadir();
     201                RETVAL = (char *) DATADIR;
    202202        OUTPUT:
    203203        RETVAL
    204 
    205 char *
    206 get_config_dir ()
    207         CODE:
    208                 RETVAL = (char *) owl_global_get_confdir(&g);
    209         OUTPUT:
    210         RETVAL 
    211204
    212205void
  • perlwrap.pm

    r18fb3d4f r42947f1  
    2121};
    2222
    23 use lib(get_data_dir() . "/lib");
    24 use lib(get_config_dir() . "/lib");
    25 
    26 # perlconfig.c will set this to the value of the -c command-line
    27 # switch, if present.
     23use lib(get_data_dir()."/lib");
     24use lib($ENV{HOME}."/.owl/lib");
     25
    2826our $configfile;
    2927
     
    522520    if ( $m->is_loginout) {
    523521        return format_login($m);
    524     } elsif($m->is_ping && $m->is_personal) {
     522    } elsif($m->is_ping) {
    525523        return ( "\@b(PING) from \@b(" . $m->pretty_sender . ")\n" );
    526524    } elsif($m->is_admin) {
     
    570568    }
    571569
    572     if($m->opcode) {
    573         $header .= " [" . $m->opcode . "]";
    574     }
    575570    $header .= "  " . time_hhmm($m);
    576571    my $sender = $m->long_sender;
  • test.h

    r1cf3f8d3 r0138478  
    33
    44#define FAIL_UNLESS(desc,pred) do { int __pred = (pred);                \
    5     printf("%s %s", (__pred)?"ok":(numfailed++,"not ok"), desc);     \
     5    printf("\t%-4s: %s", (__pred)?"ok":(numfailed++,"FAIL"), desc);     \
    66    if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0)
    77
  • tester.c

    r1cf3f8d3 re7dc035  
    143143
    144144
    145 #define OWL_DICT_NTESTS  20
    146 #define OWL_UTIL_NTESTS  9
    147 #define OWL_OBARRAY_NTESTS  5
    148 #define OWL_VARIABLE_NTESTS  52
    149 #define OWL_FILTER_NTESTS  23
    150 
    151145int main(int argc, char **argv, char **env)
    152146{
     
    155149
    156150  int numfailures=0;
    157   if (argc==1 || (argc==2 && 0==strcmp(argv[1],"reg"))) {
    158     printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS
    159            +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS);
     151  if (argc==2 && 0==strcmp(argv[1],"reg")) {
    160152    numfailures += owl_util_regtest();
    161153    numfailures += owl_dict_regtest();
     
    164156    numfailures += owl_obarray_regtest();
    165157    if (numfailures) {
    166       fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
     158      fprintf(stderr, "*** WARNING: %d failures total\n", numfailures);
    167159    }
    168160    return(numfailures);
  • util.c

    r34509d5 r34509d5  
    759759char * owl_util_baseclass(char * class)
    760760{
     761  char *ret;
    761762  char *start, *end;
    762763
     
    768769  start = owl_strdup(start);
    769770  end = start + strlen(start) - 1;
    770   while(end > start && *end == 'd' && *(end-1) == '.') {
     771  while(*end == 'd' && *(end-1) == '.') {
    771772    end -= 2;
    772773  }
     
    788789  int numfailed=0;
    789790
    790   printf("# BEGIN testing owl_util\n");
     791  printf("BEGIN testing owl_util\n");
    791792
    792793  FAIL_UNLESS("owl_util_substitute 1",
     
    811812              !strcmp("meep foo bar", owl_util_uniq("meep foo", "bar foo meep", "-")));
    812813
    813   // if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
    814   printf("# END testing owl_util (%d failures)\n", numfailed);
     814  if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
     815  printf("END testing owl_util (%d failures)\n", numfailed);
    815816  return(numfailed);
    816817}
  • variable.c

    rad15610 ra695a68  
    974974  int numfailed=0;
    975975  char buf[1024];
    976   owl_variable * v;
    977976
    978977  in_regtest = 1;
    979978
    980   printf("# BEGIN testing owl_variable\n");
     979  printf("BEGIN testing owl_variable\n");
    981980  FAIL_UNLESS("setup", 0==owl_variable_dict_setup(&vd));
    982981
     
    10281027  FAIL_UNLESS("get enum 10", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));
    10291028
     1029  owl_variable * v;
     1030 
    10301031  owl_variable_dict_newvar_string(&vd, "stringvar", "", "", "testval");
    10311032  FAIL_UNLESS("get new string var", NULL != (v = owl_variable_get(&vd, "stringvar", OWL_VARIABLE_STRING)));
     
    10481049  owl_variable_dict_free(&vd);
    10491050
    1050   // if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
    1051   printf("# END testing owl_variable (%d failures)\n", numfailed);
     1051  if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
     1052  printf("END testing owl_variable (%d failures)\n", numfailed);
    10521053  return(numfailed);
    10531054}
  • zephyr.c

    r50e29e3 r13a3c1db  
    328328  char *out;
    329329
    330   /* If there's no message here, just run along now */
    331   if (n->z_message_len == 0)
    332     return(owl_strdup(""));
    333 
    334330  count=save=0;
    335331  for (i=0; i<n->z_message_len; i++) {
     
    366362{
    367363  int i, fields;
    368 
    369   if(n->z_message_len == 0)
    370     return 0;
    371364
    372365  fields=1;
  • zwrite.c

    r34509d5 r34509d5  
    125125  }
    126126
    127   if (z->class == NULL &&
    128       z->inst == NULL &&
    129       owl_list_get_size(&(z->recips))==0) {
    130     owl_function_error("You must specify a recipient for zwrite");
    131     return(-1);
    132   }
    133 
    134127  /* now deal with defaults */
    135128  if (z->class==NULL) z->class=owl_strdup("message");
     
    139132  /* z->message is allowed to stay NULL */
    140133 
     134  if (!strcasecmp(z->class, "message") &&
     135      !strcasecmp(z->inst, "personal") &&
     136      owl_list_get_size(&(z->recips))==0) {
     137    owl_function_error("You must specify a recipient for zwrite");
     138    return(-1);
     139  }
     140
    141141  /* get a zsig, if not given */
    142142  if (z->zsig==NULL) {
Note: See TracChangeset for help on using the changeset viewer.