Changeset 2367f1c


Ignore:
Timestamp:
Jul 9, 2011, 4:00:41 PM (13 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
Parents:
a16d7e5 (diff), 37ac344 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 37ac3443e4be8b822ab13b34901c88bcb8ed375f into a16d7e5b1281bf21e0fe52b6d9946fd58893da28
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • runtests.sh

    r5aa33fd r37ac344  
    55export BARNOWL_BIN_DIR="$SRCDIR/"
    66
    7 HARNESS_PERL=./tester exec prove t/
     7HARNESS_PERL=./tester exec prove --failures t/
  • tester.c

    rb4a678a re073081  
    44#undef WINDOW
    55
     6#include <errno.h>
    67#include <unistd.h>
     8#include <pwd.h>
     9#include <stdio.h>
    710#include <stdlib.h>
     11#include <string.h>
     12#include <sys/types.h>
    813
    914#undef instr
     
    124129#define FAIL_UNLESS(desc,pred) do { int __pred = (pred);                \
    125130    numtests++;                                                         \
    126     printf("%s %s", (__pred)?"ok":(numfailed++,"not ok"), desc);        \
     131    printf("%s %d %s", (__pred) ? "ok" : (numfailed++, "not ok"), numtests, desc); \
    127132    if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0)
    128133
     
    131136{
    132137  int numfailed=0;
     138  const char *home;
     139  char *s, *path;
     140  struct passwd *pw;
    133141
    134142  printf("# BEGIN testing owl_util\n");
     
    225233  g_string_free(g, true);
    226234
     235
     236  s = owl_util_baseclass("barnowl");
     237  FAIL_UNLESS("baseclass barnowl", !strcmp("barnowl", s));
     238  g_free(s);
     239  s = owl_util_baseclass("unbarnowl");
     240  FAIL_UNLESS("baseclass unbarnowl", !strcmp("barnowl", s));
     241  g_free(s);
     242  s = owl_util_baseclass("unununbarnowl.d.d");
     243  FAIL_UNLESS("baseclass unununbarnowl.d.d", !strcmp("barnowl", s));
     244  g_free(s);
     245  s = owl_util_baseclass("ununun.d.d");
     246  FAIL_UNLESS("baseclass ununun.d.d", !strcmp("", s));
     247  g_free(s);
     248  s = owl_util_baseclass("d.d.d.d");
     249  FAIL_UNLESS("baseclass d.d.d.d", !strcmp("d", s));
     250  g_free(s);
     251  s = owl_util_baseclass("n.d.d.d");
     252  FAIL_UNLESS("baseclass n.d.d.d", !strcmp("n", s));
     253  g_free(s);
     254  s = owl_util_baseclass("ununun.");
     255  FAIL_UNLESS("baseclass ununun.", !strcmp(".", s));
     256  g_free(s);
     257  s = owl_util_baseclass("unununu");
     258  FAIL_UNLESS("baseclass unununu", !strcmp("u", s));
     259  g_free(s);
     260
     261
     262  s = owl_util_makepath("foo/bar");
     263  FAIL_UNLESS("makepath foo/bar", !strcmp("foo/bar", s));
     264  g_free(s);
     265  s = owl_util_makepath("//foo///bar");
     266  FAIL_UNLESS("makepath //foo///bar", !strcmp("/foo/bar", s));
     267  g_free(s);
     268  s = owl_util_makepath("foo/~//bar/");
     269  FAIL_UNLESS("makepath foo/~//bar/", !strcmp("foo/~/bar/", s));
     270  g_free(s);
     271  s = owl_util_makepath("~thisuserhadreallybetternotexist/foobar/");
     272  FAIL_UNLESS("makepath ~thisuserhadreallybetternotexist/foobar/",
     273              !strcmp("~thisuserhadreallybetternotexist/foobar/", s));
     274  g_free(s);
     275
     276  errno = 0;
     277  pw = getpwuid(getuid());
     278  if (pw) {
     279    home = pw->pw_dir;
     280  } else {
     281    /* Just make some noise so we notice. */
     282    home = "<WHAT>";
     283    fprintf(stderr, "getpwuid: %s", errno ? strerror(errno) : "No such user");
     284  }
     285  s = owl_util_makepath("~");
     286  FAIL_UNLESS("makepath ~", !strcmp(home, s));
     287  g_free(s);
     288
     289  path = g_strconcat(home, "/foo/bar/baz", NULL);
     290  s = owl_util_makepath("~///foo/bar//baz");
     291  FAIL_UNLESS("makepath ~///foo/bar//baz", !strcmp(path, s));
     292  g_free(s);
     293  g_free(path);
     294
     295  errno = 0;
     296  pw = getpwnam("root");
     297  if (pw) {
     298    home = pw->pw_dir;
     299  } else {
     300    /* Just make some noise so we notice. */
     301    home = "<WHAT>";
     302    fprintf(stderr, "getpwnam: %s", errno ? strerror(errno) : "No such user");
     303  }
     304
     305  s = owl_util_makepath("~root");
     306  FAIL_UNLESS("makepath ~root", !strcmp(home, s));
     307  g_free(s);
     308
     309  path = g_strconcat(home, "/foo/bar/baz", NULL);
     310  s = owl_util_makepath("~root///foo/bar//baz");
     311  FAIL_UNLESS("makepath ~root///foo/bar//baz", !strcmp(path, s));
     312  g_free(s);
     313  g_free(path);
     314
    227315  /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */
    228316  printf("# END testing owl_util (%d failures)\n", numfailed);
  • util.c

    rb8a3e00 rffe1135  
    3737CALLER_OWN char *owl_util_makepath(const char *in)
    3838{
    39   int i, j, x;
    40   char *out, user[MAXPATHLEN];
    41   struct passwd *pw;
    42 
    43   out=g_new(char, MAXPATHLEN+1);
    44   out[0]='\0';
    45   j=strlen(in);
    46   x=0;
    47   for (i=0; i<j; i++) {
    48     if (in[i]=='~') {
    49       if ( (i==(j-1)) ||          /* last character */
    50            (in[i+1]=='/') ) {     /* ~/ */
    51         /* use my homedir */
    52         pw=getpwuid(getuid());
    53         if (!pw) {
    54           out[x]=in[i];
    55         } else {
    56           out[x]='\0';
    57           strcat(out, pw->pw_dir);
    58           x+=strlen(pw->pw_dir);
    59         }
    60       } else {
    61         /* another user homedir */
    62         int a, b;
    63         b=0;
    64         for (a=i+1; i<j; a++) {
    65           if (in[a]==' ' || in[a]=='/') {
    66             break;
    67           } else {
    68             user[b]=in[a];
    69             i++;
    70             b++;
    71           }
    72         }
    73         user[b]='\0';
    74         pw=getpwnam(user);
    75         if (!pw) {
    76           out[x]=in[i];
    77         } else {
    78           out[x]='\0';
    79           strcat(out, pw->pw_dir);
    80           x+=strlen(pw->pw_dir);
    81         }
    82       }
    83     } else if (in[i]=='/') {
    84       /* check for a double / */
    85       if (i<(j-1) && (in[i+1]=='/')) {
    86         /* do nothing */
    87       } else {
    88         out[x]=in[i];
    89         x++;
    90       }
     39  char *out;
     40  int i, j;
     41  if (in[0] == '~') {
     42    /* Attempt tilde-expansion of the first component. Get the
     43       tilde-prefix, which goes up to the next slash. */
     44    struct passwd *pw;
     45    const char *end = strchr(in + 1, '/');
     46    if (end == NULL)
     47      end = in + strlen(in);
     48
     49    if (end == in + 1) {
     50      /* My home directory. */
     51      pw = getpwuid(getuid());
    9152    } else {
    92       out[x]=in[i];
    93       x++;
    94     }
    95   }
    96   out[x]='\0';
    97   return(out);
     53      /* Someone else's home directory. */
     54      char *user = g_strndup(in + 1, end - (in + 1));
     55      pw = getpwnam(user);
     56      g_free(user);
     57    }
     58
     59    /* Patch together a new path. Replace the ~ and tilde-prefix with
     60       the homedir. */
     61    if (pw) {
     62      out = g_strconcat(pw->pw_dir, end, NULL);
     63    } else {
     64      out = g_strdup(in);
     65    }
     66  } else {
     67      out = g_strdup(in);
     68  }
     69
     70  /* And a quick pass to remove duplicate slashes. */
     71  for (i = j = 0; out[i] != '\0'; i++) {
     72    if (out[i] != '/' || i == 0 || out[i-1] != '/')
     73      out[j++] = out[i];
     74  }
     75  out[j] = '\0';
     76  return out;
    9877}
    9978
  • commands.c

    r901cee9 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 
  • filterelement.c

    rd4927a7 r7756dde  
    104104}
    105105
    106 /* XXX: Our boolea operators short-circuit here. The original owl did
     106/* XXX: Our boolean operators short-circuit here. The original owl did
    107107   not. Do we care?
    108108*/
  • functions.c

    rca749a9 ra16d7e5  
    144144    "\n"
    145145    "   * Redistributions in any form must be accompanied by information on\n"
    146     "     how to obtain complete source code for the Owl software and any\n"
    147     "     accompanying software that uses the Owl software. The source code\n"
     146    "     how to obtain complete source code for the BarnOwl software and any\n"
     147    "     accompanying software that uses the BarnOwl software. The source code\n"
    148148    "     must either be included in the distribution or be available for no\n"
    149149    "     more than the cost of distribution plus a nominal fee, and must be\n"
     
    972972  }
    973973
    974   owl_function_debugmsg("Quitting Owl");
     974  owl_function_debugmsg("Quitting BarnOwl");
    975975  owl_select_quit_loop();
    976976}
     
    14391439  }
    14401440
    1441   owl_fmtext_append_bold(&fm, "\nOwl Message Attributes:\n");
     1441  owl_fmtext_append_bold(&fm, "\nBarnOwl Message Attributes:\n");
    14421442  owl_message_attributes_tofmtext(m, &attrfm);
    14431443  owl_fmtext_append_fmtext(&fm, &attrfm);
  • help.c

    rca54fd6 ra16d7e5  
    7070     "    w             Open a URL in the current message\n"
    7171     "    C-l           Refresh the screen\n"
    72      "    C-z           Suspend Owl\n"
     72     "    C-z           Suspend BarnOwl\n"
    7373     "    h             Print this help message\n"
    7474     "    : , M-x       Enter command mode\n"
     
    8484  owl_fmtext_append_normal
    8585    (&fm,
    86      "    quit, exit    Exit owl\n"
     86     "    quit, exit    Exit BarnOwl\n"
    8787     "    help          Get help about commands\n"
    88      "    show          Show information about owl (see detailed help)\n"
     88     "    show          Show information about BarnOwl (see detailed help)\n"
    8989     "\n"
    9090     "    zwrite        Send a zephyr\n"
     
    102102     "    set           Set a variable (see list below)\n"
    103103     "    print         Print a variable's value (variables listed below)\n"
    104      "    startup       Set a command to be run at every Owl startup\n"
    105      "    unstartup     Remove a command to be run at every Owl startup\n"
     104     "    startup       Set a command to be run at every BarnOwl startup\n"
     105     "    unstartup     Remove a command to be run at every BarnOwl startup\n"
    106106     "\n"
    107107     "    getsubs       Print a list of current subscriptions\n"
     
    122122     "    dump          Dump messagelist as text to a file\n"
    123123     "\n"
    124      "    about         Print information about owl\n"
    125      "    status        Print status information about the running owl\n"
    126      "    version       Print the version number of owl\n"
     124     "    about         Print information about BarnOwl\n"
     125     "    status        Print status information about the running BarnOwl\n"
     126     "    version       Print the version number of BarnOwl\n"
    127127     "\n");
    128128 
  • variable.c

    rfa981f3 ra16d7e5  
    7070
    7171  OWLVAR_BOOL( "startuplogin" /* %OwlVarStub */, 1,
    72                "send a login message when owl starts", "" ),
     72               "send a login message when BarnOwl starts", "" ),
    7373
    7474  OWLVAR_BOOL( "shutdownlogout" /* %OwlVarStub */, 1,
    75                "send a logout message when owl exits", "" ),
     75               "send a logout message when BarnOwl exits", "" ),
    7676
    7777  OWLVAR_BOOL( "rxping" /* %OwlVarStub */, 0,
     
    137137  OWLVAR_BOOL_FULL( "pseudologins" /* %OwlVarStub */, 0,
    138138                    "Enable zephyr pseudo logins",
    139                     "When this is enabled, Owl will periodically check the zephyr\n"
     139                    "When this is enabled, BarnOwl will periodically check the zephyr\n"
    140140                    "location of users in your .anyone file.  If a user is present\n"
    141141                    "but sent no login message, or a user is not present that sent no\n"
     
    145145  OWLVAR_BOOL( "ignorelogins" /* %OwlVarStub */, 0,
    146146               "Enable printing of login notifications",
    147                "When this is enabled, Owl will print login and logout notifications\n"
    148                "for AIM, zephyr, or other protocols.  If disabled Owl will not print\n"
     147               "When this is enabled, BarnOwl will print login and logout notifications\n"
     148               "for AIM, zephyr, or other protocols.  If disabled BarnOwl will not print\n"
    149149               "login or logout notifications.\n"),
    150150
     
    160160  OWLVAR_BOOL( "loglogins" /* %OwlVarStub */, 0,
    161161               "Enable logging of login notifications",
    162                "When this is enabled, Owl will login login and logout notifications\n"
     162               "When this is enabled, BarnOwl will log login and logout notifications\n"
    163163               "for AIM, zephyr, or other protocols.  If disabled Owl will not print\n"
    164164               "login or logout notifications.\n"),
     
    201201  OWLVAR_PATH( "newmsgproc" /* %OwlVarStub:newmsgproc */, NULL,
    202202               "name of a program to run when new messages are present",
    203                "The named program will be run when owl receives new\n"
     203               "The named program will be run when BarnOwl receives new\n"
    204204               "messages.  It will not be run again until the first\n"
    205205               "instance exits"),
     
    229229                 "string to append to the end of the sepbar",
    230230                 "The sepbar is the bar separating the top and bottom\n"
    231                  "of the owl screen.  Any string specified here will\n"
     231                 "of the BarnOwl screen.  Any string specified here will\n"
    232232                 "be displayed on the right of the sepbar\n"),
    233233
     
    265265
    266266  OWLVAR_STRING( "alert_action" /* %OwlVarStub */, "nop",
    267                  "owl command to execute for alert actions",
     267                 "BarnOwl command to execute for alert actions",
    268268                 "" ),
    269269
     
    276276                 "Styles may be created with the 'style' command.\n"
    277277                 "Some built-in styles include:\n"
    278                  "   default  - the default owl formatting\n"
     278                 "   default  - the default BarnOwl formatting\n"
    279279                 "   oneline  - one line per-message\n"
    280280                 "   perl     - legacy perl interface\n"
     
    333333               "cursor moves between messages being displayed.\n"
    334334               "The following modes are supported:\n\n"
    335                "   normal      - This is the owl default.  Scrolling happens\n"
     335               "   normal      - This is the BarnOwl default.  Scrolling happens\n"
    336336               "                 when it needs to, and an attempt is made to\n"
    337337               "                 keep the current message roughly near\n"
Note: See TracChangeset for help on using the changeset viewer.