Changeset 2367f1c
- Timestamp:
- Jul 9, 2011, 4:00:41 PM (14 years ago)
- 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. - Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
runtests.sh
r5aa33fd r37ac344 5 5 export BARNOWL_BIN_DIR="$SRCDIR/" 6 6 7 HARNESS_PERL=./tester exec prove t/7 HARNESS_PERL=./tester exec prove --failures t/ -
tester.c
rb4a678a re073081 4 4 #undef WINDOW 5 5 6 #include <errno.h> 6 7 #include <unistd.h> 8 #include <pwd.h> 9 #include <stdio.h> 7 10 #include <stdlib.h> 11 #include <string.h> 12 #include <sys/types.h> 8 13 9 14 #undef instr … … 124 129 #define FAIL_UNLESS(desc,pred) do { int __pred = (pred); \ 125 130 numtests++; \ 126 printf("%s % s", (__pred)?"ok":(numfailed++,"not ok"), desc);\131 printf("%s %d %s", (__pred) ? "ok" : (numfailed++, "not ok"), numtests, desc); \ 127 132 if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0) 128 133 … … 131 136 { 132 137 int numfailed=0; 138 const char *home; 139 char *s, *path; 140 struct passwd *pw; 133 141 134 142 printf("# BEGIN testing owl_util\n"); … … 225 233 g_string_free(g, true); 226 234 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 227 315 /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */ 228 316 printf("# END testing owl_util (%d failures)\n", numfailed); -
util.c
rb8a3e00 rffe1135 37 37 CALLER_OWN char *owl_util_makepath(const char *in) 38 38 { 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()); 91 52 } 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; 98 77 } 99 78 -
commands.c
r901cee9 ra16d7e5 50 50 "zlog in will send a login notification, zlog out will send a\n" 51 51 "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" 53 53 "is exited. This behavior can be changed with the 'startuplogin'\n" 54 54 "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" 56 56 "it to be used as the zephyr location tty.\n"), 57 57 58 58 OWLCMD_VOID("quit", owl_command_quit, OWL_CTX_ANY, 59 "exit owl",59 "exit BarnOwl", 60 60 "", 61 "Exit owl and run any shutdown activities."),61 "Exit BarnOwl and run any shutdown activities."), 62 62 OWLCMD_ALIAS("exit", "quit"), 63 63 OWLCMD_ALIAS("q", "quit"), … … 180 180 181 181 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", 183 183 "startup <commands> ...", 184 184 "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" 187 187 "is started"), 188 188 189 189 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", 191 191 "unstartup <commands> ...", 192 192 ""), 193 193 194 194 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", "", ""), 196 196 197 197 OWLCMD_ARGS("subscribe", owl_command_subscribe, OWL_CTX_ANY, … … 204 204 "only be temporary, i.e., it will not be written to\n" 205 205 "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"), 207 207 OWLCMD_ALIAS("sub", "subscribe"), 208 208 … … 216 216 "only be temporary, i.e., it will not be updated in\n" 217 217 "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"), 219 219 OWLCMD_ALIAS("unsub", "unsubscribe"), 220 220 … … 234 234 235 235 OWLCMD_ARGS("source", owl_command_source, OWL_CTX_ANY, 236 "execute owl commands from a file",236 "execute BarnOwl commands from a file", 237 237 "source <filename>", 238 "Execute the owl commands in <filename>.\n"),238 "Execute the BarnOwl commands in <filename>.\n"), 239 239 240 240 OWLCMD_ARGS("aim", owl_command_aim, OWL_CTX_INTERACTIVE, … … 305 305 306 306 OWLCMD_ARGS("help", owl_command_help, OWL_CTX_INTERACTIVE, 307 "display help on using owl",307 "display help on using BarnOwl", 308 308 "help [command]", ""), 309 309 … … 418 418 419 419 OWLCMD_VOID("suspend", owl_command_suspend, OWL_CTX_ANY, 420 "suspend owl", "", ""),420 "suspend BarnOwl", "", ""), 421 421 422 422 OWLCMD_ARGS("echo", owl_command_echo, OWL_CTX_ANY, … … 509 509 510 510 OWLCMD_VOID("about", owl_command_about, OWL_CTX_INTERACTIVE, 511 "print information about owl", "", ""),511 "print information about BarnOwl", "", ""), 512 512 513 513 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", "", ""), 515 515 516 516 OWLCMD_ARGS("zlocate", owl_command_zlocate, OWL_CTX_INTERACTIVE, … … 590 590 "The other usages listed above are abbreviated forms that simply set\n" 591 591 "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" 593 593 "applied as the view's filter\n" 594 594 "SEE ALSO: filter, viewclass, viewuser\n"), … … 676 676 "for formatting messages.\n\n" 677 677 "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" 679 679 "SEE ALSO: filter, view, alias, bindkey, help\n"), 680 680 -
filterelement.c
rd4927a7 r7756dde 104 104 } 105 105 106 /* XXX: Our boolea operators short-circuit here. The original owl did106 /* XXX: Our boolean operators short-circuit here. The original owl did 107 107 not. Do we care? 108 108 */ -
functions.c
rca749a9 ra16d7e5 144 144 "\n" 145 145 " * 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" 148 148 " must either be included in the distribution or be available for no\n" 149 149 " more than the cost of distribution plus a nominal fee, and must be\n" … … 972 972 } 973 973 974 owl_function_debugmsg("Quitting Owl");974 owl_function_debugmsg("Quitting BarnOwl"); 975 975 owl_select_quit_loop(); 976 976 } … … 1439 1439 } 1440 1440 1441 owl_fmtext_append_bold(&fm, "\n Owl Message Attributes:\n");1441 owl_fmtext_append_bold(&fm, "\nBarnOwl Message Attributes:\n"); 1442 1442 owl_message_attributes_tofmtext(m, &attrfm); 1443 1443 owl_fmtext_append_fmtext(&fm, &attrfm); -
help.c
rca54fd6 ra16d7e5 70 70 " w Open a URL in the current message\n" 71 71 " C-l Refresh the screen\n" 72 " C-z Suspend Owl\n"72 " C-z Suspend BarnOwl\n" 73 73 " h Print this help message\n" 74 74 " : , M-x Enter command mode\n" … … 84 84 owl_fmtext_append_normal 85 85 (&fm, 86 " quit, exit Exit owl\n"86 " quit, exit Exit BarnOwl\n" 87 87 " 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" 89 89 "\n" 90 90 " zwrite Send a zephyr\n" … … 102 102 " set Set a variable (see list below)\n" 103 103 " 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" 106 106 "\n" 107 107 " getsubs Print a list of current subscriptions\n" … … 122 122 " dump Dump messagelist as text to a file\n" 123 123 "\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" 127 127 "\n"); 128 128 -
variable.c
rfa981f3 ra16d7e5 70 70 71 71 OWLVAR_BOOL( "startuplogin" /* %OwlVarStub */, 1, 72 "send a login message when owl starts", "" ),72 "send a login message when BarnOwl starts", "" ), 73 73 74 74 OWLVAR_BOOL( "shutdownlogout" /* %OwlVarStub */, 1, 75 "send a logout message when owl exits", "" ),75 "send a logout message when BarnOwl exits", "" ), 76 76 77 77 OWLVAR_BOOL( "rxping" /* %OwlVarStub */, 0, … … 137 137 OWLVAR_BOOL_FULL( "pseudologins" /* %OwlVarStub */, 0, 138 138 "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" 140 140 "location of users in your .anyone file. If a user is present\n" 141 141 "but sent no login message, or a user is not present that sent no\n" … … 145 145 OWLVAR_BOOL( "ignorelogins" /* %OwlVarStub */, 0, 146 146 "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" 149 149 "login or logout notifications.\n"), 150 150 … … 160 160 OWLVAR_BOOL( "loglogins" /* %OwlVarStub */, 0, 161 161 "Enable logging of login notifications", 162 "When this is enabled, Owl will loginlogin and logout notifications\n"162 "When this is enabled, BarnOwl will log login and logout notifications\n" 163 163 "for AIM, zephyr, or other protocols. If disabled Owl will not print\n" 164 164 "login or logout notifications.\n"), … … 201 201 OWLVAR_PATH( "newmsgproc" /* %OwlVarStub:newmsgproc */, NULL, 202 202 "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" 204 204 "messages. It will not be run again until the first\n" 205 205 "instance exits"), … … 229 229 "string to append to the end of the sepbar", 230 230 "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" 232 232 "be displayed on the right of the sepbar\n"), 233 233 … … 265 265 266 266 OWLVAR_STRING( "alert_action" /* %OwlVarStub */, "nop", 267 " owl command to execute for alert actions",267 "BarnOwl command to execute for alert actions", 268 268 "" ), 269 269 … … 276 276 "Styles may be created with the 'style' command.\n" 277 277 "Some built-in styles include:\n" 278 " default - the default owl formatting\n"278 " default - the default BarnOwl formatting\n" 279 279 " oneline - one line per-message\n" 280 280 " perl - legacy perl interface\n" … … 333 333 "cursor moves between messages being displayed.\n" 334 334 "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" 336 336 " when it needs to, and an attempt is made to\n" 337 337 " keep the current message roughly near\n"
Note: See TracChangeset
for help on using the changeset viewer.