barnowl-1.9-src/0000775000175000017500000000000012247034253013132 5ustar andersandersbarnowl-1.9-src/window.h0000664000175000017500000000505112247032546014616 0ustar andersanders#ifndef INC_BARNOWL_WINDOW_H #define INC_BARNOWL_WINDOW_H #include #include #include G_BEGIN_DECLS #define OWL_TYPE_WINDOW (owl_window_get_type ()) #define OWL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OWL_TYPE_WINDOW, OwlWindow)) #define OWL_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OWL_TYPE_WINDOW)) #define OWL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OWL_TYPE_WINDOW, OwlWindowClass)) #define OWL_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OWL_TYPE_WINDOW)) #define OWL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OWL_TYPE_WINDOW, OwlWindowClass)) typedef struct _owl_window OwlWindow; typedef struct _OwlWindowClass OwlWindowClass; typedef OwlWindow owl_window; /* meh */ struct _OwlWindowClass { GObjectClass parent_class; /* default implementations for signals */ void (*redraw)(owl_window *, WINDOW *); void (*resized)(owl_window *); }; GType owl_window_get_type(void); owl_window *owl_window_get_screen(void); owl_window *owl_window_new(owl_window *parent); void owl_window_unlink(owl_window *w); void owl_window_children_foreach(owl_window *parent, GFunc func, gpointer user_data); owl_window *owl_window_parent(owl_window *parent); owl_window *owl_window_first_child(owl_window *parent); owl_window *owl_window_next_sibling(owl_window *w); owl_window *owl_window_previous_sibling(owl_window *w); void owl_window_show(owl_window *w); void owl_window_show_all(owl_window *w); void owl_window_hide(owl_window *w); bool owl_window_is_shown(owl_window *w); bool owl_window_is_realized(owl_window *w); bool owl_window_is_toplevel(owl_window *w); bool owl_window_is_subwin(owl_window *w); void owl_window_set_cursor(owl_window *w); void owl_window_set_default_cursor(owl_window *w); void owl_window_dirty(owl_window *w); void owl_window_dirty_children(owl_window *w); void owl_window_redraw_scheduled(void); void owl_window_get_position(owl_window *w, int *nlines, int *ncols, int *begin_y, int *begin_x); void owl_window_set_position(owl_window *w, int nlines, int ncols, int begin_y, int begin_x); void owl_window_move(owl_window *w, int begin_y, int begin_x); void owl_window_resize(owl_window *w, int nlines, int ncols); GSource *owl_window_redraw_source_new(void); /* Standard callback functions in windowcb.c */ void owl_window_erase_cb(owl_window *w, WINDOW *win, void *user_data); void owl_window_fill_parent_cb(owl_window *parent, void *user_data); G_END_DECLS #endif /* INC_BARNOWL_WINDOW_H */ barnowl-1.9-src/wcwidth.c0000664000175000017500000003322312247032546014755 0ustar andersanders/* * This is an implementation of wcwidth() and wcswidth() (defined in * IEEE Std 1002.1-2001) for Unicode. * * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html * * In fixed-width output devices, Latin characters all occupy a single * "cell" position of equal width, whereas ideographic CJK characters * occupy two such cells. Interoperability between terminal-line * applications and (teletype-style) character terminals using the * UTF-8 encoding requires agreement on which character should advance * the cursor by how many cell positions. No established formal * standards exist at present on which Unicode character shall occupy * how many cell positions on character terminals. These routines are * a first attempt of defining such behavior based on simple rules * applied to data provided by the Unicode Consortium. * * For some graphical characters, the Unicode standard explicitly * defines a character-cell width via the definition of the East Asian * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. * In all these cases, there is no ambiguity about which width a * terminal shall use. For characters in the East Asian Ambiguous (A) * class, the width choice depends purely on a preference of backward * compatibility with either historic CJK or Western practice. * Choosing single-width for these characters is easy to justify as * the appropriate long-term solution, as the CJK practice of * displaying these characters as double-width comes from historic * implementation simplicity (8-bit encoded characters were displayed * single-width and 16-bit ones double-width, even for Greek, * Cyrillic, etc.) and not any typographic considerations. * * Much less clear is the choice of width for the Not East Asian * (Neutral) class. Existing practice does not dictate a width for any * of these characters. It would nevertheless make sense * typographically to allocate two character cells to characters such * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be * represented adequately with a single-width glyph. The following * routines at present merely assign a single-cell width to all * neutral characters, in the interest of simplicity. This is not * entirely satisfactory and should be reconsidered before * establishing a formal standard in this area. At the moment, the * decision which Not East Asian (Neutral) characters should be * represented by double-width glyphs cannot yet be answered by * applying a simple rule from the Unicode database content. Setting * up a proper standard for the behavior of UTF-8 character terminals * will require a careful analysis not only of each Unicode character, * but also of each presentation form, something the author of these * routines has avoided to do so far. * * http://www.unicode.org/unicode/reports/tr11/ * * Markus Kuhn -- 2007-05-26 (Unicode 5.0) * * Permission to use, copy, modify, and distribute this software * for any purpose and without fee is hereby granted. The author * disclaims all warranties with regard to this software. * * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ #include struct interval { /* noproto */ int first; int last; }; /* auxiliary function for binary search in interval table */ static int bisearch(wchar_t ucs, const struct interval *table, int max) { int min = 0; int mid; if (ucs < table[0].first || ucs > table[max].last) return 0; while (max >= min) { mid = (min + max) / 2; if (ucs > table[mid].last) min = mid + 1; else if (ucs < table[mid].first) max = mid - 1; else return 1; } return 0; } /* The following two functions define the column width of an ISO 10646 * character as follows: * * - The null character (U+0000) has a column width of 0. * * - Other C0/C1 control characters and DEL will lead to a return * value of -1. * * - Non-spacing and enclosing combining characters (general * category code Mn or Me in the Unicode database) have a * column width of 0. * * - SOFT HYPHEN (U+00AD) has a column width of 1. * * - Other format characters (general category code Cf in the Unicode * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. * * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) * have a column width of 0. * * - Spacing characters in the East Asian Wide (W) or East Asian * Full-width (F) category as defined in Unicode Technical * Report #11 have a column width of 2. * * - All remaining characters (including all printable * ISO 8859-1 and WGL4 characters, Unicode control characters, * etc.) have a column width of 1. * * This implementation assumes that wchar_t characters are encoded * in ISO 10646. */ int mk_wcwidth(wchar_t ucs) { /* sorted list of non-overlapping intervals of non-spacing characters */ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ static const struct interval combining[] = { { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, { 0xE0100, 0xE01EF } }; /* test for 8-bit control characters */ if (ucs == 0) return 0; if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) return -1; /* binary search in table of non-spacing characters */ if (bisearch(ucs, combining, sizeof(combining) / sizeof(struct interval) - 1)) return 0; /* if we arrive here, ucs is not a combining or C0/C1 control character */ return 1 + (ucs >= 0x1100 && (ucs <= 0x115f || /* Hangul Jamo init. consonants */ ucs == 0x2329 || ucs == 0x232a || (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f) || /* CJK ... Yi */ (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ (ucs >= 0xffe0 && ucs <= 0xffe6) || (ucs >= 0x20000 && ucs <= 0x2fffd) || (ucs >= 0x30000 && ucs <= 0x3fffd))); } int mk_wcswidth(const wchar_t *pwcs, size_t n) { int w, width = 0; for (;*pwcs && n-- > 0; pwcs++) if ((w = mk_wcwidth(*pwcs)) < 0) return -1; else width += w; return width; } /* * The following functions are the same as mk_wcwidth() and * mk_wcswidth(), except that spacing characters in the East Asian * Ambiguous (A) category as defined in Unicode Technical Report #11 * have a column width of 2. This variant might be useful for users of * CJK legacy encodings who want to migrate to UCS without changing * the traditional terminal character-width behaviour. It is not * otherwise recommended for general use. */ int mk_wcwidth_cjk(wchar_t ucs) { /* sorted list of non-overlapping intervals of East Asian Ambiguous * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ static const struct interval ambiguous[] = { { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } }; /* binary search in table of non-spacing characters */ if (bisearch(ucs, ambiguous, sizeof(ambiguous) / sizeof(struct interval) - 1)) return 2; return mk_wcwidth(ucs); } int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) { int w, width = 0; for (;*pwcs && n-- > 0; pwcs++) if ((w = mk_wcwidth_cjk(*pwcs)) < 0) return -1; else width += w; return width; } barnowl-1.9-src/tester.c0000664000175000017500000010476112247032546014620 0ustar andersanders#define OWL_PERL #define WINDOW FAKE_WINDOW #include "owl.h" #undef WINDOW #include "filterproc.h" #include #undef instr #include owl_global g; int numtests; int owl_regtest(void); int owl_util_regtest(void); int owl_dict_regtest(void); int owl_variable_regtest(void); int owl_filter_regtest(void); int owl_obarray_regtest(void); int owl_editwin_regtest(void); int owl_fmtext_regtest(void); int owl_smartfilter_regtest(void); int owl_history_regtest(void); int call_filter_regtest(void); extern void owl_perl_xs_init(pTHX); int main(int argc, char **argv, char **env) { FILE *rnull; FILE *wnull; char *perlerr; int status = 0; SCREEN *screen; if (argc <= 1) { fprintf(stderr, "Usage: %s --builtin|TEST.t|-le CODE\n", argv[0]); return 1; } /* initialize a fake ncurses, detached from std{in,out} */ wnull = fopen("/dev/null", "w"); rnull = fopen("/dev/null", "r"); screen = newterm("xterm", wnull, rnull); /* initialize global structures */ owl_global_init(&g); perlerr = owl_perlconfig_initperl(NULL, &argc, &argv, &env); if (perlerr) { endwin(); fprintf(stderr, "Internal perl error: %s\n", perlerr); status = 1; goto out; } owl_global_complete_setup(&g); owl_global_setup_default_filters(&g); owl_view_create(owl_global_get_current_view(&g), "main", owl_global_get_filter(&g, "all"), owl_global_get_style_by_name(&g, "default")); owl_function_firstmsg(); ENTER; SAVETMPS; if (strcmp(argv[1], "--builtin") == 0) { status = owl_regtest(); } else if (strcmp(argv[1], "-le") == 0 && argc > 2) { /* * 'prove' runs its harness perl with '-le CODE' to get some * information out. */ moreswitches("l"); eval_pv(argv[2], true); } else { sv_setpv(get_sv("0", false), argv[1]); sv_setpv(get_sv("main::test_prog", TRUE), argv[1]); eval_pv("do $main::test_prog; die($@) if($@)", true); } status = 0; FREETMPS; LEAVE; out: perl_destruct(owl_global_get_perlinterp(&g)); perl_free(owl_global_get_perlinterp(&g)); /* probably not necessary, but tear down the screen */ endwin(); delscreen(screen); fclose(rnull); fclose(wnull); return status; } int owl_regtest(void) { numtests = 0; int numfailures=0; /* printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS); */ numfailures += owl_util_regtest(); numfailures += owl_dict_regtest(); numfailures += owl_variable_regtest(); numfailures += owl_filter_regtest(); numfailures += owl_editwin_regtest(); numfailures += owl_fmtext_regtest(); numfailures += owl_smartfilter_regtest(); numfailures += owl_history_regtest(); numfailures += call_filter_regtest(); if (numfailures) { fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures); } printf("1..%d\n", numtests); return(numfailures); } #define FAIL_UNLESS(desc,pred) do { int __pred = (pred); \ numtests++; \ printf("%s %d %s", (__pred) ? "ok" : (numfailed++, "not ok"), numtests, desc); \ if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0) int owl_util_regtest(void) { int numfailed=0; char *s, *path, *home; printf("# BEGIN testing owl_util\n"); #define CHECK_STR_AND_FREE(desc, expected, expr) \ do { \ char *__value = (expr); \ FAIL_UNLESS((desc), !strcmp((expected), __value)); \ g_free(__value); \ } while (0) CHECK_STR_AND_FREE("owl_text_substitute 2", "fYZYZ", owl_text_substitute("foo", "o", "YZ")); CHECK_STR_AND_FREE("owl_text_substitute 3", "foo", owl_text_substitute("fYZYZ", "YZ", "o")); CHECK_STR_AND_FREE("owl_text_substitute 4", "/u/foo/meep", owl_text_substitute("~/meep", "~", "/u/foo")); FAIL_UNLESS("skiptokens 1", !strcmp("bar quux", skiptokens("foo bar quux", 1))); FAIL_UNLESS("skiptokens 2", !strcmp("meep", skiptokens("foo 'bar quux' meep", 2))); CHECK_STR_AND_FREE("expand_tabs 1", " hi", owl_text_expand_tabs("\thi")); CHECK_STR_AND_FREE("expand_tabs 2", " hi\nword tab", owl_text_expand_tabs("\thi\nword\ttab")); CHECK_STR_AND_FREE("expand_tabs 3", " 2 tabs", owl_text_expand_tabs("\t\t2 tabs")); CHECK_STR_AND_FREE("expand_tabs 4", "α ααααααα! ", owl_text_expand_tabs("α\tααααααα!\t")); CHECK_STR_AND_FREE("expand_tabs 5", "A AAA!! ", owl_text_expand_tabs("A\tAAA!!\t")); FAIL_UNLESS("skiptokens 1", !strcmp("world", skiptokens("hello world", 1))); FAIL_UNLESS("skiptokens 2", !strcmp("c d e", skiptokens("a b c d e", 2))); FAIL_UNLESS("skiptokens 3", !strcmp("\"b\" c d e", skiptokens("a \"b\" c d e", 1))); FAIL_UNLESS("skiptokens 4", !strcmp("c d e", skiptokens("a \"b\" c d e", 2))); FAIL_UNLESS("skiptokens 5", !strcmp("c d e", skiptokens("a \"'\" c d e", 2))); #define CHECK_QUOTING(desc, unquoted, quoted) \ do { \ int __argc; \ char *__quoted = owl_arg_quote(unquoted); \ char **__argv; \ FAIL_UNLESS(desc, !strcmp(quoted, __quoted)); \ __argv = owl_parseline(__quoted, &__argc); \ FAIL_UNLESS(desc " - arg count", __argc == 1); \ FAIL_UNLESS(desc " - null-terminated", \ __argv[__argc] == NULL); \ FAIL_UNLESS(desc " - parsed", \ !strcmp(__argv[0], unquoted)); \ g_strfreev(__argv); \ g_free(__quoted); \ } while (0) CHECK_QUOTING("boring text", "mango", "mango"); CHECK_QUOTING("spaces", "mangos are tasty", "'mangos are tasty'"); CHECK_QUOTING("single quotes", "mango's", "\"mango's\""); CHECK_QUOTING("double quotes", "he said \"mangos are tasty\"", "'he said \"mangos are tasty\"'"); CHECK_QUOTING("both quotes", "he said \"mango's are tasty even when you put in " "a random apostrophe\"", "\"he said \"'\"'\"mango's are tasty even when you put in " "a random apostrophe\"'\"'\"\""); CHECK_QUOTING("quote monster", "'\"\"'\"'''\"", "\"" "'" "\"'\"'\"" "\"'\"'\"" "'" "\"'\"'\"" "'" "'" "'" "\"'\"'\"" "\""); GString *quoted = g_string_new(""); owl_string_appendf_quoted(quoted, "%q foo %q%q %s %", "hello", "world is", "can't"); FAIL_UNLESS("owl_string_appendf", !strcmp(quoted->str, "hello foo 'world is'\"can't\" %s %")); g_string_free(quoted, true); s = owl_util_baseclass("barnowl"); FAIL_UNLESS("baseclass barnowl", !strcmp("barnowl", s)); g_free(s); s = owl_util_baseclass("unbarnowl"); FAIL_UNLESS("baseclass unbarnowl", !strcmp("barnowl", s)); g_free(s); s = owl_util_baseclass("unununbarnowl.d.d"); FAIL_UNLESS("baseclass unununbarnowl.d.d", !strcmp("barnowl", s)); g_free(s); s = owl_util_baseclass("ununun.d.d"); FAIL_UNLESS("baseclass ununun.d.d", !strcmp("", s)); g_free(s); s = owl_util_baseclass("d.d.d.d"); FAIL_UNLESS("baseclass d.d.d.d", !strcmp("d", s)); g_free(s); s = owl_util_baseclass("n.d.d.d"); FAIL_UNLESS("baseclass n.d.d.d", !strcmp("n", s)); g_free(s); s = owl_util_baseclass("ununun."); FAIL_UNLESS("baseclass ununun.", !strcmp(".", s)); g_free(s); s = owl_util_baseclass("unununu"); FAIL_UNLESS("baseclass unununu", !strcmp("u", s)); g_free(s); s = owl_util_makepath("foo/bar"); FAIL_UNLESS("makepath foo/bar", !strcmp("foo/bar", s)); g_free(s); s = owl_util_makepath("//foo///bar"); FAIL_UNLESS("makepath //foo///bar", !strcmp("/foo/bar", s)); g_free(s); s = owl_util_makepath("foo/~//bar/"); FAIL_UNLESS("makepath foo/~//bar/", !strcmp("foo/~/bar/", s)); g_free(s); s = owl_util_makepath("~thisuserhadreallybetternotexist/foobar/"); FAIL_UNLESS("makepath ~thisuserhadreallybetternotexist/foobar/", !strcmp("~thisuserhadreallybetternotexist/foobar/", s)); g_free(s); home = g_strdup(owl_global_get_homedir(&g)); s = owl_util_makepath("~"); FAIL_UNLESS("makepath ~", !strcmp(home, s)); g_free(s); path = g_build_filename(home, "foo/bar/baz", NULL); s = owl_util_makepath("~///foo/bar//baz"); FAIL_UNLESS("makepath ~///foo/bar//baz", !strcmp(path, s)); g_free(s); g_free(path); g_free(home); home = owl_util_homedir_for_user("root"); if (home == NULL) { /* Just make some noise so we notice. */ home = g_strdup(""); fprintf(stderr, "owl_util_homedir_for_user failed"); } s = owl_util_makepath("~root"); FAIL_UNLESS("makepath ~root", !strcmp(home, s)); g_free(s); path = g_build_filename(home, "foo/bar/baz", NULL); s = owl_util_makepath("~root///foo/bar//baz"); FAIL_UNLESS("makepath ~root///foo/bar//baz", !strcmp(path, s)); g_free(s); g_free(path); g_free(home); /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */ printf("# END testing owl_util (%d failures)\n", numfailed); return(numfailed); } int owl_dict_regtest(void) { owl_dict d; GPtrArray *l; int numfailed=0; char *av = g_strdup("aval"), *bv = g_strdup("bval"), *cv = g_strdup("cval"), *dv = g_strdup("dval"); printf("# BEGIN testing owl_dict\n"); owl_dict_create(&d); FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", bv, owl_dict_noop_delete)); FAIL_UNLESS("insert d", 0==owl_dict_insert_element(&d, "d", dv, owl_dict_noop_delete)); FAIL_UNLESS("insert a", 0==owl_dict_insert_element(&d, "a", av, owl_dict_noop_delete)); FAIL_UNLESS("insert c", 0==owl_dict_insert_element(&d, "c", cv, owl_dict_noop_delete)); FAIL_UNLESS("reinsert d (no replace)", -2==owl_dict_insert_element(&d, "d", dv, 0)); FAIL_UNLESS("find a", av==owl_dict_find_element(&d, "a")); FAIL_UNLESS("find b", bv==owl_dict_find_element(&d, "b")); FAIL_UNLESS("find c", cv==owl_dict_find_element(&d, "c")); FAIL_UNLESS("find d", dv==owl_dict_find_element(&d, "d")); FAIL_UNLESS("find e (non-existent)", NULL==owl_dict_find_element(&d, "e")); FAIL_UNLESS("remove d", dv==owl_dict_remove_element(&d, "d")); FAIL_UNLESS("find d (post-removal)", NULL==owl_dict_find_element(&d, "d")); FAIL_UNLESS("get_size", 3==owl_dict_get_size(&d)); l = owl_dict_get_keys(&d); FAIL_UNLESS("get_keys result size", 3 == l->len); /* these assume the returned keys are sorted */ FAIL_UNLESS("get_keys result val", 0 == strcmp("a", l->pdata[0])); FAIL_UNLESS("get_keys result val", 0 == strcmp("b", l->pdata[1])); FAIL_UNLESS("get_keys result val", 0 == strcmp("c", l->pdata[2])); owl_ptr_array_free(l, g_free); owl_dict_cleanup(&d, NULL); g_free(av); g_free(bv); g_free(cv); g_free(dv); /* if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n"); */ printf("# END testing owl_dict (%d failures)\n", numfailed); return(numfailed); } int owl_variable_regtest(void) { owl_vardict vd; owl_variable *var; int numfailed=0; char *value; const void *v; printf("# BEGIN testing owl_variable\n"); FAIL_UNLESS("setup", 0==owl_variable_dict_setup(&vd)); FAIL_UNLESS("get bool var", NULL != (var = owl_variable_get_var(&vd, "rxping"))); FAIL_UNLESS("get bool", 0 == owl_variable_get_bool(var)); FAIL_UNLESS("get bool (no such)", NULL == owl_variable_get_var(&vd, "mumble")); FAIL_UNLESS("get bool as string", !strcmp((value = owl_variable_get_tostring(var)), "off")); g_free(value); FAIL_UNLESS("set bool 1", 0 == owl_variable_set_bool_on(var)); FAIL_UNLESS("get bool 2", 1 == owl_variable_get_bool(var)); FAIL_UNLESS("set bool 3", 0 == owl_variable_set_fromstring(var, "off", 0)); FAIL_UNLESS("get bool 4", 0 == owl_variable_get_bool(var)); FAIL_UNLESS("set bool 5", -1 == owl_variable_set_fromstring(var, "xxx", 0)); FAIL_UNLESS("get bool 6", 0 == owl_variable_get_bool(var)); FAIL_UNLESS("get string var", NULL != (var = owl_variable_get_var(&vd, "logpath"))); FAIL_UNLESS("get string", 0 == strcmp("~/zlog/people", owl_variable_get_string(var))); FAIL_UNLESS("set string 7", 0 == owl_variable_set_string(var, "whee")); FAIL_UNLESS("get string", !strcmp("whee", owl_variable_get_string(var))); FAIL_UNLESS("get int var", NULL != (var = owl_variable_get_var(&vd, "typewinsize"))); FAIL_UNLESS("get int", 8 == owl_variable_get_int(var)); FAIL_UNLESS("get int (no such)", NULL == owl_variable_get_var(&vd, "mumble")); FAIL_UNLESS("get int as string", !strcmp((value = owl_variable_get_tostring(var)), "8")); g_free(value); FAIL_UNLESS("set int 1", 0 == owl_variable_set_int(var, 12)); FAIL_UNLESS("get int 2", 12 == owl_variable_get_int(var)); FAIL_UNLESS("set int 1b", -1 == owl_variable_set_int(var, -3)); FAIL_UNLESS("get int 2b", 12 == owl_variable_get_int(var)); FAIL_UNLESS("set int 3", 0 == owl_variable_set_fromstring(var, "9", 0)); FAIL_UNLESS("get int 4", 9 == owl_variable_get_int(var)); FAIL_UNLESS("set int 5", -1 == owl_variable_set_fromstring(var, "xxx", 0)); FAIL_UNLESS("set int 6", -1 == owl_variable_set_fromstring(var, "", 0)); FAIL_UNLESS("get int 7", 9 == owl_variable_get_int(var)); owl_variable_dict_newvar_string(&vd, "stringvar", "", "", "testval"); FAIL_UNLESS("get new string var", NULL != (var = owl_variable_get_var(&vd, "stringvar"))); FAIL_UNLESS("get new string var", NULL != (v = owl_variable_get(var))); FAIL_UNLESS("get new string val", !strcmp("testval", owl_variable_get_string(var))); owl_variable_set_string(var, "new val"); FAIL_UNLESS("update string val", !strcmp("new val", owl_variable_get_string(var))); owl_variable_dict_newvar_int(&vd, "intvar", "", "", 47); FAIL_UNLESS("get new int var", NULL != (var = owl_variable_get_var(&vd, "intvar"))); FAIL_UNLESS("get new int var", NULL != (v = owl_variable_get(var))); FAIL_UNLESS("get new int val", 47 == owl_variable_get_int(var)); owl_variable_set_int(var, 17); FAIL_UNLESS("update int val", 17 == owl_variable_get_int(var)); owl_variable_dict_newvar_bool(&vd, "boolvar", "", "", 1); FAIL_UNLESS("get new bool var", NULL != (var = owl_variable_get_var(&vd, "boolvar"))); FAIL_UNLESS("get new bool var", NULL != (v = owl_variable_get(var))); FAIL_UNLESS("get new bool val", owl_variable_get_bool(var)); owl_variable_set_bool_off(var); FAIL_UNLESS("update bool val", !owl_variable_get_bool(var)); owl_variable_dict_newvar_string(&vd, "nullstringvar", "", "", NULL); FAIL_UNLESS("get new string (NULL) var", NULL != (var = owl_variable_get_var(&vd, "nullstringvar"))); FAIL_UNLESS("get string (NULL)", NULL == (value = owl_variable_get_tostring(var))); g_free(value); var = owl_variable_get_var(&vd, "zsigproc"); FAIL_UNLESS("get string (NULL) 2", NULL == (value = owl_variable_get_tostring(var))); g_free(value); owl_variable_dict_cleanup(&vd); /* if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n"); */ printf("# END testing owl_variable (%d failures)\n", numfailed); return(numfailed); } static int owl_filter_test_string(const char *filt, const owl_message *m, int shouldmatch) { owl_filter *f; int ok; int failed = 0; if ((f = owl_filter_new_fromstring("test-filter", filt)) == NULL) { printf("not ok can't parse %s\n", filt); failed = 1; goto out; } ok = owl_filter_message_match(f, m); if((shouldmatch && !ok) || (!shouldmatch && ok)) { printf("not ok match %s (got %d, expected %d)\n", filt, ok, shouldmatch); failed = 1; } out: owl_filter_delete(f); if(!failed) { printf("ok %s %s\n", shouldmatch ? "matches" : "doesn't match", filt); } return failed; } int owl_filter_regtest(void) { int numfailed=0; owl_message m; owl_filter *f1, *f2, *f3, *f4, *f5; owl_message_init(&m); owl_message_set_type_zephyr(&m); owl_message_set_direction_in(&m); owl_message_set_class(&m, "owl"); owl_message_set_instance(&m, "tester"); owl_message_set_sender(&m, "owl-user"); owl_message_set_recipient(&m, "joe"); owl_message_set_attribute(&m, "foo", "bar"); #define TEST_FILTER(f, e) do { \ numtests++; \ numfailed += owl_filter_test_string(f, &m, e); \ } while(0) TEST_FILTER("true", 1); TEST_FILTER("false", 0); TEST_FILTER("( true )", 1); TEST_FILTER("not false", 1); TEST_FILTER("( true ) or ( false )", 1); TEST_FILTER("true and false", 0); TEST_FILTER("( true or true ) or ( ( false ) )", 1); TEST_FILTER("class owl", 1); TEST_FILTER("class ^owl$", 1); TEST_FILTER("instance test", 1); TEST_FILTER("instance ^test$", 0); TEST_FILTER("instance ^tester$", 1); TEST_FILTER("foo bar", 1); TEST_FILTER("class owl and instance tester", 1); TEST_FILTER("type ^zephyr$ and direction ^in$ and ( class ^owl$ or instance ^owl$ )", 1); /* Order of operations and precedence */ TEST_FILTER("not true or false", 0); TEST_FILTER("true or true and false", 0); TEST_FILTER("true and true and false or true", 1); TEST_FILTER("false and false or true", 1); TEST_FILTER("true and false or false", 0); f1 = owl_filter_new_fromstring("f1", "class owl"); owl_global_add_filter(&g, f1); TEST_FILTER("filter f1", 1); owl_global_remove_filter(&g, "f1"); /* Test recursion prevention */ FAIL_UNLESS("self reference", (f2 = owl_filter_new_fromstring("test", "filter test")) == NULL); owl_filter_delete(f2); /* mutual recursion */ f3 = owl_filter_new_fromstring("f3", "filter f4"); owl_global_add_filter(&g, f3); FAIL_UNLESS("mutual recursion", (f4 = owl_filter_new_fromstring("f4", "filter f3")) == NULL); owl_global_remove_filter(&g, "f3"); owl_filter_delete(f4); /* support referencing a filter several times */ FAIL_UNLESS("DAG", (f5 = owl_filter_new_fromstring("dag", "filter f1 or filter f1")) != NULL); owl_filter_delete(f5); owl_message_cleanup(&m); return 0; } int owl_editwin_regtest(void) { int numfailed = 0; const char *p; owl_editwin *oe; const char *autowrap_string = "we feel our owls should live " "closer to our ponies."; printf("# BEGIN testing owl_editwin\n"); oe = owl_editwin_new(NULL, 80, 80, OWL_EDITWIN_STYLE_MULTILINE, NULL); /* TODO: make the strings a little more lenient w.r.t trailing whitespace */ /* check paragraph fill */ owl_editwin_insert_string(oe, "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.\n\nblah"); owl_editwin_move_to_top(oe); owl_editwin_fill_paragraph(oe); p = owl_editwin_get_text(oe); FAIL_UNLESS("text was correctly wrapped", p && !strcmp(p, "blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n" "blah blah blah.\n" "\n" "blah")); owl_editwin_unref(oe); oe = NULL; oe = owl_editwin_new(NULL, 80, 80, OWL_EDITWIN_STYLE_MULTILINE, NULL); /* check that lines ending with ". " correctly fill */ owl_editwin_insert_string(oe, "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. \n\nblah"); owl_editwin_move_to_top(oe); owl_editwin_fill_paragraph(oe); p = owl_editwin_get_text(oe); FAIL_UNLESS("text was correctly wrapped", p && !strcmp(p, "blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n" "blah blah blah. \n" "\n" "blah")); owl_editwin_unref(oe); oe = NULL; /* Test owl_editwin_move_to_beginning_of_line. */ oe = owl_editwin_new(NULL, 80, 80, OWL_EDITWIN_STYLE_MULTILINE, NULL); owl_editwin_insert_string(oe, "\n"); owl_editwin_insert_string(oe, "12345678\n"); owl_editwin_insert_string(oe, "\n"); owl_editwin_insert_string(oe, "abcdefg\n"); owl_editwin_move_to_top(oe); FAIL_UNLESS("already at beginning of line", owl_editwin_move_to_beginning_of_line(oe) == 0); owl_editwin_line_move(oe, 1); owl_editwin_point_move(oe, 5); FAIL_UNLESS("find beginning of line after empty first line", owl_editwin_move_to_beginning_of_line(oe) == -5); owl_editwin_line_move(oe, 1); FAIL_UNLESS("find beginning empty middle line", owl_editwin_move_to_beginning_of_line(oe) == 0); owl_editwin_line_move(oe, 1); owl_editwin_point_move(oe, 2); FAIL_UNLESS("find beginning of line after empty middle line", owl_editwin_move_to_beginning_of_line(oe) == -2); owl_editwin_unref(oe); oe = NULL; /* Test automatic line-wrapping. */ owl_global_set_edit_maxwrapcols(&g, 10); oe = owl_editwin_new(NULL, 80, 80, OWL_EDITWIN_STYLE_MULTILINE, NULL); for (p = autowrap_string; *p; p++) { owl_input j; j.ch = *p; j.uch = *p; /* Assuming ASCII. */ owl_editwin_process_char(oe, j); } p = owl_editwin_get_text(oe); FAIL_UNLESS("text was automatically wrapped", p && !strcmp(p, "we feel\n" "our owls\n" "should\n" "live\n" "closer to\n" "our\n" "ponies.")); owl_editwin_unref(oe); oe = NULL; owl_global_set_edit_maxwrapcols(&g, 70); /* Test owl_editwin_current_column. */ oe = owl_editwin_new(NULL, 80, 80, OWL_EDITWIN_STYLE_MULTILINE, NULL); FAIL_UNLESS("initial column zero", owl_editwin_current_column(oe) == 0); owl_editwin_insert_string(oe, "abcdef"); FAIL_UNLESS("simple insert", owl_editwin_current_column(oe) == 6); owl_editwin_insert_string(oe, "\t"); FAIL_UNLESS("insert tabs", owl_editwin_current_column(oe) == 8); owl_editwin_insert_string(oe, "123\n12\t3"); FAIL_UNLESS("newline with junk", owl_editwin_current_column(oe) == 9); owl_editwin_move_to_beginning_of_line(oe); FAIL_UNLESS("beginning of line", owl_editwin_current_column(oe) == 0); owl_editwin_unref(oe); oe = NULL; printf("# END testing owl_editwin (%d failures)\n", numfailed); return numfailed; } int owl_fmtext_regtest(void) { int numfailed = 0; int start, end; owl_fmtext fm1; owl_fmtext fm2; owl_regex re; char *str; printf("# BEGIN testing owl_fmtext\n"); owl_fmtext_init_null(&fm1); owl_fmtext_init_null(&fm2); /* Verify text gets correctly appended. */ owl_fmtext_append_normal(&fm1, "1234567898"); owl_fmtext_append_fmtext(&fm2, &fm1); FAIL_UNLESS("string lengths correct", owl_fmtext_num_bytes(&fm2) == strlen(owl_fmtext_get_text(&fm2))); /* Test owl_fmtext_num_lines. */ owl_fmtext_clear(&fm1); FAIL_UNLESS("empty line correct", owl_fmtext_num_lines(&fm1) == 0); owl_fmtext_append_normal(&fm1, "12345\n67898"); FAIL_UNLESS("trailing chars correct", owl_fmtext_num_lines(&fm1) == 2); owl_fmtext_append_normal(&fm1, "\n"); FAIL_UNLESS("trailing newline correct", owl_fmtext_num_lines(&fm1) == 2); owl_fmtext_append_bold(&fm1, ""); FAIL_UNLESS("trailing attributes correct", owl_fmtext_num_lines(&fm1) == 2); /* Test owl_fmtext_truncate_lines */ owl_fmtext_clear(&fm1); owl_fmtext_append_normal(&fm1, "0\n1\n2\n3\n4\n"); owl_fmtext_clear(&fm2); owl_fmtext_truncate_lines(&fm1, 1, 3, &fm2); str = owl_fmtext_print_plain(&fm2); FAIL_UNLESS("lines corrected truncated", str && !strcmp(str, "1\n2\n3\n")); g_free(str); owl_fmtext_clear(&fm2); owl_fmtext_truncate_lines(&fm1, 1, 5, &fm2); str = owl_fmtext_print_plain(&fm2); FAIL_UNLESS("lines corrected truncated", str && !strcmp(str, "1\n2\n3\n4\n")); g_free(str); /* Test owl_fmtext_truncate_cols. */ owl_fmtext_clear(&fm1); owl_fmtext_append_normal(&fm1, "123456789012345\n"); owl_fmtext_append_normal(&fm1, "123456789\n"); owl_fmtext_append_normal(&fm1, "1234567890\n"); owl_fmtext_clear(&fm2); owl_fmtext_truncate_cols(&fm1, 4, 9, &fm2); str = owl_fmtext_print_plain(&fm2); FAIL_UNLESS("columns correctly truncated", str && !strcmp(str, "567890" "56789\n" "567890")); g_free(str); owl_fmtext_clear(&fm1); owl_fmtext_append_normal(&fm1, "12\t1234"); owl_fmtext_append_bold(&fm1, "56\n"); owl_fmtext_append_bold(&fm1, "12345678\t\n"); owl_fmtext_clear(&fm2); owl_fmtext_truncate_cols(&fm1, 4, 13, &fm2); str = owl_fmtext_print_plain(&fm2); FAIL_UNLESS("columns correctly truncated", str && !strcmp(str, " 123456" "5678 ")); g_free(str); /* Test owl_fmtext_expand_tabs. */ owl_fmtext_clear(&fm1); owl_fmtext_append_normal(&fm1, "12\t1234"); owl_fmtext_append_bold(&fm1, "567\t1\n12345678\t1"); owl_fmtext_clear(&fm2); owl_fmtext_expand_tabs(&fm1, &fm2, 0); str = owl_fmtext_print_plain(&fm2); FAIL_UNLESS("no tabs remaining", strchr(str, '\t') == NULL); FAIL_UNLESS("tabs corrected expanded", str && !strcmp(str, "12 1234567 1\n" "12345678 1")); g_free(str); owl_fmtext_clear(&fm2); owl_fmtext_expand_tabs(&fm1, &fm2, 1); str = owl_fmtext_print_plain(&fm2); FAIL_UNLESS("no tabs remaining", strchr(str, '\t') == NULL); FAIL_UNLESS("tabs corrected expanded", str && !strcmp(str, "12 1234567 1\n" "12345678 1")); g_free(str); /* Test owl_fmtext_search. */ owl_fmtext_clear(&fm1); owl_fmtext_append_normal(&fm1, "123123123123"); owl_regex_create(&re, "12"); { int count = 0, offset; offset = owl_fmtext_search(&fm1, &re, 0); while (offset >= 0) { FAIL_UNLESS("search matches", !strncmp("12", owl_fmtext_get_text(&fm1) + offset, 2)); count++; offset = owl_fmtext_search(&fm1, &re, offset+1); } FAIL_UNLESS("exactly four matches", count == 4); } owl_regex_cleanup(&re); /* Test owl_fmtext_line_number. */ owl_fmtext_clear(&fm1); owl_fmtext_append_normal(&fm1, "123\n456\n"); owl_fmtext_append_bold(&fm1, ""); FAIL_UNLESS("lines start at 0", 0 == owl_fmtext_line_number(&fm1, 0)); FAIL_UNLESS("trailing formatting characters part of false line", 2 == owl_fmtext_line_number(&fm1, owl_fmtext_num_bytes(&fm1))); owl_regex_create_quoted(&re, "456"); FAIL_UNLESS("correctly find second line (line 1)", 1 == owl_fmtext_line_number(&fm1, owl_fmtext_search(&fm1, &re, 0))); owl_regex_cleanup(&re); /* Test owl_fmtext_line_extents. */ owl_fmtext_clear(&fm1); owl_fmtext_append_normal(&fm1, "123\n456\n789"); owl_fmtext_line_extents(&fm1, 1, &start, &end); FAIL_UNLESS("line contents", !strncmp("456\n", owl_fmtext_get_text(&fm1)+start, end-start)); owl_fmtext_line_extents(&fm1, 2, &start, &end); FAIL_UNLESS("point to end of buffer", end == owl_fmtext_num_bytes(&fm1)); owl_fmtext_cleanup(&fm1); owl_fmtext_cleanup(&fm2); printf("# END testing owl_fmtext (%d failures)\n", numfailed); return numfailed; } static int owl_smartfilter_test_equals(const char *filtname, const char *expected) { owl_filter *f = NULL; char *filtstr = NULL; int failed = 0; f = owl_global_get_filter(&g, filtname); if (f == NULL) { printf("not ok filter missing: %s\n", filtname); failed = 1; goto out; } /* TODO: Come up with a better way to test this. */ filtstr = owl_filter_print(f); if (strcmp(expected, filtstr)) { printf("not ok filter incorrect: |%s| instead of |%s|\n", filtstr, expected); failed = 1; goto out; } out: g_free(filtstr); return failed; } static int owl_classinstfilt_test(const char *c, const char *i, int related, const char *expected) { char *filtname = NULL; int failed = 0; filtname = owl_function_classinstfilt(c, i, related); if (filtname == NULL) { printf("not ok null filtname: %s %s %s\n", c, i ? i : "(null)", related ? "related" : "not related"); failed = 1; goto out; } if (owl_smartfilter_test_equals(filtname, expected)) { failed = 1; goto out; } out: if (!failed) { printf("ok %s\n", filtname); } if (filtname) owl_global_remove_filter(&g, filtname); g_free(filtname); return failed; } static int owl_zuserfilt_test(const char *longuser, const char *expected) { char *filtname = NULL; int failed = 0; filtname = owl_function_zuserfilt(longuser); if (filtname == NULL) { printf("not ok null filtname: %s\n", longuser); failed = 1; goto out; } if (owl_smartfilter_test_equals(filtname, expected)) { failed = 1; goto out; } out: if (!failed) { printf("ok %s\n", filtname); } if (filtname) owl_global_remove_filter(&g, filtname); g_free(filtname); return failed; } int owl_smartfilter_regtest(void) { int numfailed = 0; printf("# BEGIN testing owl_smartfilter\n"); /* Check classinst making. */ #define TEST_CLASSINSTFILT(c, i, r, e) do { \ numtests++; \ numfailed += owl_classinstfilt_test(c, i, r, e); \ } while (0) TEST_CLASSINSTFILT("message", NULL, false, "class ^message$\n"); TEST_CLASSINSTFILT("message", NULL, true, "class ^(un)*message(\\.d)*$\n"); TEST_CLASSINSTFILT("message", "personal", false, "class ^message$ and instance ^personal$\n"); TEST_CLASSINSTFILT("message", "personal", true, "class ^(un)*message(\\.d)*$ and ( instance ^(un)*personal(\\.d)*$ )\n"); TEST_CLASSINSTFILT("message", "evil\tinstance", false, "class ^message$ and instance '^evil\tinstance$'\n"); TEST_CLASSINSTFILT("message", "evil instance", false, "class ^message$ and instance '^evil instance$'\n"); TEST_CLASSINSTFILT("message", "evil'instance", false, "class ^message$ and instance \"^evil'instance$\"\n"); TEST_CLASSINSTFILT("message", "evil\"instance", false, "class ^message$ and instance '^evil\"instance$'\n"); TEST_CLASSINSTFILT("message", "evil$instance", false, "class ^message$ and instance ^evil\\$instance$\n"); #define TEST_ZUSERFILT(l, e) do { \ numtests++; \ numfailed += owl_zuserfilt_test(l, e); \ } while (0) TEST_ZUSERFILT("user", "( type ^zephyr$ and filter personal and " "( ( direction ^in$ and sender " "^user$" " ) or ( direction ^out$ and recipient " "^user$" " ) ) ) or ( ( class ^login$ ) and ( sender " "^user$" " ) )\n"); TEST_ZUSERFILT("very evil\t.user", "( type ^zephyr$ and filter personal and " "( ( direction ^in$ and sender " "'^very evil\t\\.user$'" " ) or ( direction ^out$ and recipient " "'^very evil\t\\.user$'" " ) ) ) or ( ( class ^login$ ) and ( sender " "'^very evil\t\\.user$'" " ) )\n"); printf("# END testing owl_smartfilter (%d failures)\n", numfailed); return numfailed; } int owl_history_regtest(void) { int numfailed = 0; int i; owl_history h; printf("# BEGIN testing owl_history\n"); owl_history_init(&h); /* Operations on empty history. */ FAIL_UNLESS("prev NULL", owl_history_get_prev(&h) == NULL); FAIL_UNLESS("next NULL", owl_history_get_next(&h) == NULL); FAIL_UNLESS("untouched", !owl_history_is_touched(&h)); /* Insert a few records. */ owl_history_store(&h, "a", false); owl_history_store(&h, "b", false); owl_history_store(&h, "c", false); owl_history_store(&h, "d", true); /* Walk up and down the history a bit. */ FAIL_UNLESS("untouched", !owl_history_is_touched(&h)); FAIL_UNLESS("prev c", strcmp(owl_history_get_prev(&h), "c") == 0); FAIL_UNLESS("touched", owl_history_is_touched(&h)); FAIL_UNLESS("next d", strcmp(owl_history_get_next(&h), "d") == 0); FAIL_UNLESS("untouched", !owl_history_is_touched(&h)); FAIL_UNLESS("next NULL", owl_history_get_next(&h) == NULL); FAIL_UNLESS("prev c", strcmp(owl_history_get_prev(&h), "c") == 0); FAIL_UNLESS("prev b", strcmp(owl_history_get_prev(&h), "b") == 0); FAIL_UNLESS("prev a", strcmp(owl_history_get_prev(&h), "a") == 0); FAIL_UNLESS("prev NULL", owl_history_get_prev(&h) == NULL); /* Now insert something. It should reset and blow away 'd'. */ owl_history_store(&h, "e", false); FAIL_UNLESS("untouched", !owl_history_is_touched(&h)); FAIL_UNLESS("next NULL", owl_history_get_next(&h) == NULL); FAIL_UNLESS("prev c", strcmp(owl_history_get_prev(&h), "c") == 0); FAIL_UNLESS("touched", owl_history_is_touched(&h)); FAIL_UNLESS("next e", strcmp(owl_history_get_next(&h), "e") == 0); FAIL_UNLESS("untouched", !owl_history_is_touched(&h)); /* Lines get de-duplicated on insert. */ owl_history_store(&h, "e", false); owl_history_store(&h, "e", false); owl_history_store(&h, "e", false); FAIL_UNLESS("prev c", strcmp(owl_history_get_prev(&h), "c") == 0); FAIL_UNLESS("next e", strcmp(owl_history_get_next(&h), "e") == 0); /* But a partial is not deduplicated, as it'll go away soon. */ owl_history_store(&h, "e", true); FAIL_UNLESS("prev e", strcmp(owl_history_get_prev(&h), "e") == 0); FAIL_UNLESS("prev c", strcmp(owl_history_get_prev(&h), "c") == 0); FAIL_UNLESS("next e", strcmp(owl_history_get_next(&h), "e") == 0); FAIL_UNLESS("next e", strcmp(owl_history_get_next(&h), "e") == 0); /* Reset moves to the front... */ owl_history_store(&h, "f", true); FAIL_UNLESS("prev e", strcmp(owl_history_get_prev(&h), "e") == 0); FAIL_UNLESS("prev c", strcmp(owl_history_get_prev(&h), "c") == 0); owl_history_reset(&h); FAIL_UNLESS("untouched", !owl_history_is_touched(&h)); /* ...and destroys any pending partial entry... */ FAIL_UNLESS("prev c", strcmp(owl_history_get_prev(&h), "c") == 0); FAIL_UNLESS("prev b", strcmp(owl_history_get_prev(&h), "b") == 0); /* ...but not non-partial ones. */ owl_history_reset(&h); FAIL_UNLESS("untouched", !owl_history_is_touched(&h)); /* Finally, check we are bounded by OWL_HISTORYSIZE. */ for (i = 0; i < OWL_HISTORYSIZE; i++) { char *string = g_strdup_printf("mango%d", i); owl_history_store(&h, string, false); g_free(string); } /* The OWL_HISTORYSIZE'th prev gets NULL. */ for (i = OWL_HISTORYSIZE - 2; i >= 0; i--) { char *string = g_strdup_printf("mango%d", i); FAIL_UNLESS("prev mango_N", strcmp(owl_history_get_prev(&h), string) == 0); g_free(string); } FAIL_UNLESS("prev NULL", owl_history_get_prev(&h) == NULL); owl_history_cleanup(&h); printf("# END testing owl_history (%d failures)\n", numfailed); return numfailed; } int call_filter_regtest(void) { int numfailed = 0; int ret; char *out = NULL; int status; printf("# BEGIN testing call_filter\n"); const char *cat_argv[] = { "cat", NULL }; ret = call_filter(cat_argv, "Mangos!", &out, &status); FAIL_UNLESS("call_filter cat", (ret == 0 && status == 0 && strcmp(out, "Mangos!") == 0)); g_free(out); out = NULL; ret = call_filter(cat_argv, "", &out, &status); FAIL_UNLESS("call_filter cat", (ret == 0 && status == 0 && strcmp(out, "") == 0)); g_free(out); out = NULL; ret = call_filter(cat_argv, NULL, &out, &status); FAIL_UNLESS("call_filter cat", (ret == 0 && status == 0 && strcmp(out, "") == 0)); g_free(out); out = NULL; printf("# END testing call_filter (%d failures)\n", numfailed); return numfailed; } barnowl-1.9-src/barnowl0000775000175000017500000000061512247032546014531 0ustar andersanders#!/bin/sh # This is a wrapper script to point BARNOWL_DATA_DIR at the source dir # if we're running from a build tree. barnowl.bin is the actual built # binary. SRCDIR=`dirname "${0}"` EXE="$0.bin" if test ! -x "$EXE"; then echo "Cannot find $EXE" >&2 exit 1 fi BARNOWL_DATA_DIR="$SRCDIR/perl/" BARNOWL_BIN_DIR="$SRCDIR/" export BARNOWL_DATA_DIR export BARNOWL_BIN_DIR exec "$EXE" "$@" barnowl-1.9-src/install-sh0000755000175000017500000003325512247034253015144 0ustar andersanders#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: barnowl-1.9-src/perlglue.xs0000664000175000017500000002457612247032546015346 0ustar andersanders/* -*- mode: c; indent-tabs-mode: t; c-basic-offset: 8 -*- */ #define OWL_PERL #include "owl.h" #define SV_IS_CODEREF(sv) (SvROK((sv)) && SvTYPE(SvRV((sv))) == SVt_PVCV) typedef char utf8; /************************************************************* * NOTE ************************************************************* * These functions, when they are intended to be user-visible, * are documented in perl/lib/BarnOwl.pm. If you add functions * to this file, add the appropriate documentation there! * * If the function is simple enough, we simply define its * entire functionality here in XS. If, however, it needs * complex argument processing or something, we define a * simple version here that takes arguments in as flat a * manner as possible, to simplify the XS code, put it in * BarnOwl::Internal::, and write a perl wrapper in BarnOwl.pm * that munges the arguments as appropriate and calls the * internal version. */ MODULE = BarnOwl PACKAGE = BarnOwl const utf8 * command(cmd, ...) const char *cmd PREINIT: char *rv = NULL; const char **argv; int i; CODE: { if (items == 1) { rv = owl_function_command(cmd); } else { /* Ensure this is NULL-terminated. */ argv = g_new0(const char *, items + 1); argv[0] = cmd; for(i = 1; i < items; i++) { argv[i] = SvPV_nolen(ST(i)); } rv = owl_function_command_argv(argv, items); g_free(argv); } RETVAL = rv; } OUTPUT: RETVAL CLEANUP: g_free(rv); SV * getcurmsg() CODE: RETVAL = owl_perlconfig_curmessage2hashref(); OUTPUT: RETVAL int getnumcols() CODE: RETVAL = owl_global_get_cols(&g); OUTPUT: RETVAL int getnumlines() CODE: RETVAL = owl_global_get_lines(&g); OUTPUT: RETVAL time_t getidletime() CODE: RETVAL = owl_global_get_idletime(&g); OUTPUT: RETVAL const utf8 * zephyr_getrealm() CODE: RETVAL = owl_zephyr_get_realm(); OUTPUT: RETVAL const utf8 * zephyr_getsender() CODE: RETVAL = owl_zephyr_get_sender(); OUTPUT: RETVAL const utf8 * ztext_stylestrip(ztext) const char *ztext PREINIT: char *rv = NULL; CODE: rv = owl_function_ztext_stylestrip(ztext); RETVAL = rv; OUTPUT: RETVAL CLEANUP: g_free(rv); const utf8 * zephyr_smartstrip_user(in) const char *in PREINIT: char *rv = NULL; CODE: { rv = owl_zephyr_smartstripped_user(in); RETVAL = rv; } OUTPUT: RETVAL CLEANUP: g_free(rv); const utf8 * zephyr_getsubs() PREINIT: char *rv = NULL; CODE: rv = owl_zephyr_getsubs(); RETVAL = rv; OUTPUT: RETVAL CLEANUP: g_free(rv); SV * queue_message(msg) SV *msg PREINIT: owl_message *m; CODE: { if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) { croak("Usage: BarnOwl::queue_message($message)"); } m = owl_perlconfig_hashref2message(msg); owl_global_messagequeue_addmsg(&g, m); RETVAL = owl_perlconfig_message2hashref(m); } OUTPUT: RETVAL void admin_message(header, body) const char *header const char *body CODE: { owl_function_adminmsg(header, body); } const char * get_data_dir () CODE: RETVAL = owl_get_datadir(); OUTPUT: RETVAL const char * get_config_dir () CODE: RETVAL = owl_global_get_confdir(&g); OUTPUT: RETVAL void popless_text(text) const char *text CODE: { owl_function_popless_text(text); } void popless_ztext(text) const char *text CODE: { owl_fmtext fm; owl_fmtext_init_null(&fm); owl_fmtext_append_ztext(&fm, text); owl_function_popless_fmtext(&fm); owl_fmtext_cleanup(&fm); } void error(text) const char *text CODE: { owl_function_error("%s", text); } void debug(text) const char *text CODE: { owl_function_debugmsg("%s", text); } void message(text) const char *text CODE: { owl_function_makemsg("%s", text); } void create_style(name, object) const char *name SV *object PREINIT: owl_style *s; CODE: { s = g_new(owl_style, 1); owl_style_create_perl(s, name, newSVsv(object)); owl_global_add_style(&g, s); } int getnumcolors() CODE: RETVAL = owl_function_get_color_count(); OUTPUT: RETVAL void _remove_filter(filterName) const char *filterName CODE: { /* Don't delete the current view, or the 'all' filter */ if (strcmp(filterName, owl_view_get_filtname(owl_global_get_current_view(&g))) && strcmp(filterName, "all")) { owl_global_remove_filter(&g,filterName); } } const utf8 * wordwrap(in, cols) const char *in int cols PREINIT: char *rv = NULL; CODE: rv = owl_text_wordwrap(in, cols); RETVAL = rv; OUTPUT: RETVAL CLEANUP: g_free(rv); AV* all_filters() PREINIT: GPtrArray *fl; CODE: { fl = owl_dict_get_keys(&g.filters); RETVAL = owl_new_av(fl, (SV*(*)(const void*))owl_new_sv); sv_2mortal((SV*)RETVAL); owl_ptr_array_free(fl, g_free); } OUTPUT: RETVAL AV* all_styles() PREINIT: GPtrArray *l; CODE: { l = owl_global_get_style_names(&g); RETVAL = owl_new_av(l, (SV*(*)(const void*))owl_new_sv); sv_2mortal((SV*)RETVAL); } OUTPUT: RETVAL CLEANUP: owl_ptr_array_free(l, g_free); AV* all_variables() PREINIT: GPtrArray *l; CODE: { l = owl_dict_get_keys(owl_global_get_vardict(&g)); RETVAL = owl_new_av(l, (SV*(*)(const void*))owl_new_sv); sv_2mortal((SV*)RETVAL); } OUTPUT: RETVAL CLEANUP: owl_ptr_array_free(l, g_free); AV* all_keymaps() PREINIT: GPtrArray *l; const owl_keyhandler *kh; CODE: { kh = owl_global_get_keyhandler(&g); l = owl_keyhandler_get_keymap_names(kh); RETVAL = owl_new_av(l, (SV*(*)(const void*))owl_new_sv); sv_2mortal((SV*)RETVAL); } OUTPUT: RETVAL CLEANUP: owl_ptr_array_free(l, g_free); void redisplay() CODE: { owl_messagelist_invalidate_formats(owl_global_get_msglist(&g)); owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS); owl_mainwin_redisplay(owl_global_get_mainwin(&g)); } const char * get_zephyr_variable(name) const char *name; CODE: RETVAL = owl_zephyr_get_variable(name); OUTPUT: RETVAL const utf8 * skiptokens(str, n) const char *str; int n; CODE: RETVAL = skiptokens(str, n); OUTPUT: RETVAL MODULE = BarnOwl PACKAGE = BarnOwl::Zephyr int have_zephyr() CODE: RETVAL = owl_global_is_havezephyr(&g); OUTPUT: RETVAL MODULE = BarnOwl PACKAGE = BarnOwl::Internal void new_command(name, func, summary, usage, description) char *name SV *func char *summary char *usage char *description PREINIT: owl_cmd cmd; CODE: { if(!SV_IS_CODEREF(func)) { croak("Command function must be a coderef!"); } cmd.name = name; cmd.cmd_perl = newSVsv(func); cmd.summary = summary; cmd.usage = usage; cmd.description = description; cmd.validctx = OWL_CTX_ANY; cmd.cmd_aliased_to = NULL; cmd.cmd_args_fn = NULL; cmd.cmd_v_fn = NULL; cmd.cmd_i_fn = NULL; cmd.cmd_ctxargs_fn = NULL; cmd.cmd_ctxv_fn = NULL; cmd.cmd_ctxi_fn = NULL; owl_cmddict_add_cmd(owl_global_get_cmddict(&g), &cmd); } void new_variable_string(name, ival, summ, desc) const char * name const char * ival const char * summ const char * desc CODE: owl_variable_dict_newvar_string(owl_global_get_vardict(&g), name, summ, desc, ival); void new_variable_int(name, ival, summ, desc) const char * name int ival const char * summ const char * desc CODE: owl_variable_dict_newvar_int(owl_global_get_vardict(&g), name, summ, desc, ival); void new_variable_bool(name, ival, summ, desc) const char * name int ival const char * summ const char * desc CODE: owl_variable_dict_newvar_bool(owl_global_get_vardict(&g), name, summ, desc, ival); void start_edit(edit_type, line, callback) const char *edit_type const char *line SV *callback PREINIT: owl_editwin *e; CODE: { if (!SV_IS_CODEREF(callback)) croak("Callback must be a subref"); if (!strcmp(edit_type, "question")) e = owl_function_start_question(line); else if (!strcmp(edit_type, "password")) e = owl_function_start_password(line); else if (!strcmp(edit_type, "edit_win")) e = owl_function_start_edit_win(line); else croak("edit_type must be one of 'password', 'question', 'edit_win', not '%s'", edit_type); owl_editwin_set_cbdata(e, newSVsv(callback), owl_perlconfig_dec_refcnt); owl_editwin_set_callback(e, owl_perlconfig_edit_callback); } int zephyr_zwrite(cmd,msg) const char *cmd const char *msg CODE: RETVAL = owl_zwrite_create_and_send_from_line(cmd, msg); OUTPUT: RETVAL MODULE = BarnOwl PACKAGE = BarnOwl::Editwin int replace(count, string) int count; const char *string; PREINIT: owl_editwin *e; CODE: e = owl_global_current_typwin(&g); if (e) { RETVAL = owl_editwin_replace(e, count, string); } else { RETVAL = 0; } OUTPUT: RETVAL int point_move(delta) int delta; PREINIT: owl_editwin *e; CODE: e = owl_global_current_typwin(&g); if (e) { RETVAL = owl_editwin_point_move(e, delta); } else { RETVAL = 0; } OUTPUT: RETVAL int replace_region(string) const char *string; PREINIT: owl_editwin *e; CODE: e = owl_global_current_typwin(&g); if (e) { RETVAL = owl_editwin_replace_region(e, string); } else { RETVAL = 0; } OUTPUT: RETVAL const utf8 * get_region() PREINIT: char *region; owl_editwin *e; CODE: e = owl_global_current_typwin(&g); if (e) { region = owl_editwin_get_region(owl_global_current_typwin(&g)); } else { region = NULL; } RETVAL = region; OUTPUT: RETVAL CLEANUP: g_free(region); SV * save_excursion(sub) SV *sub; PROTOTYPE: & PREINIT: int count; owl_editwin *e; owl_editwin_excursion *x; CODE: { e = owl_global_current_typwin(&g); if(!e) croak("The edit window is not currently active!"); x = owl_editwin_begin_excursion(owl_global_current_typwin(&g)); PUSHMARK(SP); count = call_sv(sub, G_SCALAR|G_EVAL|G_NOARGS); SPAGAIN; owl_editwin_end_excursion(owl_global_current_typwin(&g), x); if(SvTRUE(ERRSV)) { croak(NULL); } if(count == 1) RETVAL = SvREFCNT_inc(POPs); else XSRETURN_UNDEF; } OUTPUT: RETVAL int current_column() PREINIT: owl_editwin *e; CODE: e = owl_global_current_typwin(&g); if (e) { RETVAL = owl_editwin_current_column(e); } else { RETVAL = 0; } OUTPUT: RETVAL int point() PREINIT: owl_editwin *e; CODE: e = owl_global_current_typwin(&g); if (e) { RETVAL = owl_editwin_get_point(e); } else { RETVAL = 0; } OUTPUT: RETVAL int mark() PREINIT: owl_editwin *e; CODE: e = owl_global_current_typwin(&g); if (e) { RETVAL = owl_editwin_get_mark(e); } else { RETVAL = 0; } OUTPUT: RETVAL barnowl-1.9-src/fmtext.c0000664000175000017500000006402612247032546014620 0ustar andersanders#include "owl.h" /* initialize an fmtext with no data */ void owl_fmtext_init_null(owl_fmtext *f) { f->buff = g_string_new(""); } /* Clear the data from an fmtext, but don't deallocate memory. This fmtext can then be appended to again. */ void owl_fmtext_clear(owl_fmtext *f) { g_string_truncate(f->buff, 0); } int owl_fmtext_is_format_char(gunichar c) { if ((c & ~OWL_FMTEXT_UC_ATTR_MASK) == OWL_FMTEXT_UC_ATTR) return 1; if ((c & ~(OWL_FMTEXT_UC_ALLCOLOR_MASK)) == OWL_FMTEXT_UC_COLOR_BASE) return 1; return 0; } /* append text to the end of 'f' with attribute 'attr' and color * 'color' */ void owl_fmtext_append_attr(owl_fmtext *f, const char *text, char attr, short fgcolor, short bgcolor) { int a = 0, fg = 0, bg = 0; if (attr != OWL_FMTEXT_ATTR_NONE) a=1; if (fgcolor != OWL_COLOR_DEFAULT) fg=1; if (bgcolor != OWL_COLOR_DEFAULT) bg=1; /* Set attributes */ if (a) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_ATTR | attr); if (fg) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_FGCOLOR | fgcolor); if (bg) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_BGCOLOR | bgcolor); g_string_append(f->buff, text); /* Reset attributes */ if (bg) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_BGDEFAULT); if (fg) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_FGDEFAULT); if (a) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_ATTR | OWL_FMTEXT_UC_ATTR); } /* Append normal, uncolored text 'text' to 'f' */ void owl_fmtext_append_normal(owl_fmtext *f, const char *text) { owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_NONE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT); } /* Append normal, uncolored text specified by format string to 'f' */ void G_GNUC_PRINTF(2, 3) owl_fmtext_appendf_normal(owl_fmtext *f, const char *fmt, ...) { va_list ap; char *buff; va_start(ap, fmt); buff = g_strdup_vprintf(fmt, ap); va_end(ap); if (!buff) return; owl_fmtext_append_attr(f, buff, OWL_FMTEXT_ATTR_NONE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT); g_free(buff); } /* Append normal text 'text' to 'f' with color 'color' */ void owl_fmtext_append_normal_color(owl_fmtext *f, const char *text, int fgcolor, int bgcolor) { owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_NONE, fgcolor, bgcolor); } /* Append bold text 'text' to 'f' */ void owl_fmtext_append_bold(owl_fmtext *f, const char *text) { owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_BOLD, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT); } /* Append reverse video text 'text' to 'f' */ void owl_fmtext_append_reverse(owl_fmtext *f, const char *text) { owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_REVERSE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT); } /* Append reversed and bold, uncolored text 'text' to 'f' */ void owl_fmtext_append_reversebold(owl_fmtext *f, const char *text) { owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_REVERSE | OWL_FMTEXT_ATTR_BOLD, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT); } /* Internal function. Parse attrbute character. */ static void _owl_fmtext_update_attributes(gunichar c, char *attr, short *fgcolor, short *bgcolor) { if ((c & OWL_FMTEXT_UC_ATTR) == OWL_FMTEXT_UC_ATTR) { *attr = c & OWL_FMTEXT_UC_ATTR_MASK; } else if ((c & OWL_FMTEXT_UC_COLOR_BASE) == OWL_FMTEXT_UC_COLOR_BASE) { if ((c & OWL_FMTEXT_UC_BGCOLOR) == OWL_FMTEXT_UC_BGCOLOR) { *bgcolor = (c == OWL_FMTEXT_UC_BGDEFAULT ? OWL_COLOR_DEFAULT : c & OWL_FMTEXT_UC_COLOR_MASK); } else if ((c & OWL_FMTEXT_UC_FGCOLOR) == OWL_FMTEXT_UC_FGCOLOR) { *fgcolor = (c == OWL_FMTEXT_UC_FGDEFAULT ? OWL_COLOR_DEFAULT : c & OWL_FMTEXT_UC_COLOR_MASK); } } } /* Internal function. Scan for attribute characters. */ static void _owl_fmtext_scan_attributes(const owl_fmtext *f, int start, char *attr, short *fgcolor, short *bgcolor) { const char *p; p = strchr(f->buff->str, OWL_FMTEXT_UC_STARTBYTE_UTF8); while (p && p < f->buff->str + start) { _owl_fmtext_update_attributes(g_utf8_get_char(p), attr, fgcolor, bgcolor); p = strchr(p+1, OWL_FMTEXT_UC_STARTBYTE_UTF8); } } /* Internal function. Append text from 'in' between index 'start' * inclusive and 'stop' exclusive, to the end of 'f'. This function * works with bytes. */ static void _owl_fmtext_append_fmtext(owl_fmtext *f, const owl_fmtext *in, int start, int stop) { char attr = 0; short fgcolor = OWL_COLOR_DEFAULT; short bgcolor = OWL_COLOR_DEFAULT; _owl_fmtext_scan_attributes(in, start, &attr, &fgcolor, &bgcolor); if (attr != OWL_FMTEXT_ATTR_NONE) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_ATTR | attr); if (fgcolor != OWL_COLOR_DEFAULT) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_FGCOLOR | fgcolor); if (bgcolor != OWL_COLOR_DEFAULT) g_string_append_unichar(f->buff, OWL_FMTEXT_UC_BGCOLOR | bgcolor); g_string_append_len(f->buff, in->buff->str+start, stop-start); /* Reset attributes */ g_string_append_unichar(f->buff, OWL_FMTEXT_UC_BGDEFAULT); g_string_append_unichar(f->buff, OWL_FMTEXT_UC_FGDEFAULT); g_string_append_unichar(f->buff, OWL_FMTEXT_UC_ATTR | OWL_FMTEXT_UC_ATTR); } /* append fmtext 'in' to 'f' */ void owl_fmtext_append_fmtext(owl_fmtext *f, const owl_fmtext *in) { _owl_fmtext_append_fmtext(f, in, 0, in->buff->len); } /* Append 'nspaces' number of spaces to the end of 'f' */ void owl_fmtext_append_spaces(owl_fmtext *f, int nspaces) { int i; for (i=0; ibuff->str); } static void _owl_fmtext_wattrset(WINDOW *w, int attrs) { wattrset(w, A_NORMAL); if (attrs & OWL_FMTEXT_ATTR_BOLD) wattron(w, A_BOLD); if (attrs & OWL_FMTEXT_ATTR_REVERSE) wattron(w, A_REVERSE); if (attrs & OWL_FMTEXT_ATTR_UNDERLINE) wattron(w, A_UNDERLINE); } static void _owl_fmtext_wcolor_set(WINDOW *w, short pair) { cchar_t background; wchar_t blank[2] = { ' ', 0 }; if (has_colors()) { wcolor_set(w, pair, NULL); /* Set the background with wbkgrndset so that we can handle color-pairs * past 256 on ncurses ABI 6 and later. */ setcchar(&background, blank, 0, pair, NULL); wbkgrndset(w, &background); } } /* add the formatted text to the curses window 'w'. The window 'w' * must already be initiatlized with curses */ static void _owl_fmtext_curs_waddstr(const owl_fmtext *f, WINDOW *w, int do_search, char default_attrs, short default_fgcolor, short default_bgcolor) { /* char *tmpbuff; */ /* int position, trans1, trans2, trans3, len, lastsame; */ char *s, *p; char attr; short fg, bg, pair = 0; if (w==NULL) { owl_function_debugmsg("Hit a null window in owl_fmtext_curs_waddstr."); return; } s = f->buff->str; /* Set default attributes. */ attr = default_attrs; fg = default_fgcolor; bg = default_bgcolor; _owl_fmtext_wattrset(w, attr); pair = owl_fmtext_get_colorpair(fg, bg); _owl_fmtext_wcolor_set(w, pair); /* Find next possible format character. */ p = strchr(s, OWL_FMTEXT_UC_STARTBYTE_UTF8); while(p) { if (owl_fmtext_is_format_char(g_utf8_get_char(p))) { /* Deal with all text from last insert to here. */ char tmp; tmp = p[0]; p[0] = '\0'; if (do_search && owl_global_is_search_active(&g)) { /* Search is active, so highlight search results. */ int start, end; while (owl_regex_compare(owl_global_get_search_re(&g), s, &start, &end) == 0) { /* Prevent an infinite loop matching the empty string. */ if (end == 0) break; /* Found search string, highlight it. */ waddnstr(w, s, start); _owl_fmtext_wattrset(w, attr ^ OWL_FMTEXT_ATTR_REVERSE); _owl_fmtext_wcolor_set(w, pair); waddnstr(w, s + start, end - start); _owl_fmtext_wattrset(w, attr); _owl_fmtext_wcolor_set(w, pair); s += end; } } /* Deal with remaining part of string. */ waddstr(w, s); p[0] = tmp; /* Deal with new attributes. Process all consecutive formatting * characters, and then apply defaults where relevant. */ while (owl_fmtext_is_format_char(g_utf8_get_char(p))) { _owl_fmtext_update_attributes(g_utf8_get_char(p), &attr, &fg, &bg); p = g_utf8_next_char(p); } attr |= default_attrs; if (fg == OWL_COLOR_DEFAULT) fg = default_fgcolor; if (bg == OWL_COLOR_DEFAULT) bg = default_bgcolor; _owl_fmtext_wattrset(w, attr); pair = owl_fmtext_get_colorpair(fg, bg); _owl_fmtext_wcolor_set(w, pair); /* Advance to next non-formatting character. */ s = p; p = strchr(s, OWL_FMTEXT_UC_STARTBYTE_UTF8); } else { p = strchr(p+1, OWL_FMTEXT_UC_STARTBYTE_UTF8); } } if (s) { waddstr(w, s); } wbkgdset(w, 0); } void owl_fmtext_curs_waddstr(const owl_fmtext *f, WINDOW *w, char default_attrs, short default_fgcolor, short default_bgcolor) { _owl_fmtext_curs_waddstr(f, w, 1, default_attrs, default_fgcolor, default_bgcolor); } void owl_fmtext_curs_waddstr_without_search(const owl_fmtext *f, WINDOW *w, char default_attrs, short default_fgcolor, short default_bgcolor) { _owl_fmtext_curs_waddstr(f, w, 0, default_attrs, default_fgcolor, default_bgcolor); } /* Expands tabs. Tabs are expanded as if given an initial indent of start. */ void owl_fmtext_expand_tabs(const owl_fmtext *in, owl_fmtext *out, int start) { int col = start, numcopied = 0; char *ptr; for (ptr = in->buff->str; ptr < in->buff->str + in->buff->len; ptr = g_utf8_next_char(ptr)) { gunichar c = g_utf8_get_char(ptr); int chwidth; if (c == '\t') { /* Copy up to this tab */ _owl_fmtext_append_fmtext(out, in, numcopied, ptr - in->buff->str); /* and then copy spaces for the tab. */ chwidth = OWL_TAB_WIDTH - (col % OWL_TAB_WIDTH); owl_fmtext_append_spaces(out, chwidth); col += chwidth; numcopied = g_utf8_next_char(ptr) - in->buff->str; } else { /* Just update col. We'll append later. */ if (c == '\n') { col = start; } else if (!owl_fmtext_is_format_char(c)) { col += mk_wcwidth(c); } } } /* Append anything we've missed. */ if (numcopied < in->buff->len) _owl_fmtext_append_fmtext(out, in, numcopied, in->buff->len); } /* start with line 'aline' (where the first line is 0) and print * 'lines' number of lines into 'out' */ int owl_fmtext_truncate_lines(const owl_fmtext *in, int aline, int lines, owl_fmtext *out) { const char *ptr1, *ptr2; int i, offset; /* find the starting line */ ptr1 = in->buff->str; for (i = 0; i < aline; i++) { ptr1 = strchr(ptr1, '\n'); if (!ptr1) return(-1); ptr1++; } /* ptr1 now holds the starting point */ /* copy in the next 'lines' lines */ if (lines < 1) return(-1); for (i = 0; i < lines; i++) { offset = ptr1 - in->buff->str; ptr2 = strchr(ptr1, '\n'); if (!ptr2) { /* Copy to the end of the buffer. */ _owl_fmtext_append_fmtext(out, in, offset, in->buff->len); return(-1); } /* Copy up to, and including, the new line. */ _owl_fmtext_append_fmtext(out, in, offset, (ptr2 - ptr1) + offset + 1); ptr1 = ptr2 + 1; } return(0); } /* Implementation of owl_fmtext_truncate_cols. Does not support tabs in input. */ void _owl_fmtext_truncate_cols_internal(const owl_fmtext *in, int acol, int bcol, owl_fmtext *out) { const char *ptr_s, *ptr_e, *ptr_c, *last; int col, st, padding, chwidth; last = in->buff->str + in->buff->len - 1; ptr_s = in->buff->str; while (ptr_s <= last) { ptr_e=strchr(ptr_s, '\n'); if (!ptr_e) { /* but this shouldn't happen if we end in a \n */ break; } if (ptr_e == ptr_s) { owl_fmtext_append_normal(out, "\n"); ++ptr_s; continue; } col = 0; st = 0; padding = 0; chwidth = 0; ptr_c = ptr_s; while(ptr_c < ptr_e) { gunichar c = g_utf8_get_char(ptr_c); if (!owl_fmtext_is_format_char(c)) { chwidth = mk_wcwidth(c); if (col + chwidth > bcol) break; if (col >= acol) { if (st == 0) { ptr_s = ptr_c; padding = col - acol; ++st; } } col += chwidth; chwidth = 0; } ptr_c = g_utf8_next_char(ptr_c); } if (st) { /* lead padding */ owl_fmtext_append_spaces(out, padding); if (ptr_c == ptr_e) { /* We made it to the newline. Append up to, and including it. */ _owl_fmtext_append_fmtext(out, in, ptr_s - in->buff->str, ptr_c - in->buff->str + 1); } else if (chwidth > 1) { /* Last char is wide, truncate. */ _owl_fmtext_append_fmtext(out, in, ptr_s - in->buff->str, ptr_c - in->buff->str); owl_fmtext_append_normal(out, "\n"); } else { /* Last char fits perfectly, We stop at the next char to make * sure we get it all. */ ptr_c = g_utf8_next_char(ptr_c); _owl_fmtext_append_fmtext(out, in, ptr_s - in->buff->str, ptr_c - in->buff->str); } } else { owl_fmtext_append_normal(out, "\n"); } ptr_s = g_utf8_next_char(ptr_e); } } /* Truncate the message so that each line begins at column 'acol' and * ends at 'bcol' or sooner. The first column is number 0. The new * message is placed in 'out'. The message is expected to end in a * new line for now. * * NOTE: This needs to be modified to deal with backing up if we find * a SPACING COMBINING MARK at the end of a line. If that happens, we * should back up to the last non-mark character and stop there. * * NOTE: If a line ends at bcol, we omit the newline. This is so printing * to ncurses works. */ void owl_fmtext_truncate_cols(const owl_fmtext *in, int acol, int bcol, owl_fmtext *out) { owl_fmtext notabs; /* _owl_fmtext_truncate_cols_internal cannot handle tabs. */ if (strchr(in->buff->str, '\t')) { owl_fmtext_init_null(¬abs); owl_fmtext_expand_tabs(in, ¬abs, 0); _owl_fmtext_truncate_cols_internal(¬abs, acol, bcol, out); owl_fmtext_cleanup(¬abs); } else { _owl_fmtext_truncate_cols_internal(in, acol, bcol, out); } } /* Return the number of lines in 'f' */ int owl_fmtext_num_lines(const owl_fmtext *f) { int lines, i; char *lastbreak, *p; lines=0; lastbreak = f->buff->str; for (i = 0; i < f->buff->len; i++) { if (f->buff->str[i]=='\n') { lastbreak = f->buff->str + i; lines++; } } /* Check if there's a trailing line; formatting characters don't count. */ for (p = g_utf8_next_char(lastbreak); p < f->buff->str + f->buff->len; p = g_utf8_next_char(p)) { if (!owl_fmtext_is_format_char(g_utf8_get_char(p))) { lines++; break; } } return(lines); } /* Returns the line number, starting at 0, of the character which * contains the byte at 'offset'. Note that a trailing newline is part * of the line it ends. Also, while a trailing line of formatting * characters does not contribute to owl_fmtext_num_lines, those * characters are considered on a new line. */ int owl_fmtext_line_number(const owl_fmtext *f, int offset) { int i, lineno = 0; if (offset >= f->buff->len) offset = f->buff->len - 1; for (i = 0; i < offset; i++) { if (f->buff->str[i] == '\n') lineno++; } return lineno; } /* Searches for line 'lineno' in 'f'. The returned range, [start, * end), forms a half-open interval for the extent of the line. */ void owl_fmtext_line_extents(const owl_fmtext *f, int lineno, int *o_start, int *o_end) { int start, end; char *newline; for (start = 0; lineno > 0 && start < f->buff->len; start++) { if (f->buff->str[start] == '\n') lineno--; } newline = strchr(f->buff->str + start, '\n'); /* Include the newline, if it is there. */ end = newline ? newline - f->buff->str + 1 : f->buff->len; if (o_start) *o_start = start; if (o_end) *o_end = end; } const char *owl_fmtext_get_text(const owl_fmtext *f) { return f->buff->str; } int owl_fmtext_num_bytes(const owl_fmtext *f) { return f->buff->len; } /* Make a copy of the fmtext 'src' into 'dst' */ void owl_fmtext_copy(owl_fmtext *dst, const owl_fmtext *src) { dst->buff = g_string_new(src->buff->str); } /* Search 'f' for the regex 're' for matches starting at * 'start'. Returns the offset of the first match, -1 if not * found. This is a case-insensitive search. */ int owl_fmtext_search(const owl_fmtext *f, const owl_regex *re, int start) { int offset; if (start > f->buff->len || owl_regex_compare(re, f->buff->str + start, &offset, NULL) != 0) return -1; return offset + start; } /* Append the text 'text' to 'f' and interpret the zephyr style * formatting syntax to set appropriate attributes. */ void owl_fmtext_append_ztext(owl_fmtext *f, const char *text) { int stacksize, curattrs, curcolor; const char *ptr, *txtptr, *tmpptr; char *buff; int attrstack[32], chrstack[32], colorstack[32]; curattrs=OWL_FMTEXT_ATTR_NONE; curcolor=OWL_COLOR_DEFAULT; stacksize=0; txtptr=text; while (1) { ptr=strpbrk(txtptr, "@{[<()>]}"); if (!ptr) { /* add all the rest of the text and exit */ owl_fmtext_append_attr(f, txtptr, curattrs, curcolor, OWL_COLOR_DEFAULT); return; } else if (ptr[0]=='@') { /* add the text up to this point then deal with the stack */ buff=g_new(char, ptr-txtptr+20); strncpy(buff, txtptr, ptr-txtptr); buff[ptr-txtptr]='\0'; owl_fmtext_append_attr(f, buff, curattrs, curcolor, OWL_COLOR_DEFAULT); g_free(buff); /* update pointer to point at the @ */ txtptr=ptr; /* now the stack */ /* if we've hit our max stack depth, print the @ and move on */ if (stacksize==32) { owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); txtptr++; continue; } /* if it's an @@, print an @ and continue */ if (txtptr[1]=='@') { owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); txtptr+=2; continue; } /* if there's no opener, print the @ and continue */ tmpptr=strpbrk(txtptr, "(<[{ "); if (!tmpptr || tmpptr[0]==' ') { owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); txtptr++; continue; } /* check what command we've got, push it on the stack, start using it, and continue ... unless it's a color command */ buff=g_new(char, tmpptr-ptr+20); strncpy(buff, ptr, tmpptr-ptr); buff[tmpptr-ptr]='\0'; if (!strcasecmp(buff, "@bold")) { attrstack[stacksize]=OWL_FMTEXT_ATTR_BOLD; chrstack[stacksize]=tmpptr[0]; colorstack[stacksize]=curcolor; stacksize++; curattrs|=OWL_FMTEXT_ATTR_BOLD; txtptr+=6; g_free(buff); continue; } else if (!strcasecmp(buff, "@b")) { attrstack[stacksize]=OWL_FMTEXT_ATTR_BOLD; chrstack[stacksize]=tmpptr[0]; colorstack[stacksize]=curcolor; stacksize++; curattrs|=OWL_FMTEXT_ATTR_BOLD; txtptr+=3; g_free(buff); continue; } else if (!strcasecmp(buff, "@i")) { attrstack[stacksize]=OWL_FMTEXT_ATTR_UNDERLINE; chrstack[stacksize]=tmpptr[0]; colorstack[stacksize]=curcolor; stacksize++; curattrs|=OWL_FMTEXT_ATTR_UNDERLINE; txtptr+=3; g_free(buff); continue; } else if (!strcasecmp(buff, "@italic")) { attrstack[stacksize]=OWL_FMTEXT_ATTR_UNDERLINE; chrstack[stacksize]=tmpptr[0]; colorstack[stacksize]=curcolor; stacksize++; curattrs|=OWL_FMTEXT_ATTR_UNDERLINE; txtptr+=8; g_free(buff); continue; } else if (!strcasecmp(buff, "@")) { attrstack[stacksize]=OWL_FMTEXT_ATTR_NONE; chrstack[stacksize]=tmpptr[0]; colorstack[stacksize]=curcolor; stacksize++; txtptr+=2; g_free(buff); continue; /* if it's a color read the color, set the current color and continue */ } else if (!strcasecmp(buff, "@color") && owl_global_is_colorztext(&g)) { g_free(buff); txtptr+=7; tmpptr=strpbrk(txtptr, "@{[<()>]}"); if (tmpptr && ((txtptr[-1]=='(' && tmpptr[0]==')') || (txtptr[-1]=='<' && tmpptr[0]=='>') || (txtptr[-1]=='[' && tmpptr[0]==']') || (txtptr[-1]=='{' && tmpptr[0]=='}'))) { /* grab the color name */ buff=g_new(char, tmpptr-txtptr+20); strncpy(buff, txtptr, tmpptr-txtptr); buff[tmpptr-txtptr]='\0'; /* set it as the current color */ curcolor=owl_util_string_to_color(buff); if (curcolor == OWL_COLOR_INVALID) curcolor = OWL_COLOR_DEFAULT; g_free(buff); txtptr=tmpptr+1; continue; } else { } } else { /* if we didn't understand it, we'll print it. This is different from zwgc * but zwgc seems to be smarter about some screw cases than I am */ g_free(buff); owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); txtptr++; continue; } } else if (ptr[0]=='}' || ptr[0]==']' || ptr[0]==')' || ptr[0]=='>') { /* add the text up to this point first */ buff=g_new(char, ptr-txtptr+20); strncpy(buff, txtptr, ptr-txtptr); buff[ptr-txtptr]='\0'; owl_fmtext_append_attr(f, buff, curattrs, curcolor, OWL_COLOR_DEFAULT); g_free(buff); /* now deal with the closer */ txtptr=ptr; /* first, if the stack is empty we must bail (just print and go) */ if (stacksize==0) { buff=g_new(char, 5); buff[0]=ptr[0]; buff[1]='\0'; owl_fmtext_append_attr(f, buff, curattrs, curcolor, OWL_COLOR_DEFAULT); g_free(buff); txtptr++; continue; } /* if the closing char is what's on the stack, turn off the attribue and pop the stack */ if ((ptr[0]==')' && chrstack[stacksize-1]=='(') || (ptr[0]=='>' && chrstack[stacksize-1]=='<') || (ptr[0]==']' && chrstack[stacksize-1]=='[') || (ptr[0]=='}' && chrstack[stacksize-1]=='{')) { int i; stacksize--; curattrs=OWL_FMTEXT_ATTR_NONE; curcolor = colorstack[stacksize]; for (i=0; ilen; i++) { elem = l->pdata[i]; if (elem && format_fn) { text = format_fn(elem); if (text) { owl_fmtext_append_normal(f, text); g_free(text); } } else if (elem) { owl_fmtext_append_normal(f, elem); } if ((i < l->len - 1) && join_with) { owl_fmtext_append_normal(f, join_with); } } } /* Free all memory allocated by the object */ void owl_fmtext_cleanup(owl_fmtext *f) { if (f->buff) g_string_free(f->buff, true); f->buff = NULL; } /*** Color Pair manager ***/ void owl_fmtext_init_colorpair_mgr(owl_colorpair_mgr *cpmgr) { /* This could be a bitarray if we wanted to save memory. */ short i; /* The test is <= because we allocate COLORS+1 entries. */ cpmgr->pairs = g_new(short *, COLORS + 1); for(i = 0; i <= COLORS; i++) { cpmgr->pairs[i] = g_new(short, COLORS + 1); } owl_fmtext_reset_colorpairs(cpmgr); } /* Reset used list */ void owl_fmtext_reset_colorpairs(owl_colorpair_mgr *cpmgr) { short i, j; cpmgr->overflow = false; cpmgr->next = 8; /* The test is <= because we allocated COLORS+1 entries. */ for(i = 0; i <= COLORS; i++) { for(j = 0; j <= COLORS; j++) { cpmgr->pairs[i][j] = -1; } } if (has_colors()) { for(i = 0; i < 8; i++) { short fg, bg; if (i >= COLORS) continue; pair_content(i, &fg, &bg); cpmgr->pairs[fg+1][bg+1] = i; } } } /* Assign pairs by request */ short owl_fmtext_get_colorpair(int fg, int bg) { owl_colorpair_mgr *cpmgr; short pair; if (!has_colors()) return 0; /* Sanity (Bounds) Check */ if (fg > COLORS || fg < OWL_COLOR_DEFAULT) fg = OWL_COLOR_DEFAULT; if (bg > COLORS || bg < OWL_COLOR_DEFAULT) bg = OWL_COLOR_DEFAULT; #ifdef HAVE_USE_DEFAULT_COLORS if (fg == OWL_COLOR_DEFAULT) fg = -1; #else if (fg == OWL_COLOR_DEFAULT) fg = 0; if (bg == OWL_COLOR_DEFAULT) bg = 0; #endif /* looking for a pair we already set up for this draw. */ cpmgr = owl_global_get_colorpair_mgr(&g); pair = cpmgr->pairs[fg+1][bg+1]; if (!(pair != -1 && pair < cpmgr->next)) { /* If we didn't find a pair, search for a free one to assign. */ pair = (cpmgr->next < owl_util_get_colorpairs()) ? cpmgr->next : -1; if (pair != -1) { /* We found a free pair, initialize it. */ init_pair(pair, fg, bg); cpmgr->pairs[fg+1][bg+1] = pair; cpmgr->next++; } else if (bg != OWL_COLOR_DEFAULT) { /* We still don't have a pair, drop the background color. Too bad. */ owl_function_debugmsg("colorpairs: color shortage - dropping background color."); cpmgr->overflow = true; pair = owl_fmtext_get_colorpair(fg, OWL_COLOR_DEFAULT); } else { /* We still don't have a pair, defaults all around. */ owl_function_debugmsg("colorpairs: color shortage - dropping foreground and background color."); cpmgr->overflow = true; pair = 0; } } return pair; } barnowl-1.9-src/viewwin.c0000664000175000017500000003050612247032546014775 0ustar andersanders#include "owl.h" #define BOTTOM_OFFSET 1 static void owl_viewwin_redraw_content(owl_window *w, WINDOW *curswin, void *user_data); static void owl_viewwin_redraw_status(owl_window *w, WINDOW *curswin, void *user_data); static void owl_viewwin_layout(owl_viewwin *v); static void owl_viewwin_set_window(owl_viewwin *v, owl_window *w); /* Create a viewwin. 'win' is an already initialized owl_window that * will be used by the viewwin */ CALLER_OWN owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text) { owl_viewwin *v = g_new0(owl_viewwin, 1); owl_fmtext_init_null(&(v->fmtext)); if (text) { owl_fmtext_append_normal(&(v->fmtext), text); if (text[0] != '\0' && text[strlen(text) - 1] != '\n') { owl_fmtext_append_normal(&(v->fmtext), "\n"); } v->textlines=owl_fmtext_num_lines(&(v->fmtext)); } v->topline=0; v->rightshift=0; v->onclose_hook = NULL; owl_viewwin_set_window(v, win); return v; } /* Create a viewwin. 'win' is an already initialized owl_window that * will be used by the viewwin */ CALLER_OWN owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext) { char *text; owl_viewwin *v = g_new0(owl_viewwin, 1); owl_fmtext_copy(&(v->fmtext), fmtext); text = owl_fmtext_print_plain(fmtext); if (text[0] != '\0' && text[strlen(text) - 1] != '\n') { owl_fmtext_append_normal(&(v->fmtext), "\n"); } g_free(text); v->textlines=owl_fmtext_num_lines(&(v->fmtext)); v->topline=0; v->rightshift=0; owl_viewwin_set_window(v, win); return v; } static void owl_viewwin_set_window(owl_viewwin *v, owl_window *w) { v->window = g_object_ref(w); v->content = owl_window_new(v->window); v->status = owl_window_new(v->window); v->cmdwin = NULL; v->sig_content_redraw_id = g_signal_connect(v->content, "redraw", G_CALLBACK(owl_viewwin_redraw_content), v); v->sig_status_redraw_id = g_signal_connect(v->status, "redraw", G_CALLBACK(owl_viewwin_redraw_status), v); v->sig_resize_id = g_signal_connect_swapped(v->window, "resized", G_CALLBACK(owl_viewwin_layout), v); owl_viewwin_layout(v); owl_window_show(v->content); owl_window_show(v->status); } void owl_viewwin_set_onclose_hook(owl_viewwin *v, void (*onclose_hook) (owl_viewwin *vwin, void *data), void *onclose_hook_data) { v->onclose_hook = onclose_hook; v->onclose_hook_data = onclose_hook_data; } static void owl_viewwin_layout(owl_viewwin *v) { int lines, cols; owl_window_get_position(v->window, &lines, &cols, NULL, NULL); owl_window_set_position(v->content, lines - BOTTOM_OFFSET, cols, 0, 0); /* Only one of these will be visible at a time: */ owl_window_set_position(v->status, BOTTOM_OFFSET, cols, lines - BOTTOM_OFFSET, 0); if (v->cmdwin) owl_window_set_position(v->cmdwin, BOTTOM_OFFSET, cols, lines - BOTTOM_OFFSET, 0); } /* regenerate text on the curses window. */ static void owl_viewwin_redraw_content(owl_window *w, WINDOW *curswin, void *user_data) { owl_fmtext fm1, fm2; owl_viewwin *v = user_data; int winlines, wincols; owl_window_get_position(w, &winlines, &wincols, 0, 0); werase(curswin); wmove(curswin, 0, 0); owl_fmtext_init_null(&fm1); owl_fmtext_init_null(&fm2); owl_fmtext_truncate_lines(&(v->fmtext), v->topline, winlines, &fm1); owl_fmtext_truncate_cols(&fm1, v->rightshift, wincols-1+v->rightshift, &fm2); owl_fmtext_curs_waddstr(&fm2, curswin, OWL_FMTEXT_ATTR_NONE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT); owl_fmtext_cleanup(&fm1); owl_fmtext_cleanup(&fm2); } static void owl_viewwin_redraw_status(owl_window *w, WINDOW *curswin, void *user_data) { owl_viewwin *v = user_data; int winlines, wincols; owl_window_get_position(v->content, &winlines, &wincols, 0, 0); werase(curswin); wmove(curswin, 0, 0); wattrset(curswin, A_REVERSE); if (v->textlines - v->topline > winlines) { waddstr(curswin, "--More-- (Space to see more, 'q' to quit)"); } else { waddstr(curswin, "--End-- (Press 'q' to quit)"); } wattroff(curswin, A_REVERSE); } char *owl_viewwin_command_search(owl_viewwin *v, int argc, const char *const *argv, const char *buff) { int direction, consider_current; const char *buffstart; direction=OWL_DIRECTION_DOWNWARDS; buffstart=skiptokens(buff, 1); if (argc>1 && !strcmp(argv[1], "-r")) { direction=OWL_DIRECTION_UPWARDS; buffstart=skiptokens(buff, 2); } if (argc==1 || (argc==2 && !strcmp(argv[1], "-r"))) { consider_current = false; } else { owl_function_set_search(buffstart); consider_current = true; } if (!owl_viewwin_search(v, owl_global_get_search_re(&g), consider_current, direction)) owl_function_makemsg("No more matches"); return NULL; } typedef struct _owl_viewwin_search_data { /*noproto*/ owl_viewwin *v; int direction; } owl_viewwin_search_data; static void owl_viewwin_callback_search(owl_editwin *e, bool success) { if (!success) return; int consider_current = false; const char *line = owl_editwin_get_text(e); owl_viewwin_search_data *data = owl_editwin_get_cbdata(e); /* Given an empty string, just continue the current search. */ if (line && *line) { owl_function_set_search(line); consider_current = true; } if (!owl_viewwin_search(data->v, owl_global_get_search_re(&g), consider_current, data->direction)) owl_function_makemsg("No matches"); } char *owl_viewwin_command_start_search(owl_viewwin *v, int argc, const char *const *argv, const char *buff) { int direction; const char *buffstart; owl_editwin *tw; owl_context *ctx; owl_viewwin_search_data *data; direction=OWL_DIRECTION_DOWNWARDS; buffstart=skiptokens(buff, 1); if (argc>1 && !strcmp(argv[1], "-r")) { direction=OWL_DIRECTION_UPWARDS; buffstart=skiptokens(buff, 2); } /* TODO: Add a search history? */ tw = owl_viewwin_set_typwin_active(v, NULL); owl_editwin_set_locktext(tw, (direction == OWL_DIRECTION_DOWNWARDS) ? "/" : "?"); owl_editwin_insert_string(tw, buffstart); data = g_new(owl_viewwin_search_data, 1); data->v = v; data->direction = direction; ctx = owl_editcontext_new(OWL_CTX_EDITLINE, tw, "editline", owl_viewwin_deactivate_editcontext, v); ctx->cbdata = v; owl_global_push_context_obj(&g, ctx); owl_editwin_set_callback(tw, owl_viewwin_callback_search); owl_editwin_set_cbdata(tw, data, g_free); /* We aren't saving tw, so release the reference we were given. */ owl_editwin_unref(tw); return NULL; } char *owl_viewwin_start_command(owl_viewwin *v, int argc, const char *const *argv, const char *buff) { owl_editwin *tw; owl_context *ctx; buff = skiptokens(buff, 1); tw = owl_viewwin_set_typwin_active(v, owl_global_get_cmd_history(&g)); owl_editwin_set_locktext(tw, ":"); owl_editwin_insert_string(tw, buff); ctx = owl_editcontext_new(OWL_CTX_EDITLINE, tw, "editline", owl_viewwin_deactivate_editcontext, v); owl_global_push_context_obj(&g, ctx); owl_editwin_set_callback(tw, owl_callback_command); /* We aren't saving tw, so release the reference we were given. */ owl_editwin_unref(tw); return NULL; } void owl_viewwin_deactivate_editcontext(owl_context *ctx) { owl_viewwin *v = ctx->cbdata; owl_viewwin_set_typwin_inactive(v); } CALLER_OWN owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) { int lines, cols; owl_editwin *cmdline; if (v->cmdwin) return NULL; /* Create the command line. */ v->cmdwin = owl_window_new(v->window); owl_viewwin_layout(v); owl_window_get_position(v->cmdwin, &lines, &cols, NULL, NULL); cmdline = owl_editwin_new(v->cmdwin, lines, cols, OWL_EDITWIN_STYLE_ONELINE, hist); /* Swap out the bottom window. */ owl_window_hide(v->status); owl_window_show(v->cmdwin); return cmdline; } void owl_viewwin_set_typwin_inactive(owl_viewwin *v) { if (v->cmdwin) { /* Swap out the bottom window. */ owl_window_hide(v->cmdwin); owl_window_show(v->status); /* Destroy the window itself. */ owl_window_unlink(v->cmdwin); g_object_unref(v->cmdwin); v->cmdwin = NULL; } } void owl_viewwin_append_text(owl_viewwin *v, const char *text) { owl_fmtext_append_normal(&(v->fmtext), text); v->textlines=owl_fmtext_num_lines(&(v->fmtext)); owl_viewwin_dirty(v); } /* Schedule a redraw of 'v'. Exported for hooking into the search string; when we have some way of listening for changes, this can be removed. */ void owl_viewwin_dirty(owl_viewwin *v) { owl_window_dirty(v->content); owl_window_dirty(v->status); } void owl_viewwin_down(owl_viewwin *v, int amount) { int winlines; owl_window_get_position(v->content, &winlines, 0, 0, 0); /* Don't scroll past the bottom. */ amount = MIN(amount, v->textlines - (v->topline + winlines)); /* But if we're already past the bottom, don't back up either. */ if (amount > 0) { v->topline += amount; owl_viewwin_dirty(v); } } void owl_viewwin_up(owl_viewwin *v, int amount) { v->topline -= amount; if (v->topline<0) v->topline=0; owl_viewwin_dirty(v); } void owl_viewwin_pagedown(owl_viewwin *v) { int winlines; owl_window_get_position(v->content, &winlines, 0, 0, 0); owl_viewwin_down(v, winlines); } void owl_viewwin_linedown(owl_viewwin *v) { owl_viewwin_down(v, 1); } void owl_viewwin_pageup(owl_viewwin *v) { int winlines; owl_window_get_position(v->content, &winlines, 0, 0, 0); owl_viewwin_up(v, winlines); } void owl_viewwin_lineup(owl_viewwin *v) { owl_viewwin_up(v, 1); } void owl_viewwin_right(owl_viewwin *v, int n) { v->rightshift+=n; owl_viewwin_dirty(v); } void owl_viewwin_left(owl_viewwin *v, int n) { v->rightshift-=n; if (v->rightshift<0) v->rightshift=0; owl_viewwin_dirty(v); } void owl_viewwin_top(owl_viewwin *v) { v->topline=0; v->rightshift=0; owl_viewwin_dirty(v); } void owl_viewwin_bottom(owl_viewwin *v) { int winlines; owl_window_get_position(v->content, &winlines, 0, 0, 0); v->topline = v->textlines - winlines; owl_viewwin_dirty(v); } /* This is a bit of a hack, because regexec doesn't have an 'n' * version. */ static int _re_memcompare(const owl_regex *re, const char *string, int start, int end) { int ans; char *tmp = g_strndup(string + start, end - start); ans = owl_regex_compare(re, tmp, NULL, NULL); g_free(tmp); return !ans; } /* Scroll in 'direction' to the next line containing 're' in 'v', * starting from the current line. Returns 0 if no occurrence is * found. * * If consider_current is true then stay on the current line * if it matches. */ int owl_viewwin_search(owl_viewwin *v, const owl_regex *re, int consider_current, int direction) { int start, end, offset; int lineend, linestart; const char *buf, *linestartp; owl_fmtext_line_extents(&v->fmtext, v->topline, &start, &end); if (direction == OWL_DIRECTION_DOWNWARDS) { offset = owl_fmtext_search(&v->fmtext, re, consider_current ? start : end); if (offset < 0) return 0; v->topline = owl_fmtext_line_number(&v->fmtext, offset); owl_viewwin_dirty(v); return 1; } else { /* TODO: This is a hack. Really, we should have an owl_fmlines or * something containing an array of owl_fmtext split into * lines. Also, it cannot handle multi-line regex, if we ever care about * them. */ buf = owl_fmtext_get_text(&v->fmtext); lineend = consider_current ? end : start; while (lineend > 0) { linestartp = memrchr(buf, '\n', lineend - 1); linestart = linestartp ? linestartp - buf + 1 : 0; if (_re_memcompare(re, buf, linestart, lineend)) { v->topline = owl_fmtext_line_number(&v->fmtext, linestart); owl_viewwin_dirty(v); return 1; } lineend = linestart; } return 0; } } void owl_viewwin_delete(owl_viewwin *v) { if (v->onclose_hook) { v->onclose_hook(v, v->onclose_hook_data); v->onclose_hook = NULL; v->onclose_hook_data = NULL; } owl_viewwin_set_typwin_inactive(v); /* TODO: This is far too tedious. owl_viewwin should own v->window * and just unlink it in one go. Signals should also go away for * free. */ g_signal_handler_disconnect(v->window, v->sig_resize_id); g_signal_handler_disconnect(v->content, v->sig_content_redraw_id); g_signal_handler_disconnect(v->status, v->sig_status_redraw_id); owl_window_unlink(v->content); owl_window_unlink(v->status); g_object_unref(v->window); g_object_unref(v->content); g_object_unref(v->status); owl_fmtext_cleanup(&(v->fmtext)); g_free(v); } barnowl-1.9-src/test-driver0000755000175000017500000000761112247034253015333 0ustar andersanders#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2012-06-27.10; # UTC # Copyright (C) 2011-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: barnowl-1.9-src/pair.c0000664000175000017500000000062212247032546014234 0ustar andersanders#include "owl.h" void owl_pair_create(owl_pair *p, const char *key, char *value) { p->key=key; p->value=value; } void owl_pair_set_key(owl_pair *p, const char *key) { p->key=key; } void owl_pair_set_value(owl_pair *p, char *value) { p->value=value; } const char *owl_pair_get_key(const owl_pair *p) { return(p->key); } char *owl_pair_get_value(const owl_pair *p) { return(p->value); } barnowl-1.9-src/messagelist.c0000664000175000017500000000575612247032546015636 0ustar andersanders#include "owl.h" CALLER_OWN owl_messagelist *owl_messagelist_new(void) { owl_messagelist *ml = g_new(owl_messagelist, 1); ml->list = g_ptr_array_new(); return ml; } void owl_messagelist_delete(owl_messagelist *ml, bool free_messages) { if (free_messages) g_ptr_array_foreach(ml->list, (GFunc)owl_message_delete, NULL); g_ptr_array_free(ml->list, true); g_free(ml); } int owl_messagelist_get_size(const owl_messagelist *ml) { return ml->list->len; } void *owl_messagelist_get_element(const owl_messagelist *ml, int n) { /* we assume things like owl_view_get_element(v, owl_global_get_curmsg(&g)) * work even when there are no messages in the message list. So don't * segfault if someone asks for the zeroth element of an empty list. */ if (n >= ml->list->len) return NULL; return ml->list->pdata[n]; } int owl_messagelist_get_index_by_id(const owl_messagelist *ml, int target_id) { /* return the message index with id == 'id'. If it doesn't exist return -1. */ int first, last, mid, msg_id; owl_message *m; first = 0; last = ml->list->len - 1; while (first <= last) { mid = (first + last) / 2; m = ml->list->pdata[mid]; msg_id = owl_message_get_id(m); if (msg_id == target_id) { return mid; } else if (msg_id < target_id) { first = mid + 1; } else { last = mid - 1; } } return -1; } owl_message *owl_messagelist_get_by_id(const owl_messagelist *ml, int target_id) { /* return the message with id == 'id'. If it doesn't exist return NULL. */ int n = owl_messagelist_get_index_by_id(ml, target_id); if (n < 0) return NULL; return ml->list->pdata[n]; } void owl_messagelist_append_element(owl_messagelist *ml, void *element) { g_ptr_array_add(ml->list, element); } /* do we really still want this? */ int owl_messagelist_delete_element(owl_messagelist *ml, int n) { /* mark a message as deleted */ owl_message_mark_delete(ml->list->pdata[n]); return(0); } int owl_messagelist_undelete_element(owl_messagelist *ml, int n) { /* mark a message as deleted */ owl_message_unmark_delete(ml->list->pdata[n]); return(0); } void owl_messagelist_delete_and_expunge_element(owl_messagelist *ml, int n) { owl_message_delete(g_ptr_array_remove_index(ml->list, n)); } int owl_messagelist_expunge(owl_messagelist *ml) { /* expunge deleted messages */ int i; GPtrArray *newlist; owl_message *m; newlist = g_ptr_array_new(); /*create a new list without messages marked as deleted */ for (i = 0; i < ml->list->len; i++) { m = ml->list->pdata[i]; if (owl_message_is_delete(m)) { owl_message_delete(m); } else { g_ptr_array_add(newlist, m); } } /* free the old list */ g_ptr_array_free(ml->list, true); /* copy the new list to the old list */ ml->list = newlist; return(0); } void owl_messagelist_invalidate_formats(const owl_messagelist *ml) { int i; owl_message *m; for (i = 0; i < ml->list->len; i++) { m = ml->list->pdata[i]; owl_message_invalidate_format(m); } } barnowl-1.9-src/sepbar.c0000664000175000017500000000651212247032546014561 0ustar andersanders#include "owl.h" static void sepbar_redraw(owl_window *w, WINDOW *sepwin, void *user_data); void owl_sepbar_init(owl_window *w) { g_signal_connect(w, "redraw", G_CALLBACK(sepbar_redraw), NULL); /* TODO: handle dirtiness in the sepbar */ owl_window_dirty(w); } static void sepbar_redraw(owl_window *w, WINDOW *sepwin, void *user_data) { const owl_messagelist *ml; const owl_view *v; int x, y, i; const char *foo, *appendtosepbar; int cur_numlines, cur_totallines; ml=owl_global_get_msglist(&g); v=owl_global_get_current_view(&g); werase(sepwin); wattron(sepwin, A_REVERSE); if (owl_global_is_fancylines(&g)) { whline(sepwin, ACS_HLINE, owl_global_get_cols(&g)); } else { whline(sepwin, '-', owl_global_get_cols(&g)); } if (owl_global_is_sepbar_disable(&g)) { getyx(sepwin, y, x); wmove(sepwin, y, owl_global_get_cols(&g)-1); return; } wmove(sepwin, 0, 2); if (owl_messagelist_get_size(ml) == 0) waddstr(sepwin, " (-/-) "); else wprintw(sepwin, " (%i/%i/%i) ", owl_global_get_curmsg(&g) + 1, owl_view_get_size(v), owl_messagelist_get_size(ml)); foo=owl_view_get_filtname(v); if (strcmp(foo, owl_global_get_view_home(&g))) wattroff(sepwin, A_REVERSE); wprintw(sepwin, " %s ", owl_view_get_filtname(v)); if (strcmp(foo, owl_global_get_view_home(&g))) wattron(sepwin, A_REVERSE); i=owl_mainwin_get_last_msg(owl_global_get_mainwin(&g)); if ((i != -1) && (i < owl_view_get_size(v)-1)) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wattron(sepwin, A_BOLD); waddstr(sepwin, " "); wattroff(sepwin, A_BOLD); } if (owl_global_get_rightshift(&g)>0) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wprintw(sepwin, " right: %i ", owl_global_get_rightshift(&g)); } if (owl_global_is_zaway(&g) || owl_global_is_aaway(&g)) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wattron(sepwin, A_BOLD); wattroff(sepwin, A_REVERSE); if (owl_global_is_zaway(&g) && owl_global_is_aaway(&g)) { waddstr(sepwin, " AWAY "); } else if (owl_global_is_zaway(&g)) { waddstr(sepwin, " Z-AWAY "); } else if (owl_global_is_aaway(&g)) { waddstr(sepwin, " A-AWAY "); } wattron(sepwin, A_REVERSE); wattroff(sepwin, A_BOLD); } if (owl_mainwin_is_curmsg_truncated(owl_global_get_mainwin(&g))) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wattron(sepwin, A_BOLD); cur_numlines = owl_global_get_curmsg_vert_offset(&g) + 1; cur_totallines = owl_message_get_numlines(owl_view_get_element(v, owl_global_get_curmsg(&g))); wprintw(sepwin, " ", cur_numlines, cur_totallines); wattroff(sepwin, A_BOLD); } if (owl_global_get_curmsg_vert_offset(&g)) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wattron(sepwin, A_BOLD); wattroff(sepwin, A_REVERSE); waddstr(sepwin, " SCROLL "); wattron(sepwin, A_REVERSE); wattroff(sepwin, A_BOLD); } appendtosepbar = owl_global_get_appendtosepbar(&g); if (appendtosepbar && *appendtosepbar) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); waddstr(sepwin, " "); waddstr(sepwin, owl_global_get_appendtosepbar(&g)); waddstr(sepwin, " "); } getyx(sepwin, y, x); wmove(sepwin, y, owl_global_get_cols(&g)-1); wattroff(sepwin, A_BOLD); wattroff(sepwin, A_REVERSE); } barnowl-1.9-src/aclocal.m40000664000175000017500000012211312247034252014771 0ustar andersanders# generated automatically by aclocal 1.14 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.14], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.14])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_cflags_warn_all.m4]) m4_include([m4/ax_check_flag.m4]) m4_include([m4/ax_prog_perl_modules.m4]) m4_include([m4/pkg.m4]) barnowl-1.9-src/keys.c0000664000175000017500000003667112247032546014271 0ustar andersanders#include "owl.h" #define BIND_CMD(kpress, command, desc) \ owl_keymap_create_binding(km, kpress, command, NULL, desc) #define BIND_FNV(kpress, fn, desc) \ owl_keymap_create_binding(km, kpress, NULL, fn, desc) /* sets up the default keymaps */ void owl_keys_setup_keymaps(owl_keyhandler *kh) { owl_keymap *km, *km_global, *km_editwin, *km_mainwin, *km_ew_multi, *km_ew_onel, *km_viewwin; /****************************************************************/ /*************************** GLOBAL *****************************/ /****************************************************************/ km_global = km = owl_keyhandler_create_and_add_keymap(kh, "global", "System-wide default key bindings", owl_keys_default_invalid, NULL, NULL); BIND_CMD("C-z", "message Use :suspend to suspend.", ""); /****************************************************************/ /***************************** EDIT *****************************/ /****************************************************************/ km_editwin = km = owl_keyhandler_create_and_add_keymap(kh, "edit", "Text editing and command window", owl_keys_editwin_default, NULL, owl_keys_editwin_postalways); owl_keymap_set_parent(km_editwin, km_global); /* BIND_CMD("F1", "help", ""); BIND_CMD("HELP", "help", ""); BIND_CMD("M-[ 2 8 ~", "help", ""); */ BIND_CMD("C-c", "edit:cancel", ""); BIND_CMD("C-g", "edit:cancel", ""); BIND_CMD("M-f", "edit:move-next-word", ""); BIND_CMD("M-O 3 C", "edit:move-next-word", ""); BIND_CMD("M-RIGHT", "edit:move-next-word", ""); BIND_CMD("M-[ 1 ; 3 D", "edit:move-next-word", ""); BIND_CMD("M-b", "edit:move-prev-word", ""); BIND_CMD("M-O 3 D", "edit:move-prev-word", ""); BIND_CMD("M-LEFT", "edit:move-prev-word", ""); BIND_CMD("M-[ 1 ; 3 C", "edit:move-next-word", ""); BIND_CMD("LEFT", "edit:move-left", ""); BIND_CMD("M-[ D", "edit:move-left", ""); BIND_CMD("C-b", "edit:move-left", ""); BIND_CMD("RIGHT", "edit:move-right", ""); BIND_CMD("M-[ C", "edit:move-right", ""); BIND_CMD("C-f", "edit:move-right", ""); BIND_CMD("M-<", "edit:move-to-buffer-start", ""); BIND_CMD("HOME", "edit:move-to-buffer-start", ""); BIND_CMD("M->", "edit:move-to-buffer-end", ""); BIND_CMD("END", "edit:move-to-buffer-end", ""); BIND_CMD("C-a", "edit:move-to-line-start", ""); BIND_CMD("C-e", "edit:move-to-line-end", ""); BIND_CMD("M-BACKSPACE", "edit:delete-prev-word", ""); BIND_CMD("M-DELETE", "edit:delete-prev-word", ""); BIND_CMD("M-d", "edit:delete-next-word", ""); BIND_CMD("M-DC", "edit:delete-next-word", ""); BIND_CMD("M-[ 3 ; 3 ~", "edit:delete-next-word", ""); BIND_CMD("C-h", "edit:delete-prev-char", ""); BIND_CMD("BACKSPACE", "edit:delete-prev-char", ""); BIND_CMD("DELETE", "edit:delete-prev-char", ""); BIND_CMD("C-d", "edit:delete-next-char", ""); BIND_CMD("DC", "edit:delete-next-char", ""); BIND_CMD("C-k", "edit:delete-to-line-end", ""); BIND_CMD("C-t", "edit:transpose-chars", ""); BIND_CMD("M-q", "edit:fill-paragraph", ""); BIND_CMD("C-@", "edit:set-mark", ""); BIND_CMD("C-x C-x", "edit:exchange-point-and-mark", ""); BIND_CMD("M-w", "edit:copy-region-as-kill", ""); BIND_CMD("C-w", "edit:kill-region", ""); BIND_CMD("C-y", "edit:yank", ""); BIND_CMD("C-l", "( edit:recenter ; redisplay )", ""); /****************************************************************/ /**************************** EDITMULTI *************************/ /****************************************************************/ km_ew_multi = km = owl_keyhandler_create_and_add_keymap(kh, "editmulti", "Multi-line text editing", owl_keys_editwin_default, NULL, owl_keys_editwin_postalways); owl_keymap_set_parent(km_ew_multi, km_editwin); BIND_CMD("UP", "edit:move-up-line", ""); BIND_CMD("M-[ A", "edit:move-up-line", ""); BIND_CMD("C-p", "edit:move-up-line", ""); BIND_CMD("DOWN", "edit:move-down-line", ""); BIND_CMD("M-[ B", "edit:move-down-line", ""); BIND_CMD("C-n", "edit:move-down-line", ""); BIND_CMD("M-}", "edit:forward-paragraph", ""); BIND_CMD("M-{", "edit:backward-paragraph", ""); /* This would be nice, but interferes with C-c to cancel */ /*BIND_CMD("C-c C-c", "edit:done", "sends the zephyr");*/ BIND_CMD("M-p", "edit:history-prev", ""); BIND_CMD("M-n", "edit:history-next", ""); /* note that changing "disable-ctrl-d" to "on" will change this to * edit:delete-next-char */ BIND_CMD("C-d", "edit:done-or-delete", "sends the zephyr if at the end of the message"); /****************************************************************/ /**************************** EDITLINE **************************/ /****************************************************************/ km_ew_onel = km = owl_keyhandler_create_and_add_keymap(kh, "editline", "Single-line text editing", owl_keys_editwin_default, NULL, owl_keys_editwin_postalways); owl_keymap_set_parent(km_ew_onel, km_editwin); BIND_CMD("C-u", "edit:delete-all", "Clears the entire line"); BIND_CMD("UP", "edit:history-prev", ""); BIND_CMD("M-[ A", "edit:history-prev", ""); BIND_CMD("C-p", "edit:history-prev", ""); BIND_CMD("M-p", "edit:history-prev", ""); BIND_CMD("DOWN", "edit:history-next", ""); BIND_CMD("M-[ B", "edit:history-next", ""); BIND_CMD("C-n", "edit:history-next", ""); BIND_CMD("M-n", "edit:history-next", ""); BIND_CMD("LF", "editline:done", "executes the command"); BIND_CMD("CR", "editline:done", "executes the command"); /****************************************************************/ /**************************** EDITRESPONSE **********************/ /****************************************************************/ km_ew_onel = km = owl_keyhandler_create_and_add_keymap(kh, "editresponse", "Single-line response to question", owl_keys_editwin_default, NULL, owl_keys_editwin_postalways); owl_keymap_set_parent(km_ew_onel, km_editwin); BIND_CMD("C-u", "edit:delete-all", "Clears the entire line"); BIND_CMD("LF", "editresponse:done", "executes the command"); BIND_CMD("CR", "editresponse:done", "executes the command"); /****************************************************************/ /**************************** POPLESS ***************************/ /****************************************************************/ km_viewwin = km = owl_keyhandler_create_and_add_keymap(kh, "popless", "Pop-up window (eg, help)", owl_keys_default_invalid, NULL, owl_keys_popless_postalways); owl_keymap_set_parent(km_viewwin, km_global); BIND_CMD("SPACE", "popless:scroll-down-page", ""); BIND_CMD("NPAGE", "popless:scroll-down-page", ""); BIND_CMD("M-n", "popless:scroll-down-page", ""); BIND_CMD("C-v", "popless:scroll-down-page", ""); BIND_CMD("b", "popless:scroll-up-page", ""); BIND_CMD("PPAGE", "popless:scroll-up-page", ""); BIND_CMD("M-p", "popless:scroll-up-page", ""); BIND_CMD("M-v", "popless:scroll-up-page", ""); BIND_CMD("CR", "popless:scroll-down-line", ""); BIND_CMD("LF", "popless:scroll-down-line", ""); BIND_CMD("DOWN", "popless:scroll-down-line", ""); BIND_CMD("M-[ B", "popless:scroll-down-line", ""); BIND_CMD("C-n", "popless:scroll-down-line", ""); BIND_CMD("UP", "popless:scroll-up-line", ""); BIND_CMD("M-[ A", "popless:scroll-up-line", ""); BIND_CMD("C-h", "popless:scroll-up-line", ""); BIND_CMD("C-p", "popless:scroll-up-line", ""); BIND_CMD("DELETE", "popless:scroll-up-line", ""); BIND_CMD("BACKSPACE", "popless:scroll-up-line", ""); BIND_CMD("DC", "popless:scroll-up-line", ""); BIND_CMD("RIGHT", "popless:scroll-right 10", "scrolls right"); BIND_CMD("M-[ C", "popless:scroll-right 10", "scrolls right"); BIND_CMD("LEFT", "popless:scroll-left 10", "scrolls left"); BIND_CMD("M-[ D", "popless:scroll-left 10", "scrolls left"); BIND_CMD("HOME", "popless:scroll-to-top", ""); BIND_CMD("<", "popless:scroll-to-top", ""); BIND_CMD("M-<", "popless:scroll-to-top", ""); BIND_CMD("END", "popless:scroll-to-bottom", ""); BIND_CMD(">", "popless:scroll-to-bottom", ""); BIND_CMD("M->", "popless:scroll-to-bottom", ""); BIND_CMD("q", "popless:quit", ""); BIND_CMD("C-c", "popless:quit", ""); BIND_CMD("C-g", "popless:quit", ""); /* Don't bind popless:start-command for now, as most commands make * no sense. */ #if 0 BIND_CMD(":", "popless:start-command", "start a new command"); BIND_CMD("M-x", "popless:start-command", "start a new command"); #endif BIND_CMD("/", "popless:start-search", "start a search command"); BIND_CMD("?", "popless:start-search -r", "start a reverse search command"); BIND_CMD("n", "popless:search", "find next occurrence of search"); BIND_CMD("N", "popless:search -r", "find previous occurrence of search"); BIND_CMD("C-l", "redisplay", ""); /****************************************************************/ /***************************** RECV *****************************/ /****************************************************************/ km_mainwin = km = owl_keyhandler_create_and_add_keymap(kh, "recv", "Main window / message list", owl_keys_default_invalid, owl_keys_recwin_prealways, NULL); owl_keymap_set_parent(km_mainwin, km_global); BIND_CMD("C-x C-c", "start-command quit", ""); BIND_CMD("F1", "help", ""); BIND_CMD("h", "help", ""); BIND_CMD("HELP", "help", ""); BIND_CMD("M-[ 2 8 ~", "help", ""); BIND_CMD(":", "start-command", "start a new command"); BIND_CMD("M-x", "start-command", "start a new command"); BIND_CMD("x", "expunge", ""); BIND_CMD("u", "undelete", ""); BIND_CMD("M-u", "undelete view", "undelete all messages in view"); BIND_CMD("d", "delete", "mark message for deletion"); BIND_CMD("M-D", "delete view", "mark all messages in view for deletion"); BIND_CMD("C-x k", "smartzpunt -i", "zpunt current "); BIND_CMD("X", "( expunge ; view --home )", "expunge deletions and switch to home view"); BIND_CMD("v", "start-command view ", "start a view command"); BIND_CMD("V", "view --home", "change to the home view ('all' by default)"); BIND_CMD("!", "view -r", "invert the current view filter"); BIND_CMD("M-n", "smartnarrow", "narrow to a view based on the current message"); BIND_CMD("M-N", "smartnarrow -i", "narrow to a view based on the current message, and consider instance pair"); BIND_CMD("M-m", "smartnarrow -r", "like M-n but with 'narrow-related' temporarily flipped."); BIND_CMD("M-M", "smartnarrow -ri", "like M-N but with 'narrow-related' temporarily flipped."); BIND_CMD("M-p", "view personal", ""); BIND_CMD("/", "start-command search ", "start a search command"); BIND_CMD("?", "start-command search -r ", "start a reverse search command"); BIND_CMD("HOME", "recv:setshift 0","move the display all the way left"); BIND_CMD("LEFT", "recv:shiftleft", ""); BIND_CMD("M-[ D", "recv:shiftleft", ""); BIND_CMD("RIGHT", "recv:shiftright",""); BIND_CMD("M-[ C", "recv:shiftright",""); BIND_CMD("DOWN", "recv:next", ""); BIND_CMD("C-n", "recv:next", ""); BIND_CMD("M-[ B", "recv:next", ""); BIND_CMD("M-C-n", "recv:next --smart-filter", "move to next message matching the current one"); BIND_CMD("UP", "recv:prev", ""); BIND_CMD("M-[ A", "recv:prev", ""); BIND_CMD("n", "recv:next-notdel", ""); BIND_CMD("p", "recv:prev-notdel", ""); BIND_CMD("C-p", "recv:prev", ""); BIND_CMD("M-C-p", "recv:prev --smart-filter", "move to previous message matching the current one"); BIND_CMD("P", "recv:next-personal", ""); BIND_CMD("M-P", "recv:prev-personal", ""); BIND_CMD("M-<", "recv:first", ""); BIND_CMD("<", "recv:first", ""); BIND_CMD("M->", "recv:last", ""); BIND_CMD(">", "recv:last", ""); BIND_CMD("C-v", "recv:pagedown", ""); BIND_CMD("NPAGE", "recv:pagedown", ""); BIND_CMD("M-v", "recv:pageup", ""); BIND_CMD("PPAGE", "recv:pageup", ""); BIND_CMD("C-@", "recv:mark", ""); BIND_CMD("C-x C-x", "recv:swapmark", ""); BIND_CMD("SPACE", "recv:scroll 10", "scroll message down a page"); BIND_CMD("CR", "recv:scroll 1", "scroll message down a line"); BIND_CMD("LF", "recv:scroll 1", "scroll message down a line"); BIND_CMD("C-h" , "recv:scroll -1", "scroll message up a line"); BIND_CMD("DELETE", "recv:scroll -1", "scroll message up a line"); BIND_CMD("BACKSPACE", "recv:scroll -1", "scroll message up a line"); BIND_CMD("DC", "recv:scroll -1", "scroll message up a line"); BIND_CMD("b", "recv:scroll -10", "scroll message up a page"); BIND_CMD("C-l", "redisplay", ""); BIND_CMD("i", "info", ""); BIND_CMD("l", "blist", ""); BIND_CMD("B", "alist", ""); BIND_CMD("M", "pop-message", ""); BIND_CMD("T", "delete trash", "mark all 'trash' messages for deletion"); BIND_CMD("o", "toggle-oneline", ""); BIND_CMD("A", "away toggle", "toggles away message on and off"); BIND_CMD("z", "start-command zwrite ", "start a zwrite command"); BIND_CMD("a", "start-command aimwrite ", "start an aimwrite command"); BIND_CMD("r", "reply", "reply to the current message"); BIND_CMD("R", "reply sender", "reply to sender of the current message"); BIND_CMD("C-r", "reply -e", "reply to the current message, but allow editing of recipient"); BIND_CMD("M-r", "reply -e", "reply to the current message, but allow editing of recipient"); BIND_CMD("M-R", "reply -e sender", "reply to sender of the current message, but allow editing of recipient"); BIND_CMD("W", "start-command webzephyr ", "start a webzephyr command"); BIND_CMD("C-c", "", "no effect in this mode"); BIND_CMD("C-g", "", "no effect in this mode"); } /****************************************************************/ /********************* Support Functions ************************/ /****************************************************************/ void owl_keys_recwin_prealways(owl_input j) { /* Clear the message line on subsequent key presses */ owl_function_makemsg(""); } void owl_keys_editwin_default(owl_input j) { owl_editwin *e; if (NULL != (e=owl_global_current_typwin(&g))) { owl_editwin_process_char(e, j); } } void owl_keys_editwin_postalways(owl_input j) { owl_editwin *e; if (NULL != (e=owl_global_current_typwin(&g))) { owl_editwin_post_process_char(e, j); } } void owl_keys_popless_postalways(owl_input j) { } void owl_keys_default_invalid(owl_input j) { if (j.ch==ERR) return; if (j.ch==410) return; owl_keyhandler_invalidkey(owl_global_get_keyhandler(&g)); } barnowl-1.9-src/Makefile.am0000664000175000017500000000511312247032546015171 0ustar andersandersACLOCAL_AMFLAGS = -I m4 GIT_DESCRIPTION := $(if $(wildcard .git),$(shell git describe --match='barnowl-*' HEAD 2>/dev/null)) GIT_FLAGS := $(if $(GIT_DESCRIPTION),-DGIT_VERSION=$(GIT_DESCRIPTION:barnowl-%=%)) bin_PROGRAMS = barnowl.bin if ENABLE_ZCRYPT bin_PROGRAMS += zcrypt endif zcrypt_SOURCES = zcrypt.c filterproc.c check_PROGRAMS = tester.bin barnowl_bin_SOURCES = $(BASE_SRCS) \ owl.h owl_perl.h config.h \ owl.c \ $(GEN_C) $(GEN_H) man_MANS = doc/barnowl.1 doc_DATA = doc/intro.txt doc/advanced.txt barnowl_bin_LDADD = compat/libcompat.a libfaim/libfaim.a tester_bin_SOURCES = $(BASE_SRCS) \ owl.h owl_perl.h config.h \ $(GEN_C) $(GEN_H) \ tester.c tester_bin_LDADD = compat/libcompat.a libfaim/libfaim.a TESTS=runtests.sh AM_CPPFLAGS = -I$(top_srcdir)/ \ -I$(top_srcdir)/libfaim/ \ -DDATADIR='"$(pkgdatadir)"' \ -DBINDIR='"$(bindir)"' \ $(GIT_FLAGS) CODELIST_SRCS=message.c mainwin.c popwin.c zephyr.c messagelist.c \ commands.c global.c text.c fmtext.c editwin.c util.c logging.c \ perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \ regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ keypress.c keymap.c keybinding.c cmd.c context.c \ aim.c buddy.c buddylist.c style.c errqueue.c \ zbuddylist.c popexec.c select.c wcwidth.c \ mainpanel.c msgwin.c sepbar.c editcontext.c signal.c NORMAL_SRCS = filterproc.c window.c windowcb.c BASE_SRCS = $(CODELIST_SRCS) $(NORMAL_SRCS) GEN_C = varstubs.c perlglue.c GEN_H = owl_prototypes.h BUILT_SOURCES = $(GEN_C) $(GEN_H) # Only copy file into place if file.new is different %: %.new @diff -U0 $@ $< || { \ test -f $@ && echo '$@ changed!'; \ echo cp -f $< $@; \ cp -f $< $@; } proto: owl_prototypes.h perlglue.c: perlglue.xs $(TYPEMAP) $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs > perlglue.c varstubs.c: stubgen.pl variable.c $(AM_V_GEN)perl $< $(sort $(filter-out $<,$+)) > $@ owl_prototypes.h.new: codelist.pl varstubs.c $(CODELIST_SRCS) $(AM_V_GEN)perl $< $(sort $(filter-out $<,$+)) > $@ # For emacs flymake-mode check-syntax: proto $(COMPILE) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES) install-data-local: $(mkinstalldirs) ${DESTDIR}${pkgdatadir}/lib (cd perl/lib && tar -cf - . ) | (cd ${DESTDIR}${pkgdatadir}/lib && tar -xf - ) do_transform = $(shell echo '$(1)' | sed '$(transform)') install-exec-hook: mv -f $(DESTDIR)$(bindir)/$(call do_transform,barnowl.bin) \ $(DESTDIR)$(bindir)/$(call do_transform,barnowl) SUBDIRS = compat libfaim perl barnowl-1.9-src/mainpanel.c0000664000175000017500000000350512247032546015250 0ustar andersanders#include "owl.h" void owl_mainpanel_init(owl_mainpanel *mp) { /* Create windows */ mp->panel = owl_window_new(NULL); /* HACK for now: the sepwin must be drawn /after/ the recwin for * lastdisplayed to work */ mp->sepwin = owl_window_new(mp->panel); mp->recwin = owl_window_new(mp->panel); mp->msgwin = owl_window_new(mp->panel); mp->typwin = owl_window_new(mp->panel); /* Set up sizing hooks */ owl_signal_connect_object(owl_window_get_screen(), "resized", G_CALLBACK(owl_window_fill_parent_cb), mp->panel, 0); g_signal_connect_swapped(mp->panel, "resized", G_CALLBACK(owl_mainpanel_layout_contents), mp); /* Bootstrap the sizes and go */ owl_window_fill_parent_cb(owl_window_get_screen(), mp->panel); owl_window_show_all(mp->panel); } void owl_mainpanel_layout_contents(owl_mainpanel *mp) { int lines, cols, typwin_lines; /* skip if we haven't been initialized */ if (!mp->panel) return; owl_window_get_position(mp->panel, &lines, &cols, NULL, NULL); typwin_lines = owl_global_get_typwin_lines(&g); /* set the new window sizes */ mp->recwinlines=lines-(typwin_lines+2); if (mp->recwinlines<0) { /* gotta deal with this */ mp->recwinlines=0; typwin_lines = lines - 2; } /* resize all the windows */ owl_window_set_position(mp->recwin, mp->recwinlines, cols, 0, 0); owl_window_set_position(mp->sepwin, 1, cols, mp->recwinlines, 0); owl_window_set_position(mp->msgwin, 1, cols, mp->recwinlines+1, 0); owl_window_set_position(mp->typwin, typwin_lines, cols, mp->recwinlines+2, 0); } void owl_mainpanel_cleanup(owl_mainpanel *mp) { owl_window_unlink(mp->panel); g_object_unref(mp->panel); g_object_unref(mp->recwin); g_object_unref(mp->sepwin); g_object_unref(mp->msgwin); g_object_unref(mp->typwin); mp->panel = mp->recwin = mp->sepwin = mp->msgwin = mp->typwin = NULL; } barnowl-1.9-src/Makefile.in0000664000175000017500000015105312247034253015204 0ustar andersanders# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = barnowl.bin$(EXEEXT) $(am__EXEEXT_1) @ENABLE_ZCRYPT_TRUE@am__append_1 = zcrypt check_PROGRAMS = tester.bin$(EXEEXT) subdir = . DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in depcomp test-driver AUTHORS COPYING \ ChangeLog README compile install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_flag.m4 \ $(top_srcdir)/m4/ax_prog_perl_modules.m4 \ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ENABLE_ZCRYPT_TRUE@am__EXEEXT_1 = zcrypt$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(docdir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = message.$(OBJEXT) mainwin.$(OBJEXT) popwin.$(OBJEXT) \ zephyr.$(OBJEXT) messagelist.$(OBJEXT) commands.$(OBJEXT) \ global.$(OBJEXT) text.$(OBJEXT) fmtext.$(OBJEXT) \ editwin.$(OBJEXT) util.$(OBJEXT) logging.$(OBJEXT) \ perlconfig.$(OBJEXT) keys.$(OBJEXT) functions.$(OBJEXT) \ zwrite.$(OBJEXT) viewwin.$(OBJEXT) help.$(OBJEXT) \ filter.$(OBJEXT) regex.$(OBJEXT) history.$(OBJEXT) \ view.$(OBJEXT) dict.$(OBJEXT) variable.$(OBJEXT) \ filterelement.$(OBJEXT) pair.$(OBJEXT) keypress.$(OBJEXT) \ keymap.$(OBJEXT) keybinding.$(OBJEXT) cmd.$(OBJEXT) \ context.$(OBJEXT) aim.$(OBJEXT) buddy.$(OBJEXT) \ buddylist.$(OBJEXT) style.$(OBJEXT) errqueue.$(OBJEXT) \ zbuddylist.$(OBJEXT) popexec.$(OBJEXT) select.$(OBJEXT) \ wcwidth.$(OBJEXT) mainpanel.$(OBJEXT) msgwin.$(OBJEXT) \ sepbar.$(OBJEXT) editcontext.$(OBJEXT) signal.$(OBJEXT) am__objects_2 = filterproc.$(OBJEXT) window.$(OBJEXT) \ windowcb.$(OBJEXT) am__objects_3 = $(am__objects_1) $(am__objects_2) am__objects_4 = varstubs.$(OBJEXT) perlglue.$(OBJEXT) am__objects_5 = am_barnowl_bin_OBJECTS = $(am__objects_3) owl.$(OBJEXT) \ $(am__objects_4) $(am__objects_5) barnowl_bin_OBJECTS = $(am_barnowl_bin_OBJECTS) barnowl_bin_DEPENDENCIES = compat/libcompat.a libfaim/libfaim.a am_tester_bin_OBJECTS = $(am__objects_3) $(am__objects_4) \ $(am__objects_5) tester.$(OBJEXT) tester_bin_OBJECTS = $(am_tester_bin_OBJECTS) tester_bin_DEPENDENCIES = compat/libcompat.a libfaim/libfaim.a am_zcrypt_OBJECTS = zcrypt.$(OBJEXT) filterproc.$(OBJEXT) zcrypt_OBJECTS = $(am_zcrypt_OBJECTS) zcrypt_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(barnowl_bin_SOURCES) $(tester_bin_SOURCES) \ $(zcrypt_SOURCES) DIST_SOURCES = $(barnowl_bin_SOURCES) $(tester_bin_SOURCES) \ $(zcrypt_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DATA = $(doc_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope check recheck distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GREP = @GREP@ HAVE_ZIP = @HAVE_ZIP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBCRYPTO_CFLAGS = @LIBCRYPTO_CFLAGS@ LIBCRYPTO_LIBS = @LIBCRYPTO_LIBS@ LIBFAIM_CFLAGS = @LIBFAIM_CFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XSUBPPDIR = @XSUBPPDIR@ XSUBPPFLAGS = @XSUBPPFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 GIT_DESCRIPTION := $(if $(wildcard .git),$(shell git describe --match='barnowl-*' HEAD 2>/dev/null)) GIT_FLAGS := $(if $(GIT_DESCRIPTION),-DGIT_VERSION=$(GIT_DESCRIPTION:barnowl-%=%)) zcrypt_SOURCES = zcrypt.c filterproc.c barnowl_bin_SOURCES = $(BASE_SRCS) \ owl.h owl_perl.h config.h \ owl.c \ $(GEN_C) $(GEN_H) man_MANS = doc/barnowl.1 doc_DATA = doc/intro.txt doc/advanced.txt barnowl_bin_LDADD = compat/libcompat.a libfaim/libfaim.a tester_bin_SOURCES = $(BASE_SRCS) \ owl.h owl_perl.h config.h \ $(GEN_C) $(GEN_H) \ tester.c tester_bin_LDADD = compat/libcompat.a libfaim/libfaim.a TESTS = runtests.sh AM_CPPFLAGS = -I$(top_srcdir)/ \ -I$(top_srcdir)/libfaim/ \ -DDATADIR='"$(pkgdatadir)"' \ -DBINDIR='"$(bindir)"' \ $(GIT_FLAGS) CODELIST_SRCS = message.c mainwin.c popwin.c zephyr.c messagelist.c \ commands.c global.c text.c fmtext.c editwin.c util.c logging.c \ perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \ regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ keypress.c keymap.c keybinding.c cmd.c context.c \ aim.c buddy.c buddylist.c style.c errqueue.c \ zbuddylist.c popexec.c select.c wcwidth.c \ mainpanel.c msgwin.c sepbar.c editcontext.c signal.c NORMAL_SRCS = filterproc.c window.c windowcb.c BASE_SRCS = $(CODELIST_SRCS) $(NORMAL_SRCS) GEN_C = varstubs.c perlglue.c GEN_H = owl_prototypes.h BUILT_SOURCES = $(GEN_C) $(GEN_H) do_transform = $(shell echo '$(1)' | sed '$(transform)') SUBDIRS = compat libfaim perl all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .log .o .obj .test .test$(EXEEXT) .trs am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) barnowl.bin$(EXEEXT): $(barnowl_bin_OBJECTS) $(barnowl_bin_DEPENDENCIES) $(EXTRA_barnowl_bin_DEPENDENCIES) @rm -f barnowl.bin$(EXEEXT) $(AM_V_CCLD)$(LINK) $(barnowl_bin_OBJECTS) $(barnowl_bin_LDADD) $(LIBS) tester.bin$(EXEEXT): $(tester_bin_OBJECTS) $(tester_bin_DEPENDENCIES) $(EXTRA_tester_bin_DEPENDENCIES) @rm -f tester.bin$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tester_bin_OBJECTS) $(tester_bin_LDADD) $(LIBS) zcrypt$(EXEEXT): $(zcrypt_OBJECTS) $(zcrypt_DEPENDENCIES) $(EXTRA_zcrypt_DEPENDENCIES) @rm -f zcrypt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(zcrypt_OBJECTS) $(zcrypt_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddylist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commands.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/context.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dict.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/editcontext.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/editwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errqueue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filterelement.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filterproc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmtext.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functions.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/global.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/history.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keybinding.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keymap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keypress.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keys.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mainpanel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mainwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messagelist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msgwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pair.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perlconfig.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perlglue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/popexec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/popwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sepbar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/style.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tester.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/variable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varstubs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/view.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/viewwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcwidth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowcb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zbuddylist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zcrypt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zephyr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zwrite.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-docDATA: $(doc_DATA) @$(NORMAL_INSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-docDATA: @$(NORMAL_UNINSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? runtests.sh.log: runtests.sh @p='runtests.sh'; \ b='runtests.sh'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-docDATA install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-docDATA uninstall-man uninstall-man: uninstall-man1 .MAKE: $(am__recursive_targets) all check check-am install install-am \ install-exec-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-TESTS check-am clean clean-binPROGRAMS \ clean-checkPROGRAMS clean-cscope clean-generic cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-compile distclean-generic \ distclean-hdr distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-data-local install-docDATA install-dvi \ install-dvi-am install-exec install-exec-am install-exec-hook \ install-html install-html-am install-info install-info-am \ install-man install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am recheck tags tags-am \ uninstall uninstall-am uninstall-binPROGRAMS uninstall-docDATA \ uninstall-man uninstall-man1 # Only copy file into place if file.new is different %: %.new @diff -U0 $@ $< || { \ test -f $@ && echo '$@ changed!'; \ echo cp -f $< $@; \ cp -f $< $@; } proto: owl_prototypes.h perlglue.c: perlglue.xs $(TYPEMAP) $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs > perlglue.c varstubs.c: stubgen.pl variable.c $(AM_V_GEN)perl $< $(sort $(filter-out $<,$+)) > $@ owl_prototypes.h.new: codelist.pl varstubs.c $(CODELIST_SRCS) $(AM_V_GEN)perl $< $(sort $(filter-out $<,$+)) > $@ # For emacs flymake-mode check-syntax: proto $(COMPILE) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES) install-data-local: $(mkinstalldirs) ${DESTDIR}${pkgdatadir}/lib (cd perl/lib && tar -cf - . ) | (cd ${DESTDIR}${pkgdatadir}/lib && tar -xf - ) install-exec-hook: mv -f $(DESTDIR)$(bindir)/$(call do_transform,barnowl.bin) \ $(DESTDIR)$(bindir)/$(call do_transform,barnowl) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: barnowl-1.9-src/codelist.pl0000775000175000017500000000132612247032546015305 0ustar andersanders#! /usr/bin/perl my $guard_symbol = "INC_BARNOWL_OWL_PROTOTYPES_H"; print "#ifndef $guard_symbol\n"; print "#define $guard_symbol\n"; foreach $file (@ARGV) { open(FILE, $file); print "/* -------------------------------- $file -------------------------------- */\n"; while () { if (/^\S/ && (/\{\s*$/ || /\)\s*$/) && !/\}/ && !/^\{/ && !/^#/ && !/^static/ && !/^system/ && !/^XS/ && !/\/\*/ && !/ZWRITEOPTIONS/ && !/owlfaim_priv/) { s/\s+\{/\;/; s/\)[ \t]*$/\)\;/; print "extern "; print; } elsif (/^#if/ || /^#else/ || /^#endif/) { print; } } close(FILE); print "\n"; } print "#endif /* $guard_symbol */\n"; barnowl-1.9-src/cmd.c0000664000175000017500000002020112247032546014037 0ustar andersanders#include "owl.h" /**************************************************************************/ /***************************** COMMAND DICT *******************************/ /**************************************************************************/ void owl_cmddict_setup(owl_cmddict *cd) { owl_cmddict_init(cd); owl_cmd_add_defaults(cd); } void owl_cmddict_init(owl_cmddict *cd) { owl_dict_create(cd); } /* for bulk initialization at startup */ void owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) { const owl_cmd *cur; for (cur = cmds; cur->name != NULL; cur++) { owl_cmddict_add_cmd(cd, cur); } } GPtrArray *owl_cmddict_get_names(const owl_cmddict *d) { return owl_dict_get_keys(d); } const owl_cmd *owl_cmddict_find(const owl_cmddict *d, const char *name) { return owl_dict_find_element(d, name); } /* creates a new command alias */ void owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) { owl_cmd *cmd; cmd = g_new(owl_cmd, 1); owl_cmd_create_alias(cmd, alias_from, alias_to); owl_perlconfig_new_command(cmd->name); owl_dict_insert_element(cd, cmd->name, cmd, (void (*)(void *))owl_cmd_delete); } int owl_cmddict_add_cmd(owl_cmddict *cd, const owl_cmd * cmd) { owl_cmd * newcmd = g_new(owl_cmd, 1); if(owl_cmd_create_from_template(newcmd, cmd) < 0) { g_free(newcmd); return -1; } owl_perlconfig_new_command(cmd->name); return owl_dict_insert_element(cd, newcmd->name, newcmd, (void (*)(void *))owl_cmd_delete); } /* caller must free the return */ CALLER_OWN char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) { char *retval = NULL; const owl_cmd *cmd; if (!strcmp(argv[0], "")) { } else if (NULL != (cmd = owl_dict_find_element(cd, argv[0]))) { retval = owl_cmd_execute(cmd, cd, ctx, argc, argv, buff); /* redraw the sepbar; TODO: don't violate layering */ owl_global_sepbar_dirty(&g); } else { owl_function_makemsg("Unknown command '%s'.", buff); } return retval; } /* caller must free the return */ CALLER_OWN char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff) { char **argv; int argc; char *retval = NULL; argv = owl_parseline(cmdbuff, &argc); if (argv == NULL) { owl_function_makemsg("Unbalanced quotes"); return NULL; } if (argc < 1) { g_strfreev(argv); return NULL; } retval = _owl_cmddict_execute(cd, ctx, strs(argv), argc, cmdbuff); g_strfreev(argv); return retval; } /* caller must free the return */ CALLER_OWN char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc) { char *buff; char *retval = NULL; buff = g_strjoinv(" ", (char**)argv); retval = _owl_cmddict_execute(cd, ctx, argv, argc, buff); g_free(buff); return retval; } /*********************************************************************/ /***************************** COMMAND *******************************/ /*********************************************************************/ /* sets up a new command based on a template, copying strings */ int owl_cmd_create_from_template(owl_cmd *cmd, const owl_cmd *templ) { *cmd = *templ; if (!templ->name) return(-1); cmd->name = g_strdup(templ->name); if (templ->summary) cmd->summary = g_strdup(templ->summary); if (templ->usage) cmd->usage = g_strdup(templ->usage); if (templ->description) cmd->description = g_strdup(templ->description); if (templ->cmd_aliased_to) cmd->cmd_aliased_to = g_strdup(templ->cmd_aliased_to); return(0); } void owl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) { memset(cmd, 0, sizeof(owl_cmd)); cmd->name = g_strdup(name); cmd->cmd_aliased_to = g_strdup(aliased_to); cmd->summary = g_strdup_printf("%s%s", OWL_CMD_ALIAS_SUMMARY_PREFIX, aliased_to); } void owl_cmd_cleanup(owl_cmd *cmd) { g_free(cmd->name); g_free(cmd->summary); g_free(cmd->usage); g_free(cmd->description); g_free(cmd->cmd_aliased_to); if (cmd->cmd_perl) owl_perlconfig_cmd_cleanup(cmd); } void owl_cmd_delete(owl_cmd *cmd) { owl_cmd_cleanup(cmd); g_free(cmd); } int owl_cmd_is_context_valid(const owl_cmd *cmd, const owl_context *ctx) { if (owl_context_matches(ctx, cmd->validctx)) return 1; else return 0; } /* caller must free the result */ CALLER_OWN char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) { static int alias_recurse_depth = 0; int ival=0; const char *cmdbuffargs; char *newcmd, *rv=NULL; if (argc < 1) return(NULL); /* Recurse if this is an alias */ if (cmd->cmd_aliased_to) { if (alias_recurse_depth++ > 50) { owl_function_makemsg("Alias loop detected for '%s'.", cmdbuff); } else { cmdbuffargs = skiptokens(cmdbuff, 1); newcmd = g_strdup_printf("%s %s", cmd->cmd_aliased_to, cmdbuffargs); rv = owl_function_command(newcmd); g_free(newcmd); } alias_recurse_depth--; return rv; } /* Do validation and conversions */ if (cmd->cmd_ctxargs_fn || cmd->cmd_ctxv_fn || cmd->cmd_ctxi_fn) { if (!owl_cmd_is_context_valid(cmd, ctx)) { owl_function_makemsg("Invalid context for command '%s'.", cmdbuff); return NULL; } } if ((argc != 1) && (cmd->cmd_v_fn || cmd->cmd_ctxv_fn)) { owl_function_makemsg("Wrong number of arguments for %s command.", argv[0]); return NULL; } if (cmd->cmd_i_fn || cmd->cmd_ctxi_fn) { char *ep; if (argc != 2) { owl_function_makemsg("Wrong number of arguments for %s command.", argv[0]); return NULL; } ival = strtol(argv[1], &ep, 10); if (*ep || ep==argv[1]) { owl_function_makemsg("Invalid argument '%s' for %s command.", argv[1], argv[0]); return(NULL); } } if (cmd->cmd_args_fn) { return cmd->cmd_args_fn(argc, argv, cmdbuff); } else if (cmd->cmd_v_fn) { cmd->cmd_v_fn(); } else if (cmd->cmd_i_fn) { cmd->cmd_i_fn(ival); } else if (cmd->cmd_ctxargs_fn) { return cmd->cmd_ctxargs_fn(owl_context_get_data(ctx), argc, argv, cmdbuff); } else if (cmd->cmd_ctxv_fn) { cmd->cmd_ctxv_fn(owl_context_get_data(ctx)); } else if (cmd->cmd_ctxi_fn) { cmd->cmd_ctxi_fn(owl_context_get_data(ctx), ival); } else if (cmd->cmd_perl) { return owl_perlconfig_perlcmd(cmd, argc, argv); } return NULL; } /* returns a reference */ const char *owl_cmd_get_summary(const owl_cmd *cmd) { return cmd->summary; } /* returns a summary line describing this keymap. the caller must free. */ CALLER_OWN char *owl_cmd_describe(const owl_cmd *cmd) { if (!cmd || !cmd->name || !cmd->summary) return NULL; return g_strdup_printf("%-25s - %s", cmd->name, cmd->summary); } void owl_cmd_get_help(const owl_cmddict *d, const char *name, owl_fmtext *fm) { const char *s; char *indent; owl_cmd *cmd; if (!name || (cmd = owl_dict_find_element(d, name)) == NULL) { owl_fmtext_append_bold(fm, "OWL HELP\n\n"); owl_fmtext_append_normal(fm, "No such command...\n"); return; } owl_fmtext_append_bold(fm, "OWL HELP\n\n"); owl_fmtext_append_bold(fm, "NAME\n\n"); owl_fmtext_append_normal(fm, OWL_TABSTR); owl_fmtext_append_normal(fm, cmd->name); if (cmd->summary && *cmd->summary) { owl_fmtext_append_normal(fm, " - "); owl_fmtext_append_normal(fm, cmd->summary); } owl_fmtext_append_normal(fm, "\n"); if (cmd->usage && *cmd->usage) { s = cmd->usage; indent = owl_text_indent(s, OWL_TAB, true); owl_fmtext_append_bold(fm, "\nSYNOPSIS\n"); owl_fmtext_append_normal(fm, indent); owl_fmtext_append_normal(fm, "\n"); g_free(indent); } else { owl_fmtext_append_bold(fm, "\nSYNOPSIS\n"); owl_fmtext_append_normal(fm, OWL_TABSTR); owl_fmtext_append_normal(fm, cmd->name); owl_fmtext_append_normal(fm, "\n"); } if (cmd->description && *cmd->description) { s = cmd->description; indent = owl_text_indent(s, OWL_TAB, true); owl_fmtext_append_bold(fm, "\nDESCRIPTION\n"); owl_fmtext_append_normal(fm, indent); owl_fmtext_append_normal(fm, "\n"); g_free(indent); } owl_fmtext_append_normal(fm, "\n\n"); } barnowl-1.9-src/m4/0000775000175000017500000000000012247032546013455 5ustar andersandersbarnowl-1.9-src/m4/pkg.m40000664000175000017500000001302312247032546014477 0ustar andersanders# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES barnowl-1.9-src/m4/ax_check_flag.m40000664000175000017500000001400212247032546016452 0ustar andersanders# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_PREPROC_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) # AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) # AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's # preprocessor/compiler/linker, or whether they give an error. (Warnings, # however, are ignored.) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check us thus made # with the following flags: "CFLAGS EXTRA-FLAGS FLAG". EXTRA-FLAGS can # for example be used to force the compiler to issue an error when a bad # flag is given. # # AX_APPEND_FLAG appends the FLAG to the FLAG-VARIABLE shell variable or # the current language's flags if not specified. FLAG is not added to # FLAG-VARIABLE if it is already in the shell variable. # # AX_APPEND_COMPILE_FLAGS checks for each FLAG1, FLAG2, etc. using # AX_CHECK_COMPILE_FLAG and if the check is successful the flag is added # to the appropriate FLAGS variable with AX_APPEND_FLAG. The # FLAGS-VARIABLE and EXTRA-FLAGS arguments are the same as in the other # macros. AX_APPEND_LINK_FLAGS does the same for linker flags. # # NOTE: Based on AX_CHECK_COMPILER_FLAGS and AX_CFLAGS_GCC_OPTION. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2009 Steven G. Johnson # Copyright (c) 2009 Matteo Frigo # Copyright (c) 2011 Maarten Bosmans # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 3 AC_DEFUN([AX_CHECK_PREPROC_FLAG], [AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]cppflags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG preprocessor accepts $1], CACHEVAR, [ ax_check_save_flags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $4 $1" AC_PREPROC_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) CPPFLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_PREPROC_FLAGS AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS AC_DEFUN([AX_CHECK_LINK_FLAG], [AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $4 $1" AC_LINK_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) LDFLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_LINK_FLAGS AC_DEFUN([AX_APPEND_FLAG], [AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl AS_VAR_SET_IF(FLAGS, [case " AS_VAR_GET(FLAGS) " in *" $1 "*) AC_RUN_LOG([: FLAGS already contains $1]) ;; *) AC_RUN_LOG([: FLAGS="$FLAGS $1"]) AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"]) ;; esac], [AS_VAR_SET(FLAGS,["$1"])]) AS_VAR_POPDEF([FLAGS])dnl ])dnl AX_APPEND_FLAG AC_DEFUN([AX_APPEND_COMPILE_FLAGS], [for flag in $1; do AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3]) done ])dnl AX_APPEND_COMPILE_FLAGS AC_DEFUN([AX_APPEND_LINK_FLAGS], [for flag in $1; do AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3]) done ])dnl AX_APPEND_LINK_FLAGS barnowl-1.9-src/m4/ax_prog_perl_modules.m40000664000175000017500000000431312247032546020131 0ustar andersanders# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html # =========================================================================== # # SYNOPSIS # # AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # # DESCRIPTION # # Checks to see if the given perl modules are available. If true the shell # commands in ACTION-IF-TRUE are executed. If not the shell commands in # ACTION-IF-FALSE are run. Note if $PERL is not set (for example by # calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl) # will be run. # # MODULES is a space separated list of module names. To check for a # minimum version of a module, append the version number to the module # name, separated by an equals sign. # # Example: # # AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, , # AC_MSG_WARN(Need some Perl modules) # # LICENSE # # Copyright (c) 2009 Dean Povey # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 7 AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES]) AC_DEFUN([AX_PROG_PERL_MODULES],[dnl m4_define([ax_perl_modules]) m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])), [ m4_append([ax_perl_modules], [']m4_bpatsubst(ax_perl_module,=,[ ])[' ]) ]) # Make sure we have perl if test -z "$PERL"; then AC_CHECK_PROG(PERL,perl,perl) fi if test "x$PERL" != x; then ax_perl_modules_failed=0 for ax_perl_module in ax_perl_modules; do AC_MSG_CHECKING(for perl module $ax_perl_module) # Would be nice to log result here, but can't rely on autoconf internals $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1 if test $? -ne 0; then AC_MSG_RESULT(no); ax_perl_modules_failed=1 else AC_MSG_RESULT(ok); fi done # Run optional shell commands if test "$ax_perl_modules_failed" = 0; then : $2 else : $3 fi else AC_MSG_WARN(could not find perl) fi])dnl barnowl-1.9-src/m4/ax_cflags_warn_all.m40000664000175000017500000002007612247032546017532 0ustar andersanders# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html # =========================================================================== # # SYNOPSIS # # AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] # AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] # AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] # # DESCRIPTION # # Try to find a compiler option that enables most reasonable warnings. # # For the GNU compiler it will be -Wall (and -ansi -pedantic) The result # is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. # # Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, # HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and # Intel compilers. For a given compiler, the Fortran flags are much more # experimental than their C equivalents. # # - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS # - $2 add-value-if-not-found : nothing # - $3 action-if-found : add value to shellvariable # - $4 action-if-not-found : nothing # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2010 Rhys Ulerich # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 10 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], VAR,[VAR="no, unknown" AC_LANG_PUSH([C]) ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % -Wall" dnl GCC "-xstrconst % -v" dnl Solaris C "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX "-ansi -ansiE % -fullwarn" dnl IRIX "+ESlit % +w1" dnl HP-UX C "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) "-h conform % -h msglevel 2" dnl Cray C (Unicos) # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_POP([C]) ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) dnl the only difference - the LANG selection... and the default FLAGS AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], VAR,[VAR="no, unknown" AC_LANG_PUSH([C++]) ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % -Wall" dnl GCC "-xstrconst % -v" dnl Solaris C "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX "-ansi -ansiE % -fullwarn" dnl IRIX "+ESlit % +w1" dnl HP-UX C "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) "-h conform % -h msglevel 2" dnl Cray C (Unicos) # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_POP([C++]) ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) dnl the only difference - the LANG selection... and the default FLAGS AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl AS_VAR_PUSHDEF([FLAGS],[FCFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ax_cv_fcflags_warn_all])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], VAR,[VAR="no, unknown" AC_LANG_PUSH([Fortran]) ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-warn all % -warn all" dnl Intel "-pedantic % -Wall" dnl GCC "-xstrconst % -v" dnl Solaris C "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX "-ansi -ansiE % -fullwarn" dnl IRIX "+ESlit % +w1" dnl HP-UX C "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) "-h conform % -h msglevel 2" dnl Cray C (Unicos) # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_POP([Fortran]) ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) dnl implementation tactics: dnl the for-argument contains a list of options. The first part of dnl these does only exist to detect the compiler - usually it is dnl a global option to enable -ansi or -extrawarnings. All other dnl compilers will fail about it. That was needed since a lot of dnl compilers will give false positives for some option-syntax dnl like -Woption or -Xoption as they think of it is a pass-through dnl to later compile stages or something. The "%" is used as a dnl delimiter. A non-option comment can be given after "%%" marks dnl which will be shown but not added to the respective C/CXXFLAGS. barnowl-1.9-src/typemap0000664000175000017500000000021512247032546014535 0ustar andersandersTYPEMAP utf8 * T_PV_UTF8 const utf8 * T_PV_UTF8 OUTPUT T_PV_UTF8 sv_setpv((SV*)$arg, $var); SvUTF8_on((SV*)$arg); barnowl-1.9-src/perl/0000775000175000017500000000000012247034253014074 5ustar andersandersbarnowl-1.9-src/perl/modules/0000775000175000017500000000000012247034253015544 5ustar andersandersbarnowl-1.9-src/perl/modules/Facebook/0000775000175000017500000000000012247032546017260 5ustar andersandersbarnowl-1.9-src/perl/modules/Facebook/lib/0000775000175000017500000000000012247032546020026 5ustar andersandersbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/0000775000175000017500000000000012247032546021537 5ustar andersandersbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/0000775000175000017500000000000012247032546022600 5ustar andersandersbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Role/0000775000175000017500000000000012247032546023501 5ustar andersandersbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Role/Uri.pm0000664000175000017500000000113512247032546024576 0ustar andersanderspackage Facebook::Graph::Role::Uri; BEGIN { $Facebook::Graph::Role::Uri::VERSION = '1.0300'; } use Any::Moose 'Role'; use URI; sub uri { return URI->new('https://graph.facebook.com') } 1; =head1 NAME Facebook::Graph::Role::Uri - The base URI for the Facebook Graph API. =head1 VERSION version 1.0300 =head1 DESCRIPTION Provides a C method in any class which returns a L object that points to the Facebook Graph API. =head1 LEGAL Facebook::Graph is Copyright 2010 Plain Black Corporation (L) and is licensed under the same terms as Perl itself. =cutbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Cookbook.pod0000664000175000017500000000203712247032546025054 0ustar andersanders=head1 NAME Facebook::Graph::Cookbook - A cookbook for Facebook::Graph =head1 VERSION version 1.0300 =head1 DESCRIPTION The goal of this document is to provide a set of common recipies for success. The L API is relatively easy to use, but there are just enough tricks to it that it can throw you off if you don't have a little insider information. Hopefully this document will help you overcome those hurdles. =head1 RECIPIES =over =item L Shows you how to set up a privileged application using nothing more than L. This is very much a step by step tutorial. =item L A fully functional Facebook::Graph app that publishes data to Facebook and reads data from it. Uses a full application server and lots of other modules. This is a working example, without a lot of explaination. =back =head1 LEGAL Facebook::Graph is Copyright 2010 Plain Black Corporation (L) and is licensed under the same terms as Perl itself. =cutbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Authorize.pm0000664000175000017500000000553412247032546025117 0ustar andersanderspackage Facebook::Graph::Authorize; BEGIN { $Facebook::Graph::Authorize::VERSION = '1.0300'; } use Any::Moose; with 'Facebook::Graph::Role::Uri'; has app_id => ( is => 'ro', required=> 1, ); has postback => ( is => 'ro', required=> 1, ); has permissions => ( is => 'rw', lazy => 1, predicate => 'has_permissions', default => sub { [] }, ); has display => ( is => 'rw', default => 'page', ); sub extend_permissions { my ($self, @permissions) = @_; push @{$self->permissions}, @permissions; return $self; } sub set_display { my ($self, $display) = @_; $self->display($display); return $self; } sub uri_as_string { my ($self) = @_; my $uri = $self->uri; $uri->path('oauth/authorize'); my %query = ( client_id => $self->app_id, redirect_uri => $self->postback, display => $self->display, ); if ($self->has_permissions) { $query{scope} = join(',', @{$self->permissions}); } $uri->query_form(%query); return $uri->as_string; } no Any::Moose; __PACKAGE__->meta->make_immutable; =head1 NAME Facebook::Graph::Authorize - Authorizing an app with Facebook =head1 VERSION version 1.0300 =head1 SYNOPSIS my $fb = Facebook::Graph->new( secret => $facebook_application_secret, app_id => $facebook_application_id, postback => 'https://www.yourapplication.com/facebook/postback', ); my $uri = $fb->authorize ->extend_permissions(qw( email publish_stream )) ->set_display('popup') ->uri_as_string; =head1 DESCRIPTION Get an authorization code from Facebook so that you can request an access token to make privileged requests. The result of this package is to give you a URI to redirect a user to Facebook so they can log in, and approve whatever permissions you are requesting. =head1 METHODS =head2 extend_permissions ( permissions ) Ask for extra permissions for your app. By default, if you do not request extended permissions your app will have access to only general information that any Facebook user would have. Returns a reference to self for method chaining. =head3 permissions An array of permissions. See L for more information about what's available. =head2 set_display ( type ) Sets the display type for the authorization screen that a user will see. =head3 type Defaults to C. Valid types are C, C, C, and C. See B in L for details. =head2 uri_as_string ( ) Returns a URI string to redirect the user back to Facebook. =head1 LEGAL Facebook::Graph is Copyright 2010 Plain Black Corporation (L) and is licensed under the same terms as Perl itself. =cutbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/AccessToken.pm0000664000175000017500000000435212247032546025344 0ustar andersanderspackage Facebook::Graph::AccessToken; BEGIN { $Facebook::Graph::AccessToken::VERSION = '1.0300'; } use Any::Moose; use Facebook::Graph::AccessToken::Response; with 'Facebook::Graph::Role::Uri'; use AnyEvent::HTTP; has app_id => ( is => 'ro', required=> 1, ); has secret => ( is => 'ro', required=> 1, ); has postback => ( is => 'ro', required=> 1, ); has code => ( is => 'ro', required=> 1, ); sub uri_as_string { my ($self) = @_; my $uri = $self->uri; $uri->path('oauth/access_token'); $uri->query_form( client_id => $self->app_id, client_secret => $self->secret, redirect_uri => $self->postback, code => $self->code, ); return $uri->as_string; } sub request { my ($self, $cb) = @_; http_get $self->uri_as_string, sub { my ($response, $headers) = @_; $cb->(Facebook::Graph::AccessToken::Response->new( response => $response, headers => $headers, uri => $self->uri_as_string )); }; () # return nothing } no Any::Moose; __PACKAGE__->meta->make_immutable; =head1 NAME Facebook::Graph::AccessToken - Acquire an access token from Facebook. =head1 VERSION version 1.0300 =head1 SYNOPSIS my $fb = Facebook::Graph->new( secret => $facebook_application_secret, app_id => $facebook_application_id, postback => 'https://www.yourapplication.com/facebook/postback', ); my $token_response_object = $fb->request_access_token($code_from_authorize_postback); my $token_string = $token_response_object->token; my $token_expires_epoch = $token_response_object->expires; =head1 DESCRIPTION Allows you to request an access token from Facebook so you can make privileged requests on the Graph API. =head1 METHODS =head2 uri_as_string () Returns the URI that will be called to fetch the token as a string. Mostly useful for debugging and testing. =head2 request () Makes a request to Facebook to fetch an access token. Returns a L object. =head1 LEGAL Facebook::Graph is Copyright 2010 Plain Black Corporation (L) and is licensed under the same terms as Perl itself. =cut barnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Picture.pm0000664000175000017500000000501112247032546024546 0ustar andersanderspackage Facebook::Graph::Picture; BEGIN { $Facebook::Graph::Picture::VERSION = '1.0300'; } use Any::Moose; with 'Facebook::Graph::Role::Uri'; has type => ( is => 'rw', predicate => 'has_type', ); has object_name => ( is => 'rw', default => '', ); sub get_small { my ($self) = @_; $self->type('small'); return $self; } sub get_square { my ($self) = @_; $self->type('square'); return $self; } sub get_large { my ($self) = @_; $self->type('large'); return $self; } sub uri_as_string { my ($self) = @_; my %query; if ($self->has_type) { $query{type} = $self->type; } my $uri = $self->uri; $uri->path($self->object_name . '/picture'); $uri->query_form(%query); return $uri->as_string; } no Any::Moose; __PACKAGE__->meta->make_immutable; =head1 NAME Facebook::Graph::Picture - Get the URI for the picture of any object. =head1 VERSION version 1.0300 =head1 SYNOPSIS my $fb = Facebook::Graph->new; my $default_picture = $fb->picture('16665510298')->uri_as_string; my $large_picture = $fb->picture('16665510298')->get_large->uri_as_string; my $small_picture = $fb->picture('16665510298')->get_small->uri_as_string; my $square_picture = $fb->picture('16665510298')->get_square->uri_as_string; =head1 DESCRIPTION This module allows you to generate the URL needed to fetch a picture for any object on Facebook. =head1 METHODS =head2 get_large ( id ) Get a large picture. 200 pixels wide by a variable height. =head3 id The unique id or object name of an object. B For user "Sarah Bownds" you could use either her profile id C or her object id C<767598108>. =head2 get_small ( id ) Get a small picture. 50 pixels wide by a variable height. =head3 id The unique id or object name of an object. B For user "Sarah Bownds" you could use either her profile id C or her object id C<767598108>. =head2 get_square ( id ) Get a square picture. 50 pixels wide by 50 pixels tall. =head3 id The unique id or object name of an object. B For user "Sarah Bownds" you could use either her profile id C or her object id C<767598108>. =head2 uri_as_string () Returns a URI string based upon all the methods you've called so far on the query. You can throw the resulting URI right into an tag. =head1 LEGAL Facebook::Graph is Copyright 2010 Plain Black Corporation (L) and is licensed under the same terms as Perl itself. =cutbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Session.pm0000664000175000017500000000420412247032546024561 0ustar andersanderspackage Facebook::Graph::Session; BEGIN { $Facebook::Graph::Session::VERSION = '1.0300'; } use Any::Moose; use Facebook::Graph::Response; with 'Facebook::Graph::Role::Uri'; use AnyEvent::HTTP; has app_id => ( is => 'ro', required=> 1, ); has secret => ( is => 'ro', required=> 1, ); has sessions => ( is => 'ro', required=> 1, ); sub uri_as_string { my ($self) = @_; my $uri = $self->uri; $uri->path('oauth/access_token'); $uri->query_form( type => 'client_cred', client_id => $self->app_id, client_secret => $self->secret, sessions => join(',', @{$self->sessions}) ); return $uri->as_string; } sub request { my ($self, $cb) = @_; http_get $self->uri_as_string, sub { my ($response, $headers) = @_; $cb->(Facebook::Graph::Response->new( response => $response, headers => $headers, uri => $self->uri_as_string )); }; () # return nothing } no Any::Moose; __PACKAGE__->meta->make_immutable; =head1 NAME Facebook::Graph::Session - Convert old API sessions into Graph API access_tokens. =head1 VERSION version 1.0300 =head1 SYNOPSIS my $fb = Facebook::Graph->new( secret => $facebook_application_secret, app_id => $facebook_application_id, postback => 'https://www.yourapplication.com/facebook/postback', ); my $tokens = $fb->session(\@session_ids)->request->as_hashref; =head1 DESCRIPTION Allows you to request convert your old sessions into access tokens. B If you're writing your application from scratch using L then you'll never need this module. =head1 METHODS =head2 uri_as_string () Returns the URI that will be called to fetch the token as a string. Mostly useful for debugging and testing. =head2 request () Makes a request to Facebook to fetch an access token. Returns a L object. Example JSON response: =head1 LEGAL Facebook::Graph is Copyright 2010 Plain Black Corporation (L) and is licensed under the same terms as Perl itself. =cut barnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Response.pm0000664000175000017500000000436312247032546024742 0ustar andersanderspackage Facebook::Graph::Response; BEGIN { $Facebook::Graph::Response::VERSION = '1.0300'; } use Any::Moose; use JSON; use Ouch; has response => ( is => 'ro', required=> 1, ); has headers => ( is => 'ro', required=> 1, ); has uri => ( is => 'ro', required=> 1, ); has as_string => ( is => 'ro', lazy => 1, default => sub { my $self = shift; if (!defined $self->response) { ouch $self->headers->{Status}, $self->headers->{Reason}, $self->uri; } if ($self->headers->{Status} < 200 || $self->headers->{Status} >= 300) { my $type = $self->headers->{Status}; my $message = $self->response; my $error = eval { JSON->new->decode($self->response) }; unless ($@) { $type = $error->{error}{type}; $message = $error->{error}{message}; } ouch $type, 'Could not execute request ('.$self->uri.'): '.$message, $self->uri; } return $self->response; }, ); has as_json => ( is => 'ro', lazy => 1, default => sub { my $self = shift; return $self->as_string; }, ); has as_hashref => ( is => 'ro', lazy => 1, default => sub { my $self = shift; return JSON->new->decode($self->as_json); }, ); no Any::Moose; __PACKAGE__->meta->make_immutable; =head1 NAME Facebook::Graph::Response - Handling of a Facebook::Graph response documents. =head1 VERSION version 1.0300 =head1 DESCRIPTION You'll be given one of these as a result of calling the C method on a C or others. =head1 METHODS Returns the response as a string. Does not throw an exception of any kind. =head2 as_json () Returns the response from Facebook as a JSON string. =head2 as_hashref () Returns the response from Facebook as a hash reference. =head2 as_string () No processing what so ever. Just returns the raw body string that was received from Facebook. =head2 response () Direct access to the L object. =head1 LEGAL Facebook::Graph is Copyright 2010 Plain Black Corporation (L) and is licensed under the same terms as Perl itself. =cut barnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Cookbook/0000775000175000017500000000000012247032546024346 5ustar andersandersbarnowl-1.9-src/perl/modules/Facebook/lib/Facebook/Graph/Cookbook/Recipe2.pod0000664000175000017500000000666612247032546026361 0ustar andersanders=head1 NAME Facebook::Graph::Cookbook::Recipe2 - Building a Full Web App =head1 VERSION version 1.0300 =head1 DESCRIPTION A full working web app for those people who like to start hacking from a working example and make it their own. =head2 Prerequisite Modules You'll need to have all of the following modules installed in order to run this app (in addition to L): L L L