├── ELFRuntimeSpy ├── .gitignore ├── Makefile ├── README.md ├── cli.c ├── cli.h ├── elf-arch.c ├── elf-arch.h ├── example │ ├── test_target │ └── test_target.c ├── main.c ├── rtspy-linux32 ├── rtspy.h ├── thirdparty │ └── readline │ │ ├── include │ │ └── readline │ │ │ ├── chardefs.h │ │ │ ├── history.h │ │ │ ├── keymaps.h │ │ │ ├── readline.h │ │ │ ├── rlconf.h │ │ │ ├── rlstdc.h │ │ │ ├── rltypedefs.h │ │ │ └── tilde.h │ │ ├── lib │ │ ├── libhistory.a │ │ └── libreadline.a │ │ └── share │ │ ├── doc │ │ └── readline │ │ │ ├── CHANGES │ │ │ ├── INSTALL │ │ │ └── README │ │ ├── info │ │ ├── dir │ │ ├── history.info │ │ ├── readline.info │ │ └── rluserman.info │ │ ├── man │ │ └── man3 │ │ │ ├── history.3 │ │ │ └── readline.3 │ │ └── readline │ │ ├── excallback.c │ │ ├── fileman.c │ │ ├── hist_erasedups.c │ │ ├── hist_purgecmd.c │ │ ├── histexamp.c │ │ ├── manexamp.c │ │ ├── rl-callbacktest.c │ │ ├── rl-fgets.c │ │ ├── rl.c │ │ ├── rlbasic.c │ │ ├── rlcat.c │ │ ├── rlevent.c │ │ ├── rlptytest.c │ │ ├── rltest.c │ │ └── rlversion.c ├── utils.c └── utils.h ├── LICENSE ├── MachoRuntimeSpy ├── .gitignore ├── Macho.cpp ├── Macho.hpp ├── Makefile ├── README.md ├── Zz.hpp ├── cli.cpp ├── cli.hpp ├── ent.xml ├── example │ ├── readme │ ├── test_target.c │ ├── test_target.m │ └── test_target_oc ├── issues ├── main.cpp ├── objc.cpp ├── objc.hpp ├── output │ ├── rtspy-ios │ └── rtspy-mac ├── requires │ ├── control │ ├── ent.xml │ └── readme ├── rtspy-ios ├── rtspy-mac ├── thirdparty │ └── readline │ │ ├── ios │ │ ├── include │ │ │ └── readline │ │ │ │ ├── chardefs.h │ │ │ │ ├── history.h │ │ │ │ ├── keymaps.h │ │ │ │ ├── readline.h │ │ │ │ ├── rlconf.h │ │ │ │ ├── rlstdc.h │ │ │ │ ├── rltypedefs.h │ │ │ │ └── tilde.h │ │ ├── lib │ │ │ ├── libhistory.a │ │ │ └── libreadline.a │ │ └── share │ │ │ ├── doc │ │ │ └── readline │ │ │ │ ├── CHANGES │ │ │ │ ├── INSTALL │ │ │ │ └── README │ │ │ ├── info │ │ │ ├── dir │ │ │ ├── history.info │ │ │ ├── readline.info │ │ │ └── rluserman.info │ │ │ ├── man │ │ │ └── man3 │ │ │ │ ├── history.3 │ │ │ │ └── readline.3 │ │ │ └── readline │ │ │ ├── excallback.c │ │ │ ├── fileman.c │ │ │ ├── hist_erasedups.c │ │ │ ├── hist_purgecmd.c │ │ │ ├── histexamp.c │ │ │ ├── manexamp.c │ │ │ ├── rl-callbacktest.c │ │ │ ├── rl-fgets.c │ │ │ ├── rl.c │ │ │ ├── rlbasic.c │ │ │ ├── rlcat.c │ │ │ ├── rlevent.c │ │ │ ├── rlptytest.c │ │ │ ├── rltest.c │ │ │ └── rlversion.c │ │ └── mac │ │ ├── include │ │ └── readline │ │ │ ├── chardefs.h │ │ │ ├── history.h │ │ │ ├── keymaps.h │ │ │ ├── readline.h │ │ │ ├── rlconf.h │ │ │ ├── rlstdc.h │ │ │ ├── rltypedefs.h │ │ │ └── tilde.h │ │ ├── lib │ │ ├── libhistory.a │ │ ├── libhistory.old │ │ ├── libreadline.a │ │ └── libreadline.old │ │ └── share │ │ ├── doc │ │ └── readline │ │ │ ├── CHANGES │ │ │ ├── INSTALL │ │ │ └── README │ │ ├── info │ │ ├── dir │ │ ├── history.info │ │ ├── readline.info │ │ └── rluserman.info │ │ ├── man │ │ └── man3 │ │ │ ├── history.3 │ │ │ └── readline.3 │ │ └── readline │ │ ├── excallback.c │ │ ├── fileman.c │ │ ├── hist_erasedups.c │ │ ├── hist_purgecmd.c │ │ ├── histexamp.c │ │ ├── manexamp.c │ │ ├── rl-callbacktest.c │ │ ├── rl-fgets.c │ │ ├── rl.c │ │ ├── rlcat.c │ │ ├── rlevent.c │ │ ├── rlptytest.c │ │ ├── rltest.c │ │ └── rlversion.c ├── utils.cpp └── utils.hpp └── README.md /ELFRuntimeSpy/.gitignore: -------------------------------------------------------------------------------- 1 | cmake-build-debug 2 | CmakeLists.txt 3 | .idea 4 | .vscode 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/Makefile: -------------------------------------------------------------------------------- 1 | SOURCES = $(wildcard *.c) 2 | 3 | LINUX_INCLUDE_DIR = $(abspath thirdparty/readline/linux32/include) 4 | LINUX_LIB_DIR = $(abspath thirdparty/readline/linux32/lib) 5 | 6 | LINUX_CFLAGS = -O3 -m32 -I$(LINUX_INCLUDE_DIR) -std=c99 7 | LINUX_LDFLAGS = -m32 -L$(LINUX_LIB_DIR) 8 | LINUX_LIBS = -lreadline -lncurses 9 | linux: 10 | gcc $(LINUX_CFLAGS) $(LINUX_LDFLAGS) -w -g $(SOURCES) -o rtspy-linux32 11 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/README.md: -------------------------------------------------------------------------------- 1 | ## ELFRuntimeSpy 2 | 3 | runtime spy 4 | 5 | **In development...** 6 | 7 | #### Make 8 | 9 | #### Usage 10 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/cli.c: -------------------------------------------------------------------------------- 1 | #include "cli.h" 2 | #include "rtspy.h" 3 | 4 | #define _print_line_sep (printf("--------------------------------------------------------------\n")) 5 | 6 | void process_command() { 7 | } 8 | 9 | void print_welcome() { 10 | _print_line_sep; 11 | printf("%s-Android/Linux (%s) - by %s\n", PROGRAM_NAME, PROGRAM_VER, PROGRAM_AUTHOR); 12 | _print_line_sep; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/cli.h: -------------------------------------------------------------------------------- 1 | #ifndef cli_h 2 | #define cli_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define RED "\x1B[31m" 9 | #define GRN "\x1B[32m" 10 | #define YEL "\x1B[33m" 11 | #define BLU "\x1B[34m" 12 | #define MAG "\x1B[35m" 13 | #define CYN "\x1B[36m" 14 | #define WHT "\x1B[37m" 15 | #define RESET "\x1B[0m" 16 | 17 | #define xwarn(str) printf(YEL "[!] " "%s" "\n" RESET, str) 18 | #define xdebug(X) {printf(RESET "[*] "); X; printf("\n");} 19 | #define xerror(str) printf(RED "[!] " "%s" "\n" RESET, str) 20 | #define xinfo(str) printf(RESET "[*] " "%s" "\n" RESET, str) 21 | 22 | void process_command(); 23 | void print_welcome(); 24 | void print_usage(); 25 | 26 | #endif /* cli_hpp */ 27 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/elf-arch.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include // bool type 7 | 8 | // #define __ELF_NATIVE_CLASS 32 9 | 10 | // #define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type) 11 | // #define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) 12 | // #define _ElfW_1(e,w,t) e##w##t 13 | 14 | // eglibc-2.19/sysdeps/generic/ldsodefs.h 15 | // #define D_PTR(map, i) ((map)->i->d_un.d_ptr + (map)->l_addr) 16 | // #define LOOKUP_VALUE_ADDRESS(map) ((map) ? (map)->l_addr : 0) 17 | // #define DL_SYMBOL_ADDRESS(map, ref) \ 18 | // (void *) (LOOKUP_VALUE_ADDRESS (map) + ref->st_value) 19 | 20 | // echo | gcc -E -dM - | grep 64 21 | // ld --verbose 22 | #ifdef __x86_64__ 23 | #define PROGRAM_LOAD_ADDRESS 0x400000 24 | #else 25 | #define PROGRAM_LOAD_ADDRESS 0x08048000 26 | #endif 27 | 28 | #define link_map_public link_map 29 | #include 30 | #undef link_map 31 | 32 | // linker's link_map 33 | typedef struct dyn_info 34 | { 35 | // pltgot 36 | struct link_map_public *linkmap_public; 37 | 38 | // section 39 | long dynsym_addr; 40 | long dynstr_addr; 41 | long gnuhash_addr; 42 | 43 | // .gnu.hash 44 | unsigned int nbuckets; 45 | unsigned int symndx; 46 | unsigned int nmaskwords; 47 | unsigned int shift2; 48 | long bitmask_addr; 49 | long hashbuckets_addr; 50 | long hashvalues_addr; 51 | 52 | // so name; 53 | char *soname; 54 | } dyn_info_t; 55 | 56 | // read input 57 | typedef struct elf_rt_input 58 | { 59 | long vmaddr; 60 | pid_t pid; 61 | } elf_rt_input_t; 62 | 63 | typedef struct elf_arch 64 | { 65 | ElfW(Ehdr) *ehdr; 66 | ElfW(Phdr) *phdr; 67 | ElfW(Shdr) *shdr; 68 | } elf_arch_t; 69 | 70 | // runtime elf file 71 | typedef struct elf_rt 72 | { 73 | struct elf_rt_input input; 74 | struct elf_arch elf; 75 | struct dyn_info dyn; 76 | } elf_rt_t; 77 | 78 | long find_symbol(elf_rt_t *target, char *sym_name, char *lib_name); 79 | 80 | void set_pid(elf_rt_t *target, pid_t pid); 81 | 82 | bool elf_rt_read(elf_rt_input_t input, long addr, void *data, long len); 83 | 84 | bool elf_rt_off_read(elf_rt_input_t input, long addr, void *data, long len); 85 | 86 | char * 87 | elf_rt_read_string(elf_rt_input_t input, long addr); 88 | 89 | bool parse_elf(elf_rt_t *target); 90 | 91 | bool parse_header(elf_rt_t *target); 92 | 93 | bool parse_segment_headers(elf_rt_t *target); 94 | 95 | bool parse_segments(elf_rt_t *target); 96 | 97 | bool parse_section_headers(elf_rt_t *target); 98 | bool parse_sections(elf_rt_t *target); 99 | 100 | bool parse_PT_DYNAMIC(dyn_info_t *dyninfo, elf_rt_input_t input, long dyn_addr); 101 | 102 | bool parse_DT_SONAME(dyn_info_t *dyninfo, elf_rt_input_t input, unsigned long ndx); 103 | 104 | bool parse_DT_GNU_HASH(dyn_info_t *dyninfo, elf_rt_input_t input, long gnuhash_addr); 105 | 106 | bool parse_DT_PLTGOT(dyn_info_t *dyninfo, elf_rt_input_t input, long gotplt_addr); 107 | 108 | unsigned long 109 | dl_new_hash(const char *s); 110 | 111 | ElfW(Sym) * 112 | find_symbol_in_lib(dyn_info_t *dyldinfo, elf_rt_input_t input, char *sym_name); 113 | 114 | void print_elf(elf_rt_t *target); 115 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/example/test_target: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/ELFRuntimeSpy/example/test_target -------------------------------------------------------------------------------- /ELFRuntimeSpy/example/test_target.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() { 4 | printf("pid: %d\n", getpid()); 5 | while(1) 6 | sleep(3); 7 | } 8 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/main.c: -------------------------------------------------------------------------------- 1 | #include "elf-arch.h" 2 | #include "utils.h" 3 | #include "cli.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | int pid; 8 | 9 | if (argc < 2) { 10 | xdebug(("usage: %s " , argv[0])); 11 | exit(-1); 12 | } 13 | 14 | pid = atoi(argv[1]); 15 | print_welcome(); 16 | 17 | ptrace_attach(pid); 18 | xdebug(printf("attached to pid %d", pid)); 19 | elf_rt_t target; 20 | set_pid(&target, pid); 21 | parse_elf(&target); 22 | print_elf(&target); 23 | ptrace_detach(pid); 24 | 25 | } -------------------------------------------------------------------------------- /ELFRuntimeSpy/rtspy-linux32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/ELFRuntimeSpy/rtspy-linux32 -------------------------------------------------------------------------------- /ELFRuntimeSpy/rtspy.h: -------------------------------------------------------------------------------- 1 | #ifndef rtspy_hpp 2 | #define rtspy_hpp 3 | 4 | #define PROGRAM_NAME "RTspy" 5 | #define PROGRAM_VER "1.0.0" 6 | #define PROGRAM_AUTHOR "jmpews@gmail.com" 7 | 8 | #define DEBUG 1 9 | 10 | #endif -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/include/readline/chardefs.h: -------------------------------------------------------------------------------- 1 | /* chardefs.h -- Character definitions for readline. */ 2 | 3 | /* Copyright (C) 1994-2015 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _CHARDEFS_H_ 23 | #define _CHARDEFS_H_ 24 | 25 | #include 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # if defined (HAVE_STRING_H) 29 | # if ! defined (STDC_HEADERS) && defined (HAVE_MEMORY_H) 30 | # include 31 | # endif 32 | # include 33 | # endif /* HAVE_STRING_H */ 34 | # if defined (HAVE_STRINGS_H) 35 | # include 36 | # endif /* HAVE_STRINGS_H */ 37 | #else 38 | # include 39 | #endif /* !HAVE_CONFIG_H */ 40 | 41 | #ifndef whitespace 42 | #define whitespace(c) (((c) == ' ') || ((c) == '\t')) 43 | #endif 44 | 45 | #ifdef CTRL 46 | # undef CTRL 47 | #endif 48 | #ifdef UNCTRL 49 | # undef UNCTRL 50 | #endif 51 | 52 | /* Some character stuff. */ 53 | #define control_character_threshold 0x020 /* Smaller than this is control. */ 54 | #define control_character_mask 0x1f /* 0x20 - 1 */ 55 | #define meta_character_threshold 0x07f /* Larger than this is Meta. */ 56 | #define control_character_bit 0x40 /* 0x000000, must be off. */ 57 | #define meta_character_bit 0x080 /* x0000000, must be on. */ 58 | #define largest_char 255 /* Largest character value. */ 59 | 60 | #define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0)) 61 | #define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char) 62 | 63 | #define CTRL(c) ((c) & control_character_mask) 64 | #define META(c) ((c) | meta_character_bit) 65 | 66 | #define UNMETA(c) ((c) & (~meta_character_bit)) 67 | #define UNCTRL(c) _rl_to_upper(((c)|control_character_bit)) 68 | 69 | #if defined STDC_HEADERS || (!defined (isascii) && !defined (HAVE_ISASCII)) 70 | # define IN_CTYPE_DOMAIN(c) 1 71 | #else 72 | # define IN_CTYPE_DOMAIN(c) isascii(c) 73 | #endif 74 | 75 | #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) 76 | # define isxdigit(c) (isdigit((unsigned char)(c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) 77 | #endif 78 | 79 | #if defined (CTYPE_NON_ASCII) 80 | # define NON_NEGATIVE(c) 1 81 | #else 82 | # define NON_NEGATIVE(c) ((unsigned char)(c) == (c)) 83 | #endif 84 | 85 | /* Some systems define these; we want our definitions. */ 86 | #undef ISPRINT 87 | 88 | /* Beware: these only work with single-byte ASCII characters. */ 89 | 90 | #define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum ((unsigned char)c)) 91 | #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha ((unsigned char)c)) 92 | #define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit ((unsigned char)c)) 93 | #define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower ((unsigned char)c)) 94 | #define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint ((unsigned char)c)) 95 | #define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper ((unsigned char)c)) 96 | #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit ((unsigned char)c)) 97 | 98 | #define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c)) 99 | #define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c)) 100 | #define _rl_digit_p(c) ((c) >= '0' && (c) <= '9') 101 | 102 | #define _rl_pure_alphabetic(c) (NON_NEGATIVE(c) && ISALPHA(c)) 103 | #define ALPHABETIC(c) (NON_NEGATIVE(c) && ISALNUM(c)) 104 | 105 | #ifndef _rl_to_upper 106 | # define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)c) : (c)) 107 | # define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)c) : (c)) 108 | #endif 109 | 110 | #ifndef _rl_digit_value 111 | # define _rl_digit_value(x) ((x) - '0') 112 | #endif 113 | 114 | #ifndef _rl_isident 115 | # define _rl_isident(c) (ISALNUM(c) || (c) == '_') 116 | #endif 117 | 118 | #ifndef ISOCTAL 119 | # define ISOCTAL(c) ((c) >= '0' && (c) <= '7') 120 | #endif 121 | #define OCTVALUE(c) ((c) - '0') 122 | 123 | #define HEXVALUE(c) \ 124 | (((c) >= 'a' && (c) <= 'f') \ 125 | ? (c)-'a'+10 \ 126 | : (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0') 127 | 128 | #ifndef NEWLINE 129 | #define NEWLINE '\n' 130 | #endif 131 | 132 | #ifndef RETURN 133 | #define RETURN CTRL('M') 134 | #endif 135 | 136 | #ifndef RUBOUT 137 | #define RUBOUT 0x7f 138 | #endif 139 | 140 | #ifndef TAB 141 | #define TAB '\t' 142 | #endif 143 | 144 | #ifdef ABORT_CHAR 145 | #undef ABORT_CHAR 146 | #endif 147 | #define ABORT_CHAR CTRL('G') 148 | 149 | #ifdef PAGE 150 | #undef PAGE 151 | #endif 152 | #define PAGE CTRL('L') 153 | 154 | #ifdef SPACE 155 | #undef SPACE 156 | #endif 157 | #define SPACE ' ' /* XXX - was 0x20 */ 158 | 159 | #ifdef ESC 160 | #undef ESC 161 | #endif 162 | #define ESC CTRL('[') 163 | 164 | #endif /* _CHARDEFS_H_ */ 165 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/include/readline/keymaps.h: -------------------------------------------------------------------------------- 1 | /* keymaps.h -- Manipulation of readline keymaps. */ 2 | 3 | /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _KEYMAPS_H_ 23 | #define _KEYMAPS_H_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #if defined (READLINE_LIBRARY) 30 | # include "rlstdc.h" 31 | # include "chardefs.h" 32 | # include "rltypedefs.h" 33 | #else 34 | # include 35 | # include 36 | # include 37 | #endif 38 | 39 | /* A keymap contains one entry for each key in the ASCII set. 40 | Each entry consists of a type and a pointer. 41 | FUNCTION is the address of a function to run, or the 42 | address of a keymap to indirect through. 43 | TYPE says which kind of thing FUNCTION is. */ 44 | typedef struct _keymap_entry { 45 | char type; 46 | rl_command_func_t *function; 47 | } KEYMAP_ENTRY; 48 | 49 | /* This must be large enough to hold bindings for all of the characters 50 | in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, 51 | and so on) plus one for subsequence matching. */ 52 | #define KEYMAP_SIZE 257 53 | #define ANYOTHERKEY KEYMAP_SIZE-1 54 | 55 | typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; 56 | typedef KEYMAP_ENTRY *Keymap; 57 | 58 | /* The values that TYPE can have in a keymap entry. */ 59 | #define ISFUNC 0 60 | #define ISKMAP 1 61 | #define ISMACR 2 62 | 63 | extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; 64 | extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; 65 | 66 | /* Return a new, empty keymap. 67 | Free it with free() when you are done. */ 68 | extern Keymap rl_make_bare_keymap PARAMS((void)); 69 | 70 | /* Return a new keymap which is a copy of MAP. */ 71 | extern Keymap rl_copy_keymap PARAMS((Keymap)); 72 | 73 | /* Return a new keymap with the printing characters bound to rl_insert, 74 | the lowercase Meta characters bound to run their equivalents, and 75 | the Meta digits bound to produce numeric arguments. */ 76 | extern Keymap rl_make_keymap PARAMS((void)); 77 | 78 | /* Free the storage associated with a keymap. */ 79 | extern void rl_discard_keymap PARAMS((Keymap)); 80 | 81 | /* These functions actually appear in bind.c */ 82 | 83 | /* Return the keymap corresponding to a given name. Names look like 84 | `emacs' or `emacs-meta' or `vi-insert'. */ 85 | extern Keymap rl_get_keymap_by_name PARAMS((const char *)); 86 | 87 | /* Return the current keymap. */ 88 | extern Keymap rl_get_keymap PARAMS((void)); 89 | 90 | /* Set the current keymap to MAP. */ 91 | extern void rl_set_keymap PARAMS((Keymap)); 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif /* _KEYMAPS_H_ */ 98 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/include/readline/rlconf.h: -------------------------------------------------------------------------------- 1 | /* rlconf.h -- readline configuration definitions */ 2 | 3 | /* Copyright (C) 1992-2015 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #if !defined (_RLCONF_H_) 23 | #define _RLCONF_H_ 24 | 25 | /* Define this if you want the vi-mode editing available. */ 26 | #define VI_MODE 27 | 28 | /* Define this to get an indication of file type when listing completions. */ 29 | #define VISIBLE_STATS 30 | 31 | /* Define this to get support for colors when listing completions and in 32 | other places. */ 33 | #define COLOR_SUPPORT 34 | 35 | /* This definition is needed by readline.c, rltty.c, and signals.c. */ 36 | /* If on, then readline handles signals in a way that doesn't suck. */ 37 | #define HANDLE_SIGNALS 38 | 39 | /* Ugly but working hack for binding prefix meta. */ 40 | #define PREFIX_META_HACK 41 | 42 | /* The next-to-last-ditch effort file name for a user-specific init file. */ 43 | #define DEFAULT_INPUTRC "~/.inputrc" 44 | 45 | /* The ultimate last-ditch filenname for an init file -- system-wide. */ 46 | #define SYS_INPUTRC "/etc/inputrc" 47 | 48 | /* If defined, expand tabs to spaces. */ 49 | #define DISPLAY_TABS 50 | 51 | /* If defined, use the terminal escape sequence to move the cursor forward 52 | over a character when updating the line rather than rewriting it. */ 53 | /* #define HACK_TERMCAP_MOTION */ 54 | 55 | /* The string inserted by the `insert comment' command. */ 56 | #define RL_COMMENT_BEGIN_DEFAULT "#" 57 | 58 | /* Define this if you want code that allows readline to be used in an 59 | X `callback' style. */ 60 | #define READLINE_CALLBACKS 61 | 62 | /* Define this if you want the cursor to indicate insert or overwrite mode. */ 63 | /* #define CURSOR_MODE */ 64 | 65 | /* Define this if you want to enable code that talks to the Linux kernel 66 | tty auditing system. */ 67 | /* #define ENABLE_TTY_AUDIT_SUPPORT */ 68 | 69 | /* Defaults for the various editing mode indicators, inserted at the beginning 70 | of the last (maybe only) line of the prompt if show-mode-in-prompt is on */ 71 | #define RL_EMACS_MODESTR_DEFAULT "@" 72 | #define RL_EMACS_MODESTR_DEFLEN 1 73 | 74 | #define RL_VI_INS_MODESTR_DEFAULT "(ins)" 75 | #define RL_VI_INS_MODESTR_DEFLEN 5 76 | #define RL_VI_CMD_MODESTR_DEFAULT "(cmd)" 77 | #define RL_VI_CMD_MODESTR_DEFLEN 5 78 | 79 | #endif /* _RLCONF_H_ */ 80 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/include/readline/rlstdc.h: -------------------------------------------------------------------------------- 1 | /* stdc.h -- macros to make source compile on both ANSI C and K&R C compilers. */ 2 | 3 | /* Copyright (C) 1993-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #if !defined (_RL_STDC_H_) 23 | #define _RL_STDC_H_ 24 | 25 | /* Adapted from BSD /usr/include/sys/cdefs.h. */ 26 | 27 | /* A function can be defined using prototypes and compile on both ANSI C 28 | and traditional C compilers with something like this: 29 | extern char *func PARAMS((char *, char *, int)); */ 30 | 31 | #if !defined (PARAMS) 32 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) 33 | # define PARAMS(protos) protos 34 | # else 35 | # define PARAMS(protos) () 36 | # endif 37 | #endif 38 | 39 | #ifndef __attribute__ 40 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) 41 | # define __attribute__(x) 42 | # endif 43 | #endif 44 | 45 | /* Moved from config.h.in because readline.h:rl_message depends on these 46 | defines. */ 47 | #if defined (__STDC__) && defined (HAVE_STDARG_H) 48 | # define PREFER_STDARG 49 | # define USE_VARARGS 50 | #else 51 | # if defined (HAVE_VARARGS_H) 52 | # define PREFER_VARARGS 53 | # define USE_VARARGS 54 | # endif 55 | #endif 56 | 57 | #endif /* !_RL_STDC_H_ */ 58 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/include/readline/rltypedefs.h: -------------------------------------------------------------------------------- 1 | /* rltypedefs.h -- Type declarations for readline functions. */ 2 | 3 | /* Copyright (C) 2000-2011 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _RL_TYPEDEFS_H_ 23 | #define _RL_TYPEDEFS_H_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Old-style, attempt to mark as deprecated in some way people will notice. */ 30 | 31 | #if !defined (_FUNCTION_DEF) 32 | # define _FUNCTION_DEF 33 | 34 | #if defined(__GNUC__) || defined(__clang__) 35 | typedef int Function () __attribute__ ((deprecated)); 36 | typedef void VFunction () __attribute__ ((deprecated)); 37 | typedef char *CPFunction () __attribute__ ((deprecated)); 38 | typedef char **CPPFunction () __attribute__ ((deprecated)); 39 | #else 40 | typedef int Function (); 41 | typedef void VFunction (); 42 | typedef char *CPFunction (); 43 | typedef char **CPPFunction (); 44 | #endif 45 | 46 | #endif /* _FUNCTION_DEF */ 47 | 48 | /* New style. */ 49 | 50 | #if !defined (_RL_FUNCTION_TYPEDEF) 51 | # define _RL_FUNCTION_TYPEDEF 52 | 53 | /* Bindable functions */ 54 | typedef int rl_command_func_t PARAMS((int, int)); 55 | 56 | /* Typedefs for the completion system */ 57 | typedef char *rl_compentry_func_t PARAMS((const char *, int)); 58 | typedef char **rl_completion_func_t PARAMS((const char *, int, int)); 59 | 60 | typedef char *rl_quote_func_t PARAMS((char *, int, char *)); 61 | typedef char *rl_dequote_func_t PARAMS((char *, int)); 62 | 63 | typedef int rl_compignore_func_t PARAMS((char **)); 64 | 65 | typedef void rl_compdisp_func_t PARAMS((char **, int, int)); 66 | 67 | /* Type for input and pre-read hook functions like rl_event_hook */ 68 | typedef int rl_hook_func_t PARAMS((void)); 69 | 70 | /* Input function type */ 71 | typedef int rl_getc_func_t PARAMS((FILE *)); 72 | 73 | /* Generic function that takes a character buffer (which could be the readline 74 | line buffer) and an index into it (which could be rl_point) and returns 75 | an int. */ 76 | typedef int rl_linebuf_func_t PARAMS((char *, int)); 77 | 78 | /* `Generic' function pointer typedefs */ 79 | typedef int rl_intfunc_t PARAMS((int)); 80 | #define rl_ivoidfunc_t rl_hook_func_t 81 | typedef int rl_icpfunc_t PARAMS((char *)); 82 | typedef int rl_icppfunc_t PARAMS((char **)); 83 | 84 | typedef void rl_voidfunc_t PARAMS((void)); 85 | typedef void rl_vintfunc_t PARAMS((int)); 86 | typedef void rl_vcpfunc_t PARAMS((char *)); 87 | typedef void rl_vcppfunc_t PARAMS((char **)); 88 | 89 | typedef char *rl_cpvfunc_t PARAMS((void)); 90 | typedef char *rl_cpifunc_t PARAMS((int)); 91 | typedef char *rl_cpcpfunc_t PARAMS((char *)); 92 | typedef char *rl_cpcppfunc_t PARAMS((char **)); 93 | 94 | #endif /* _RL_FUNCTION_TYPEDEF */ 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif /* _RL_TYPEDEFS_H_ */ 101 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/include/readline/tilde.h: -------------------------------------------------------------------------------- 1 | /* tilde.h: Externally available variables and function in libtilde.a. */ 2 | 3 | /* Copyright (C) 1992-2009 Free Software Foundation, Inc. 4 | 5 | This file contains the Readline Library (Readline), a set of 6 | routines for providing Emacs style line input to programs that ask 7 | for it. 8 | 9 | Readline is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Readline is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Readline. If not, see . 21 | */ 22 | 23 | #if !defined (_TILDE_H_) 24 | # define _TILDE_H_ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* A function can be defined using prototypes and compile on both ANSI C 31 | and traditional C compilers with something like this: 32 | extern char *func PARAMS((char *, char *, int)); */ 33 | 34 | #if !defined (PARAMS) 35 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) 36 | # define PARAMS(protos) protos 37 | # else 38 | # define PARAMS(protos) () 39 | # endif 40 | #endif 41 | 42 | typedef char *tilde_hook_func_t PARAMS((char *)); 43 | 44 | /* If non-null, this contains the address of a function that the application 45 | wants called before trying the standard tilde expansions. The function 46 | is called with the text sans tilde, and returns a malloc()'ed string 47 | which is the expansion, or a NULL pointer if the expansion fails. */ 48 | extern tilde_hook_func_t *tilde_expansion_preexpansion_hook; 49 | 50 | /* If non-null, this contains the address of a function to call if the 51 | standard meaning for expanding a tilde fails. The function is called 52 | with the text (sans tilde, as in "foo"), and returns a malloc()'ed string 53 | which is the expansion, or a NULL pointer if there is no expansion. */ 54 | extern tilde_hook_func_t *tilde_expansion_failure_hook; 55 | 56 | /* When non-null, this is a NULL terminated array of strings which 57 | are duplicates for a tilde prefix. Bash uses this to expand 58 | `=~' and `:~'. */ 59 | extern char **tilde_additional_prefixes; 60 | 61 | /* When non-null, this is a NULL terminated array of strings which match 62 | the end of a username, instead of just "/". Bash sets this to 63 | `:' and `=~'. */ 64 | extern char **tilde_additional_suffixes; 65 | 66 | /* Return a new string which is the result of tilde expanding STRING. */ 67 | extern char *tilde_expand PARAMS((const char *)); 68 | 69 | /* Do the work of tilde expansion on FILENAME. FILENAME starts with a 70 | tilde. If there is no expansion, call tilde_expansion_failure_hook. */ 71 | extern char *tilde_expand_word PARAMS((const char *)); 72 | 73 | /* Find the portion of the string beginning with ~ that should be expanded. */ 74 | extern char *tilde_find_word PARAMS((const char *, int, int *)); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* _TILDE_H_ */ 81 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/lib/libhistory.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/ELFRuntimeSpy/thirdparty/readline/lib/libhistory.a -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/lib/libreadline.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/ELFRuntimeSpy/thirdparty/readline/lib/libreadline.a -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/info/dir: -------------------------------------------------------------------------------- 1 | This is the file .../info/dir, which contains the 2 | topmost node of the Info hierarchy, called (dir)Top. 3 | The first time you invoke Info you start off looking at this node. 4 |  5 | File: dir, Node: Top This is the top of the INFO tree 6 | 7 | This (the Directory node) gives a menu of major topics. 8 | Typing "q" exits, "?" lists all Info commands, "d" returns here, 9 | "h" gives a primer for first-timers, 10 | "mEmacs" visits the Emacs manual, etc. 11 | 12 | In Emacs, you can click mouse button 2 on a menu item or cross reference 13 | to select it. 14 | 15 | * Menu: 16 | 17 | Libraries 18 | * History: (history). The GNU history library API. 19 | * RLuserman: (rluserman). The GNU readline library User's Manual. 20 | * Readline: (readline). The GNU readline library API. 21 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/excallback.c: -------------------------------------------------------------------------------- 1 | /* 2 | From: Jeff Solomon 3 | Date: Fri, 9 Apr 1999 10:13:27 -0700 (PDT) 4 | To: chet@po.cwru.edu 5 | Subject: new readline example 6 | Message-ID: <14094.12094.527305.199695@mrclean.Stanford.EDU> 7 | 8 | Chet, 9 | 10 | I've been using readline 4.0. Specifically, I've been using the perl 11 | version Term::ReadLine::Gnu. It works great. 12 | 13 | Anyway, I've been playing around the alternate interface and I wanted 14 | to contribute a little C program, callback.c, to you that you could 15 | use as an example of the alternate interface in the /examples 16 | directory of the readline distribution. 17 | 18 | My example shows how, using the alternate interface, you can 19 | interactively change the prompt (which is very nice imo). Also, I 20 | point out that you must roll your own terminal setting when using the 21 | alternate interface because readline depreps (using your parlance) the 22 | terminal while in the user callback. I try to demostrate what I mean 23 | with an example. I've included the program below. 24 | 25 | To compile, I just put the program in the examples directory and made 26 | the appropriate changes to the EXECUTABLES and OBJECTS line and added 27 | an additional target 'callback'. 28 | 29 | I compiled on my Sun Solaris2.6 box using Sun's cc. 30 | 31 | Let me know what you think. 32 | 33 | Jeff 34 | */ 35 | /* 36 | Copyright (C) 1999 Jeff Solomon 37 | */ 38 | 39 | #if defined (HAVE_CONFIG_H) 40 | #include 41 | #endif 42 | 43 | #include 44 | 45 | #ifdef HAVE_UNISTD_H 46 | #include 47 | #endif 48 | #include 49 | 50 | #include 51 | #include /* xxx - should make this more general */ 52 | 53 | #ifdef READLINE_LIBRARY 54 | # include "readline.h" 55 | #else 56 | # include 57 | #endif 58 | 59 | #ifndef STDIN_FILENO 60 | # define STDIN_FILENO 0 61 | #endif 62 | 63 | /* This little examples demonstrates the alternate interface to using readline. 64 | * In the alternate interface, the user maintains control over program flow and 65 | * only calls readline when STDIN is readable. Using the alternate interface, 66 | * you can do anything else while still using readline (like talking to a 67 | * network or another program) without blocking. 68 | * 69 | * Specifically, this program highlights two importants features of the 70 | * alternate interface. The first is the ability to interactively change the 71 | * prompt, which can't be done using the regular interface since rl_prompt is 72 | * read-only. 73 | * 74 | * The second feature really highlights a subtle point when using the alternate 75 | * interface. That is, readline will not alter the terminal when inside your 76 | * callback handler. So let's so, your callback executes a user command that 77 | * takes a non-trivial amount of time to complete (seconds). While your 78 | * executing the command, the user continues to type keystrokes and expects them 79 | * to be re-echoed on the new prompt when it returns. Unfortunately, the default 80 | * terminal configuration doesn't do this. After the prompt returns, the user 81 | * must hit one additional keystroke and then will see all of his previous 82 | * keystrokes. To illustrate this, compile and run this program. Type "sleep" at 83 | * the prompt and then type "bar" before the prompt returns (you have 3 84 | * seconds). Notice how "bar" is re-echoed on the prompt after the prompt 85 | * returns? This is what you expect to happen. Now comment out the 4 lines below 86 | * the line that says COMMENT LINE BELOW. Recompile and rerun the program and do 87 | * the same thing. When the prompt returns, you should not see "bar". Now type 88 | * "f", see how "barf" magically appears? This behavior is un-expected and not 89 | * desired. 90 | */ 91 | 92 | void process_line(char *line); 93 | int change_prompt(void); 94 | char *get_prompt(void); 95 | 96 | int prompt = 1; 97 | char prompt_buf[40], line_buf[256]; 98 | tcflag_t old_lflag; 99 | cc_t old_vtime; 100 | struct termios term; 101 | 102 | int 103 | main() 104 | { 105 | fd_set fds; 106 | 107 | /* Adjust the terminal slightly before the handler is installed. Disable 108 | * canonical mode processing and set the input character time flag to be 109 | * non-blocking. 110 | */ 111 | if( tcgetattr(STDIN_FILENO, &term) < 0 ) { 112 | perror("tcgetattr"); 113 | exit(1); 114 | } 115 | old_lflag = term.c_lflag; 116 | old_vtime = term.c_cc[VTIME]; 117 | term.c_lflag &= ~ICANON; 118 | term.c_cc[VTIME] = 1; 119 | /* COMMENT LINE BELOW - see above */ 120 | if( tcsetattr(STDIN_FILENO, TCSANOW, &term) < 0 ) { 121 | perror("tcsetattr"); 122 | exit(1); 123 | } 124 | 125 | rl_add_defun("change-prompt", change_prompt, CTRL('t')); 126 | rl_callback_handler_install(get_prompt(), process_line); 127 | 128 | while(1) { 129 | FD_ZERO(&fds); 130 | FD_SET(fileno(stdin), &fds); 131 | 132 | if( select(FD_SETSIZE, &fds, NULL, NULL, NULL) < 0) { 133 | perror("select"); 134 | exit(1); 135 | } 136 | 137 | if( FD_ISSET(fileno(stdin), &fds) ) { 138 | rl_callback_read_char(); 139 | } 140 | } 141 | } 142 | 143 | void 144 | process_line(char *line) 145 | { 146 | if( line == NULL ) { 147 | fprintf(stderr, "\n", line); 148 | 149 | /* reset the old terminal setting before exiting */ 150 | term.c_lflag = old_lflag; 151 | term.c_cc[VTIME] = old_vtime; 152 | if( tcsetattr(STDIN_FILENO, TCSANOW, &term) < 0 ) { 153 | perror("tcsetattr"); 154 | exit(1); 155 | } 156 | exit(0); 157 | } 158 | 159 | if( strcmp(line, "sleep") == 0 ) { 160 | sleep(3); 161 | } else { 162 | fprintf(stderr, "|%s|\n", line); 163 | } 164 | 165 | free (line); 166 | } 167 | 168 | int 169 | change_prompt(void) 170 | { 171 | /* toggle the prompt variable */ 172 | prompt = !prompt; 173 | 174 | /* save away the current contents of the line */ 175 | strcpy(line_buf, rl_line_buffer); 176 | 177 | /* install a new handler which will change the prompt and erase the current line */ 178 | rl_callback_handler_install(get_prompt(), process_line); 179 | 180 | /* insert the old text on the new line */ 181 | rl_insert_text(line_buf); 182 | 183 | /* redraw the current line - this is an undocumented function. It invokes the 184 | * redraw-current-line command. 185 | */ 186 | rl_refresh_line(0, 0); 187 | } 188 | 189 | char * 190 | get_prompt(void) 191 | { 192 | /* The prompts can even be different lengths! */ 193 | sprintf(prompt_buf, "%s", 194 | prompt ? "Hit ctrl-t to toggle prompt> " : "Pretty cool huh?> "); 195 | return prompt_buf; 196 | } 197 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/hist_erasedups.c: -------------------------------------------------------------------------------- 1 | /* hist_erasedups -- remove all duplicate entries from history file */ 2 | 3 | /* Copyright (C) 2011 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | #ifndef READLINE_LIBRARY 22 | #define READLINE_LIBRARY 1 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef READLINE_LIBRARY 30 | # include "history.h" 31 | #else 32 | # include 33 | #endif 34 | 35 | #include 36 | 37 | #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) 38 | #define STREQN(a, b, n) ((n == 0) ? (1) \ 39 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) 40 | 41 | static void 42 | usage() 43 | { 44 | fprintf (stderr, "hist_erasedups: usage: hist_erasedups [-t] [filename]\n"); 45 | exit (2); 46 | } 47 | 48 | int 49 | main (argc, argv) 50 | int argc; 51 | char **argv; 52 | { 53 | char *fn; 54 | int r; 55 | 56 | while ((r = getopt (argc, argv, "t")) != -1) 57 | { 58 | switch (r) 59 | { 60 | case 't': 61 | history_write_timestamps = 1; 62 | break; 63 | default: 64 | usage (); 65 | } 66 | } 67 | argv += optind; 68 | argc -= optind; 69 | 70 | fn = argc ? argv[0] : getenv ("HISTFILE"); 71 | if (fn == 0) 72 | { 73 | fprintf (stderr, "hist_erasedups: no history file\n"); 74 | usage (); 75 | } 76 | 77 | if ((r = read_history (fn)) != 0) 78 | { 79 | fprintf (stderr, "hist_erasedups: read_history: %s: %s\n", fn, strerror (r)); 80 | exit (1); 81 | } 82 | 83 | hist_erasedups (); 84 | 85 | if ((r = write_history (fn)) != 0) 86 | { 87 | fprintf (stderr, "hist_erasedups: write_history: %s: %s\n", fn, strerror (r)); 88 | exit (1); 89 | } 90 | 91 | exit (0); 92 | } 93 | 94 | int 95 | hist_erasedups () 96 | { 97 | int r, n; 98 | HIST_ENTRY *h, *temp; 99 | 100 | using_history (); 101 | while (h = previous_history ()) 102 | { 103 | r = where_history (); 104 | for (n = 0; n < r; n++) 105 | { 106 | temp = history_get (n+history_base); 107 | if (STREQ (h->line, temp->line)) 108 | { 109 | remove_history (n); 110 | r--; /* have to get one fewer now */ 111 | n--; /* compensate for above increment */ 112 | history_offset--; /* moving backwards in history list */ 113 | } 114 | } 115 | } 116 | using_history (); 117 | 118 | return r; 119 | } 120 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/hist_purgecmd.c: -------------------------------------------------------------------------------- 1 | /* hist_purgecmd -- remove all instances of command or pattern from history 2 | file */ 3 | 4 | /* Copyright (C) 2011 Free Software Foundation, Inc. 5 | 6 | This file is part of the GNU Readline Library (Readline), a library for 7 | reading lines of text with interactive input and history editing. 8 | 9 | Readline is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Readline is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Readline. If not, see . 21 | */ 22 | #ifndef READLINE_LIBRARY 23 | #define READLINE_LIBRARY 1 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #ifdef READLINE_LIBRARY 33 | # include "history.h" 34 | #else 35 | # include 36 | #endif 37 | 38 | #include 39 | 40 | #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) 41 | #define STREQN(a, b, n) ((n == 0) ? (1) \ 42 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) 43 | 44 | #define PURGE_REGEXP 0x01 45 | 46 | static void 47 | usage() 48 | { 49 | fprintf (stderr, "hist_purgecmd: usage: hist_purgecmd [-r] [-t] [-f filename] command-spec\n"); 50 | exit (2); 51 | } 52 | 53 | int 54 | main (argc, argv) 55 | int argc; 56 | char **argv; 57 | { 58 | char *fn; 59 | int r, flags; 60 | 61 | flags = 0; 62 | fn = 0; 63 | while ((r = getopt (argc, argv, "f:rt")) != -1) 64 | { 65 | switch (r) 66 | { 67 | case 'f': 68 | fn = optarg; 69 | break; 70 | case 'r': 71 | flags |= PURGE_REGEXP; 72 | break; 73 | case 't': 74 | history_write_timestamps = 1; 75 | break; 76 | default: 77 | usage (); 78 | } 79 | } 80 | argv += optind; 81 | argc -= optind; 82 | 83 | if (fn == 0) 84 | fn = getenv ("HISTFILE"); 85 | if (fn == 0) 86 | { 87 | fprintf (stderr, "hist_purgecmd: no history file\n"); 88 | usage (); 89 | } 90 | 91 | if ((r = read_history (fn)) != 0) 92 | { 93 | fprintf (stderr, "hist_purgecmd: read_history: %s: %s\n", fn, strerror (r)); 94 | exit (1); 95 | } 96 | 97 | for (r = 0; r < argc; r++) 98 | hist_purgecmd (argv[r], flags); 99 | 100 | if ((r = write_history (fn)) != 0) 101 | { 102 | fprintf (stderr, "hist_purgecmd: write_history: %s: %s\n", fn, strerror (r)); 103 | exit (1); 104 | } 105 | 106 | exit (0); 107 | } 108 | 109 | int 110 | hist_purgecmd (cmd, flags) 111 | char *cmd; 112 | int flags; 113 | { 114 | int r, n, rflags; 115 | HIST_ENTRY *temp; 116 | regex_t regex = { 0 }; 117 | 118 | if (flags & PURGE_REGEXP) 119 | { 120 | rflags = REG_EXTENDED|REG_NOSUB; 121 | if (regcomp (®ex, cmd, rflags)) 122 | { 123 | fprintf (stderr, "hist_purgecmd: %s: invalid regular expression\n", cmd); 124 | return -1; 125 | } 126 | } 127 | 128 | r = 0; 129 | using_history (); 130 | r = where_history (); 131 | for (n = 0; n < r; n++) 132 | { 133 | temp = history_get (n+history_base); 134 | if (((flags & PURGE_REGEXP) && (regexec (®ex, temp->line, 0, 0, 0) == 0)) || 135 | ((flags & PURGE_REGEXP) == 0 && STREQ (temp->line, cmd))) 136 | { 137 | remove_history (n); 138 | r--; /* have to get one fewer now */ 139 | n--; /* compensate for above increment */ 140 | history_offset--; /* moving backwards in history list */ 141 | } 142 | } 143 | using_history (); 144 | 145 | if (flags & PURGE_REGEXP) 146 | regfree (®ex); 147 | 148 | return r; 149 | } 150 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/histexamp.c: -------------------------------------------------------------------------------- 1 | /* histexamp.c - history library example program. */ 2 | 3 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #include 23 | 24 | #ifdef READLINE_LIBRARY 25 | # include "history.h" 26 | #else 27 | # include 28 | #endif 29 | 30 | #include 31 | 32 | main (argc, argv) 33 | int argc; 34 | char **argv; 35 | { 36 | char line[1024], *t; 37 | int len, done; 38 | 39 | line[0] = 0; 40 | done = 0; 41 | 42 | using_history (); 43 | while (!done) 44 | { 45 | printf ("history$ "); 46 | fflush (stdout); 47 | t = fgets (line, sizeof (line) - 1, stdin); 48 | if (t && *t) 49 | { 50 | len = strlen (t); 51 | if (t[len - 1] == '\n') 52 | t[len - 1] = '\0'; 53 | } 54 | 55 | if (!t) 56 | strcpy (line, "quit"); 57 | 58 | if (line[0]) 59 | { 60 | char *expansion; 61 | int result; 62 | 63 | using_history (); 64 | 65 | result = history_expand (line, &expansion); 66 | if (result) 67 | fprintf (stderr, "%s\n", expansion); 68 | 69 | if (result < 0 || result == 2) 70 | { 71 | free (expansion); 72 | continue; 73 | } 74 | 75 | add_history (expansion); 76 | strncpy (line, expansion, sizeof (line) - 1); 77 | free (expansion); 78 | } 79 | 80 | if (strcmp (line, "quit") == 0) 81 | done = 1; 82 | else if (strcmp (line, "save") == 0) 83 | write_history ("history_file"); 84 | else if (strcmp (line, "read") == 0) 85 | read_history ("history_file"); 86 | else if (strcmp (line, "list") == 0) 87 | { 88 | register HIST_ENTRY **the_list; 89 | register int i; 90 | time_t tt; 91 | char timestr[128]; 92 | 93 | the_list = history_list (); 94 | if (the_list) 95 | for (i = 0; the_list[i]; i++) 96 | { 97 | tt = history_get_time (the_list[i]); 98 | if (tt) 99 | strftime (timestr, sizeof (timestr), "%a %R", localtime(&tt)); 100 | else 101 | strcpy (timestr, "??"); 102 | printf ("%d: %s: %s\n", i + history_base, timestr, the_list[i]->line); 103 | } 104 | } 105 | else if (strncmp (line, "delete", 6) == 0) 106 | { 107 | int which; 108 | if ((sscanf (line + 6, "%d", &which)) == 1) 109 | { 110 | HIST_ENTRY *entry = remove_history (which); 111 | if (!entry) 112 | fprintf (stderr, "No such entry %d\n", which); 113 | else 114 | { 115 | free (entry->line); 116 | free (entry); 117 | } 118 | } 119 | else 120 | { 121 | fprintf (stderr, "non-numeric arg given to `delete'\n"); 122 | } 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/manexamp.c: -------------------------------------------------------------------------------- 1 | /* manexamp.c -- The examples which appear in the documentation are here. */ 2 | 3 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | /* **************************************************************** */ 26 | /* */ 27 | /* How to Emulate gets () */ 28 | /* */ 29 | /* **************************************************************** */ 30 | 31 | /* A static variable for holding the line. */ 32 | static char *line_read = (char *)NULL; 33 | 34 | /* Read a string, and return a pointer to it. Returns NULL on EOF. */ 35 | char * 36 | rl_gets () 37 | { 38 | /* If the buffer has already been allocated, return the memory 39 | to the free pool. */ 40 | if (line_read) 41 | { 42 | free (line_read); 43 | line_read = (char *)NULL; 44 | } 45 | 46 | /* Get a line from the user. */ 47 | line_read = readline (""); 48 | 49 | /* If the line has any text in it, save it on the history. */ 50 | if (line_read && *line_read) 51 | add_history (line_read); 52 | 53 | return (line_read); 54 | } 55 | 56 | /* **************************************************************** */ 57 | /* */ 58 | /* Writing a Function to be Called by Readline. */ 59 | /* */ 60 | /* **************************************************************** */ 61 | 62 | /* Invert the case of the COUNT following characters. */ 63 | invert_case_line (count, key) 64 | int count, key; 65 | { 66 | register int start, end; 67 | 68 | start = rl_point; 69 | 70 | if (count < 0) 71 | { 72 | direction = -1; 73 | count = -count; 74 | } 75 | else 76 | direction = 1; 77 | 78 | /* Find the end of the range to modify. */ 79 | end = start + (count * direction); 80 | 81 | /* Force it to be within range. */ 82 | if (end > rl_end) 83 | end = rl_end; 84 | else if (end < 0) 85 | end = -1; 86 | 87 | if (start > end) 88 | { 89 | int temp = start; 90 | start = end; 91 | end = temp; 92 | } 93 | 94 | if (start == end) 95 | return; 96 | 97 | /* Tell readline that we are modifying the line, so save the undo 98 | information. */ 99 | rl_modifying (start, end); 100 | 101 | for (; start != end; start += direction) 102 | { 103 | if (_rl_uppercase_p (rl_line_buffer[start])) 104 | rl_line_buffer[start] = _rl_to_lower (rl_line_buffer[start]); 105 | else if (_rl_lowercase_p (rl_line_buffer[start])) 106 | rl_line_buffer[start] = _rl_to_upper (rl_line_buffer[start]); 107 | } 108 | 109 | /* Move point to on top of the last character changed. */ 110 | rl_point = end - direction; 111 | } 112 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/rl-callbacktest.c: -------------------------------------------------------------------------------- 1 | /* Standard include files. stdio.h is required. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | /* Used for select(2) */ 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | /* Standard readline include files. */ 17 | #if defined (READLINE_LIBRARY) 18 | # include "readline.h" 19 | # include "history.h" 20 | #else 21 | # include 22 | # include 23 | #endif 24 | 25 | extern int errno; 26 | 27 | static void cb_linehandler (char *); 28 | static void signandler (int); 29 | 30 | int running, sigwinch_received; 31 | const char *prompt = "rltest$ "; 32 | 33 | /* Handle SIGWINCH and window size changes when readline is not active and 34 | reading a character. */ 35 | static void 36 | sighandler (int sig) 37 | { 38 | sigwinch_received = 1; 39 | } 40 | 41 | /* Callback function called for each line when accept-line executed, EOF 42 | seen, or EOF character read. This sets a flag and returns; it could 43 | also call exit(3). */ 44 | static void 45 | cb_linehandler (char *line) 46 | { 47 | /* Can use ^D (stty eof) or `exit' to exit. */ 48 | if (line == NULL || strcmp (line, "exit") == 0) 49 | { 50 | if (line == 0) 51 | printf ("\n"); 52 | printf ("exit\n"); 53 | /* This function needs to be called to reset the terminal settings, 54 | and calling it from the line handler keeps one extra prompt from 55 | being displayed. */ 56 | rl_callback_handler_remove (); 57 | 58 | running = 0; 59 | } 60 | else 61 | { 62 | if (*line) 63 | add_history (line); 64 | printf ("input line: %s\n", line); 65 | free (line); 66 | } 67 | } 68 | 69 | int 70 | main (int c, char **v) 71 | { 72 | fd_set fds; 73 | int r; 74 | 75 | 76 | setlocale (LC_ALL, ""); 77 | 78 | /* Handle SIGWINCH */ 79 | signal (SIGWINCH, sighandler); 80 | 81 | /* Install the line handler. */ 82 | rl_callback_handler_install (prompt, cb_linehandler); 83 | 84 | /* Enter a simple event loop. This waits until something is available 85 | to read on readline's input stream (defaults to standard input) and 86 | calls the builtin character read callback to read it. It does not 87 | have to modify the user's terminal settings. */ 88 | running = 1; 89 | while (running) 90 | { 91 | FD_ZERO (&fds); 92 | FD_SET (fileno (rl_instream), &fds); 93 | 94 | r = select (FD_SETSIZE, &fds, NULL, NULL, NULL); 95 | if (r < 0 && errno != EINTR) 96 | { 97 | perror ("rltest: select"); 98 | rl_callback_handler_remove (); 99 | break; 100 | } 101 | if (sigwinch_received) 102 | { 103 | rl_resize_terminal (); 104 | sigwinch_received = 0; 105 | } 106 | if (r < 0) 107 | continue; 108 | 109 | if (FD_ISSET (fileno (rl_instream), &fds)) 110 | rl_callback_read_char (); 111 | } 112 | 113 | printf ("rltest: Event loop has exited\n"); 114 | return 0; 115 | } 116 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/rl-fgets.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/ELFRuntimeSpy/thirdparty/readline/share/readline/rl-fgets.c -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/rl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rl - command-line interface to read a line from the standard input 3 | * (or another fd) using readline. 4 | * 5 | * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars] 6 | */ 7 | 8 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 9 | 10 | This file is part of the GNU Readline Library (Readline), a library for 11 | reading lines of text with interactive input and history editing. 12 | 13 | Readline is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | Readline is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with Readline. If not, see . 25 | */ 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # include 29 | #endif 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #ifdef HAVE_STDLIB_H 36 | # include 37 | #else 38 | extern void exit(); 39 | #endif 40 | 41 | #if defined (READLINE_LIBRARY) 42 | # include "posixstat.h" 43 | # include "readline.h" 44 | # include "history.h" 45 | #else 46 | # include 47 | # include 48 | # include 49 | #endif 50 | 51 | extern int optind; 52 | extern char *optarg; 53 | 54 | #if !defined (strchr) && !defined (__STDC__) 55 | extern char *strrchr(); 56 | #endif 57 | 58 | static char *progname; 59 | static char *deftext; 60 | 61 | static int 62 | set_deftext () 63 | { 64 | if (deftext) 65 | { 66 | rl_insert_text (deftext); 67 | deftext = (char *)NULL; 68 | rl_startup_hook = (rl_hook_func_t *)NULL; 69 | } 70 | return 0; 71 | } 72 | 73 | static void 74 | usage() 75 | { 76 | fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n", 77 | progname, progname); 78 | } 79 | 80 | int 81 | main (argc, argv) 82 | int argc; 83 | char **argv; 84 | { 85 | char *temp, *prompt; 86 | struct stat sb; 87 | int opt, fd, nch; 88 | FILE *ifp; 89 | 90 | progname = strrchr(argv[0], '/'); 91 | if (progname == 0) 92 | progname = argv[0]; 93 | else 94 | progname++; 95 | 96 | /* defaults */ 97 | prompt = "readline$ "; 98 | fd = nch = 0; 99 | deftext = (char *)0; 100 | 101 | while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF) 102 | { 103 | switch (opt) 104 | { 105 | case 'p': 106 | prompt = optarg; 107 | break; 108 | case 'u': 109 | fd = atoi(optarg); 110 | if (fd < 0) 111 | { 112 | fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg); 113 | exit (2); 114 | } 115 | break; 116 | case 'd': 117 | deftext = optarg; 118 | break; 119 | case 'n': 120 | nch = atoi(optarg); 121 | if (nch < 0) 122 | { 123 | fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg); 124 | exit (2); 125 | } 126 | break; 127 | default: 128 | usage (); 129 | exit (2); 130 | } 131 | } 132 | 133 | if (fd != 0) 134 | { 135 | if (fstat (fd, &sb) < 0) 136 | { 137 | fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd); 138 | exit (1); 139 | } 140 | ifp = fdopen (fd, "r"); 141 | rl_instream = ifp; 142 | } 143 | 144 | if (deftext && *deftext) 145 | rl_startup_hook = set_deftext; 146 | 147 | if (nch > 0) 148 | rl_num_chars_to_read = nch; 149 | 150 | temp = readline (prompt); 151 | 152 | /* Test for EOF. */ 153 | if (temp == 0) 154 | exit (1); 155 | 156 | printf ("%s\n", temp); 157 | exit (0); 158 | } 159 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/rlbasic.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #if defined (READLINE_LIBRARY) 7 | # include "readline.h" 8 | # include "history.h" 9 | #else 10 | # include 11 | # include 12 | #endif 13 | 14 | int 15 | main (int c, char **v) 16 | { 17 | char *input; 18 | 19 | for (;;) { 20 | input = readline ((char *)NULL); 21 | if (input == 0) 22 | break; 23 | printf ("%s\n", input); 24 | if (strcmp (input, "exit") == 0) 25 | break; 26 | free (input); 27 | } 28 | exit (0); 29 | } 30 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/rlcat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rlcat - cat(1) using readline 3 | * 4 | * usage: rlcat 5 | */ 6 | 7 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 8 | 9 | This file is part of the GNU Readline Library (Readline), a library for 10 | reading lines of text with interactive input and history editing. 11 | 12 | Readline is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | Readline is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with Readline. If not, see . 24 | */ 25 | 26 | #if defined (HAVE_CONFIG_H) 27 | # include 28 | #endif 29 | 30 | #ifdef HAVE_UNISTD_H 31 | # include 32 | #endif 33 | 34 | #include 35 | #include "posixstat.h" 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #ifdef HAVE_STDLIB_H 43 | # include 44 | #else 45 | extern void exit(); 46 | #endif 47 | 48 | #ifndef errno 49 | extern int errno; 50 | #endif 51 | 52 | #if defined (READLINE_LIBRARY) 53 | # include "readline.h" 54 | # include "history.h" 55 | #else 56 | # include 57 | # include 58 | #endif 59 | 60 | extern int optind; 61 | extern char *optarg; 62 | 63 | static int stdcat(); 64 | 65 | static char *progname; 66 | static int vflag; 67 | 68 | static void 69 | usage() 70 | { 71 | fprintf (stderr, "%s: usage: %s [-vEVN] [filename]\n", progname, progname); 72 | } 73 | 74 | int 75 | main (argc, argv) 76 | int argc; 77 | char **argv; 78 | { 79 | char *temp; 80 | int opt, Vflag, Nflag; 81 | 82 | progname = strrchr(argv[0], '/'); 83 | if (progname == 0) 84 | progname = argv[0]; 85 | else 86 | progname++; 87 | 88 | vflag = Vflag = Nflag = 0; 89 | while ((opt = getopt(argc, argv, "vEVN")) != EOF) 90 | { 91 | switch (opt) 92 | { 93 | case 'v': 94 | vflag = 1; 95 | break; 96 | case 'V': 97 | Vflag = 1; 98 | break; 99 | case 'E': 100 | Vflag = 0; 101 | break; 102 | case 'N': 103 | Nflag = 1; 104 | break; 105 | default: 106 | usage (); 107 | exit (2); 108 | } 109 | } 110 | 111 | argc -= optind; 112 | argv += optind; 113 | 114 | if (isatty(0) == 0 || argc || Nflag) 115 | return stdcat(argc, argv); 116 | 117 | rl_variable_bind ("editing-mode", Vflag ? "vi" : "emacs"); 118 | while (temp = readline ("")) 119 | { 120 | if (*temp) 121 | add_history (temp); 122 | printf ("%s\n", temp); 123 | } 124 | 125 | return (ferror (stdout)); 126 | } 127 | 128 | static int 129 | fcopy(fp) 130 | FILE *fp; 131 | { 132 | int c; 133 | char *x; 134 | 135 | while ((c = getc(fp)) != EOF) 136 | { 137 | if (vflag && isascii ((unsigned char)c) && isprint((unsigned char)c) == 0) 138 | { 139 | x = rl_untranslate_keyseq (c); 140 | if (fputs (x, stdout) != 0) 141 | return 1; 142 | } 143 | else if (putchar (c) == EOF) 144 | return 1; 145 | } 146 | return (ferror (stdout)); 147 | } 148 | 149 | int 150 | stdcat (argc, argv) 151 | int argc; 152 | char **argv; 153 | { 154 | int i, fd, r; 155 | char *s; 156 | FILE *fp; 157 | 158 | if (argc == 0) 159 | return (fcopy(stdin)); 160 | 161 | for (i = 0, r = 1; i < argc; i++) 162 | { 163 | if (*argv[i] == '-' && argv[i][1] == 0) 164 | fp = stdin; 165 | else 166 | { 167 | fp = fopen (argv[i], "r"); 168 | if (fp == 0) 169 | { 170 | fprintf (stderr, "%s: %s: cannot open: %s\n", progname, argv[i], strerror(errno)); 171 | continue; 172 | } 173 | } 174 | r = fcopy (fp); 175 | if (fp != stdin) 176 | fclose(fp); 177 | } 178 | return r; 179 | } 180 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/rlevent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rl - command-line interface to read a line from the standard input 3 | * (or another fd) using readline. 4 | * 5 | * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars] 6 | */ 7 | 8 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 9 | 10 | This file is part of the GNU Readline Library (Readline), a library for 11 | reading lines of text with interactive input and history editing. 12 | 13 | Readline is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | Readline is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with Readline. If not, see . 25 | */ 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # include 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #ifdef HAVE_STDLIB_H 35 | # include 36 | #else 37 | extern void exit(); 38 | #endif 39 | 40 | #if defined (READLINE_LIBRARY) 41 | # include "posixstat.h" 42 | # include "readline.h" 43 | # include "history.h" 44 | #else 45 | # include 46 | # include 47 | # include 48 | #endif 49 | 50 | extern int optind; 51 | extern char *optarg; 52 | 53 | #if !defined (strchr) && !defined (__STDC__) 54 | extern char *strrchr(); 55 | #endif 56 | 57 | static char *progname; 58 | static char *deftext; 59 | 60 | static int 61 | event_hook () 62 | { 63 | fprintf (stderr, "ding!\n"); 64 | sleep (1); 65 | return 0; 66 | } 67 | 68 | static int 69 | set_deftext () 70 | { 71 | if (deftext) 72 | { 73 | rl_insert_text (deftext); 74 | deftext = (char *)NULL; 75 | rl_startup_hook = (rl_hook_func_t *)NULL; 76 | } 77 | return 0; 78 | } 79 | 80 | static void 81 | usage() 82 | { 83 | fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n", 84 | progname, progname); 85 | } 86 | 87 | int 88 | main (argc, argv) 89 | int argc; 90 | char **argv; 91 | { 92 | char *temp, *prompt; 93 | struct stat sb; 94 | int opt, fd, nch; 95 | FILE *ifp; 96 | 97 | progname = strrchr(argv[0], '/'); 98 | if (progname == 0) 99 | progname = argv[0]; 100 | else 101 | progname++; 102 | 103 | /* defaults */ 104 | prompt = "readline$ "; 105 | fd = nch = 0; 106 | deftext = (char *)0; 107 | 108 | while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF) 109 | { 110 | switch (opt) 111 | { 112 | case 'p': 113 | prompt = optarg; 114 | break; 115 | case 'u': 116 | fd = atoi(optarg); 117 | if (fd < 0) 118 | { 119 | fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg); 120 | exit (2); 121 | } 122 | break; 123 | case 'd': 124 | deftext = optarg; 125 | break; 126 | case 'n': 127 | nch = atoi(optarg); 128 | if (nch < 0) 129 | { 130 | fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg); 131 | exit (2); 132 | } 133 | break; 134 | default: 135 | usage (); 136 | exit (2); 137 | } 138 | } 139 | 140 | if (fd != 0) 141 | { 142 | if (fstat (fd, &sb) < 0) 143 | { 144 | fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd); 145 | exit (1); 146 | } 147 | ifp = fdopen (fd, "r"); 148 | rl_instream = ifp; 149 | } 150 | 151 | if (deftext && *deftext) 152 | rl_startup_hook = set_deftext; 153 | 154 | if (nch > 0) 155 | rl_num_chars_to_read = nch; 156 | 157 | rl_event_hook = event_hook; 158 | temp = readline (prompt); 159 | 160 | /* Test for EOF. */ 161 | if (temp == 0) 162 | exit (1); 163 | 164 | printf ("%s\n", temp); 165 | exit (0); 166 | } 167 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/rltest.c: -------------------------------------------------------------------------------- 1 | /* **************************************************************** */ 2 | /* */ 3 | /* Testing Readline */ 4 | /* */ 5 | /* **************************************************************** */ 6 | 7 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 8 | 9 | This file is part of the GNU Readline Library (Readline), a library for 10 | reading lines of text with interactive input and history editing. 11 | 12 | Readline is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | Readline is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with Readline. If not, see . 24 | */ 25 | 26 | #if defined (HAVE_CONFIG_H) 27 | #include 28 | #endif 29 | 30 | #include 31 | #include 32 | 33 | #ifdef HAVE_STDLIB_H 34 | # include 35 | #else 36 | extern void exit(); 37 | #endif 38 | 39 | #ifdef READLINE_LIBRARY 40 | # include "readline.h" 41 | # include "history.h" 42 | #else 43 | # include 44 | # include 45 | #endif 46 | 47 | extern HIST_ENTRY **history_list (); 48 | 49 | main () 50 | { 51 | char *temp, *prompt; 52 | int done; 53 | 54 | temp = (char *)NULL; 55 | prompt = "readline$ "; 56 | done = 0; 57 | 58 | while (!done) 59 | { 60 | temp = readline (prompt); 61 | 62 | /* Test for EOF. */ 63 | if (!temp) 64 | exit (1); 65 | 66 | /* If there is anything on the line, print it and remember it. */ 67 | if (*temp) 68 | { 69 | fprintf (stderr, "%s\r\n", temp); 70 | add_history (temp); 71 | } 72 | 73 | /* Check for `command' that we handle. */ 74 | if (strcmp (temp, "quit") == 0) 75 | done = 1; 76 | 77 | if (strcmp (temp, "list") == 0) 78 | { 79 | HIST_ENTRY **list; 80 | register int i; 81 | 82 | list = history_list (); 83 | if (list) 84 | { 85 | for (i = 0; list[i]; i++) 86 | fprintf (stderr, "%d: %s\r\n", i, list[i]->line); 87 | } 88 | } 89 | free (temp); 90 | } 91 | exit (0); 92 | } 93 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/thirdparty/readline/share/readline/rlversion.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rlversion -- print out readline's version number 3 | */ 4 | 5 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 6 | 7 | This file is part of the GNU Readline Library (Readline), a library for 8 | reading lines of text with interactive input and history editing. 9 | 10 | Readline is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | Readline is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with Readline. If not, see . 22 | */ 23 | 24 | #if defined (HAVE_CONFIG_H) 25 | # include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include "posixstat.h" 31 | 32 | #ifdef HAVE_STDLIB_H 33 | # include 34 | #else 35 | extern void exit(); 36 | #endif 37 | 38 | #ifdef READLINE_LIBRARY 39 | # include "readline.h" 40 | #else 41 | # include 42 | #endif 43 | 44 | int 45 | main() 46 | { 47 | printf ("%s\n", rl_library_version ? rl_library_version : "unknown"); 48 | exit (0); 49 | } 50 | -------------------------------------------------------------------------------- /ELFRuntimeSpy/utils.c: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | #include "cli.h" 3 | 4 | unsigned char 5 | soloader[] = 6 | "\x90" 7 | "\xeb\x13" 8 | "\x58" 9 | "\xba\x01\x00\x00\x00" 10 | "\x52" 11 | "\x50" 12 | "\xbb\x03\x00\x00\x00" 13 | "\xff\xd3" 14 | "\x83\xc4\x08" 15 | "\xcc" 16 | "\xe8\xe8\xff\xff\xff"; 17 | 18 | void ptrace_attach(int pid) 19 | { 20 | if ((ptrace(PTRACE_ATTACH, pid, NULL, NULL)) < 0) 21 | { 22 | perror("ptrace_attach"); 23 | exit(-1); 24 | } 25 | 26 | waitpid(pid, NULL, WUNTRACED); 27 | } 28 | 29 | void ptrace_cont(int pid) 30 | { 31 | int s; 32 | 33 | if ((ptrace(PTRACE_CONT, pid, NULL, NULL)) < 0) 34 | { 35 | perror("ptrace_cont"); 36 | exit(-1); 37 | } 38 | 39 | while (!WIFSTOPPED(s)) 40 | waitpid(pid, &s, WNOHANG); 41 | } 42 | 43 | void ptrace_detach(int pid) 44 | { 45 | if (ptrace(PTRACE_DETACH, pid, NULL, NULL) < 0) 46 | { 47 | perror("ptrace_detach"); 48 | exit(-1); 49 | } 50 | } 51 | 52 | bool ptrace_read(int pid, unsigned long addr, void *data, unsigned int len) 53 | { 54 | int bytesRead = 0; 55 | int i = 0; 56 | long word = 0; 57 | unsigned long *ptr = (unsigned long *)data; 58 | 59 | while (bytesRead < len) 60 | { 61 | word = ptrace(PTRACE_PEEKTEXT, pid, addr + bytesRead, NULL); 62 | if (word == -1) 63 | { 64 | xdebug(fprintf(stderr, "ptrace(PTRACE_PEEKTEXT) failed")); 65 | return false; 66 | } 67 | bytesRead += sizeof(long); 68 | if (bytesRead > len) 69 | { 70 | memcpy(ptr + i, &word, sizeof(long) - (bytesRead - len)); 71 | break; 72 | } 73 | ptr[i++] = word; 74 | } 75 | 76 | return true; 77 | } 78 | 79 | long 80 | ptrace_memory_search(int pid, long start, long end, void *data, long len) 81 | { 82 | long addr = start; 83 | char *buf = (char *)malloc(len); 84 | while(addr < end) 85 | { 86 | if(ptrace_read(pid, addr, buf, len)) 87 | if(!memcmp(buf, data, len)) 88 | return addr; 89 | addr += len; 90 | } 91 | return 0; 92 | } 93 | 94 | char * 95 | ptrace_read_string(int pid, unsigned long start) 96 | { 97 | char x = '\0'; 98 | long end; 99 | char *str = NULL; 100 | end = ptrace_memory_search(pid, start, start+0x1000, &x, 1); 101 | if(!end) 102 | return NULL; 103 | str = (char *)malloc(end-start); 104 | if(ptrace_read(pid, start, str, end-start)) 105 | return str; 106 | return NULL; 107 | } 108 | 109 | void ptrace_write(int pid, unsigned long addr, void *vptr, int len) 110 | { 111 | int byteCount = 0; 112 | long word = 0; 113 | 114 | while (byteCount < len) 115 | { 116 | memcpy(&word, vptr + byteCount, sizeof(word)); 117 | word = ptrace(PTRACE_POKETEXT, pid, addr + byteCount, word); 118 | if (word == -1) 119 | { 120 | xdebug((stderr, "ptrace(PTRACE_POKETEXT) failed")); 121 | exit(1); 122 | } 123 | byteCount += sizeof(word); 124 | } 125 | } -------------------------------------------------------------------------------- /ELFRuntimeSpy/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef utils_h 2 | #define utils_h 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include // bool type 19 | 20 | void ptrace_attach(int pid); 21 | void ptrace_cont(int pid); 22 | void ptrace_detach(int pid); 23 | bool ptrace_read(int pid, unsigned long addr, void *data, unsigned int len); 24 | char * 25 | ptrace_read_string(int pid, unsigned long addr); 26 | void ptrace_write(int pid, unsigned long addr, void *vptr, int len); 27 | #endif -------------------------------------------------------------------------------- /MachoRuntimeSpy/.gitignore: -------------------------------------------------------------------------------- 1 | cmake-build-debug 2 | CmakeLists.txt 3 | *.dSYM 4 | .idea 5 | .vscode 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/Macho.hpp: -------------------------------------------------------------------------------- 1 | #ifndef Macho_hpp 2 | #define Macho_hpp 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #include //open 16 | #include //stat 17 | #include //mmap 18 | 19 | #include "objc.hpp" 20 | 21 | #define MACHO_LOAD_ADDRESS 0x100000000 22 | 23 | namespace macho { 24 | typedef struct input_rt { 25 | pid_t pid; 26 | task_t task; 27 | unsigned long baseAddr; 28 | } input_rt_t; 29 | 30 | typedef struct input_fd { 31 | int fd; 32 | void *data; 33 | uint64_t length; 34 | unsigned long baseAddr; 35 | } input_fd_t; 36 | 37 | typedef struct load_command_info { 38 | struct load_command *cmd; 39 | void *cmd_info; 40 | unsigned long cmd_addr; 41 | } load_command_info_t; 42 | typedef std::vector load_command_infos_t; 43 | 44 | typedef std::vector section_64_infos_t; 45 | 46 | typedef struct segment_command_64_info { 47 | struct segment_command_64 *cmd; 48 | section_64_infos_t section_64_infos; 49 | } segment_command_64_info_t; 50 | typedef std::vector segment_command_64_infos_t; 51 | 52 | typedef struct objc_class_info { 53 | unsigned long class_addr; 54 | struct objc::objc_class *objc; 55 | char *class_name; 56 | } objc_class_info_t; 57 | 58 | typedef std::vector objc_class_infos_t; 59 | 60 | class Macho { 61 | public: 62 | bool m_isRT; 63 | bool m_is64bit; 64 | bool m_isDyldLinker; 65 | char *m_dyld_path; 66 | 67 | virtual bool parse_macho()=0; 68 | 69 | virtual bool parse_header()=0; 70 | 71 | virtual bool parse_load_commands()=0; 72 | 73 | virtual bool parse_load_command_headers()=0; 74 | 75 | virtual bool checkInitialization()=0; 76 | 77 | virtual bool macho_read(unsigned long addr, void *data, unsigned long len)=0; 78 | 79 | virtual bool macho_off_read(unsigned long offset, void *data, unsigned long len)=0; 80 | 81 | virtual char *macho_read_string(unsigned long addr)=0; 82 | 83 | struct mach_header *m_header; 84 | struct mach_header_64 *m_header64; 85 | load_command_infos_t m_load_command_infos; 86 | segment_command_64_infos_t m_segment_command_64_infos; 87 | objc_class_infos_t m_objc_class_infos; 88 | 89 | private: 90 | 91 | }; 92 | 93 | typedef struct fat_arch_info { 94 | struct fat_arch *arch; 95 | Macho *macho; 96 | } fat_arch_info_t; 97 | 98 | typedef std::vector fat_arch_infos_t; 99 | 100 | class MachoFD : public Macho { 101 | public: 102 | MachoFD(); 103 | 104 | bool m_isUniversal; 105 | unsigned long m_vm_64_addr; //bin vm addr 106 | bool parse_universal(); 107 | 108 | bool setPath(char *path); 109 | 110 | bool parse_macho(); 111 | 112 | bool parse_header(); 113 | 114 | bool parse_load_commands(); 115 | 116 | bool parse_load_command_headers(); 117 | 118 | bool parse_LC_SEGMENT_64(load_command_info_t *load_cmd_info); 119 | //bool parse_LC_SYMTAB(load_command_info_t *load_cmd_info); 120 | //bool parse_LC_LOAD_DYLINKER(load_command_info_t* load_cmd_info); 121 | 122 | 123 | bool checkInitialization(); 124 | 125 | bool macho_read(unsigned long addr, void *data, unsigned long len); 126 | 127 | bool macho_off_read(unsigned long offset, void *data, unsigned long len); 128 | 129 | char *macho_read_string(unsigned long addr); 130 | 131 | private: 132 | input_fd_t m_input; 133 | struct fat_header *m_fat_header; 134 | fat_arch_infos_t m_fat_arch_infos; 135 | 136 | }; 137 | 138 | class MachoRT : public Macho { 139 | public: 140 | MachoRT(); 141 | 142 | unsigned long m_load_addr; //macho load vm addr 143 | unsigned long m_load_end_addr; 144 | size_t m_aslr_slide; 145 | unsigned long m_dyld_load_addr; //where is dyld load 146 | unsigned long m_symtab_addr; 147 | unsigned long m_strtab_addr; 148 | 149 | bool setPid(pid_t pid); 150 | 151 | bool searchBinLoadAddress(); 152 | 153 | bool searchDyldImageLoadAddress(unsigned long dyld_vm_addr); 154 | 155 | bool check_dyld_arch(unsigned long addr); 156 | 157 | bool parse_macho(); 158 | 159 | bool parse_header(); 160 | 161 | bool parse_load_commands(); 162 | 163 | bool parse_load_command_headers(); 164 | 165 | bool parse_LC_SEGMENT_64(load_command_info_t *load_cmd_info); 166 | 167 | bool parse_LC_SYMTAB(load_command_info_t *load_cmd_info); 168 | 169 | bool parse_LC_LOAD_DYLINKER(load_command_info_t *load_cmd_info); 170 | 171 | bool parse_SECT_CLASSLIST(struct section_64 *sect); 172 | 173 | bool parse_CLASS(objc_class_info_t * objc_class_info); 174 | 175 | bool checkInitialization(); 176 | 177 | bool macho_read(unsigned long addr, void *data, unsigned long len); 178 | 179 | bool macho_off_read(unsigned long offset, void *data, unsigned long len); 180 | 181 | char *macho_read_string(unsigned long addr); 182 | 183 | private: 184 | unsigned long m_link_edit_bias; 185 | input_rt_t m_input; 186 | }; 187 | } 188 | 189 | static macho::MachoRT *mrt; 190 | #endif 191 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/Makefile: -------------------------------------------------------------------------------- 1 | SOURCES = $(wildcard *.cpp) 2 | 3 | # OSX macOS 4 | ifeq ($(MAC_GCC_UNIVERSAL),) 5 | # $(CURDIR)/build/include 6 | MAC_INCLUDE_DIR = $(abspath thirdparty/readline/mac/include) 7 | # $(CURDIR)/build/lib 8 | MAC_LIB_DIR = $(abspath thirdparty/readline/mac/lib) 9 | MAC_CFLAGS = 10 | # http://hanjianwei.com/2013/01/27/abi-compatibility-between-c-plus-plus-11-and-c-plus-plus-98/ 11 | MAC_CXXFLAGS = $(MAC_CFLAGS) -I$(MAC_INCLUDE_DIR) -stdlib=libc++ -std=c++11 -O0 -gmodules 12 | MAC_LDFLAGS = -L$(MAC_LIB_DIR) 13 | MAC_LIBS = -lreadline -lncurses 14 | MAC_GCC_BIN = `xcrun --sdk macosx --find clang++` 15 | MAC_SDK = `xcrun --sdk macosx --show-sdk-path` 16 | MAC_GCC_BASE = $(MAC_GCC_BIN) -g $(MAC_CXXFLAGS) $(MAC_LDFLAGS) $(MAC_LIBS) -isysroot $(MAC_SDK) 17 | export MAC_GCC_UNIVERSAL = $(MAC_GCC_BASE) -arch x86_64 18 | endif 19 | 20 | # IOS 21 | ifeq ($(IOS_GCC_UNIVERSAL),) 22 | IOS_INCLUDE_DIR = $(abspath thirdparty/readline/ios/include) 23 | IOS_LIB_DIR = $(abspath thirdparty/readline/ios/lib) 24 | 25 | IOS_CFLAGS = 26 | # http://hanjianwei.com/2013/01/27/abi-compatibility-between-c-plus-plus-11-and-c-plus-plus-98/ 27 | IOS_CXXFLAGS = $(IOS_CFLAGS) -I$(IOS_INCLUDE_DIR) -stdlib=libc++ -std=c++11 -O0 -gmodules 28 | IOS_LDFLAGS = -L$(IOS_LIB_DIR) 29 | IOS_LIBS = -lreadline -lncurses 30 | IOS_GCC_BIN = `xcrun --sdk iphoneos --find clang++` 31 | IOS_SDK = `xcrun --sdk iphoneos --show-sdk-path` 32 | IOS_GCC_BASE=$(IOS_GCC_BIN) -g $(IOS_CXXFLAGS) $(IOS_LDFLAGS) $(IOS_LIBS) -Wimplicit -isysroot $(IOS_SDK) 33 | export IOS_GCC_UNIVERSAL = $(IOS_GCC_BASE) -arch armv7 -arch arm64 34 | endif 35 | 36 | # output directories 37 | 38 | all: 39 | @echo $(MAC_GCC_UNIVERSAL) 40 | @echo $(CURDIR)/build/include 41 | 42 | mac: 43 | mkdir -p output/ 44 | @echo $(MAC_GCC_UNIVERSAL) $(SOURCES) -o rtspy-mac 45 | @$(MAC_GCC_UNIVERSAL) $(SOURCES) -o rtspy-mac 46 | @cp rtspy-mac output/rtspy-mac 47 | # @echo start ldid... 48 | # @ldid -Sent.xml rtspy-mac 49 | 50 | ios: 51 | mkdir -p output/ 52 | @echo $(IOS_GCC_UNIVERSAL) $(SOURCES) -o rtspy-ios 53 | @$(IOS_GCC_UNIVERSAL) $(SOURCES) -o rtspy-ios 54 | @cp rtspy-ios output/rtspy-ios 55 | # @echo start ldid... 56 | # @ldid -Sent.xml rtspy-ios 57 | # @echo ldid done. 58 | 59 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/README.md: -------------------------------------------------------------------------------- 1 | ## MachoRuntimeSpy 2 | 3 | runtime spy 4 | 5 | **In development...** 6 | 7 | ## Demo 8 | 9 | ``` 10 | jmpews at Jmp in ~/Desktop/rtspy/MachoRuntimeSpy (master●) (normal) 11 | λ : sudo ./rtspy-mac 12 | Password: 13 | -------------------------------------------------------------- 14 | RTspy - macOS/IOS (1.0.0) - by jmpews@gmail.com 15 | -------------------------------------------------------------- 16 | >> attach 79336 17 | [*] macho load at 0x10da10000 18 | [*] start dump macho: 19 | [*] Arch-64 20 | [*] string table addr: 0x10da12278 21 | [*] symbol table addr: 0x10da12278 22 | [*] dyld path: /usr/lib/dyld. 23 | [*] start dump macho: 24 | [*] Arch-fat 25 | [*] start dump macho: 26 | [*] Arch-64 27 | [*] __TEXT segment vm_addr: 0x0 28 | [!] only support x86_64. 29 | [*] start dyld search range(0x10da13000, 0x11da13000). 30 | [*] dyld load address check at 0x10da46000 31 | [*] Arch-64 32 | [*] dyld load address check at 0x11c2d6000 33 | [*] Arch-64 34 | [+] DyldImageLoadAddress: 0x11c2d6000 35 | >> 36 | ``` 37 | 38 | #### Make 39 | 40 | #### Usage 41 | 42 | #### Update Log 43 | 44 | ``` 45 | # 2017.03.31 it can dump class's ivars, and add anthoer method to get DyldImageLoadAddress, task_info(TASK_DYLD_INFO) 46 | -------------------------------------------------------------- 47 | RTspy - macOS/IOS (1.0.0) - by jmpews@gmail.com 48 | -------------------------------------------------------------- 49 | >> attach 49444 50 | [*] macho load at 0x100000000 51 | [*] start dump macho... 52 | [*] dump bin arch-64 53 | [*] class has been realized 54 | [*] dumping class 'MyObject', 0x100000f43 55 | [*] method name 'printt:' 56 | [*] method name 'printtt:' 57 | [*] ivar name 't' 58 | [*] class not be realized 59 | [*] dumping class 'XMyObject', 0x100000f4c 60 | [*] method name 'printt:' 61 | [*] method name 'printtt:' 62 | [*] ivar name 't' 63 | [*] string table addr: 0x100002520 64 | [*] symbol table addr: 0x100002520 65 | [*] dyld path: /usr/lib/dyld. 66 | [*] start dump macho... 67 | [*] dump macho arch-fat 68 | [*] start dump macho... 69 | [*] dump macho arch-64 70 | [*] __TEXT segment vm_addr: 0x0 71 | [!] Macho.cpp:160:parse_universal(): only support x86_64. 72 | [*] start dyld search range(0x100003000, 0x110003000). 73 | [*] dyld load address check at 0x100036000 74 | [*] dump bin arch-64 75 | [*] dyld load address check at 0x108844000 76 | [*] dump bin arch-64 77 | [*] task_info() dyld_addr: 0x108844000 78 | [+] DyldImageLoadAddress: 0x108844000 79 | # 2017.03.31 it can dump class more perfet, now can tell whether A 'class' is used 80 | -------------------------------------------------------------- 81 | RTspy - macOS/IOS (1.0.0) - by jmpews@gmail.com 82 | -------------------------------------------------------------- 83 | >> attach 30650 84 | [*] macho load at 0x100000000 85 | [*] start dump macho... 86 | [*] dump bin arch-64 87 | [*] class has been realized 88 | [*] dumping class 'MyObject', 0x100000f43 89 | [*] method name 'printt:' 90 | [*] method name 'printtt:' 91 | [*] class not be realized 92 | [*] dumping class 'XMyObject', 0x100000f4c 93 | [*] method name 'printt:' 94 | [*] method name 'printtt:' 95 | [*] string table addr: 0x100002520 96 | [*] symbol table addr: 0x100002520 97 | [*] dyld path: /usr/lib/dyld. 98 | [*] start dump macho... 99 | [*] dump macho arch-fat 100 | [*] start dump macho... 101 | [*] dump macho arch-64 102 | [*] __TEXT segment vm_addr: 0x0 103 | [!] Macho.cpp:158:parse_universal(): only support x86_64. 104 | [*] start dyld search range(0x100003000, 0x110003000). 105 | [*] dyld load address check at 0x100036000 106 | [*] dump bin arch-64 107 | [*] dyld load address check at 0x1036bc000 108 | [*] dump bin arch-64 109 | [+] DyldImageLoadAddress: 0x1036bc000 110 | # 2017.03.29 haha... it can dump class and method, but just demo, need perfect. 111 | -------------------------------------------------------------- 112 | RTspy - macOS/IOS (1.0.0) - by jmpews@gmail.com 113 | -------------------------------------------------------------- 114 | >> attach 2754 115 | [*] macho load at 0x100000000 116 | [*] start dump macho... 117 | [*] dump bin arch-64 118 | [*] dumping class 'MyObject' 119 | [*] method name 'printt:' 120 | ``` 121 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/Zz.hpp: -------------------------------------------------------------------------------- 1 | #ifndef rtspy_hpp 2 | #define rtspy_hpp 3 | 4 | #define PROGRAM_NAME "RTspy" 5 | #define PROGRAM_VER "1.0.0" 6 | #define PROGRAM_AUTHOR "jmpews@gmail.com" 7 | 8 | #define DEBUG 1 9 | 10 | #define GLOBAL_DEBUG false 11 | #endif 12 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/cli.cpp: -------------------------------------------------------------------------------- 1 | #include "cli.hpp" 2 | #include "Zz.hpp" 3 | 4 | #include "Macho.hpp" 5 | #include "utils.hpp" 6 | 7 | #define _print_line_sep (printf("--------------------------------------------------------------\n")) 8 | 9 | void print_welcome() { 10 | printf(GRN); 11 | _print_line_sep; 12 | printf("%s - macOS/IOS (%s) - by %s\n", PROGRAM_NAME, PROGRAM_VER, PROGRAM_AUTHOR); 13 | _print_line_sep; 14 | printf(RESET); 15 | } 16 | 17 | typedef struct cmd_arg { 18 | unsigned int argc; 19 | char *argv[8]; 20 | } cmd_arg_t; 21 | 22 | static const char *const pszCmdPrompt = GRN ">> " RESET; 23 | static char *pszLineRead = NULL; 24 | static cmd_arg_t arg; 25 | 26 | bool preprocess(char *pszOrig) { 27 | if (NULL == pszOrig) 28 | return false; 29 | 30 | char *pszStripHead = pszOrig; 31 | while (isspace(*pszStripHead)) 32 | pszStripHead++; 33 | 34 | if ('\0' == *pszStripHead) 35 | return false; 36 | 37 | char *pszStripTail = pszStripHead + strlen(pszStripHead) - 1; 38 | while (pszStripTail > pszStripHead && isspace(*pszStripTail)) 39 | pszStripTail--; 40 | *(++pszStripTail) = '\0'; 41 | 42 | add_history(pszStripHead); 43 | arg.argc = 1; 44 | char *ndx = pszStripHead; 45 | arg.argv[0] = pszStripHead; 46 | while ((ndx = strchr(ndx, ' ')) != NULL) { 47 | *ndx = '\0'; 48 | ndx++; 49 | arg.argv[arg.argc++] = ndx; 50 | // max argc 51 | if (arg.argc == 8) 52 | break; 53 | } 54 | return true; 55 | } 56 | 57 | bool ReadCmdLine() { 58 | if (pszLineRead) { 59 | free(pszLineRead); 60 | pszLineRead = NULL; 61 | } 62 | pszLineRead = readline(pszCmdPrompt); 63 | 64 | if (preprocess(pszLineRead)) { 65 | return true; 66 | } else { 67 | return false; 68 | } 69 | 70 | } 71 | 72 | void process_attach() { 73 | if (arg.argc != 2) { 74 | Serror("format: attach "); 75 | return; 76 | } 77 | int pid = atoi(arg.argv[1]); 78 | if (!pid) { 79 | Serror("format: attach "); 80 | return; 81 | } 82 | if (mrt) { 83 | delete (mrt); 84 | } 85 | mrt = new macho::MachoRT(); 86 | mrt->setPid(pid); 87 | mrt->parse_macho(); 88 | macho::MachoFD dyld; 89 | dyld.setPath(mrt->m_dyld_path); 90 | dyld.parse_macho(); 91 | if (mrt->searchDyldImageLoadAddress(dyld.m_vm_64_addr)) { 92 | std::cout << "[+] DyldImageLoadAddress: 0x" << std::hex << mrt->m_dyld_load_addr << std::endl; 93 | } 94 | } 95 | 96 | void process_command() { 97 | while (1) { 98 | if (!ReadCmdLine()) { 99 | Serror("empty command."); 100 | } 101 | if (!strcmp(arg.argv[0], "attach")) { 102 | process_attach(); 103 | } else { 104 | Serror("Unrecognized command"); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/cli.hpp: -------------------------------------------------------------------------------- 1 | #ifndef cli_hpp 2 | #define cli_hpp 3 | 4 | #include "Zz.hpp" 5 | #include 6 | #include 7 | #include 8 | 9 | #define RED "\x1B[31m" 10 | #define GRN "\x1B[32m" 11 | #define YEL "\x1B[33m" 12 | #define BLU "\x1B[34m" 13 | #define MAG "\x1B[35m" 14 | #define CYN "\x1B[36m" 15 | #define WHT "\x1B[37m" 16 | #define RESET "\x1B[0m" 17 | 18 | 19 | //Important!!! 20 | //STDERR before STDOUT, because sync 21 | #define Xdebug(fmt, ...) \ 22 | do { if (GLOBAL_DEBUG) fprintf(stdout, RESET fmt, \ 23 | __VA_ARGS__); } while (0) 24 | #define Sdebug(MSG) Xdebug("%s", MSG) 25 | 26 | //TODO: remove __FILE__, __LINE__, __func__ 27 | #define Xerror(fmt, ...) \ 28 | do { fprintf(stderr, RED "[!] " "%s:%d:%s(): " fmt RESET "\n", __FILE__, \ 29 | __LINE__, __func__, __VA_ARGS__); } while (0) 30 | #define Serror(MSG) Xerror("%s", MSG) 31 | //#define xinfo(str) printf(GRN "[*] " "%s" "\n" RESET, str) 32 | //#define xinfo(X) {printf(RESET "[*] "); X; printf("\n");} 33 | #define Xinfo(fmt, ...) \ 34 | do { fprintf(stderr, RESET "[*] " fmt "\n", \ 35 | __VA_ARGS__); } while (0) 36 | #define Sinfo(MSG) Xinfo("%s", MSG) 37 | 38 | void process_command(); 39 | void print_welcome(); 40 | void print_usage(); 41 | 42 | #endif /* cli_hpp */ 43 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/ent.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | run-unsigned-code 6 | 7 | get-task-allow 8 | 9 | task_for_pid-allow 10 | 11 | proc_info-allow 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/example/readme: -------------------------------------------------------------------------------- 1 | ## exmaple 2 | 3 | #### target - C language 4 | 5 | ``` 6 | test_target.c 7 | clang test_target.c -o test_target_c 8 | ``` 9 | 10 | #### target - OC langueage 11 | 12 | ``` 13 | target_target.m 14 | clang -framework Foundation test_target.m -o test_target_oc -Wl,-no_pie 15 | ``` 16 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/example/test_target.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() { 4 | printf("pid: %d\n", getpid()); 5 | while(1) 6 | sleep(3); 7 | } 8 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/example/test_target.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface MyObject : NSObject { 4 | int t; 5 | } 6 | - (void) printt: (int) t; 7 | - (void) printtt: (int) t; 8 | @end 9 | 10 | @implementation MyObject 11 | 12 | - (void) printt:(int)targ { 13 | NSLog(@"Hello, World!"); 14 | } 15 | 16 | - (void) printtt:(int)targ { 17 | NSLog(@"Hello, World!"); 18 | } 19 | @end 20 | 21 | @interface XMyObject : NSObject { 22 | int t; 23 | } 24 | - (void) printt: (int) t; 25 | - (void) printtt: (int) t; 26 | @end 27 | 28 | @implementation XMyObject 29 | 30 | - (void) printt:(int)t { 31 | NSLog(@"Hello, World!"); 32 | } 33 | 34 | - (void) printtt:(int)t { 35 | NSLog(@"Hello, World!"); 36 | } 37 | @end 38 | 39 | int main(int argc, const char * argv[]) { 40 | MyObject * ob = [[MyObject alloc] init]; 41 | [ob printt:0]; 42 | 43 | // XMyObject * xob = [[XMyObject alloc] init]; 44 | // [xob printt:0]; 45 | 46 | //pid 47 | NSProcessInfo *processInfo = [NSProcessInfo processInfo]; 48 | NSString *processName = [processInfo processName]; 49 | int processID = [processInfo processIdentifier]; 50 | NSLog(@"Process Name: '%@' Process ID:'%d'", processName, processID); 51 | while(1) 52 | sleep(3); 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/example/test_target_oc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/example/test_target_oc -------------------------------------------------------------------------------- /MachoRuntimeSpy/issues: -------------------------------------------------------------------------------- 1 | 1. xcode include "linenoise" 2 | set Target -> Build Settings -> Enable Modules(C and Objective-C) No 3 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Macho.hpp" 3 | #include "cli.hpp" 4 | 5 | //machort::MachoRT target; 6 | 7 | int main(int argc, const char * argv[]) { 8 | print_welcome(); 9 | process_command(); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/objc.cpp: -------------------------------------------------------------------------------- 1 | #include "objc.hpp" 2 | 3 | namespace objc { 4 | class_rw_t *get_objc_class_data_addr(uintptr_t bits) { 5 | return (struct class_rw_t * )(bits & FAST_DATA_MASK); 6 | } 7 | bool hasArray(x_array_t *t) { return t->arrayAndFlag & 1; } 8 | 9 | array_t *array(x_array_t *t) { return (array_t *) (t->arrayAndFlag & ~1); } 10 | 11 | List **arrayList(x_array_t *t) { 12 | if (hasArray(t)) { 13 | return array(t)->lists; 14 | } else { 15 | return &(t->list); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /MachoRuntimeSpy/objc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef objc_hpp 2 | #define objc_hpp 3 | 4 | #include 5 | 6 | namespace objc { 7 | #define FAST_DATA_MASK 0x00007ffffffffff8UL 8 | #define RW_REALIZED (1<<31) 9 | #define RW_REALIZING (1<<19) 10 | 11 | typedef void protocol_list_t; 12 | typedef void property_list_t; 13 | struct ivar_t { 14 | #if __x86_64__ 15 | // *offset was originally 64-bit on some x86_64 platforms. 16 | // We read and write only 32 bits of it. 17 | // Some metadata provides all 64 bits. This is harmless for unsigned 18 | // little-endian values. 19 | // Some code uses all 64 bits. class_addIvar() over-allocates the 20 | // offset for their benefit. 21 | #endif 22 | int32_t *offset; 23 | const char *name; 24 | const char *type; 25 | // alignment is sometimes -1; use alignment() instead 26 | uint32_t alignment_raw; 27 | uint32_t size; 28 | }; 29 | 30 | typedef struct { 31 | uint32_t entsizeAndFlags; 32 | uint32_t count; 33 | struct ivar_t first; 34 | } ivar_list_t; 35 | 36 | struct method_t { 37 | void *name; 38 | const char *types; 39 | void *imp; 40 | }; 41 | typedef struct { 42 | uint32_t entsizeAndFlags; 43 | uint32_t count; 44 | struct method_t first; 45 | } method_list_t; 46 | 47 | 48 | 49 | 50 | #if __LP64__ 51 | typedef uint32_t mask_t; // x86_64 & arm64 asm are less efficient with 16-bits 52 | #else 53 | typedef uint16_t mask_t; 54 | #endif 55 | 56 | /// An opaque type that represents an Objective-C class. 57 | typedef struct objc_class *Class; 58 | 59 | /// Represents an instance of a class. 60 | struct objc_object { 61 | Class isa; 62 | }; 63 | 64 | struct class_ro_t { 65 | uint32_t flags; 66 | uint32_t instanceStart; 67 | uint32_t instanceSize; 68 | #ifdef __LP64__ 69 | uint32_t reserved; 70 | #endif 71 | 72 | const uint8_t *ivarLayout; 73 | 74 | const char *name; 75 | method_list_t *baseMethodList; 76 | protocol_list_t *baseProtocols; 77 | const ivar_list_t *ivars; 78 | 79 | const uint8_t *weakIvarLayout; 80 | property_list_t *baseProperties; 81 | }; 82 | 83 | // important!!! if write use C++, 'template' may be the better chooise. 84 | typedef void List; 85 | 86 | struct array_t { 87 | uint32_t count; 88 | List *lists[0]; 89 | }; 90 | 91 | typedef struct list_array_tt { 92 | union { 93 | List *list; 94 | uintptr_t arrayAndFlag; 95 | }; 96 | } x_array_t; 97 | 98 | // list_array_tt method 99 | bool hasArray(x_array_t *t); 100 | 101 | array_t *array(x_array_t *t); 102 | 103 | List **arrayList(x_array_t *t); 104 | 105 | struct class_rw_t { 106 | // Be warned that Symbolication knows the layout of this structure. 107 | uint32_t flags; 108 | uint32_t version; 109 | 110 | const class_ro_t *ro; 111 | 112 | x_array_t methods; 113 | x_array_t properties; 114 | x_array_t protocols; 115 | 116 | Class firstSubclass; 117 | Class nextSiblingClass; 118 | 119 | char *demangledName; 120 | 121 | #if SUPPORT_INDEXED_ISA 122 | uint32_t index; 123 | #endif 124 | }; 125 | 126 | struct objc_class { 127 | Class isa; // metaclass 128 | Class superclass; // superclas 129 | // struct bucket_t * 130 | void *_buckets; // cache 131 | mask_t _mask; // vtable 132 | mask_t _occupied; // vtable 133 | uintptr_t bits; // data 134 | }; 135 | 136 | class_rw_t *get_objc_class_data_addr(uintptr_t bits); 137 | } 138 | #endif -------------------------------------------------------------------------------- /MachoRuntimeSpy/output/rtspy-ios: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/output/rtspy-ios -------------------------------------------------------------------------------- /MachoRuntimeSpy/output/rtspy-mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/output/rtspy-mac -------------------------------------------------------------------------------- /MachoRuntimeSpy/requires/control: -------------------------------------------------------------------------------- 1 | Package: com.yourcompany.dumpruntimemacho 2 | Name: dumpRuntimeMacho 3 | Depends: 4 | Version: 0.0.1 5 | Architecture: iphoneos-arm 6 | Description: An awesome tool of some sort!! 7 | Maintainer: jmpews 8 | Author: jmpews 9 | Section: System 10 | Tag: role::hacker 11 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/requires/ent.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | run-unsigned-code 6 | 7 | get-task-allow 8 | 9 | task_for_pid-allow 10 | 11 | proc_info-allow 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/requires/readme: -------------------------------------------------------------------------------- 1 | ## signed for special access permissions 2 | ldid -Sent.xml program -------------------------------------------------------------------------------- /MachoRuntimeSpy/rtspy-ios: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/rtspy-ios -------------------------------------------------------------------------------- /MachoRuntimeSpy/rtspy-mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/rtspy-mac -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/include/readline/chardefs.h: -------------------------------------------------------------------------------- 1 | /* chardefs.h -- Character definitions for readline. */ 2 | 3 | /* Copyright (C) 1994-2015 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _CHARDEFS_H_ 23 | #define _CHARDEFS_H_ 24 | 25 | #include 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # if defined (HAVE_STRING_H) 29 | # if ! defined (STDC_HEADERS) && defined (HAVE_MEMORY_H) 30 | # include 31 | # endif 32 | # include 33 | # endif /* HAVE_STRING_H */ 34 | # if defined (HAVE_STRINGS_H) 35 | # include 36 | # endif /* HAVE_STRINGS_H */ 37 | #else 38 | # include 39 | #endif /* !HAVE_CONFIG_H */ 40 | 41 | #ifndef whitespace 42 | #define whitespace(c) (((c) == ' ') || ((c) == '\t')) 43 | #endif 44 | 45 | #ifdef CTRL 46 | # undef CTRL 47 | #endif 48 | #ifdef UNCTRL 49 | # undef UNCTRL 50 | #endif 51 | 52 | /* Some character stuff. */ 53 | #define control_character_threshold 0x020 /* Smaller than this is control. */ 54 | #define control_character_mask 0x1f /* 0x20 - 1 */ 55 | #define meta_character_threshold 0x07f /* Larger than this is Meta. */ 56 | #define control_character_bit 0x40 /* 0x000000, must be off. */ 57 | #define meta_character_bit 0x080 /* x0000000, must be on. */ 58 | #define largest_char 255 /* Largest character value. */ 59 | 60 | #define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0)) 61 | #define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char) 62 | 63 | #define CTRL(c) ((c) & control_character_mask) 64 | #define META(c) ((c) | meta_character_bit) 65 | 66 | #define UNMETA(c) ((c) & (~meta_character_bit)) 67 | #define UNCTRL(c) _rl_to_upper(((c)|control_character_bit)) 68 | 69 | #if defined STDC_HEADERS || (!defined (isascii) && !defined (HAVE_ISASCII)) 70 | # define IN_CTYPE_DOMAIN(c) 1 71 | #else 72 | # define IN_CTYPE_DOMAIN(c) isascii(c) 73 | #endif 74 | 75 | #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) 76 | # define isxdigit(c) (isdigit((unsigned char)(c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) 77 | #endif 78 | 79 | #if defined (CTYPE_NON_ASCII) 80 | # define NON_NEGATIVE(c) 1 81 | #else 82 | # define NON_NEGATIVE(c) ((unsigned char)(c) == (c)) 83 | #endif 84 | 85 | /* Some systems define these; we want our definitions. */ 86 | #undef ISPRINT 87 | 88 | /* Beware: these only work with single-byte ASCII characters. */ 89 | 90 | #define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum ((unsigned char)c)) 91 | #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha ((unsigned char)c)) 92 | #define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit ((unsigned char)c)) 93 | #define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower ((unsigned char)c)) 94 | #define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint ((unsigned char)c)) 95 | #define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper ((unsigned char)c)) 96 | #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit ((unsigned char)c)) 97 | 98 | #define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c)) 99 | #define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c)) 100 | #define _rl_digit_p(c) ((c) >= '0' && (c) <= '9') 101 | 102 | #define _rl_pure_alphabetic(c) (NON_NEGATIVE(c) && ISALPHA(c)) 103 | #define ALPHABETIC(c) (NON_NEGATIVE(c) && ISALNUM(c)) 104 | 105 | #ifndef _rl_to_upper 106 | # define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)c) : (c)) 107 | # define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)c) : (c)) 108 | #endif 109 | 110 | #ifndef _rl_digit_value 111 | # define _rl_digit_value(x) ((x) - '0') 112 | #endif 113 | 114 | #ifndef _rl_isident 115 | # define _rl_isident(c) (ISALNUM(c) || (c) == '_') 116 | #endif 117 | 118 | #ifndef ISOCTAL 119 | # define ISOCTAL(c) ((c) >= '0' && (c) <= '7') 120 | #endif 121 | #define OCTVALUE(c) ((c) - '0') 122 | 123 | #define HEXVALUE(c) \ 124 | (((c) >= 'a' && (c) <= 'f') \ 125 | ? (c)-'a'+10 \ 126 | : (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0') 127 | 128 | #ifndef NEWLINE 129 | #define NEWLINE '\n' 130 | #endif 131 | 132 | #ifndef RETURN 133 | #define RETURN CTRL('M') 134 | #endif 135 | 136 | #ifndef RUBOUT 137 | #define RUBOUT 0x7f 138 | #endif 139 | 140 | #ifndef TAB 141 | #define TAB '\t' 142 | #endif 143 | 144 | #ifdef ABORT_CHAR 145 | #undef ABORT_CHAR 146 | #endif 147 | #define ABORT_CHAR CTRL('G') 148 | 149 | #ifdef PAGE 150 | #undef PAGE 151 | #endif 152 | #define PAGE CTRL('L') 153 | 154 | #ifdef SPACE 155 | #undef SPACE 156 | #endif 157 | #define SPACE ' ' /* XXX - was 0x20 */ 158 | 159 | #ifdef ESC 160 | #undef ESC 161 | #endif 162 | #define ESC CTRL('[') 163 | 164 | #endif /* _CHARDEFS_H_ */ 165 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/include/readline/keymaps.h: -------------------------------------------------------------------------------- 1 | /* keymaps.h -- Manipulation of readline keymaps. */ 2 | 3 | /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _KEYMAPS_H_ 23 | #define _KEYMAPS_H_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #if defined (READLINE_LIBRARY) 30 | # include "rlstdc.h" 31 | # include "chardefs.h" 32 | # include "rltypedefs.h" 33 | #else 34 | # include 35 | # include 36 | # include 37 | #endif 38 | 39 | /* A keymap contains one entry for each key in the ASCII set. 40 | Each entry consists of a type and a pointer. 41 | FUNCTION is the address of a function to run, or the 42 | address of a keymap to indirect through. 43 | TYPE says which kind of thing FUNCTION is. */ 44 | typedef struct _keymap_entry { 45 | char type; 46 | rl_command_func_t *function; 47 | } KEYMAP_ENTRY; 48 | 49 | /* This must be large enough to hold bindings for all of the characters 50 | in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, 51 | and so on) plus one for subsequence matching. */ 52 | #define KEYMAP_SIZE 257 53 | #define ANYOTHERKEY KEYMAP_SIZE-1 54 | 55 | typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; 56 | typedef KEYMAP_ENTRY *Keymap; 57 | 58 | /* The values that TYPE can have in a keymap entry. */ 59 | #define ISFUNC 0 60 | #define ISKMAP 1 61 | #define ISMACR 2 62 | 63 | extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; 64 | extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; 65 | 66 | /* Return a new, empty keymap. 67 | Free it with free() when you are done. */ 68 | extern Keymap rl_make_bare_keymap PARAMS((void)); 69 | 70 | /* Return a new keymap which is a copy of MAP. */ 71 | extern Keymap rl_copy_keymap PARAMS((Keymap)); 72 | 73 | /* Return a new keymap with the printing characters bound to rl_insert, 74 | the lowercase Meta characters bound to run their equivalents, and 75 | the Meta digits bound to produce numeric arguments. */ 76 | extern Keymap rl_make_keymap PARAMS((void)); 77 | 78 | /* Free the storage associated with a keymap. */ 79 | extern void rl_discard_keymap PARAMS((Keymap)); 80 | 81 | /* These functions actually appear in bind.c */ 82 | 83 | /* Return the keymap corresponding to a given name. Names look like 84 | `emacs' or `emacs-meta' or `vi-insert'. */ 85 | extern Keymap rl_get_keymap_by_name PARAMS((const char *)); 86 | 87 | /* Return the current keymap. */ 88 | extern Keymap rl_get_keymap PARAMS((void)); 89 | 90 | /* Set the current keymap to MAP. */ 91 | extern void rl_set_keymap PARAMS((Keymap)); 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif /* _KEYMAPS_H_ */ 98 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/include/readline/rlconf.h: -------------------------------------------------------------------------------- 1 | /* rlconf.h -- readline configuration definitions */ 2 | 3 | /* Copyright (C) 1992-2015 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #if !defined (_RLCONF_H_) 23 | #define _RLCONF_H_ 24 | 25 | /* Define this if you want the vi-mode editing available. */ 26 | #define VI_MODE 27 | 28 | /* Define this to get an indication of file type when listing completions. */ 29 | #define VISIBLE_STATS 30 | 31 | /* Define this to get support for colors when listing completions and in 32 | other places. */ 33 | #define COLOR_SUPPORT 34 | 35 | /* This definition is needed by readline.c, rltty.c, and signals.c. */ 36 | /* If on, then readline handles signals in a way that doesn't suck. */ 37 | #define HANDLE_SIGNALS 38 | 39 | /* Ugly but working hack for binding prefix meta. */ 40 | #define PREFIX_META_HACK 41 | 42 | /* The next-to-last-ditch effort file name for a user-specific init file. */ 43 | #define DEFAULT_INPUTRC "~/.inputrc" 44 | 45 | /* The ultimate last-ditch filenname for an init file -- system-wide. */ 46 | #define SYS_INPUTRC "/etc/inputrc" 47 | 48 | /* If defined, expand tabs to spaces. */ 49 | #define DISPLAY_TABS 50 | 51 | /* If defined, use the terminal escape sequence to move the cursor forward 52 | over a character when updating the line rather than rewriting it. */ 53 | /* #define HACK_TERMCAP_MOTION */ 54 | 55 | /* The string inserted by the `insert comment' command. */ 56 | #define RL_COMMENT_BEGIN_DEFAULT "#" 57 | 58 | /* Define this if you want code that allows readline to be used in an 59 | X `callback' style. */ 60 | #define READLINE_CALLBACKS 61 | 62 | /* Define this if you want the cursor to indicate insert or overwrite mode. */ 63 | /* #define CURSOR_MODE */ 64 | 65 | /* Define this if you want to enable code that talks to the Linux kernel 66 | tty auditing system. */ 67 | /* #define ENABLE_TTY_AUDIT_SUPPORT */ 68 | 69 | /* Defaults for the various editing mode indicators, inserted at the beginning 70 | of the last (maybe only) line of the prompt if show-mode-in-prompt is on */ 71 | #define RL_EMACS_MODESTR_DEFAULT "@" 72 | #define RL_EMACS_MODESTR_DEFLEN 1 73 | 74 | #define RL_VI_INS_MODESTR_DEFAULT "(ins)" 75 | #define RL_VI_INS_MODESTR_DEFLEN 5 76 | #define RL_VI_CMD_MODESTR_DEFAULT "(cmd)" 77 | #define RL_VI_CMD_MODESTR_DEFLEN 5 78 | 79 | #endif /* _RLCONF_H_ */ 80 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/include/readline/rlstdc.h: -------------------------------------------------------------------------------- 1 | /* stdc.h -- macros to make source compile on both ANSI C and K&R C compilers. */ 2 | 3 | /* Copyright (C) 1993-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #if !defined (_RL_STDC_H_) 23 | #define _RL_STDC_H_ 24 | 25 | /* Adapted from BSD /usr/include/sys/cdefs.h. */ 26 | 27 | /* A function can be defined using prototypes and compile on both ANSI C 28 | and traditional C compilers with something like this: 29 | extern char *func PARAMS((char *, char *, int)); */ 30 | 31 | #if !defined (PARAMS) 32 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) 33 | # define PARAMS(protos) protos 34 | # else 35 | # define PARAMS(protos) () 36 | # endif 37 | #endif 38 | 39 | #ifndef __attribute__ 40 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) 41 | # define __attribute__(x) 42 | # endif 43 | #endif 44 | 45 | /* Moved from config.h.in because readline.h:rl_message depends on these 46 | defines. */ 47 | #if defined (__STDC__) && defined (HAVE_STDARG_H) 48 | # define PREFER_STDARG 49 | # define USE_VARARGS 50 | #else 51 | # if defined (HAVE_VARARGS_H) 52 | # define PREFER_VARARGS 53 | # define USE_VARARGS 54 | # endif 55 | #endif 56 | 57 | #endif /* !_RL_STDC_H_ */ 58 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/include/readline/rltypedefs.h: -------------------------------------------------------------------------------- 1 | /* rltypedefs.h -- Type declarations for readline functions. */ 2 | 3 | /* Copyright (C) 2000-2011 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _RL_TYPEDEFS_H_ 23 | #define _RL_TYPEDEFS_H_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Old-style, attempt to mark as deprecated in some way people will notice. */ 30 | 31 | #if !defined (_FUNCTION_DEF) 32 | # define _FUNCTION_DEF 33 | 34 | #if defined(__GNUC__) || defined(__clang__) 35 | typedef int Function () __attribute__ ((deprecated)); 36 | typedef void VFunction () __attribute__ ((deprecated)); 37 | typedef char *CPFunction () __attribute__ ((deprecated)); 38 | typedef char **CPPFunction () __attribute__ ((deprecated)); 39 | #else 40 | typedef int Function (); 41 | typedef void VFunction (); 42 | typedef char *CPFunction (); 43 | typedef char **CPPFunction (); 44 | #endif 45 | 46 | #endif /* _FUNCTION_DEF */ 47 | 48 | /* New style. */ 49 | 50 | #if !defined (_RL_FUNCTION_TYPEDEF) 51 | # define _RL_FUNCTION_TYPEDEF 52 | 53 | /* Bindable functions */ 54 | typedef int rl_command_func_t PARAMS((int, int)); 55 | 56 | /* Typedefs for the completion system */ 57 | typedef char *rl_compentry_func_t PARAMS((const char *, int)); 58 | typedef char **rl_completion_func_t PARAMS((const char *, int, int)); 59 | 60 | typedef char *rl_quote_func_t PARAMS((char *, int, char *)); 61 | typedef char *rl_dequote_func_t PARAMS((char *, int)); 62 | 63 | typedef int rl_compignore_func_t PARAMS((char **)); 64 | 65 | typedef void rl_compdisp_func_t PARAMS((char **, int, int)); 66 | 67 | /* Type for input and pre-read hook functions like rl_event_hook */ 68 | typedef int rl_hook_func_t PARAMS((void)); 69 | 70 | /* Input function type */ 71 | typedef int rl_getc_func_t PARAMS((FILE *)); 72 | 73 | /* Generic function that takes a character buffer (which could be the readline 74 | line buffer) and an index into it (which could be rl_point) and returns 75 | an int. */ 76 | typedef int rl_linebuf_func_t PARAMS((char *, int)); 77 | 78 | /* `Generic' function pointer typedefs */ 79 | typedef int rl_intfunc_t PARAMS((int)); 80 | #define rl_ivoidfunc_t rl_hook_func_t 81 | typedef int rl_icpfunc_t PARAMS((char *)); 82 | typedef int rl_icppfunc_t PARAMS((char **)); 83 | 84 | typedef void rl_voidfunc_t PARAMS((void)); 85 | typedef void rl_vintfunc_t PARAMS((int)); 86 | typedef void rl_vcpfunc_t PARAMS((char *)); 87 | typedef void rl_vcppfunc_t PARAMS((char **)); 88 | 89 | typedef char *rl_cpvfunc_t PARAMS((void)); 90 | typedef char *rl_cpifunc_t PARAMS((int)); 91 | typedef char *rl_cpcpfunc_t PARAMS((char *)); 92 | typedef char *rl_cpcppfunc_t PARAMS((char **)); 93 | 94 | #endif /* _RL_FUNCTION_TYPEDEF */ 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif /* _RL_TYPEDEFS_H_ */ 101 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/include/readline/tilde.h: -------------------------------------------------------------------------------- 1 | /* tilde.h: Externally available variables and function in libtilde.a. */ 2 | 3 | /* Copyright (C) 1992-2009 Free Software Foundation, Inc. 4 | 5 | This file contains the Readline Library (Readline), a set of 6 | routines for providing Emacs style line input to programs that ask 7 | for it. 8 | 9 | Readline is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Readline is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Readline. If not, see . 21 | */ 22 | 23 | #if !defined (_TILDE_H_) 24 | # define _TILDE_H_ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* A function can be defined using prototypes and compile on both ANSI C 31 | and traditional C compilers with something like this: 32 | extern char *func PARAMS((char *, char *, int)); */ 33 | 34 | #if !defined (PARAMS) 35 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) 36 | # define PARAMS(protos) protos 37 | # else 38 | # define PARAMS(protos) () 39 | # endif 40 | #endif 41 | 42 | typedef char *tilde_hook_func_t PARAMS((char *)); 43 | 44 | /* If non-null, this contains the address of a function that the application 45 | wants called before trying the standard tilde expansions. The function 46 | is called with the text sans tilde, and returns a malloc()'ed string 47 | which is the expansion, or a NULL pointer if the expansion fails. */ 48 | extern tilde_hook_func_t *tilde_expansion_preexpansion_hook; 49 | 50 | /* If non-null, this contains the address of a function to call if the 51 | standard meaning for expanding a tilde fails. The function is called 52 | with the text (sans tilde, as in "foo"), and returns a malloc()'ed string 53 | which is the expansion, or a NULL pointer if there is no expansion. */ 54 | extern tilde_hook_func_t *tilde_expansion_failure_hook; 55 | 56 | /* When non-null, this is a NULL terminated array of strings which 57 | are duplicates for a tilde prefix. Bash uses this to expand 58 | `=~' and `:~'. */ 59 | extern char **tilde_additional_prefixes; 60 | 61 | /* When non-null, this is a NULL terminated array of strings which match 62 | the end of a username, instead of just "/". Bash sets this to 63 | `:' and `=~'. */ 64 | extern char **tilde_additional_suffixes; 65 | 66 | /* Return a new string which is the result of tilde expanding STRING. */ 67 | extern char *tilde_expand PARAMS((const char *)); 68 | 69 | /* Do the work of tilde expansion on FILENAME. FILENAME starts with a 70 | tilde. If there is no expansion, call tilde_expansion_failure_hook. */ 71 | extern char *tilde_expand_word PARAMS((const char *)); 72 | 73 | /* Find the portion of the string beginning with ~ that should be expanded. */ 74 | extern char *tilde_find_word PARAMS((const char *, int, int *)); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* _TILDE_H_ */ 81 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/lib/libhistory.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/thirdparty/readline/ios/lib/libhistory.a -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/lib/libreadline.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/thirdparty/readline/ios/lib/libreadline.a -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/info/dir: -------------------------------------------------------------------------------- 1 | This is the file .../info/dir, which contains the 2 | topmost node of the Info hierarchy, called (dir)Top. 3 | The first time you invoke Info you start off looking at this node. 4 |  5 | File: dir, Node: Top This is the top of the INFO tree 6 | 7 | This (the Directory node) gives a menu of major topics. 8 | Typing "q" exits, "?" lists all Info commands, "d" returns here, 9 | "h" gives a primer for first-timers, 10 | "mEmacs" visits the Emacs manual, etc. 11 | 12 | In Emacs, you can click mouse button 2 on a menu item or cross reference 13 | to select it. 14 | 15 | * Menu: 16 | 17 | Libraries 18 | * History: (history). The GNU history library API. 19 | * RLuserman: (rluserman). The GNU readline library User's Manual. 20 | * Readline: (readline). The GNU readline library API. 21 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/hist_erasedups.c: -------------------------------------------------------------------------------- 1 | /* hist_erasedups -- remove all duplicate entries from history file */ 2 | 3 | /* Copyright (C) 2011 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | #ifndef READLINE_LIBRARY 22 | #define READLINE_LIBRARY 1 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef READLINE_LIBRARY 30 | # include "history.h" 31 | #else 32 | # include 33 | #endif 34 | 35 | #include 36 | 37 | #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) 38 | #define STREQN(a, b, n) ((n == 0) ? (1) \ 39 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) 40 | 41 | static void 42 | usage() 43 | { 44 | fprintf (stderr, "hist_erasedups: usage: hist_erasedups [-t] [filename]\n"); 45 | exit (2); 46 | } 47 | 48 | int 49 | main (argc, argv) 50 | int argc; 51 | char **argv; 52 | { 53 | char *fn; 54 | int r; 55 | 56 | while ((r = getopt (argc, argv, "t")) != -1) 57 | { 58 | switch (r) 59 | { 60 | case 't': 61 | history_write_timestamps = 1; 62 | break; 63 | default: 64 | usage (); 65 | } 66 | } 67 | argv += optind; 68 | argc -= optind; 69 | 70 | fn = argc ? argv[0] : getenv ("HISTFILE"); 71 | if (fn == 0) 72 | { 73 | fprintf (stderr, "hist_erasedups: no history file\n"); 74 | usage (); 75 | } 76 | 77 | if ((r = read_history (fn)) != 0) 78 | { 79 | fprintf (stderr, "hist_erasedups: read_history: %s: %s\n", fn, strerror (r)); 80 | exit (1); 81 | } 82 | 83 | hist_erasedups (); 84 | 85 | if ((r = write_history (fn)) != 0) 86 | { 87 | fprintf (stderr, "hist_erasedups: write_history: %s: %s\n", fn, strerror (r)); 88 | exit (1); 89 | } 90 | 91 | exit (0); 92 | } 93 | 94 | int 95 | hist_erasedups () 96 | { 97 | int r, n; 98 | HIST_ENTRY *h, *temp; 99 | 100 | using_history (); 101 | while (h = previous_history ()) 102 | { 103 | r = where_history (); 104 | for (n = 0; n < r; n++) 105 | { 106 | temp = history_get (n+history_base); 107 | if (STREQ (h->line, temp->line)) 108 | { 109 | remove_history (n); 110 | r--; /* have to get one fewer now */ 111 | n--; /* compensate for above increment */ 112 | history_offset--; /* moving backwards in history list */ 113 | } 114 | } 115 | } 116 | using_history (); 117 | 118 | return r; 119 | } 120 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/hist_purgecmd.c: -------------------------------------------------------------------------------- 1 | /* hist_purgecmd -- remove all instances of command or pattern from history 2 | file */ 3 | 4 | /* Copyright (C) 2011 Free Software Foundation, Inc. 5 | 6 | This file is part of the GNU Readline Library (Readline), a library for 7 | reading lines of text with interactive input and history editing. 8 | 9 | Readline is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Readline is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Readline. If not, see . 21 | */ 22 | #ifndef READLINE_LIBRARY 23 | #define READLINE_LIBRARY 1 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #ifdef READLINE_LIBRARY 33 | # include "history.h" 34 | #else 35 | # include 36 | #endif 37 | 38 | #include 39 | 40 | #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) 41 | #define STREQN(a, b, n) ((n == 0) ? (1) \ 42 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) 43 | 44 | #define PURGE_REGEXP 0x01 45 | 46 | static void 47 | usage() 48 | { 49 | fprintf (stderr, "hist_purgecmd: usage: hist_purgecmd [-r] [-t] [-f filename] command-spec\n"); 50 | exit (2); 51 | } 52 | 53 | int 54 | main (argc, argv) 55 | int argc; 56 | char **argv; 57 | { 58 | char *fn; 59 | int r, flags; 60 | 61 | flags = 0; 62 | fn = 0; 63 | while ((r = getopt (argc, argv, "f:rt")) != -1) 64 | { 65 | switch (r) 66 | { 67 | case 'f': 68 | fn = optarg; 69 | break; 70 | case 'r': 71 | flags |= PURGE_REGEXP; 72 | break; 73 | case 't': 74 | history_write_timestamps = 1; 75 | break; 76 | default: 77 | usage (); 78 | } 79 | } 80 | argv += optind; 81 | argc -= optind; 82 | 83 | if (fn == 0) 84 | fn = getenv ("HISTFILE"); 85 | if (fn == 0) 86 | { 87 | fprintf (stderr, "hist_purgecmd: no history file\n"); 88 | usage (); 89 | } 90 | 91 | if ((r = read_history (fn)) != 0) 92 | { 93 | fprintf (stderr, "hist_purgecmd: read_history: %s: %s\n", fn, strerror (r)); 94 | exit (1); 95 | } 96 | 97 | for (r = 0; r < argc; r++) 98 | hist_purgecmd (argv[r], flags); 99 | 100 | if ((r = write_history (fn)) != 0) 101 | { 102 | fprintf (stderr, "hist_purgecmd: write_history: %s: %s\n", fn, strerror (r)); 103 | exit (1); 104 | } 105 | 106 | exit (0); 107 | } 108 | 109 | int 110 | hist_purgecmd (cmd, flags) 111 | char *cmd; 112 | int flags; 113 | { 114 | int r, n, rflags; 115 | HIST_ENTRY *temp; 116 | regex_t regex = { 0 }; 117 | 118 | if (flags & PURGE_REGEXP) 119 | { 120 | rflags = REG_EXTENDED|REG_NOSUB; 121 | if (regcomp (®ex, cmd, rflags)) 122 | { 123 | fprintf (stderr, "hist_purgecmd: %s: invalid regular expression\n", cmd); 124 | return -1; 125 | } 126 | } 127 | 128 | r = 0; 129 | using_history (); 130 | r = where_history (); 131 | for (n = 0; n < r; n++) 132 | { 133 | temp = history_get (n+history_base); 134 | if (((flags & PURGE_REGEXP) && (regexec (®ex, temp->line, 0, 0, 0) == 0)) || 135 | ((flags & PURGE_REGEXP) == 0 && STREQ (temp->line, cmd))) 136 | { 137 | remove_history (n); 138 | r--; /* have to get one fewer now */ 139 | n--; /* compensate for above increment */ 140 | history_offset--; /* moving backwards in history list */ 141 | } 142 | } 143 | using_history (); 144 | 145 | if (flags & PURGE_REGEXP) 146 | regfree (®ex); 147 | 148 | return r; 149 | } 150 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/histexamp.c: -------------------------------------------------------------------------------- 1 | /* histexamp.c - history library example program. */ 2 | 3 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #include 23 | 24 | #ifdef READLINE_LIBRARY 25 | # include "history.h" 26 | #else 27 | # include 28 | #endif 29 | 30 | #include 31 | 32 | main (argc, argv) 33 | int argc; 34 | char **argv; 35 | { 36 | char line[1024], *t; 37 | int len, done; 38 | 39 | line[0] = 0; 40 | done = 0; 41 | 42 | using_history (); 43 | while (!done) 44 | { 45 | printf ("history$ "); 46 | fflush (stdout); 47 | t = fgets (line, sizeof (line) - 1, stdin); 48 | if (t && *t) 49 | { 50 | len = strlen (t); 51 | if (t[len - 1] == '\n') 52 | t[len - 1] = '\0'; 53 | } 54 | 55 | if (!t) 56 | strcpy (line, "quit"); 57 | 58 | if (line[0]) 59 | { 60 | char *expansion; 61 | int result; 62 | 63 | using_history (); 64 | 65 | result = history_expand (line, &expansion); 66 | if (result) 67 | fprintf (stderr, "%s\n", expansion); 68 | 69 | if (result < 0 || result == 2) 70 | { 71 | free (expansion); 72 | continue; 73 | } 74 | 75 | add_history (expansion); 76 | strncpy (line, expansion, sizeof (line) - 1); 77 | free (expansion); 78 | } 79 | 80 | if (strcmp (line, "quit") == 0) 81 | done = 1; 82 | else if (strcmp (line, "save") == 0) 83 | write_history ("history_file"); 84 | else if (strcmp (line, "read") == 0) 85 | read_history ("history_file"); 86 | else if (strcmp (line, "list") == 0) 87 | { 88 | register HIST_ENTRY **the_list; 89 | register int i; 90 | time_t tt; 91 | char timestr[128]; 92 | 93 | the_list = history_list (); 94 | if (the_list) 95 | for (i = 0; the_list[i]; i++) 96 | { 97 | tt = history_get_time (the_list[i]); 98 | if (tt) 99 | strftime (timestr, sizeof (timestr), "%a %R", localtime(&tt)); 100 | else 101 | strcpy (timestr, "??"); 102 | printf ("%d: %s: %s\n", i + history_base, timestr, the_list[i]->line); 103 | } 104 | } 105 | else if (strncmp (line, "delete", 6) == 0) 106 | { 107 | int which; 108 | if ((sscanf (line + 6, "%d", &which)) == 1) 109 | { 110 | HIST_ENTRY *entry = remove_history (which); 111 | if (!entry) 112 | fprintf (stderr, "No such entry %d\n", which); 113 | else 114 | { 115 | free (entry->line); 116 | free (entry); 117 | } 118 | } 119 | else 120 | { 121 | fprintf (stderr, "non-numeric arg given to `delete'\n"); 122 | } 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/manexamp.c: -------------------------------------------------------------------------------- 1 | /* manexamp.c -- The examples which appear in the documentation are here. */ 2 | 3 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | /* **************************************************************** */ 26 | /* */ 27 | /* How to Emulate gets () */ 28 | /* */ 29 | /* **************************************************************** */ 30 | 31 | /* A static variable for holding the line. */ 32 | static char *line_read = (char *)NULL; 33 | 34 | /* Read a string, and return a pointer to it. Returns NULL on EOF. */ 35 | char * 36 | rl_gets () 37 | { 38 | /* If the buffer has already been allocated, return the memory 39 | to the free pool. */ 40 | if (line_read) 41 | { 42 | free (line_read); 43 | line_read = (char *)NULL; 44 | } 45 | 46 | /* Get a line from the user. */ 47 | line_read = readline (""); 48 | 49 | /* If the line has any text in it, save it on the history. */ 50 | if (line_read && *line_read) 51 | add_history (line_read); 52 | 53 | return (line_read); 54 | } 55 | 56 | /* **************************************************************** */ 57 | /* */ 58 | /* Writing a Function to be Called by Readline. */ 59 | /* */ 60 | /* **************************************************************** */ 61 | 62 | /* Invert the case of the COUNT following characters. */ 63 | invert_case_line (count, key) 64 | int count, key; 65 | { 66 | register int start, end; 67 | 68 | start = rl_point; 69 | 70 | if (count < 0) 71 | { 72 | direction = -1; 73 | count = -count; 74 | } 75 | else 76 | direction = 1; 77 | 78 | /* Find the end of the range to modify. */ 79 | end = start + (count * direction); 80 | 81 | /* Force it to be within range. */ 82 | if (end > rl_end) 83 | end = rl_end; 84 | else if (end < 0) 85 | end = -1; 86 | 87 | if (start > end) 88 | { 89 | int temp = start; 90 | start = end; 91 | end = temp; 92 | } 93 | 94 | if (start == end) 95 | return; 96 | 97 | /* Tell readline that we are modifying the line, so save the undo 98 | information. */ 99 | rl_modifying (start, end); 100 | 101 | for (; start != end; start += direction) 102 | { 103 | if (_rl_uppercase_p (rl_line_buffer[start])) 104 | rl_line_buffer[start] = _rl_to_lower (rl_line_buffer[start]); 105 | else if (_rl_lowercase_p (rl_line_buffer[start])) 106 | rl_line_buffer[start] = _rl_to_upper (rl_line_buffer[start]); 107 | } 108 | 109 | /* Move point to on top of the last character changed. */ 110 | rl_point = end - direction; 111 | } 112 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rl-callbacktest.c: -------------------------------------------------------------------------------- 1 | /* Standard include files. stdio.h is required. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | /* Used for select(2) */ 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | /* Standard readline include files. */ 17 | #if defined (READLINE_LIBRARY) 18 | # include "readline.h" 19 | # include "history.h" 20 | #else 21 | # include 22 | # include 23 | #endif 24 | 25 | extern int errno; 26 | 27 | static void cb_linehandler (char *); 28 | static void signandler (int); 29 | 30 | int running, sigwinch_received; 31 | const char *prompt = "rltest$ "; 32 | 33 | /* Handle SIGWINCH and window size changes when readline is not active and 34 | reading a character. */ 35 | static void 36 | sighandler (int sig) 37 | { 38 | sigwinch_received = 1; 39 | } 40 | 41 | /* Callback function called for each line when accept-line executed, EOF 42 | seen, or EOF character read. This sets a flag and returns; it could 43 | also call exit(3). */ 44 | static void 45 | cb_linehandler (char *line) 46 | { 47 | /* Can use ^D (stty eof) or `exit' to exit. */ 48 | if (line == NULL || strcmp (line, "exit") == 0) 49 | { 50 | if (line == 0) 51 | printf ("\n"); 52 | printf ("exit\n"); 53 | /* This function needs to be called to reset the terminal settings, 54 | and calling it from the line handler keeps one extra prompt from 55 | being displayed. */ 56 | rl_callback_handler_remove (); 57 | 58 | running = 0; 59 | } 60 | else 61 | { 62 | if (*line) 63 | add_history (line); 64 | printf ("input line: %s\n", line); 65 | free (line); 66 | } 67 | } 68 | 69 | int 70 | main (int c, char **v) 71 | { 72 | fd_set fds; 73 | int r; 74 | 75 | 76 | setlocale (LC_ALL, ""); 77 | 78 | /* Handle SIGWINCH */ 79 | signal (SIGWINCH, sighandler); 80 | 81 | /* Install the line handler. */ 82 | rl_callback_handler_install (prompt, cb_linehandler); 83 | 84 | /* Enter a simple event loop. This waits until something is available 85 | to read on readline's input stream (defaults to standard input) and 86 | calls the builtin character read callback to read it. It does not 87 | have to modify the user's terminal settings. */ 88 | running = 1; 89 | while (running) 90 | { 91 | FD_ZERO (&fds); 92 | FD_SET (fileno (rl_instream), &fds); 93 | 94 | r = select (FD_SETSIZE, &fds, NULL, NULL, NULL); 95 | if (r < 0 && errno != EINTR) 96 | { 97 | perror ("rltest: select"); 98 | rl_callback_handler_remove (); 99 | break; 100 | } 101 | if (sigwinch_received) 102 | { 103 | rl_resize_terminal (); 104 | sigwinch_received = 0; 105 | } 106 | if (r < 0) 107 | continue; 108 | 109 | if (FD_ISSET (fileno (rl_instream), &fds)) 110 | rl_callback_read_char (); 111 | } 112 | 113 | printf ("rltest: Event loop has exited\n"); 114 | return 0; 115 | } 116 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rl-fgets.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rl-fgets.c -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rl - command-line interface to read a line from the standard input 3 | * (or another fd) using readline. 4 | * 5 | * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars] 6 | */ 7 | 8 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 9 | 10 | This file is part of the GNU Readline Library (Readline), a library for 11 | reading lines of text with interactive input and history editing. 12 | 13 | Readline is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | Readline is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with Readline. If not, see . 25 | */ 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # include 29 | #endif 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #ifdef HAVE_STDLIB_H 36 | # include 37 | #else 38 | extern void exit(); 39 | #endif 40 | 41 | #if defined (READLINE_LIBRARY) 42 | # include "posixstat.h" 43 | # include "readline.h" 44 | # include "history.h" 45 | #else 46 | # include 47 | # include 48 | # include 49 | #endif 50 | 51 | extern int optind; 52 | extern char *optarg; 53 | 54 | #if !defined (strchr) && !defined (__STDC__) 55 | extern char *strrchr(); 56 | #endif 57 | 58 | static char *progname; 59 | static char *deftext; 60 | 61 | static int 62 | set_deftext () 63 | { 64 | if (deftext) 65 | { 66 | rl_insert_text (deftext); 67 | deftext = (char *)NULL; 68 | rl_startup_hook = (rl_hook_func_t *)NULL; 69 | } 70 | return 0; 71 | } 72 | 73 | static void 74 | usage() 75 | { 76 | fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n", 77 | progname, progname); 78 | } 79 | 80 | int 81 | main (argc, argv) 82 | int argc; 83 | char **argv; 84 | { 85 | char *temp, *prompt; 86 | struct stat sb; 87 | int opt, fd, nch; 88 | FILE *ifp; 89 | 90 | progname = strrchr(argv[0], '/'); 91 | if (progname == 0) 92 | progname = argv[0]; 93 | else 94 | progname++; 95 | 96 | /* defaults */ 97 | prompt = "readline$ "; 98 | fd = nch = 0; 99 | deftext = (char *)0; 100 | 101 | while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF) 102 | { 103 | switch (opt) 104 | { 105 | case 'p': 106 | prompt = optarg; 107 | break; 108 | case 'u': 109 | fd = atoi(optarg); 110 | if (fd < 0) 111 | { 112 | fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg); 113 | exit (2); 114 | } 115 | break; 116 | case 'd': 117 | deftext = optarg; 118 | break; 119 | case 'n': 120 | nch = atoi(optarg); 121 | if (nch < 0) 122 | { 123 | fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg); 124 | exit (2); 125 | } 126 | break; 127 | default: 128 | usage (); 129 | exit (2); 130 | } 131 | } 132 | 133 | if (fd != 0) 134 | { 135 | if (fstat (fd, &sb) < 0) 136 | { 137 | fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd); 138 | exit (1); 139 | } 140 | ifp = fdopen (fd, "r"); 141 | rl_instream = ifp; 142 | } 143 | 144 | if (deftext && *deftext) 145 | rl_startup_hook = set_deftext; 146 | 147 | if (nch > 0) 148 | rl_num_chars_to_read = nch; 149 | 150 | temp = readline (prompt); 151 | 152 | /* Test for EOF. */ 153 | if (temp == 0) 154 | exit (1); 155 | 156 | printf ("%s\n", temp); 157 | exit (0); 158 | } 159 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rlbasic.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #if defined (READLINE_LIBRARY) 7 | # include "readline.h" 8 | # include "history.h" 9 | #else 10 | # include 11 | # include 12 | #endif 13 | 14 | int 15 | main (int c, char **v) 16 | { 17 | char *input; 18 | 19 | for (;;) { 20 | input = readline ((char *)NULL); 21 | if (input == 0) 22 | break; 23 | printf ("%s\n", input); 24 | if (strcmp (input, "exit") == 0) 25 | break; 26 | free (input); 27 | } 28 | exit (0); 29 | } 30 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rlcat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rlcat - cat(1) using readline 3 | * 4 | * usage: rlcat 5 | */ 6 | 7 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 8 | 9 | This file is part of the GNU Readline Library (Readline), a library for 10 | reading lines of text with interactive input and history editing. 11 | 12 | Readline is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | Readline is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with Readline. If not, see . 24 | */ 25 | 26 | #if defined (HAVE_CONFIG_H) 27 | # include 28 | #endif 29 | 30 | #ifdef HAVE_UNISTD_H 31 | # include 32 | #endif 33 | 34 | #include 35 | #include "posixstat.h" 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #ifdef HAVE_STDLIB_H 43 | # include 44 | #else 45 | extern void exit(); 46 | #endif 47 | 48 | #ifndef errno 49 | extern int errno; 50 | #endif 51 | 52 | #if defined (READLINE_LIBRARY) 53 | # include "readline.h" 54 | # include "history.h" 55 | #else 56 | # include 57 | # include 58 | #endif 59 | 60 | extern int optind; 61 | extern char *optarg; 62 | 63 | static int stdcat(); 64 | 65 | static char *progname; 66 | static int vflag; 67 | 68 | static void 69 | usage() 70 | { 71 | fprintf (stderr, "%s: usage: %s [-vEVN] [filename]\n", progname, progname); 72 | } 73 | 74 | int 75 | main (argc, argv) 76 | int argc; 77 | char **argv; 78 | { 79 | char *temp; 80 | int opt, Vflag, Nflag; 81 | 82 | progname = strrchr(argv[0], '/'); 83 | if (progname == 0) 84 | progname = argv[0]; 85 | else 86 | progname++; 87 | 88 | vflag = Vflag = Nflag = 0; 89 | while ((opt = getopt(argc, argv, "vEVN")) != EOF) 90 | { 91 | switch (opt) 92 | { 93 | case 'v': 94 | vflag = 1; 95 | break; 96 | case 'V': 97 | Vflag = 1; 98 | break; 99 | case 'E': 100 | Vflag = 0; 101 | break; 102 | case 'N': 103 | Nflag = 1; 104 | break; 105 | default: 106 | usage (); 107 | exit (2); 108 | } 109 | } 110 | 111 | argc -= optind; 112 | argv += optind; 113 | 114 | if (isatty(0) == 0 || argc || Nflag) 115 | return stdcat(argc, argv); 116 | 117 | rl_variable_bind ("editing-mode", Vflag ? "vi" : "emacs"); 118 | while (temp = readline ("")) 119 | { 120 | if (*temp) 121 | add_history (temp); 122 | printf ("%s\n", temp); 123 | } 124 | 125 | return (ferror (stdout)); 126 | } 127 | 128 | static int 129 | fcopy(fp) 130 | FILE *fp; 131 | { 132 | int c; 133 | char *x; 134 | 135 | while ((c = getc(fp)) != EOF) 136 | { 137 | if (vflag && isascii ((unsigned char)c) && isprint((unsigned char)c) == 0) 138 | { 139 | x = rl_untranslate_keyseq (c); 140 | if (fputs (x, stdout) != 0) 141 | return 1; 142 | } 143 | else if (putchar (c) == EOF) 144 | return 1; 145 | } 146 | return (ferror (stdout)); 147 | } 148 | 149 | int 150 | stdcat (argc, argv) 151 | int argc; 152 | char **argv; 153 | { 154 | int i, fd, r; 155 | char *s; 156 | FILE *fp; 157 | 158 | if (argc == 0) 159 | return (fcopy(stdin)); 160 | 161 | for (i = 0, r = 1; i < argc; i++) 162 | { 163 | if (*argv[i] == '-' && argv[i][1] == 0) 164 | fp = stdin; 165 | else 166 | { 167 | fp = fopen (argv[i], "r"); 168 | if (fp == 0) 169 | { 170 | fprintf (stderr, "%s: %s: cannot open: %s\n", progname, argv[i], strerror(errno)); 171 | continue; 172 | } 173 | } 174 | r = fcopy (fp); 175 | if (fp != stdin) 176 | fclose(fp); 177 | } 178 | return r; 179 | } 180 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rlevent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rl - command-line interface to read a line from the standard input 3 | * (or another fd) using readline. 4 | * 5 | * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars] 6 | */ 7 | 8 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 9 | 10 | This file is part of the GNU Readline Library (Readline), a library for 11 | reading lines of text with interactive input and history editing. 12 | 13 | Readline is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | Readline is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with Readline. If not, see . 25 | */ 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # include 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #ifdef HAVE_STDLIB_H 35 | # include 36 | #else 37 | extern void exit(); 38 | #endif 39 | 40 | #if defined (READLINE_LIBRARY) 41 | # include "posixstat.h" 42 | # include "readline.h" 43 | # include "history.h" 44 | #else 45 | # include 46 | # include 47 | # include 48 | #endif 49 | 50 | extern int optind; 51 | extern char *optarg; 52 | 53 | #if !defined (strchr) && !defined (__STDC__) 54 | extern char *strrchr(); 55 | #endif 56 | 57 | static char *progname; 58 | static char *deftext; 59 | 60 | static int 61 | event_hook () 62 | { 63 | fprintf (stderr, "ding!\n"); 64 | sleep (1); 65 | return 0; 66 | } 67 | 68 | static int 69 | set_deftext () 70 | { 71 | if (deftext) 72 | { 73 | rl_insert_text (deftext); 74 | deftext = (char *)NULL; 75 | rl_startup_hook = (rl_hook_func_t *)NULL; 76 | } 77 | return 0; 78 | } 79 | 80 | static void 81 | usage() 82 | { 83 | fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n", 84 | progname, progname); 85 | } 86 | 87 | int 88 | main (argc, argv) 89 | int argc; 90 | char **argv; 91 | { 92 | char *temp, *prompt; 93 | struct stat sb; 94 | int opt, fd, nch; 95 | FILE *ifp; 96 | 97 | progname = strrchr(argv[0], '/'); 98 | if (progname == 0) 99 | progname = argv[0]; 100 | else 101 | progname++; 102 | 103 | /* defaults */ 104 | prompt = "readline$ "; 105 | fd = nch = 0; 106 | deftext = (char *)0; 107 | 108 | while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF) 109 | { 110 | switch (opt) 111 | { 112 | case 'p': 113 | prompt = optarg; 114 | break; 115 | case 'u': 116 | fd = atoi(optarg); 117 | if (fd < 0) 118 | { 119 | fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg); 120 | exit (2); 121 | } 122 | break; 123 | case 'd': 124 | deftext = optarg; 125 | break; 126 | case 'n': 127 | nch = atoi(optarg); 128 | if (nch < 0) 129 | { 130 | fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg); 131 | exit (2); 132 | } 133 | break; 134 | default: 135 | usage (); 136 | exit (2); 137 | } 138 | } 139 | 140 | if (fd != 0) 141 | { 142 | if (fstat (fd, &sb) < 0) 143 | { 144 | fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd); 145 | exit (1); 146 | } 147 | ifp = fdopen (fd, "r"); 148 | rl_instream = ifp; 149 | } 150 | 151 | if (deftext && *deftext) 152 | rl_startup_hook = set_deftext; 153 | 154 | if (nch > 0) 155 | rl_num_chars_to_read = nch; 156 | 157 | rl_event_hook = event_hook; 158 | temp = readline (prompt); 159 | 160 | /* Test for EOF. */ 161 | if (temp == 0) 162 | exit (1); 163 | 164 | printf ("%s\n", temp); 165 | exit (0); 166 | } 167 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rltest.c: -------------------------------------------------------------------------------- 1 | /* **************************************************************** */ 2 | /* */ 3 | /* Testing Readline */ 4 | /* */ 5 | /* **************************************************************** */ 6 | 7 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 8 | 9 | This file is part of the GNU Readline Library (Readline), a library for 10 | reading lines of text with interactive input and history editing. 11 | 12 | Readline is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | Readline is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with Readline. If not, see . 24 | */ 25 | 26 | #if defined (HAVE_CONFIG_H) 27 | #include 28 | #endif 29 | 30 | #include 31 | #include 32 | 33 | #ifdef HAVE_STDLIB_H 34 | # include 35 | #else 36 | extern void exit(); 37 | #endif 38 | 39 | #ifdef READLINE_LIBRARY 40 | # include "readline.h" 41 | # include "history.h" 42 | #else 43 | # include 44 | # include 45 | #endif 46 | 47 | extern HIST_ENTRY **history_list (); 48 | 49 | main () 50 | { 51 | char *temp, *prompt; 52 | int done; 53 | 54 | temp = (char *)NULL; 55 | prompt = "readline$ "; 56 | done = 0; 57 | 58 | while (!done) 59 | { 60 | temp = readline (prompt); 61 | 62 | /* Test for EOF. */ 63 | if (!temp) 64 | exit (1); 65 | 66 | /* If there is anything on the line, print it and remember it. */ 67 | if (*temp) 68 | { 69 | fprintf (stderr, "%s\r\n", temp); 70 | add_history (temp); 71 | } 72 | 73 | /* Check for `command' that we handle. */ 74 | if (strcmp (temp, "quit") == 0) 75 | done = 1; 76 | 77 | if (strcmp (temp, "list") == 0) 78 | { 79 | HIST_ENTRY **list; 80 | register int i; 81 | 82 | list = history_list (); 83 | if (list) 84 | { 85 | for (i = 0; list[i]; i++) 86 | fprintf (stderr, "%d: %s\r\n", i, list[i]->line); 87 | } 88 | } 89 | free (temp); 90 | } 91 | exit (0); 92 | } 93 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/ios/share/readline/rlversion.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rlversion -- print out readline's version number 3 | */ 4 | 5 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 6 | 7 | This file is part of the GNU Readline Library (Readline), a library for 8 | reading lines of text with interactive input and history editing. 9 | 10 | Readline is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | Readline is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with Readline. If not, see . 22 | */ 23 | 24 | #if defined (HAVE_CONFIG_H) 25 | # include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include "posixstat.h" 31 | 32 | #ifdef HAVE_STDLIB_H 33 | # include 34 | #else 35 | extern void exit(); 36 | #endif 37 | 38 | #ifdef READLINE_LIBRARY 39 | # include "readline.h" 40 | #else 41 | # include 42 | #endif 43 | 44 | int 45 | main() 46 | { 47 | printf ("%s\n", rl_library_version ? rl_library_version : "unknown"); 48 | exit (0); 49 | } 50 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/include/readline/chardefs.h: -------------------------------------------------------------------------------- 1 | /* chardefs.h -- Character definitions for readline. */ 2 | 3 | /* Copyright (C) 1994-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _CHARDEFS_H_ 23 | #define _CHARDEFS_H_ 24 | 25 | #include 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # if defined (HAVE_STRING_H) 29 | # if ! defined (STDC_HEADERS) && defined (HAVE_MEMORY_H) 30 | # include 31 | # endif 32 | # include 33 | # endif /* HAVE_STRING_H */ 34 | # if defined (HAVE_STRINGS_H) 35 | # include 36 | # endif /* HAVE_STRINGS_H */ 37 | #else 38 | # include 39 | #endif /* !HAVE_CONFIG_H */ 40 | 41 | #ifndef whitespace 42 | #define whitespace(c) (((c) == ' ') || ((c) == '\t')) 43 | #endif 44 | 45 | #ifdef CTRL 46 | # undef CTRL 47 | #endif 48 | #ifdef UNCTRL 49 | # undef UNCTRL 50 | #endif 51 | 52 | /* Some character stuff. */ 53 | #define control_character_threshold 0x020 /* Smaller than this is control. */ 54 | #define control_character_mask 0x1f /* 0x20 - 1 */ 55 | #define meta_character_threshold 0x07f /* Larger than this is Meta. */ 56 | #define control_character_bit 0x40 /* 0x000000, must be off. */ 57 | #define meta_character_bit 0x080 /* x0000000, must be on. */ 58 | #define largest_char 255 /* Largest character value. */ 59 | 60 | #define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0)) 61 | #define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char) 62 | 63 | #define CTRL(c) ((c) & control_character_mask) 64 | #define META(c) ((c) | meta_character_bit) 65 | 66 | #define UNMETA(c) ((c) & (~meta_character_bit)) 67 | #define UNCTRL(c) _rl_to_upper(((c)|control_character_bit)) 68 | 69 | #if defined STDC_HEADERS || (!defined (isascii) && !defined (HAVE_ISASCII)) 70 | # define IN_CTYPE_DOMAIN(c) 1 71 | #else 72 | # define IN_CTYPE_DOMAIN(c) isascii(c) 73 | #endif 74 | 75 | #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) 76 | # define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) 77 | #endif 78 | 79 | #if defined (CTYPE_NON_ASCII) 80 | # define NON_NEGATIVE(c) 1 81 | #else 82 | # define NON_NEGATIVE(c) ((unsigned char)(c) == (c)) 83 | #endif 84 | 85 | /* Some systems define these; we want our definitions. */ 86 | #undef ISPRINT 87 | 88 | /* Beware: these only work with single-byte ASCII characters. */ 89 | 90 | #define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c)) 91 | #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) 92 | #define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) 93 | #define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c)) 94 | #define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) 95 | #define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c)) 96 | #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c)) 97 | 98 | #define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c)) 99 | #define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c)) 100 | #define _rl_digit_p(c) ((c) >= '0' && (c) <= '9') 101 | 102 | #define _rl_pure_alphabetic(c) (NON_NEGATIVE(c) && ISALPHA(c)) 103 | #define ALPHABETIC(c) (NON_NEGATIVE(c) && ISALNUM(c)) 104 | 105 | #ifndef _rl_to_upper 106 | # define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)c) : (c)) 107 | # define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)c) : (c)) 108 | #endif 109 | 110 | #ifndef _rl_digit_value 111 | # define _rl_digit_value(x) ((x) - '0') 112 | #endif 113 | 114 | #ifndef _rl_isident 115 | # define _rl_isident(c) (ISALNUM(c) || (c) == '_') 116 | #endif 117 | 118 | #ifndef ISOCTAL 119 | # define ISOCTAL(c) ((c) >= '0' && (c) <= '7') 120 | #endif 121 | #define OCTVALUE(c) ((c) - '0') 122 | 123 | #define HEXVALUE(c) \ 124 | (((c) >= 'a' && (c) <= 'f') \ 125 | ? (c)-'a'+10 \ 126 | : (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0') 127 | 128 | #ifndef NEWLINE 129 | #define NEWLINE '\n' 130 | #endif 131 | 132 | #ifndef RETURN 133 | #define RETURN CTRL('M') 134 | #endif 135 | 136 | #ifndef RUBOUT 137 | #define RUBOUT 0x7f 138 | #endif 139 | 140 | #ifndef TAB 141 | #define TAB '\t' 142 | #endif 143 | 144 | #ifdef ABORT_CHAR 145 | #undef ABORT_CHAR 146 | #endif 147 | #define ABORT_CHAR CTRL('G') 148 | 149 | #ifdef PAGE 150 | #undef PAGE 151 | #endif 152 | #define PAGE CTRL('L') 153 | 154 | #ifdef SPACE 155 | #undef SPACE 156 | #endif 157 | #define SPACE ' ' /* XXX - was 0x20 */ 158 | 159 | #ifdef ESC 160 | #undef ESC 161 | #endif 162 | #define ESC CTRL('[') 163 | 164 | #endif /* _CHARDEFS_H_ */ 165 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/include/readline/keymaps.h: -------------------------------------------------------------------------------- 1 | /* keymaps.h -- Manipulation of readline keymaps. */ 2 | 3 | /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _KEYMAPS_H_ 23 | #define _KEYMAPS_H_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #if defined (READLINE_LIBRARY) 30 | # include "rlstdc.h" 31 | # include "chardefs.h" 32 | # include "rltypedefs.h" 33 | #else 34 | # include 35 | # include 36 | # include 37 | #endif 38 | 39 | /* A keymap contains one entry for each key in the ASCII set. 40 | Each entry consists of a type and a pointer. 41 | FUNCTION is the address of a function to run, or the 42 | address of a keymap to indirect through. 43 | TYPE says which kind of thing FUNCTION is. */ 44 | typedef struct _keymap_entry { 45 | char type; 46 | rl_command_func_t *function; 47 | } KEYMAP_ENTRY; 48 | 49 | /* This must be large enough to hold bindings for all of the characters 50 | in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, 51 | and so on) plus one for subsequence matching. */ 52 | #define KEYMAP_SIZE 257 53 | #define ANYOTHERKEY KEYMAP_SIZE-1 54 | 55 | typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; 56 | typedef KEYMAP_ENTRY *Keymap; 57 | 58 | /* The values that TYPE can have in a keymap entry. */ 59 | #define ISFUNC 0 60 | #define ISKMAP 1 61 | #define ISMACR 2 62 | 63 | extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; 64 | extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; 65 | 66 | /* Return a new, empty keymap. 67 | Free it with free() when you are done. */ 68 | extern Keymap rl_make_bare_keymap PARAMS((void)); 69 | 70 | /* Return a new keymap which is a copy of MAP. */ 71 | extern Keymap rl_copy_keymap PARAMS((Keymap)); 72 | 73 | /* Return a new keymap with the printing characters bound to rl_insert, 74 | the lowercase Meta characters bound to run their equivalents, and 75 | the Meta digits bound to produce numeric arguments. */ 76 | extern Keymap rl_make_keymap PARAMS((void)); 77 | 78 | /* Free the storage associated with a keymap. */ 79 | extern void rl_discard_keymap PARAMS((Keymap)); 80 | 81 | /* These functions actually appear in bind.c */ 82 | 83 | /* Return the keymap corresponding to a given name. Names look like 84 | `emacs' or `emacs-meta' or `vi-insert'. */ 85 | extern Keymap rl_get_keymap_by_name PARAMS((const char *)); 86 | 87 | /* Return the current keymap. */ 88 | extern Keymap rl_get_keymap PARAMS((void)); 89 | 90 | /* Set the current keymap to MAP. */ 91 | extern void rl_set_keymap PARAMS((Keymap)); 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif /* _KEYMAPS_H_ */ 98 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/include/readline/rlconf.h: -------------------------------------------------------------------------------- 1 | /* rlconf.h -- readline configuration definitions */ 2 | 3 | /* Copyright (C) 1992-2012 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #if !defined (_RLCONF_H_) 23 | #define _RLCONF_H_ 24 | 25 | /* Define this if you want the vi-mode editing available. */ 26 | #define VI_MODE 27 | 28 | /* Define this to get an indication of file type when listing completions. */ 29 | #define VISIBLE_STATS 30 | 31 | /* Define this to get support for colors when listing completions and in 32 | other places. */ 33 | #define COLOR_SUPPORT 34 | 35 | /* This definition is needed by readline.c, rltty.c, and signals.c. */ 36 | /* If on, then readline handles signals in a way that doesn't suck. */ 37 | #define HANDLE_SIGNALS 38 | 39 | /* Ugly but working hack for binding prefix meta. */ 40 | #define PREFIX_META_HACK 41 | 42 | /* The next-to-last-ditch effort file name for a user-specific init file. */ 43 | #define DEFAULT_INPUTRC "~/.inputrc" 44 | 45 | /* The ultimate last-ditch filenname for an init file -- system-wide. */ 46 | #define SYS_INPUTRC "/etc/inputrc" 47 | 48 | /* If defined, expand tabs to spaces. */ 49 | #define DISPLAY_TABS 50 | 51 | /* If defined, use the terminal escape sequence to move the cursor forward 52 | over a character when updating the line rather than rewriting it. */ 53 | /* #define HACK_TERMCAP_MOTION */ 54 | 55 | /* The string inserted by the `insert comment' command. */ 56 | #define RL_COMMENT_BEGIN_DEFAULT "#" 57 | 58 | /* Define this if you want code that allows readline to be used in an 59 | X `callback' style. */ 60 | #define READLINE_CALLBACKS 61 | 62 | /* Define this if you want the cursor to indicate insert or overwrite mode. */ 63 | /* #define CURSOR_MODE */ 64 | 65 | /* Define this if you want to enable code that talks to the Linux kernel 66 | tty auditing system. */ 67 | #define ENABLE_TTY_AUDIT_SUPPORT 68 | 69 | #endif /* _RLCONF_H_ */ 70 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/include/readline/rlstdc.h: -------------------------------------------------------------------------------- 1 | /* stdc.h -- macros to make source compile on both ANSI C and K&R C compilers. */ 2 | 3 | /* Copyright (C) 1993-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #if !defined (_RL_STDC_H_) 23 | #define _RL_STDC_H_ 24 | 25 | /* Adapted from BSD /usr/include/sys/cdefs.h. */ 26 | 27 | /* A function can be defined using prototypes and compile on both ANSI C 28 | and traditional C compilers with something like this: 29 | extern char *func PARAMS((char *, char *, int)); */ 30 | 31 | #if !defined (PARAMS) 32 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) 33 | # define PARAMS(protos) protos 34 | # else 35 | # define PARAMS(protos) () 36 | # endif 37 | #endif 38 | 39 | #ifndef __attribute__ 40 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) 41 | # define __attribute__(x) 42 | # endif 43 | #endif 44 | 45 | /* Moved from config.h.in because readline.h:rl_message depends on these 46 | defines. */ 47 | #if defined (__STDC__) && defined (HAVE_STDARG_H) 48 | # define PREFER_STDARG 49 | # define USE_VARARGS 50 | #else 51 | # if defined (HAVE_VARARGS_H) 52 | # define PREFER_VARARGS 53 | # define USE_VARARGS 54 | # endif 55 | #endif 56 | 57 | #endif /* !_RL_STDC_H_ */ 58 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/include/readline/rltypedefs.h: -------------------------------------------------------------------------------- 1 | /* rltypedefs.h -- Type declarations for readline functions. */ 2 | 3 | /* Copyright (C) 2000-2011 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library 6 | for reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #ifndef _RL_TYPEDEFS_H_ 23 | #define _RL_TYPEDEFS_H_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* New style. */ 30 | 31 | #if !defined (_RL_FUNCTION_TYPEDEF) 32 | # define _RL_FUNCTION_TYPEDEF 33 | 34 | /* Bindable functions */ 35 | typedef int rl_command_func_t PARAMS((int, int)); 36 | 37 | /* Typedefs for the completion system */ 38 | typedef char *rl_compentry_func_t PARAMS((const char *, int)); 39 | typedef char **rl_completion_func_t PARAMS((const char *, int, int)); 40 | 41 | typedef char *rl_quote_func_t PARAMS((char *, int, char *)); 42 | typedef char *rl_dequote_func_t PARAMS((char *, int)); 43 | 44 | typedef int rl_compignore_func_t PARAMS((char **)); 45 | 46 | typedef void rl_compdisp_func_t PARAMS((char **, int, int)); 47 | 48 | /* Type for input and pre-read hook functions like rl_event_hook */ 49 | typedef int rl_hook_func_t PARAMS((void)); 50 | 51 | /* Input function type */ 52 | typedef int rl_getc_func_t PARAMS((FILE *)); 53 | 54 | /* Generic function that takes a character buffer (which could be the readline 55 | line buffer) and an index into it (which could be rl_point) and returns 56 | an int. */ 57 | typedef int rl_linebuf_func_t PARAMS((char *, int)); 58 | 59 | /* `Generic' function pointer typedefs */ 60 | typedef int rl_intfunc_t PARAMS((int)); 61 | #define rl_ivoidfunc_t rl_hook_func_t 62 | typedef int rl_icpfunc_t PARAMS((char *)); 63 | typedef int rl_icppfunc_t PARAMS((char **)); 64 | 65 | typedef void rl_voidfunc_t PARAMS((void)); 66 | typedef void rl_vintfunc_t PARAMS((int)); 67 | typedef void rl_vcpfunc_t PARAMS((char *)); 68 | typedef void rl_vcppfunc_t PARAMS((char **)); 69 | 70 | typedef char *rl_cpvfunc_t PARAMS((void)); 71 | typedef char *rl_cpifunc_t PARAMS((int)); 72 | typedef char *rl_cpcpfunc_t PARAMS((char *)); 73 | typedef char *rl_cpcppfunc_t PARAMS((char **)); 74 | 75 | #endif /* _RL_FUNCTION_TYPEDEF */ 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* _RL_TYPEDEFS_H_ */ 82 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/include/readline/tilde.h: -------------------------------------------------------------------------------- 1 | /* tilde.h: Externally available variables and function in libtilde.a. */ 2 | 3 | /* Copyright (C) 1992-2009 Free Software Foundation, Inc. 4 | 5 | This file contains the Readline Library (Readline), a set of 6 | routines for providing Emacs style line input to programs that ask 7 | for it. 8 | 9 | Readline is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Readline is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Readline. If not, see . 21 | */ 22 | 23 | #if !defined (_TILDE_H_) 24 | # define _TILDE_H_ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* A function can be defined using prototypes and compile on both ANSI C 31 | and traditional C compilers with something like this: 32 | extern char *func PARAMS((char *, char *, int)); */ 33 | 34 | #if !defined (PARAMS) 35 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) 36 | # define PARAMS(protos) protos 37 | # else 38 | # define PARAMS(protos) () 39 | # endif 40 | #endif 41 | 42 | typedef char *tilde_hook_func_t PARAMS((char *)); 43 | 44 | /* If non-null, this contains the address of a function that the application 45 | wants called before trying the standard tilde expansions. The function 46 | is called with the text sans tilde, and returns a malloc()'ed string 47 | which is the expansion, or a NULL pointer if the expansion fails. */ 48 | extern tilde_hook_func_t *tilde_expansion_preexpansion_hook; 49 | 50 | /* If non-null, this contains the address of a function to call if the 51 | standard meaning for expanding a tilde fails. The function is called 52 | with the text (sans tilde, as in "foo"), and returns a malloc()'ed string 53 | which is the expansion, or a NULL pointer if there is no expansion. */ 54 | extern tilde_hook_func_t *tilde_expansion_failure_hook; 55 | 56 | /* When non-null, this is a NULL terminated array of strings which 57 | are duplicates for a tilde prefix. Bash uses this to expand 58 | `=~' and `:~'. */ 59 | extern char **tilde_additional_prefixes; 60 | 61 | /* When non-null, this is a NULL terminated array of strings which match 62 | the end of a username, instead of just "/". Bash sets this to 63 | `:' and `=~'. */ 64 | extern char **tilde_additional_suffixes; 65 | 66 | /* Return a new string which is the result of tilde expanding STRING. */ 67 | extern char *tilde_expand PARAMS((const char *)); 68 | 69 | /* Do the work of tilde expansion on FILENAME. FILENAME starts with a 70 | tilde. If there is no expansion, call tilde_expansion_failure_hook. */ 71 | extern char *tilde_expand_word PARAMS((const char *)); 72 | 73 | /* Find the portion of the string beginning with ~ that should be expanded. */ 74 | extern char *tilde_find_word PARAMS((const char *, int, int *)); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* _TILDE_H_ */ 81 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/lib/libhistory.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/thirdparty/readline/mac/lib/libhistory.a -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/lib/libhistory.old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/thirdparty/readline/mac/lib/libhistory.old -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/lib/libreadline.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/thirdparty/readline/mac/lib/libreadline.a -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/lib/libreadline.old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/thirdparty/readline/mac/lib/libreadline.old -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/info/dir: -------------------------------------------------------------------------------- 1 | This is the file .../info/dir, which contains the 2 | topmost node of the Info hierarchy, called (dir)Top. 3 | The first time you invoke Info you start off looking at this node. 4 |  5 | File: dir, Node: Top This is the top of the INFO tree 6 | 7 | This (the Directory node) gives a menu of major topics. 8 | Typing "q" exits, "?" lists all Info commands, "d" returns here, 9 | "h" gives a primer for first-timers, 10 | "mEmacs" visits the Emacs manual, etc. 11 | 12 | In Emacs, you can click mouse button 2 on a menu item or cross reference 13 | to select it. 14 | 15 | * Menu: 16 | 17 | Libraries 18 | * History: (history). The GNU history library API. 19 | * RLuserman: (rluserman). The GNU readline library User's Manual. 20 | * Readline: (readline). The GNU readline library API. 21 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/hist_erasedups.c: -------------------------------------------------------------------------------- 1 | /* hist_erasedups -- remove all duplicate entries from history file */ 2 | 3 | /* Copyright (C) 2011 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | #ifndef READLINE_LIBRARY 22 | #define READLINE_LIBRARY 1 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef READLINE_LIBRARY 30 | # include "history.h" 31 | #else 32 | # include 33 | #endif 34 | 35 | #include 36 | 37 | #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) 38 | #define STREQN(a, b, n) ((n == 0) ? (1) \ 39 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) 40 | 41 | extern int history_offset; 42 | 43 | static void 44 | usage() 45 | { 46 | fprintf (stderr, "hist_erasedups: usage: hist_erasedups [-t] [filename]\n"); 47 | exit (2); 48 | } 49 | 50 | int 51 | main (argc, argv) 52 | int argc; 53 | char **argv; 54 | { 55 | char *fn; 56 | int r; 57 | 58 | while ((r = getopt (argc, argv, "t")) != -1) 59 | { 60 | switch (r) 61 | { 62 | case 't': 63 | history_write_timestamps = 1; 64 | break; 65 | default: 66 | usage (); 67 | } 68 | } 69 | argv += optind; 70 | argc -= optind; 71 | 72 | fn = argc ? argv[0] : getenv ("HISTFILE"); 73 | if (fn == 0) 74 | { 75 | fprintf (stderr, "hist_erasedups: no history file\n"); 76 | usage (); 77 | } 78 | 79 | if ((r = read_history (fn)) != 0) 80 | { 81 | fprintf (stderr, "hist_erasedups: read_history: %s: %s\n", fn, strerror (r)); 82 | exit (1); 83 | } 84 | 85 | hist_erasedups (); 86 | 87 | if ((r = write_history (fn)) != 0) 88 | { 89 | fprintf (stderr, "hist_erasedups: write_history: %s: %s\n", fn, strerror (r)); 90 | exit (1); 91 | } 92 | 93 | exit (0); 94 | } 95 | 96 | int 97 | hist_erasedups () 98 | { 99 | int r, n; 100 | HIST_ENTRY *h, *temp; 101 | 102 | using_history (); 103 | while (h = previous_history ()) 104 | { 105 | r = where_history (); 106 | for (n = 0; n < r; n++) 107 | { 108 | temp = history_get (n+history_base); 109 | if (STREQ (h->line, temp->line)) 110 | { 111 | remove_history (n); 112 | r--; /* have to get one fewer now */ 113 | n--; /* compensate for above increment */ 114 | history_offset--; /* moving backwards in history list */ 115 | } 116 | } 117 | } 118 | using_history (); 119 | 120 | return r; 121 | } 122 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/hist_purgecmd.c: -------------------------------------------------------------------------------- 1 | /* hist_purgecmd -- remove all instances of command or pattern from history 2 | file */ 3 | 4 | /* Copyright (C) 2011 Free Software Foundation, Inc. 5 | 6 | This file is part of the GNU Readline Library (Readline), a library for 7 | reading lines of text with interactive input and history editing. 8 | 9 | Readline is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Readline is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Readline. If not, see . 21 | */ 22 | #ifndef READLINE_LIBRARY 23 | #define READLINE_LIBRARY 1 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #ifdef READLINE_LIBRARY 33 | # include "history.h" 34 | #else 35 | # include 36 | #endif 37 | 38 | #include 39 | 40 | #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) 41 | #define STREQN(a, b, n) ((n == 0) ? (1) \ 42 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) 43 | 44 | extern int history_offset; 45 | 46 | #define PURGE_REGEXP 0x01 47 | 48 | static void 49 | usage() 50 | { 51 | fprintf (stderr, "hist_purgecmd: usage: hist_purgecmd [-r] [-t] [-f filename] command-spec\n"); 52 | exit (2); 53 | } 54 | 55 | int 56 | main (argc, argv) 57 | int argc; 58 | char **argv; 59 | { 60 | char *fn; 61 | int r, flags; 62 | 63 | flags = 0; 64 | fn = 0; 65 | while ((r = getopt (argc, argv, "f:rt")) != -1) 66 | { 67 | switch (r) 68 | { 69 | case 'f': 70 | fn = optarg; 71 | break; 72 | case 'r': 73 | flags |= PURGE_REGEXP; 74 | break; 75 | case 't': 76 | history_write_timestamps = 1; 77 | break; 78 | default: 79 | usage (); 80 | } 81 | } 82 | argv += optind; 83 | argc -= optind; 84 | 85 | if (fn == 0) 86 | fn = getenv ("HISTFILE"); 87 | if (fn == 0) 88 | { 89 | fprintf (stderr, "hist_purgecmd: no history file\n"); 90 | usage (); 91 | } 92 | 93 | if ((r = read_history (fn)) != 0) 94 | { 95 | fprintf (stderr, "hist_purgecmd: read_history: %s: %s\n", fn, strerror (r)); 96 | exit (1); 97 | } 98 | 99 | for (r = 0; r < argc; r++) 100 | hist_purgecmd (argv[r], flags); 101 | 102 | if ((r = write_history (fn)) != 0) 103 | { 104 | fprintf (stderr, "hist_purgecmd: write_history: %s: %s\n", fn, strerror (r)); 105 | exit (1); 106 | } 107 | 108 | exit (0); 109 | } 110 | 111 | int 112 | hist_purgecmd (cmd, flags) 113 | char *cmd; 114 | int flags; 115 | { 116 | int r, n, rflags; 117 | HIST_ENTRY *temp; 118 | regex_t regex = { 0 }; 119 | 120 | if (flags & PURGE_REGEXP) 121 | { 122 | rflags = REG_EXTENDED|REG_NOSUB; 123 | if (regcomp (®ex, cmd, rflags)) 124 | { 125 | fprintf (stderr, "hist_purgecmd: %s: invalid regular expression\n", cmd); 126 | return -1; 127 | } 128 | } 129 | 130 | r = 0; 131 | using_history (); 132 | r = where_history (); 133 | for (n = 0; n < r; n++) 134 | { 135 | temp = history_get (n+history_base); 136 | if (((flags & PURGE_REGEXP) && (regexec (®ex, temp->line, 0, 0, 0) == 0)) || 137 | ((flags & PURGE_REGEXP) == 0 && STREQ (temp->line, cmd))) 138 | { 139 | remove_history (n); 140 | r--; /* have to get one fewer now */ 141 | n--; /* compensate for above increment */ 142 | history_offset--; /* moving backwards in history list */ 143 | } 144 | } 145 | using_history (); 146 | 147 | if (flags & PURGE_REGEXP) 148 | regfree (®ex); 149 | 150 | return r; 151 | } 152 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/histexamp.c: -------------------------------------------------------------------------------- 1 | /* histexamp.c - history library example program. */ 2 | 3 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #include 23 | 24 | #ifdef READLINE_LIBRARY 25 | # include "history.h" 26 | #else 27 | # include 28 | #endif 29 | 30 | #include 31 | 32 | main (argc, argv) 33 | int argc; 34 | char **argv; 35 | { 36 | char line[1024], *t; 37 | int len, done; 38 | 39 | line[0] = 0; 40 | done = 0; 41 | 42 | using_history (); 43 | while (!done) 44 | { 45 | printf ("history$ "); 46 | fflush (stdout); 47 | t = fgets (line, sizeof (line) - 1, stdin); 48 | if (t && *t) 49 | { 50 | len = strlen (t); 51 | if (t[len - 1] == '\n') 52 | t[len - 1] = '\0'; 53 | } 54 | 55 | if (!t) 56 | strcpy (line, "quit"); 57 | 58 | if (line[0]) 59 | { 60 | char *expansion; 61 | int result; 62 | 63 | using_history (); 64 | 65 | result = history_expand (line, &expansion); 66 | if (result) 67 | fprintf (stderr, "%s\n", expansion); 68 | 69 | if (result < 0 || result == 2) 70 | { 71 | free (expansion); 72 | continue; 73 | } 74 | 75 | add_history (expansion); 76 | strncpy (line, expansion, sizeof (line) - 1); 77 | free (expansion); 78 | } 79 | 80 | if (strcmp (line, "quit") == 0) 81 | done = 1; 82 | else if (strcmp (line, "save") == 0) 83 | write_history ("history_file"); 84 | else if (strcmp (line, "read") == 0) 85 | read_history ("history_file"); 86 | else if (strcmp (line, "list") == 0) 87 | { 88 | register HIST_ENTRY **the_list; 89 | register int i; 90 | time_t tt; 91 | char timestr[128]; 92 | 93 | the_list = history_list (); 94 | if (the_list) 95 | for (i = 0; the_list[i]; i++) 96 | { 97 | tt = history_get_time (the_list[i]); 98 | if (tt) 99 | strftime (timestr, sizeof (timestr), "%a %R", localtime(&tt)); 100 | else 101 | strcpy (timestr, "??"); 102 | printf ("%d: %s: %s\n", i + history_base, timestr, the_list[i]->line); 103 | } 104 | } 105 | else if (strncmp (line, "delete", 6) == 0) 106 | { 107 | int which; 108 | if ((sscanf (line + 6, "%d", &which)) == 1) 109 | { 110 | HIST_ENTRY *entry = remove_history (which); 111 | if (!entry) 112 | fprintf (stderr, "No such entry %d\n", which); 113 | else 114 | { 115 | free (entry->line); 116 | free (entry); 117 | } 118 | } 119 | else 120 | { 121 | fprintf (stderr, "non-numeric arg given to `delete'\n"); 122 | } 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/manexamp.c: -------------------------------------------------------------------------------- 1 | /* manexamp.c -- The examples which appear in the documentation are here. */ 2 | 3 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 4 | 5 | This file is part of the GNU Readline Library (Readline), a library for 6 | reading lines of text with interactive input and history editing. 7 | 8 | Readline is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Readline is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Readline. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | /* **************************************************************** */ 26 | /* */ 27 | /* How to Emulate gets () */ 28 | /* */ 29 | /* **************************************************************** */ 30 | 31 | /* A static variable for holding the line. */ 32 | static char *line_read = (char *)NULL; 33 | 34 | /* Read a string, and return a pointer to it. Returns NULL on EOF. */ 35 | char * 36 | rl_gets () 37 | { 38 | /* If the buffer has already been allocated, return the memory 39 | to the free pool. */ 40 | if (line_read) 41 | { 42 | free (line_read); 43 | line_read = (char *)NULL; 44 | } 45 | 46 | /* Get a line from the user. */ 47 | line_read = readline (""); 48 | 49 | /* If the line has any text in it, save it on the history. */ 50 | if (line_read && *line_read) 51 | add_history (line_read); 52 | 53 | return (line_read); 54 | } 55 | 56 | /* **************************************************************** */ 57 | /* */ 58 | /* Writing a Function to be Called by Readline. */ 59 | /* */ 60 | /* **************************************************************** */ 61 | 62 | /* Invert the case of the COUNT following characters. */ 63 | invert_case_line (count, key) 64 | int count, key; 65 | { 66 | register int start, end; 67 | 68 | start = rl_point; 69 | 70 | if (count < 0) 71 | { 72 | direction = -1; 73 | count = -count; 74 | } 75 | else 76 | direction = 1; 77 | 78 | /* Find the end of the range to modify. */ 79 | end = start + (count * direction); 80 | 81 | /* Force it to be within range. */ 82 | if (end > rl_end) 83 | end = rl_end; 84 | else if (end < 0) 85 | end = -1; 86 | 87 | if (start > end) 88 | { 89 | int temp = start; 90 | start = end; 91 | end = temp; 92 | } 93 | 94 | if (start == end) 95 | return; 96 | 97 | /* Tell readline that we are modifying the line, so save the undo 98 | information. */ 99 | rl_modifying (start, end); 100 | 101 | for (; start != end; start += direction) 102 | { 103 | if (_rl_uppercase_p (rl_line_buffer[start])) 104 | rl_line_buffer[start] = _rl_to_lower (rl_line_buffer[start]); 105 | else if (_rl_lowercase_p (rl_line_buffer[start])) 106 | rl_line_buffer[start] = _rl_to_upper (rl_line_buffer[start]); 107 | } 108 | 109 | /* Move point to on top of the last character changed. */ 110 | rl_point = end - direction; 111 | } 112 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/rl-callbacktest.c: -------------------------------------------------------------------------------- 1 | /* Standard include files. stdio.h is required. */ 2 | #include 3 | #include 4 | #include 5 | 6 | /* Used for select(2) */ 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | /* Standard readline include files. */ 13 | #if defined (READLINE_LIBRARY) 14 | # include "readline.h" 15 | # include "history.h" 16 | #else 17 | # include 18 | # include 19 | #endif 20 | 21 | static void cb_linehandler (char *); 22 | 23 | int running; 24 | const char *prompt = "rltest$ "; 25 | 26 | /* Callback function called for each line when accept-line executed, EOF 27 | seen, or EOF character read. This sets a flag and returns; it could 28 | also call exit(3). */ 29 | static void 30 | cb_linehandler (char *line) 31 | { 32 | /* Can use ^D (stty eof) or `exit' to exit. */ 33 | if (line == NULL || strcmp (line, "exit") == 0) 34 | { 35 | if (line == 0) 36 | printf ("\n"); 37 | printf ("exit\n"); 38 | /* This function needs to be called to reset the terminal settings, 39 | and calling it from the line handler keeps one extra prompt from 40 | being displayed. */ 41 | rl_callback_handler_remove (); 42 | 43 | running = 0; 44 | } 45 | else 46 | { 47 | if (*line) 48 | add_history (line); 49 | printf ("input line: %s\n", line); 50 | free (line); 51 | } 52 | } 53 | 54 | int 55 | main (int c, char **v) 56 | { 57 | fd_set fds; 58 | int r; 59 | 60 | /* Install the line handler. */ 61 | rl_callback_handler_install (prompt, cb_linehandler); 62 | 63 | /* Enter a simple event loop. This waits until something is available 64 | to read on readline's input stream (defaults to standard input) and 65 | calls the builtin character read callback to read it. It does not 66 | have to modify the user's terminal settings. */ 67 | running = 1; 68 | while (running) 69 | { 70 | FD_ZERO (&fds); 71 | FD_SET (fileno (rl_instream), &fds); 72 | 73 | r = select (FD_SETSIZE, &fds, NULL, NULL, NULL); 74 | if (r < 0) 75 | { 76 | perror ("rltest: select"); 77 | rl_callback_handler_remove (); 78 | break; 79 | } 80 | 81 | if (FD_ISSET (fileno (rl_instream), &fds)) 82 | rl_callback_read_char (); 83 | } 84 | 85 | printf ("rltest: Event loop has exited\n"); 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/rl-fgets.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmpews/rtspy/a2cfd5875a1a45935e5da53e8d5e4c51bf76abd7/MachoRuntimeSpy/thirdparty/readline/mac/share/readline/rl-fgets.c -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/rl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rl - command-line interface to read a line from the standard input 3 | * (or another fd) using readline. 4 | * 5 | * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars] 6 | */ 7 | 8 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 9 | 10 | This file is part of the GNU Readline Library (Readline), a library for 11 | reading lines of text with interactive input and history editing. 12 | 13 | Readline is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | Readline is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with Readline. If not, see . 25 | */ 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # include 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #ifdef HAVE_STDLIB_H 35 | # include 36 | #else 37 | extern void exit(); 38 | #endif 39 | 40 | #if defined (READLINE_LIBRARY) 41 | # include "posixstat.h" 42 | # include "readline.h" 43 | # include "history.h" 44 | #else 45 | # include 46 | # include 47 | # include 48 | #endif 49 | 50 | extern int optind; 51 | extern char *optarg; 52 | 53 | #if !defined (strchr) && !defined (__STDC__) 54 | extern char *strrchr(); 55 | #endif 56 | 57 | static char *progname; 58 | static char *deftext; 59 | 60 | static int 61 | set_deftext () 62 | { 63 | if (deftext) 64 | { 65 | rl_insert_text (deftext); 66 | deftext = (char *)NULL; 67 | rl_startup_hook = (rl_hook_func_t *)NULL; 68 | } 69 | return 0; 70 | } 71 | 72 | static void 73 | usage() 74 | { 75 | fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n", 76 | progname, progname); 77 | } 78 | 79 | int 80 | main (argc, argv) 81 | int argc; 82 | char **argv; 83 | { 84 | char *temp, *prompt; 85 | struct stat sb; 86 | int opt, fd, nch; 87 | FILE *ifp; 88 | 89 | progname = strrchr(argv[0], '/'); 90 | if (progname == 0) 91 | progname = argv[0]; 92 | else 93 | progname++; 94 | 95 | /* defaults */ 96 | prompt = "readline$ "; 97 | fd = nch = 0; 98 | deftext = (char *)0; 99 | 100 | while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF) 101 | { 102 | switch (opt) 103 | { 104 | case 'p': 105 | prompt = optarg; 106 | break; 107 | case 'u': 108 | fd = atoi(optarg); 109 | if (fd < 0) 110 | { 111 | fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg); 112 | exit (2); 113 | } 114 | break; 115 | case 'd': 116 | deftext = optarg; 117 | break; 118 | case 'n': 119 | nch = atoi(optarg); 120 | if (nch < 0) 121 | { 122 | fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg); 123 | exit (2); 124 | } 125 | break; 126 | default: 127 | usage (); 128 | exit (2); 129 | } 130 | } 131 | 132 | if (fd != 0) 133 | { 134 | if (fstat (fd, &sb) < 0) 135 | { 136 | fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd); 137 | exit (1); 138 | } 139 | ifp = fdopen (fd, "r"); 140 | rl_instream = ifp; 141 | } 142 | 143 | if (deftext && *deftext) 144 | rl_startup_hook = set_deftext; 145 | 146 | if (nch > 0) 147 | rl_num_chars_to_read = nch; 148 | 149 | temp = readline (prompt); 150 | 151 | /* Test for EOF. */ 152 | if (temp == 0) 153 | exit (1); 154 | 155 | printf ("%s\n", temp); 156 | exit (0); 157 | } 158 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/rlcat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rlcat - cat(1) using readline 3 | * 4 | * usage: rlcat 5 | */ 6 | 7 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 8 | 9 | This file is part of the GNU Readline Library (Readline), a library for 10 | reading lines of text with interactive input and history editing. 11 | 12 | Readline is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | Readline is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with Readline. If not, see . 24 | */ 25 | 26 | #if defined (HAVE_CONFIG_H) 27 | # include 28 | #endif 29 | 30 | #ifdef HAVE_UNISTD_H 31 | # include 32 | #endif 33 | 34 | #include 35 | #include "posixstat.h" 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #ifdef HAVE_STDLIB_H 43 | # include 44 | #else 45 | extern void exit(); 46 | #endif 47 | 48 | #ifndef errno 49 | extern int errno; 50 | #endif 51 | 52 | #if defined (READLINE_LIBRARY) 53 | # include "readline.h" 54 | # include "history.h" 55 | #else 56 | # include 57 | # include 58 | #endif 59 | 60 | extern int optind; 61 | extern char *optarg; 62 | 63 | static int stdcat(); 64 | 65 | static char *progname; 66 | static int vflag; 67 | 68 | static void 69 | usage() 70 | { 71 | fprintf (stderr, "%s: usage: %s [-vEVN] [filename]\n", progname, progname); 72 | } 73 | 74 | int 75 | main (argc, argv) 76 | int argc; 77 | char **argv; 78 | { 79 | char *temp; 80 | int opt, Vflag, Nflag; 81 | 82 | progname = strrchr(argv[0], '/'); 83 | if (progname == 0) 84 | progname = argv[0]; 85 | else 86 | progname++; 87 | 88 | vflag = Vflag = Nflag = 0; 89 | while ((opt = getopt(argc, argv, "vEVN")) != EOF) 90 | { 91 | switch (opt) 92 | { 93 | case 'v': 94 | vflag = 1; 95 | break; 96 | case 'V': 97 | Vflag = 1; 98 | break; 99 | case 'E': 100 | Vflag = 0; 101 | break; 102 | case 'N': 103 | Nflag = 1; 104 | break; 105 | default: 106 | usage (); 107 | exit (2); 108 | } 109 | } 110 | 111 | argc -= optind; 112 | argv += optind; 113 | 114 | if (isatty(0) == 0 || argc || Nflag) 115 | return stdcat(argc, argv); 116 | 117 | rl_variable_bind ("editing-mode", Vflag ? "vi" : "emacs"); 118 | while (temp = readline ("")) 119 | { 120 | if (*temp) 121 | add_history (temp); 122 | printf ("%s\n", temp); 123 | } 124 | 125 | return (ferror (stdout)); 126 | } 127 | 128 | static int 129 | fcopy(fp) 130 | FILE *fp; 131 | { 132 | int c; 133 | char *x; 134 | 135 | while ((c = getc(fp)) != EOF) 136 | { 137 | if (vflag && isascii ((unsigned char)c) && isprint((unsigned char)c) == 0) 138 | { 139 | x = rl_untranslate_keyseq (c); 140 | if (fputs (x, stdout) != 0) 141 | return 1; 142 | } 143 | else if (putchar (c) == EOF) 144 | return 1; 145 | } 146 | return (ferror (stdout)); 147 | } 148 | 149 | int 150 | stdcat (argc, argv) 151 | int argc; 152 | char **argv; 153 | { 154 | int i, fd, r; 155 | char *s; 156 | FILE *fp; 157 | 158 | if (argc == 0) 159 | return (fcopy(stdin)); 160 | 161 | for (i = 0, r = 1; i < argc; i++) 162 | { 163 | if (*argv[i] == '-' && argv[i][1] == 0) 164 | fp = stdin; 165 | else 166 | { 167 | fp = fopen (argv[i], "r"); 168 | if (fp == 0) 169 | { 170 | fprintf (stderr, "%s: %s: cannot open: %s\n", progname, argv[i], strerror(errno)); 171 | continue; 172 | } 173 | } 174 | r = fcopy (fp); 175 | if (fp != stdin) 176 | fclose(fp); 177 | } 178 | return r; 179 | } 180 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/rlevent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rl - command-line interface to read a line from the standard input 3 | * (or another fd) using readline. 4 | * 5 | * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars] 6 | */ 7 | 8 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 9 | 10 | This file is part of the GNU Readline Library (Readline), a library for 11 | reading lines of text with interactive input and history editing. 12 | 13 | Readline is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | Readline is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with Readline. If not, see . 25 | */ 26 | 27 | #if defined (HAVE_CONFIG_H) 28 | # include 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #ifdef HAVE_STDLIB_H 35 | # include 36 | #else 37 | extern void exit(); 38 | #endif 39 | 40 | #if defined (READLINE_LIBRARY) 41 | # include "posixstat.h" 42 | # include "readline.h" 43 | # include "history.h" 44 | #else 45 | # include 46 | # include 47 | # include 48 | #endif 49 | 50 | extern int optind; 51 | extern char *optarg; 52 | 53 | #if !defined (strchr) && !defined (__STDC__) 54 | extern char *strrchr(); 55 | #endif 56 | 57 | static char *progname; 58 | static char *deftext; 59 | 60 | static int 61 | event_hook () 62 | { 63 | fprintf (stderr, "ding!\n"); 64 | sleep (1); 65 | return 0; 66 | } 67 | 68 | static int 69 | set_deftext () 70 | { 71 | if (deftext) 72 | { 73 | rl_insert_text (deftext); 74 | deftext = (char *)NULL; 75 | rl_startup_hook = (rl_hook_func_t *)NULL; 76 | } 77 | return 0; 78 | } 79 | 80 | static void 81 | usage() 82 | { 83 | fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n", 84 | progname, progname); 85 | } 86 | 87 | int 88 | main (argc, argv) 89 | int argc; 90 | char **argv; 91 | { 92 | char *temp, *prompt; 93 | struct stat sb; 94 | int opt, fd, nch; 95 | FILE *ifp; 96 | 97 | progname = strrchr(argv[0], '/'); 98 | if (progname == 0) 99 | progname = argv[0]; 100 | else 101 | progname++; 102 | 103 | /* defaults */ 104 | prompt = "readline$ "; 105 | fd = nch = 0; 106 | deftext = (char *)0; 107 | 108 | while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF) 109 | { 110 | switch (opt) 111 | { 112 | case 'p': 113 | prompt = optarg; 114 | break; 115 | case 'u': 116 | fd = atoi(optarg); 117 | if (fd < 0) 118 | { 119 | fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg); 120 | exit (2); 121 | } 122 | break; 123 | case 'd': 124 | deftext = optarg; 125 | break; 126 | case 'n': 127 | nch = atoi(optarg); 128 | if (nch < 0) 129 | { 130 | fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg); 131 | exit (2); 132 | } 133 | break; 134 | default: 135 | usage (); 136 | exit (2); 137 | } 138 | } 139 | 140 | if (fd != 0) 141 | { 142 | if (fstat (fd, &sb) < 0) 143 | { 144 | fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd); 145 | exit (1); 146 | } 147 | ifp = fdopen (fd, "r"); 148 | rl_instream = ifp; 149 | } 150 | 151 | if (deftext && *deftext) 152 | rl_startup_hook = set_deftext; 153 | 154 | if (nch > 0) 155 | rl_num_chars_to_read = nch; 156 | 157 | rl_event_hook = event_hook; 158 | temp = readline (prompt); 159 | 160 | /* Test for EOF. */ 161 | if (temp == 0) 162 | exit (1); 163 | 164 | printf ("%s\n", temp); 165 | exit (0); 166 | } 167 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/rltest.c: -------------------------------------------------------------------------------- 1 | /* **************************************************************** */ 2 | /* */ 3 | /* Testing Readline */ 4 | /* */ 5 | /* **************************************************************** */ 6 | 7 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 8 | 9 | This file is part of the GNU Readline Library (Readline), a library for 10 | reading lines of text with interactive input and history editing. 11 | 12 | Readline is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | Readline is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with Readline. If not, see . 24 | */ 25 | 26 | #if defined (HAVE_CONFIG_H) 27 | #include 28 | #endif 29 | 30 | #include 31 | #include 32 | 33 | #ifdef HAVE_STDLIB_H 34 | # include 35 | #else 36 | extern void exit(); 37 | #endif 38 | 39 | #ifdef READLINE_LIBRARY 40 | # include "readline.h" 41 | # include "history.h" 42 | #else 43 | # include 44 | # include 45 | #endif 46 | 47 | extern HIST_ENTRY **history_list (); 48 | 49 | main () 50 | { 51 | char *temp, *prompt; 52 | int done; 53 | 54 | temp = (char *)NULL; 55 | prompt = "readline$ "; 56 | done = 0; 57 | 58 | while (!done) 59 | { 60 | temp = readline (prompt); 61 | 62 | /* Test for EOF. */ 63 | if (!temp) 64 | exit (1); 65 | 66 | /* If there is anything on the line, print it and remember it. */ 67 | if (*temp) 68 | { 69 | fprintf (stderr, "%s\r\n", temp); 70 | add_history (temp); 71 | } 72 | 73 | /* Check for `command' that we handle. */ 74 | if (strcmp (temp, "quit") == 0) 75 | done = 1; 76 | 77 | if (strcmp (temp, "list") == 0) 78 | { 79 | HIST_ENTRY **list; 80 | register int i; 81 | 82 | list = history_list (); 83 | if (list) 84 | { 85 | for (i = 0; list[i]; i++) 86 | fprintf (stderr, "%d: %s\r\n", i, list[i]->line); 87 | } 88 | } 89 | free (temp); 90 | } 91 | exit (0); 92 | } 93 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/thirdparty/readline/mac/share/readline/rlversion.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rlversion -- print out readline's version number 3 | */ 4 | 5 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. 6 | 7 | This file is part of the GNU Readline Library (Readline), a library for 8 | reading lines of text with interactive input and history editing. 9 | 10 | Readline is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | Readline is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with Readline. If not, see . 22 | */ 23 | 24 | #if defined (HAVE_CONFIG_H) 25 | # include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include "posixstat.h" 31 | 32 | #ifdef HAVE_STDLIB_H 33 | # include 34 | #else 35 | extern void exit(); 36 | #endif 37 | 38 | #ifdef READLINE_LIBRARY 39 | # include "readline.h" 40 | #else 41 | # include 42 | #endif 43 | 44 | main() 45 | { 46 | printf ("%s\n", rl_library_version ? rl_library_version : "unknown"); 47 | exit (0); 48 | } 49 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.hpp" 2 | #include "cli.hpp" 3 | #include 4 | 5 | bool readTaskMemory(task_t t, vm_address_t addr, void *buf, unsigned long len) 6 | { 7 | if(addr <= 0) 8 | Serror("memory read address < 0"); 9 | if(len <= 0) 10 | Serror("memory read length <0"); 11 | 12 | vm_size_t dataCnt = len; 13 | kern_return_t kr = vm_read_overwrite(t, addr, len, (vm_address_t)buf, (vm_size_t *)&dataCnt); 14 | 15 | if (kr) 16 | return false; 17 | if (len != dataCnt) 18 | { 19 | warnx("rt_read size return not match!"); 20 | return false; 21 | } 22 | 23 | return true; 24 | } 25 | 26 | char *readTaskString(task_t t, vm_address_t addr) 27 | { 28 | char x = '\0'; 29 | vm_address_t end; 30 | char *str = NULL; 31 | 32 | //string upper limit 0x1000 33 | end = memorySearch(t, addr, addr + 0x1000, &x, 1); 34 | if (!end) 35 | { 36 | return NULL; 37 | } 38 | str = (char *)malloc(end - addr + 1); 39 | if (readTaskMemory(t, addr, str, end - addr + 1)) { 40 | return str; 41 | } 42 | 43 | return NULL; 44 | } 45 | 46 | task_t pid2task(unsigned int pid) 47 | { 48 | task_t t; 49 | kern_return_t ret = task_for_pid(mach_task_self(), pid, &t); 50 | if (ret != KERN_SUCCESS) { 51 | printf("Attach to: %d Failed: %d %s\n", pid, ret, mach_error_string(ret)); 52 | return 0; 53 | } 54 | return t; 55 | } 56 | 57 | //get dyld load address by task_info, TASK_DYLD_INFO 58 | vm_address_t getDyldLoadAddress(task_t task) { 59 | //http://stackoverflow.com/questions/4309117/determining-programmatically-what-modules-are-loaded-in-another-process-os-x 60 | kern_return_t kr; 61 | task_flavor_t flavor = TASK_DYLD_INFO; 62 | task_dyld_info_data_t infoData; 63 | mach_msg_type_number_t task_info_outCnt = TASK_DYLD_INFO_COUNT; 64 | kr = task_info(task, 65 | flavor, 66 | (task_info_t)&infoData, 67 | &task_info_outCnt 68 | ); 69 | if(kr){ 70 | Serror("getDyldLoadAddress:task_info error"); 71 | return 0; 72 | } 73 | struct dyld_all_image_infos *allImageInfos = (struct dyld_all_image_infos *)infoData.all_image_info_addr; 74 | allImageInfos = (struct dyld_all_image_infos *)malloc(sizeof(struct dyld_all_image_infos)); 75 | if(readTaskMemory(task, infoData.all_image_info_addr, allImageInfos, sizeof(struct dyld_all_image_infos))) { 76 | return (vm_address_t)(allImageInfos->dyldImageLoadAddress); 77 | } else { 78 | Serror("getDyldLoadAddress:readTaskMemory error"); 79 | return 0; 80 | } 81 | } 82 | 83 | vm_address_t memorySearch(task_t task, vm_address_t start, vm_address_t end, char *data, unsigned long len) 84 | { 85 | if(start <= 0) 86 | Serror("memory search address < 0"); 87 | if(start > end) 88 | Serror("memeory search end < start"); 89 | vm_address_t addr = start; 90 | char *buf = (char *)malloc(len); 91 | while (end > addr) 92 | { 93 | if (readTaskMemory(task, addr, buf, len)) 94 | if (!memcmp(buf, data, len)) 95 | { 96 | return addr; 97 | } 98 | addr += len; 99 | } 100 | return 0; 101 | 102 | // unsigned long search_block_size = 0x1000; 103 | // vm_address_t addr = start; 104 | // 105 | // char *buf = (char *)malloc(search_block_size + len); 106 | // unsigned long search_len; 107 | // search_len = search_block_size; 108 | // 109 | // while(end >= addr + len || (!end)) { 110 | // 111 | // if(readTaskMemory(task, addr, buf, search_len + len - 1)) { 112 | // if(len == 1) { 113 | // std::cout << "memorySearch: " << buf << std::endl; 114 | // } 115 | // for(char *p = buf; p < buf + search_len; p++){ 116 | // 117 | // if(!memcmp(p, data, len)) { 118 | // return addr + p - buf; 119 | // } 120 | // } 121 | // } else { 122 | // if(len == 1) { 123 | // sleep(-1); 124 | // std::cout << "memorySearch: error" << std::endl; 125 | // } 126 | // } 127 | // 128 | // addr += search_block_size; 129 | // } 130 | // 131 | // search_len = end - addr - (len - 1); 132 | // if(search_len >0 && readTaskMemory(task, addr, buf, search_len + len - 1)) { 133 | // for(char *p = buf; p < buf + search_len; p++){ 134 | // if(!memcmp(p, data, len)) { 135 | // return addr + p - buf; 136 | // } 137 | // } 138 | // } 139 | // return 0; 140 | } 141 | -------------------------------------------------------------------------------- /MachoRuntimeSpy/utils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef utils_hpp 2 | #define utils_hpp 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | //#ifdef __arm64__ 13 | //#else 14 | //#include 15 | //#endif 16 | 17 | task_t pid2task(unsigned int pid); 18 | 19 | bool readTaskMemory (task_t t, vm_address_t addr, void* buf, unsigned long len); 20 | char* readTaskString(task_t t, vm_address_t addr); 21 | vm_address_t getDyldLoadAddress(task_t task); 22 | 23 | vm_address_t memorySearch(task_t task, vm_address_t start, vm_address_t end, char *data, unsigned long len); 24 | vm_address_t memorySearchDyld(task_t task, vm_address_t start,char *data, unsigned long size); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## rtspy 2 | 3 | runtime spy on elf and macho inlucde android/linux/ios/macOS. 4 | 5 | **In development...** 6 | 7 | ## [ELFRuntimeSpy](http://github.com/jmpews/rtspy/blob/master/ELFRuntimeSpy) 8 | 9 | ## [MachoRuntimeSpy](http://github.com/jmpews/rtspy/blob/master/MachoRuntimeSpy) 10 | 11 | #### Demo 12 | 13 | ``` 14 | jmpews at Jmp in ~/Desktop/rtspy/MachoRuntimeSpy (master●) (normal) 15 | λ : sudo ./rtspy-mac 16 | Password: 17 | -------------------------------------------------------------- 18 | RTspy - macOS/IOS (1.0.0) - by jmpews@gmail.com 19 | -------------------------------------------------------------- 20 | >> attach 49444 21 | [*] macho load at 0x100000000 22 | [*] start dump macho... 23 | [*] dump bin arch-64 24 | [*] class has been realized 25 | [*] dumping class 'MyObject', 0x100000f43 26 | [*] method name 'printt:' 27 | [*] method name 'printtt:' 28 | [*] ivar name 't' 29 | [*] class not be realized 30 | [*] dumping class 'XMyObject', 0x100000f4c 31 | [*] method name 'printt:' 32 | [*] method name 'printtt:' 33 | [*] ivar name 't' 34 | [*] string table addr: 0x100002520 35 | [*] symbol table addr: 0x100002520 36 | [*] dyld path: /usr/lib/dyld. 37 | [*] start dump macho... 38 | [*] dump macho arch-fat 39 | [*] start dump macho... 40 | [*] dump macho arch-64 41 | [*] __TEXT segment vm_addr: 0x0 42 | [!] Macho.cpp:160:parse_universal(): only support x86_64. 43 | [*] start dyld search range(0x100003000, 0x110003000). 44 | [*] dyld load address check at 0x100036000 45 | [*] dump bin arch-64 46 | [*] dyld load address check at 0x108844000 47 | [*] dump bin arch-64 48 | [*] task_info() dyld_addr: 0x108844000 49 | [+] DyldImageLoadAddress: 0x108844000 50 | ``` 51 | --------------------------------------------------------------------------------