bvi-1.4.0/0000755000175000017500000000000012415044211011270 5ustar bgbg00000000000000bvi-1.4.0/re.c0000644000175000017500000003275712206452063012066 0ustar bgbg00000000000000/* re - regular expression search for bvi * * NOTE: Edit this file with tabstop=4 ! * * 1996-01-06 created; * 1999-01-19 V 1.1.0 * 1999-03-17 V 1.1.1 * 1999-09-10 V 1.2.0 * 2000-04-25 V 1.3.0 beta * 2000-09-29 V 1.3.0 final * 2010-06-02 V 1.3.4 * 2013-08-24 V 1.4.0 * * Copyright 1996-2013 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ /* You cannot use a common regexp subroutine, because \0 is a regular * character in a binary string ! */ #include "bvi.h" #include "set.h" static int sbracket(); char act_pat[MAXCMD]; /* found pattern */ char pattern[MAXCMD + 1]; char search_pat[BUFFER]; /* / or ? command */ char *notfound = "Fail|Pattern not found"; char *noprev = "No previous expression"; char *emptyclass = "Bad character class|Empty byte class '[]' or '[^]' cannot match"; PTR bregexec(start, scan) PTR start; char *scan; { char *act; int count, test; act = act_pat; while (*scan != 0) { switch (*scan++) { case ONE: /* exactly one character */ count = *scan++; if (P(P_IC) && smode == ASCII) test = toupper(*start); else test = *start; if (count == 1) { /* if (test != *scan) return 0; */ if (test != *scan) return NULL; scan++; } else if (count > 1) { /* if (sbracket(test, scan, count)) return 0; */ if (sbracket(test, scan, count)) return NULL; scan += count; } *act++ = *start++; break; case STAR: /* zero or more characters */ count = *scan++; if (P(P_IC) && smode == ASCII) test = toupper(*start); else test = *start; if (count == 1) { /* only one character, 0 - n times */ while(test == *scan) { *act++ = *start++; if (P(P_IC) && smode == ASCII) test = toupper(*start); else test = *start; } scan++; } else if (count > 1) { /* characters in bracket */ if (*scan == '^') { while (start < maxpos) { if (bregexec(start, scan + count)) { *act = '\0'; /* return 1; */ return start; } /* if (sbracket(test, scan, count)) return 0; */ if (sbracket(test, scan, count)) return NULL; *act++ = *start++; if (P(P_IC) && smode == ASCII) test = toupper(*start); else test = *start; } } else { while(!sbracket(test, scan, count)) { *act++ = *start++; if (P(P_IC) && smode == ASCII) test = toupper(*start); else test = *start; } scan += count; } } else { /* ".*" */ while (start < maxpos) { /* if (bregexec(start, scan)) { *act = '\0'; return 1; } */ if (bregexec(start, scan)) { *act = '\0'; return start; } start++; } } } } *act = '\0'; return start; /* found */ /* return 1; */ } static int sbracket(start, scan, count) int start; char *scan; int count; { if (*scan++ == '^') { if (!memchr(scan, start, --count)) return 0; } else { if (memchr(scan, start, --count)) return 0; } return 1; } PTR end_word(start) PTR start; { PTR pos; pos = start; if (!isprint(*pos & 0xff)) return start; while (isprint(*pos & 0xff)) if (pos++ > maxpos) return start; return --pos; } /* wordsearch serves the 'W' and 'w' - command */ PTR wordsearch(start, mode) PTR start; char mode; { PTR found; PTR pos; int ccount; pos = start + 1; do { while (isprint(*pos & 0xff)) if (pos++ > maxpos) return start; while (!isprint(*pos & 0xff)) if (pos++ > maxpos) return start; found = pos; ccount = 0; while (isprint(*pos & 0xff)) { if (pos++ > maxpos) return start; ccount++; } if (ccount < P(P_WL)) continue; if (mode == 'W') { if (*pos == '\0' || *pos == '\n') return found; } else { return found; } } while (pos < maxpos); return start; } /* backsearch serves the 'b' and 'B' command */ PTR backsearch(start, mode) PTR start; char mode; { PTR pos; int ccount; pos = start - 1; do { if (mode == 'B') { while (*pos != '\0' && *pos != '\n') if (pos-- < mem) return start; } else { while (!isprint(*pos & 0xff)) if (pos-- < mem) return start; } pos--; ccount = 0; while (isprint(*pos & 0xff)) { if (pos-- < mem) return start; ccount++; } if (ccount >= P(P_WL)) return (pos + 1); } while (pos > mem); return start; } /* used by :s */ int do_substitution(delim, line, startpos, endpos) int delim; char *line; PTR startpos; PTR endpos; { int n; char *found; char *cmd = NULL; int repl_count = 0; int global = 0; int conf = 0; static int direct; static int pat_len = -1; static int ch; static char find_pat[BUFFER]; static char repl_pat[MAXCMD]; ignore_case = P(P_IC); magic = P(P_MA); switch (delim) { case '/': case '?': ch = delim; direct = (ch == '/' ? FORWARD : BACKWARD); cmd = patcpy(pattern, line, ch); if (pattern[0] == '\0') break; if (ascii_comp(find_pat, pattern)) return 0; cmd = patcpy(pattern, cmd, ch); /* Replace Pattern */ poi = pattern; pat_len = 0; while (*poi) { if (*poi == '\\') { switch (*(++poi)) { case '0': repl_pat[pat_len++] = '\0'; break; case 'n': repl_pat[pat_len++] = '\n'; break; case 'r': repl_pat[pat_len++] = '\r'; break; case 't': repl_pat[pat_len++] = '\t'; break; case '\\': repl_pat[pat_len++] = '\\'; break; default: sprintf(string, "No such escape sequence \\%c", *poi); emsg(string); return 0; } } else { repl_pat[pat_len++] = *poi; } poi++; } break; case '#': case '\\': ch = delim; direct = (ch == '\\' ? FORWARD : BACKWARD); cmd = patcpy(pattern, line, ch); if (hex_comp(find_pat, pattern)) return 0; cmd = patcpy(pattern, cmd, ch); /* Replace Pattern */ poi = pattern; pat_len = 0; while (*poi) { if (*poi == ' ' || *poi == '\t') { poi++; } else { if ((n = hexchar()) < 0) { emsg("Badly formed replacement pattern"); return 0; } repl_pat[pat_len] = n; pat_len++; } } break; case '\0': case 'g': case 'c': break; default: emsg("Extra chars|Extra characters at end of command"); return -1; } if (pat_len == -1) { emsg("No previous substitute re|No previous substitute to repeat"); return -1; } if (delim != '\0') { if (strchr(cmd, 'g')) global = 1; if (strchr(cmd, 'c')) conf = 1; } if ((strchr("\\#", ch) && loc == ASCII) || (strchr("/?", ch) && loc == HEX)) { toggle(); } startpos--; move(maxy, 0); refresh(); if (global) { if ((undo_count = alloc_buf(endpos - startpos, &undo_buf))) { memcpy(undo_buf, startpos + 1, undo_count); } undo_start = startpos + 1; edits = U_EDIT; } AGAIN: if (direct == FORWARD) { found = fsearch(startpos + 1, endpos, find_pat); } else { found = rsearch(startpos - 1, mem, find_pat); } if (!found) { if (!repl_count) { if (P(P_WS)) { emsg(notfound); } else { if (P(P_TE)) sprintf(string, "No match to %s", direct == FORWARD ? "BOTTOM" : "TOP"); else sprintf(string, "Address search hit %s without matching pattern", direct == FORWARD ? "BOTTOM" : "TOP"); emsg(string); } } return repl_count; } else { setpage(found); if (conf) { repaint(); msg("Replace?"); move(y, x); if (vgetc() != 'y') goto SKIP; } repl_count++; current_start = pagepos + y * Anzahl + xpos(); if (!global) { if ((undo_count = alloc_buf(pat_len, &undo_buf))) { memcpy(undo_buf, current_start, undo_count); } undo_start = current_start; edits = U_EDIT; } memcpy(current_start, repl_pat, pat_len); SKIP: if (global) { startpos = found + pat_len - 1; goto AGAIN; } } return repl_count; } /* * Used by /, ?, \, #, n or N command * ch is this command * line are the characters after * * return address found */ PTR searching(ch, line, startpos, endpos, flag) int ch; char *line; PTR startpos; PTR endpos; int flag; { char *cmd = NULL; PTR found; int sdir; static char m[2]; static int direct; if (line[0] == '\0' && again == 0) { emsg(noprev); return 0L; } ignore_case = (P(P_IC)); magic = P(P_MA); start_addr--; if ((strchr("\\#", ch) && loc == ASCII) || (strchr("/?", ch) && loc == HEX)) { toggle(); } if (!strchr("Nn", ch)) { m[0] = ch; m[1] = '\0'; switch (ch) { case '/': case '?': direct = (ch == '/' ? FORWARD : BACKWARD); cmd = patcpy(pattern, line, ch); if (pattern[0] != '\0') { if (ascii_comp(search_pat, pattern)) return 0L; again = 1; } break; case '#': case '\\': direct = (ch == '\\' ? FORWARD : BACKWARD); cmd = patcpy(pattern, line, ch); if (pattern[0] != '\0') { if (hex_comp(search_pat, pattern)) break; again = 1; } break; } if (!again) return 0L; } else { cmd = ""; msg(m); } move(maxy, 0); refresh(); sdir = (ch == 'N') ? !direct : direct; if (sdir == FORWARD) { found = fsearch(startpos + 1, endpos, search_pat); if (flag & S_GLOBAL) return(found); if (!found) if (flag & 1) { msg("Search wrapped BOTTOM|Search wrapped around BOTTOM of buffer"); found = fsearch(mem, startpos, search_pat); } } else { found = rsearch(startpos - 1, mem, search_pat); if (flag & S_GLOBAL) return(found); if (!found) if (flag & 1) { msg("Search wrapped TOP|Search wrapped around TOP of buffer"); found = rsearch(endpos, startpos, search_pat); } } if (!found) { if (flag & 1) { emsg(notfound); } else { if (P(P_TE)) { sprintf(string, "No match to %s", sdir == FORWARD ? "BOTTOM" : "TOP"); } else { sprintf(string, "Address search hit %s without matching pattern", sdir == FORWARD ? "BOTTOM" : "TOP"); } emsg(string); } } else { setpage(found); if (cmd) { switch(*cmd) { case 'z': do_z(*++cmd); break; case 's': do_substitution(ch, cmd + 2, found, endpos); repaint(); break; case ';': searching(*(cmd + 1), cmd + 2, found, maxpos - 1, flag); case '\0': break; default: beep(); } } } return found; } /* Copies a string from s2 to s1, up to delim or 0 * returns pointer to next character */ char * patcpy(s1, s2, delim) char *s1, *s2; char delim; { while (*s2 != '\0' && *s2 != delim) { if (*s2 == '\\' && *(s2 + 1) == delim) s2++; *s1++ = *s2++; } *s1 = '\0'; if (*s2 == delim) s2++; return s2; } PTR fsearch_end(start, end, smem, s_end) /* fsearch(start, end, smem) */ PTR start; PTR end; char *smem; PTR *s_end; { PTR spos; signal(SIGINT, jmpproc); for (spos = start; spos <= end; spos++) { /* if (bregexec(spos, smem)) { */ if (*s_end = bregexec(spos, smem)) { signal(SIGINT, SIG_IGN); *s_end++; return(spos); } } signal(SIGINT, SIG_IGN); return(NULL); } PTR fsearch(start, end, smem) PTR start; PTR end; char *smem; { PTR s_end; return fsearch_end(start, end, smem, &s_end); } PTR rsearch(start, end, smem) PTR start; PTR end; char *smem; { PTR spos; signal(SIGINT, jmpproc); for (spos = start; spos >= end; spos--) { if (bregexec(spos, smem)) { signal(SIGINT, SIG_IGN); return(spos); } } signal(SIGINT, SIG_IGN); return(NULL); } /* Calculates an address of a colon command * returns NULL on error or default_address, if nothing found */ PTR calc_addr(pointer, def_addr) char **pointer; PTR def_addr; { PTR addr; int ch, mark; char *cmd; cmd = *pointer; addr = def_addr; SKIP_WHITE if (*cmd >= '1' && *cmd <= '9') { addr = mem + strtoll(cmd, &cmd, 10) - P(P_OF); } else { ch = *cmd; switch (ch) { case '.': /* Current position */ addr = current; cmd++; break; case '^': addr = mem; cmd++; break; case '$': addr = maxpos - 1; cmd++; break; case '\'': /* Mark */ mark = (*++cmd); if (mark == '\'') { addr = last_motion; cmd++; break; } else if (mark < 'a' || mark > 'z') { emsg("Marks are ' and a-z"); return NULL; } if (markbuf[mark - 'a'] == NULL) { emsg("Mark not defined"); return NULL; } addr = markbuf[mark - 'a']; cmd++; break; case '\\': case '/': cmd = patcpy(pattern, cmd + 1, ch); if (pattern[0] == '\0' && again == 0) { emsg(noprev); return NULL; } if (pattern[0] != '\0') { again = 1; if (ch == '/') { if (ascii_comp(search_pat, pattern)) return NULL; } else { if (hex_comp(search_pat, pattern)) return NULL; } } addr = fsearch(mem, maxpos - 1, search_pat); break; case '#': case '?': cmd = patcpy(pattern, cmd + 1, ch); if (pattern[0] == '\0' && again == 0) { emsg(noprev); return NULL; } if (pattern[0] != '\0') { again = 1; if (ch == '?') { if (ascii_comp(search_pat, pattern)) return NULL; } else { if (hex_comp(search_pat, pattern)) return NULL; } } addr = rsearch(maxpos - 1, mem, search_pat); break; case '0': addr = mem + strtol(cmd, &cmd, 16) - P(P_OF); break; } } SKIP_WHITE while (*cmd == '+' || *cmd == '-') { if (*cmd == '+') { cmd++; SKIP_WHITE addr += strtoll(cmd, &cmd, 0); } else { cmd++; SKIP_WHITE addr -= strtoll(cmd, &cmd, 0); } SKIP_WHITE } if (*pointer != cmd) { *pointer = cmd; addr_flag++; } return addr; } bvi-1.4.0/README0000644000175000017500000000211312415037356012161 0ustar bgbg00000000000000BVI - Binary visual editor ========================== http://bvi.sourceforge.net/ This editor for binary files was written by Gerhard Buergmann and is distributed under the GPL (GNU Public License). How to compile ============== gunzip -c bvi-1.4.0.src.tar.gz | tar xvf - cd bvi-1.4.0 ./configure make make install MAC OS X ======== Looks like the curses implementation in Darwin is really limited. You should install and use ncurses instead. You can download it from ftp.gnu.org; install it and then use ./configure --with-ncurses=/usr/local/ncurses-5.2 HTML documentation in subdirectory html/ Subscribe to the bvi mailing for support, updates and other news: Send a blank email to bvi-subscribe@yahoogroups.com. You will receive a subscription confirmation message. Simply reply this message and your subscription will be complete. ------------------------------------------------------------------------ PLEASE send any bug reports (and fixes), code for new features, comments, questions, etc. (even flames) to: Gerhard Buergmann Vienna, Austria E-mail: gerhard@puon.at bvi-1.4.0/COPYING0000644000175000017500000004307612206452026012342 0ustar bgbg00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. bvi-1.4.0/dosconf.h0000644000175000017500000000250112206452026013077 0ustar bgbg00000000000000/* dosconf.h * * 1996-02-28 V 1.0.0 * 1999-01-21 V 1.1.0 * 1999-03-17 V 1.1.1 * 1999-07-01 V 1.2.0 beta * 1999-08-27 V 1.2.0 final * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2002 by Gerhard Buergmann * Gerhard.Buergmann@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if you have the memmove function. */ #define HAVE_MEMMOVE 1 /* Define if you have the strdup function. */ #define HAVE_STRDUP 1 /* Define if you have the strtol function. */ #define HAVE_STRTOL 1 /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the header file. */ #if __TURBOC__ > 0x0400 # define HAVE_LOCALE_H 1 #endif bvi-1.4.0/Makefile.in0000644000175000017500000000503612413047430013345 0ustar bgbg00000000000000# bvi - Binary Visual Editor Makefile # # This is the Makefile for bvi - binary visual editor. If it has the name # "Makefile.in" then it is a template for a Makefile; to generate the actual # Makefile, run "./configure", which is a configuration script generated by the # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # # Copyright (c) 1996-2014 by Gerhard Buergmann # gerhard@puon.at # # 1996-01-18 V 1.0.0 # 1999-01-15 V 1.1.0 # 1999-03-03 V 1.1.1 # 1999-10-22 V 1.2.0 # 2000-05-31 V 1.3.0 beta # 2000-10-01 V 1.3.0 final # 2003-07-03 V 1.3.2 # 2014-10-01 V 1.4.0 # ############################################### srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ bindir = $(DESTDIR)@bindir@ mandir = $(DESTDIR)@mandir@ libdir = $(DESTDIR)@libdir@ helpdir = $(DESTDIR)@datadir@/bvi man1dir = $(mandir)/man1 OBJS = bvi.o comm.o set.o re.o io.o edit.o recomp.o INCLUDES = bvi.h set.h BMOBJ = bmore.o bm_unix.o recomp.o CC = @CC@ CFLAGS = @CFLAGS@ @CPPFLAGS@ DEFS = @DEFS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ SHELL = /bin/sh INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ all: bvi bmore bvi: $(OBJS) $(HEADER) $(CC) $(LDFLAGS) -o bvi $(OBJS) $(LIBS) bmore: $(BMOBJ) $(CC) $(LDFLAGS) -o bmore $(BMOBJ) $(LIBS) %.o: %.c $(INCLUDES) $(CC) $(CFLAGS) $(DEFS) -c $< bmore.o: bmore.c $(CC) $(CFLAGS) $(DEFS) -DHELPFILE=\"$(helpdir)/bmore.help\" -c $< install: all installdirs @echo "Installing bvi" @$(INSTALL_DATA) bvi.1 bmore.1 $(man1dir) @$(INSTALL_PROGRAM) bvi $(bindir) @$(INSTALL_PROGRAM) bmore $(bindir) @$(INSTALL_DATA) bmore.help $(helpdir) @if [ -f $(bindir)/bview ]; then rm $(bindir)/bview; fi @if [ -f $(bindir)/bvedit ]; then rm $(bindir)/bvedit; fi @ln $(bindir)/bvi $(bindir)/bview @ln $(bindir)/bvi $(bindir)/bvedit installdirs: $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(helpdir) $(man1dir) uninstall: @echo "Uninstalling bvi" @if [ -f $(bindir)/bview ]; then rm $(bindir)/bview; fi @if [ -f $(bindir)/bvedit ]; then rm $(bindir)/bvedit; fi @if [ -f $(bindir)/bvi ]; then rm $(bindir)/bvi; fi @if [ -f $(bindir)/bmore ]; then rm $(bindir)/bmore; fi @if [ -f $(helpdir)/bmore.help ]; then rm $(helpdir)/bmore.help; fi @if [ -f $(man1dir)/bvi.1 ]; then rm $(man1dir)/bvi.1; fi @if [ -f $(man1dir)/bmore.1 ]; then rm $(man1dir)/bmore.1; fi clean: rm -f core *.o bvi bvi.exe bmore bmore.exe a.out distclean: clean rm -f Makefile config.cache config.h config.log config.status bvi-1.4.0/set.h0000644000175000017500000000421412274720725012253 0ustar bgbg00000000000000/* SET.H * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2014 by Gerhard Buergmann * Gerhard.Buergmann@puon.at * * 1998-03-14 V 1.0.0 * 1999-01-14 V 1.1.0 * 1999-03-23 V 1.1.1 * 1999-07-02 V 1.2.0 beta * 1999-08-14 V 1.2.0 final * 2000-08-21 V 1.3.0 final * 2010-06-02 V 1.3.4 * 2013-08-23 V 1.4.0 * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ struct param { char *fullname; /* full parameter name */ char *shortname; /* permissible abbreviation */ off_t nvalue; char *svalue; int flags; }; extern struct param params[]; #define P_BOOL 0x01 /* the parameter is boolean */ #define P_NUM 0x02 /* the parameter is numeric */ #define P_TEXT 0x04 /* the paameter is text */ #define P_CHANGED 0x08 /* the parameter has been changed */ /* * The following are the indices in the params array for each parameter */ /* * parameters */ #define P_AW 0 /* Autowrite */ #define P_CM 1 /* Columns */ #define P_EB 2 /* error bells */ #define P_IC 3 /* ignore case in searches */ #define P_MA 4 /* Magic characters in reg expr */ #define P_MM 5 /* move bytes in file */ #define P_OF 6 /* address offset */ #define P_RO 7 /* Readonly */ #define P_SS 8 /* scroll size */ #define P_MO 9 /* show mode */ #define P_TT 10 /* Terminal type */ #define P_TE 11 /* Terse (short messages) */ #define P_US 12 /* Unix-Style of ASCII representation */ #define P_LI 13 /* lines */ #define P_WL 14 /* Wordlength for w, W, b, B command */ #define P_WS 15 /* wrapscan */ #define P_HL 16 /* highlight search enabled */ #define P_CO 17 /* color/attribute setting */ /* * Macro to get the value of a parameter */ #define P(n) (params[n].nvalue) bvi-1.4.0/mkinstalldirs0000755000175000017500000000370412206452063014110 0ustar bgbg00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" 1>&2 exit 0 ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # End: # mkinstalldirs ends here bvi-1.4.0/recomp.c0000644000175000017500000001262012206452063012730 0ustar bgbg00000000000000/* recomp - regular expression compiler * * NOTE: Edit this file with tabstop=4 ! * * 1996-01-06 created; * 2000-04-25 V 1.3.0 beta * 2000-07-12 V 1.3.0 final * * Copyright 1996-2002 by Gerhard Buergmann * Gerhard.Buergmann@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ /* You cannot use a common regexp subroutine, because \0 is a regular * character in a binary string ! */ #include "bvi.h" #include "set.h" char *poi; int smode; int again = 0; int magic = 1; int ignore_case = 0; extern long bytepos; extern int ignore_case; extern char *emptyclass; /* * Compiling an ASCII sequence to a regex string */ int ascii_comp(smem, pattern) char *smem; char *pattern; { char *end; char *comp; char cc, cc1; char *counter; int count; int bracket, dot; comp = smem; poi = pattern; while (*poi != END) { bracket = FALSE; if (magic) { if (*poi == '[') bracket = TRUE; } else { if (*poi == '\\' && *(poi + 1) == '[') { bracket = TRUE; poi++; } } if (bracket) { if (!(end = strchr(poi, ']'))) { emsg("Missing ]"); return 1; } poi++; if (*poi == ']' || (*poi == '^' && *(poi + 1) == ']')) { emsg(emptyclass); return 1; } if (magic) { if (*(end + 1) == '*') *comp++ = STAR; else *comp++ = ONE; } else { if (*(end + 1) == '\\' && *(end + 2) == '*') *comp++ = STAR; else *comp++ = ONE; } count = 0; counter = comp; comp++; if (*poi != '^') { *comp++ = '\0'; count++; } while (end > poi) { if (*poi == '-') { if (ignore_case) { cc = toupper(*(poi - 1)); cc1 = toupper(*(poi + 1)); } else { cc = *(poi - 1); cc1 = *(poi + 1); } while (cc <= cc1) { *comp++ = cc++; count++; } poi++; poi++; } else { count++; if (ignore_case) *comp++ = toupper(*poi++); else *comp++ = *poi++; } } poi++; *counter = count; } else { dot = FALSE; if (magic) { if (*poi == '.') dot = TRUE; } else { if (*poi == '\\' && *(poi + 1) == '.') { dot = TRUE; poi++; } } if (*poi == '\\') { switch (*(poi + 1)) { case 'n': *++poi = '\n'; break; case 'r': *++poi = '\r'; break; case 't': *++poi = '\t'; break; case '0': *++poi = '\0'; break; default : ++poi; } } if (magic) if (*(poi + 1) == '*') *comp++ = STAR; else *comp++ = ONE; else if (*(poi + 1) == '\\' && *(poi + 2) == '*') *comp++ = STAR; else *comp++ = ONE; if (dot) { *comp++ = 0; poi++; } else { *comp++ = 1; if (ignore_case) *comp++ = toupper(*poi++); else *comp++ = *poi++; } } if (magic) { if (*poi == '*') poi++; } else { if (*poi == '\\' && *(poi + 1) == '*') { poi++; poi++; } } } *comp = END; smode = ASCII; return 0; } /* * Compiling a hex expression to a regex string */ int hex_comp(smem, pattern) char *smem; char *pattern; { char *end; char *comp; int cc, ccm; char *counter; int count, nr; comp = smem; poi = pattern; while (*poi != END) { while (*poi == ' ' || *poi == '\t') poi++; if (*poi == '[') { if (!(end = strchr(poi, ']'))) { emsg("Missing ]"); return 1; } poi++; while (*poi == ' ' || *poi == '\t') poi++; if (*poi == ']' || (*poi == '^' && *(poi + 1) == ']')) { emsg(emptyclass); return 1; } if (*(end + 1) == '*') *comp++ = STAR; else *comp++ = ONE; count = 1; counter = comp; comp++; if (*poi == '^') *comp++ = *poi++; else *comp++ = '\0'; while (end > poi) { if (*poi == ' ' || *poi == '\t') poi++; else if (*poi == '-') { cc = *(comp - 1); poi++; if ((ccm = hexchar()) < 0) return 1; while (cc <= ccm) { *comp++ = cc++; count++; } poi++; poi++; } else { if ((nr = hexchar()) < 0) return 1; count++; *comp++ = nr; } } poi++; *counter = count; if (*poi == '*') poi++; } else if (*poi == '"') { poi++; if (!(end = strchr(poi, '"'))) { /* emsg("Missing '\"'"); return 1; */ end = poi + strlen(poi); } while (end > poi) { *comp++ = 1; *comp++ = 1; if (ignore_case) *comp++ = toupper(*poi++); else *comp++ = *poi++; } poi++; } else { if (*poi == '.') { if (*(poi + 1) == '*') { *comp++ = STAR; poi++; } else *comp++ = ONE; *comp++ = 0; poi++; } else { if ((nr = hexchar()) < 0) return 1; if (*poi == '*') { poi++; *comp++ = STAR; } else *comp++ = ONE; *comp++ = 1; *comp++ = nr; } } } *comp = END; smode = HEX; return 0; } int hexchar() { int nr; char tmpbuf[3]; if (isxdigit(*poi)) { tmpbuf[0] = *poi++; tmpbuf[1] = '\0'; if (isxdigit(*poi)) tmpbuf[1] = *poi++; tmpbuf[2] = '\0'; sscanf(tmpbuf, "%2x", &nr); while (*poi == ' ' || *poi == '\t') poi++; return nr; } else { emsg("Bad hex character@in expression"); return -1; } } bvi-1.4.0/config.guess0000644000175000017500000012355012415231773013626 0ustar bgbg00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-03-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: bvi-1.4.0/tags0000644000175000017500000006025712213415520012164 0ustar bgbg00000000000000!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ !_TAG_PROGRAM_NAME Exuberant Ctags // !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ !_TAG_PROGRAM_VERSION 5.8 // AND bvi.h 88;" d ANSI bmore.h 103;" d ANSI bvi.h 117;" d APPEND comm.c 50;" d file: APPEND comm.c 53;" d file: ASCII bmore.h 82;" d ASCII bvi.h 95;" d A_ATTRIBUTES doscur.h 56;" d A_BLINK doscur.h 54;" d A_BOLD doscur.h 52;" d A_CHARTEXT doscur.h 55;" d A_NORMAL doscur.h 50;" d A_REVERSE doscur.h 53;" d A_STANDOUT doscur.h 51;" d AnzAdd bmore.c /^int AnzAdd;$/;" v AnzAdd bvi.c /^int AnzAdd, Anzahl, Anzahl3;$/;" v Anzahl bvi.c /^int AnzAdd, Anzahl, Anzahl3;$/;" v Anzahl3 bvi.c /^int AnzAdd, Anzahl, Anzahl3;$/;" v Ausgabe_Datei bvi.c /^FILE *Ausgabe_Datei;$/;" v BACKWARD bmore.h 84;" d BACKWARD bvi.h 97;" d BLOCK_BEGIN bvi.h /^ BLOCK_BEGIN = 1,$/;" e enum:_block_datum BLOCK_END bvi.h /^ BLOCK_END = 2,$/;" e enum:_block_datum BLOCK_LEN bvi.h /^ BLOCK_LEN = 4$/;" e enum:_block_datum BLOCK_SPECIAL bmore.h 74;" d BLOCK_SPECIAL bvi.h 64;" d BMOBJ Makefile /^BMOBJ = bmore.o bm_unix.o recomp.o$/;" m BS bmore.h 87;" d BS bvi.h 100;" d BUFFER bmore.h 115;" d BUFFER bvi.h 131;" d BVICTRL bmore.h 91;" d BVICTRL bvi.h 103;" d CC Makefile /^CC = gcc$/;" m CFLAGS Makefile /^CFLAGS = -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES$/;" m CHARACTER_SPECIAL bmore.h 73;" d CHARACTER_SPECIAL bvi.h 63;" d CMDLNG bvi.h 105;" d CMDSZ comm.c 56;" d file: COLS dosio.c /^int COLS = 80;$/;" v CR bmore.h 85;" d CR bvi.h 98;" d DEFS Makefile /^DEFS = -DHAVE_CONFIG_H$/;" m DELIM bmore.h 106;" d DELIM bmore.h 111;" d DELIM bvi.h 120;" d DELIM bvi.h 127;" d DIRECTORY bmore.h 72;" d DIRECTORY bvi.h 62;" d ECHO dosio.c /^int ECHO = TRUE;$/;" v END bmore.h 78;" d END bvi.h 68;" d ERR doscur.h 147;" d ERROR bmore.h 69;" d ERROR bvi.h 59;" d ESC bmore.h 88;" d ESC bvi.h 101;" d ESC doscur.h 31;" d FALSE bmore.h 99;" d FALSE bvi.h 113;" d FALSE doscur.h 29;" d FORWARD bmore.h 83;" d FORWARD bvi.h 96;" d HAVE_CURSES_H acconfig.h 5;" d HAVE_FCNTL_H config.h 16;" d HAVE_FCNTL_H dosconf.h 40;" d HAVE_INTTYPES_H config.h 19;" d HAVE_LOCALE_H dosconf.h 44;" d HAVE_MEMMOVE config.h 22;" d HAVE_MEMMOVE dosconf.h 31;" d HAVE_MEMORY_H config.h 25;" d HAVE_NCURSES_H acconfig.h 3;" d HAVE_NCURSES_H config.h 5;" d HAVE_NCURSES_TERM_H acconfig.h 11;" d HAVE_STDINT_H config.h 31;" d HAVE_STDLIB_H config.h 34;" d HAVE_STRDUP config.h 37;" d HAVE_STRDUP dosconf.h 34;" d HAVE_STRERROR config.h 40;" d HAVE_STRINGS_H config.h 43;" d HAVE_STRING_H config.h 46;" d HAVE_STRTOL config.h 49;" d HAVE_STRTOL dosconf.h 37;" d HAVE_SYS_STAT_H config.h 52;" d HAVE_SYS_TYPES_H config.h 55;" d HAVE_TERMCAP_H config.h 58;" d HAVE_TERMIOS_H config.h 61;" d HAVE_TERMIO_H config.h 64;" d HAVE_TERM_H config.h 67;" d HAVE_UNISTD_H config.h 70;" d HEADER Makefile /^HEADER = bvi.h set.h$/;" m HELPFILE bmore.c 42;" d file: HELPFILE bmore.c 44;" d file: HEX bvi.h 94;" d Home bm_unix.c /^char *Home; \/* go to home *\/$/;" v INSTALL Makefile /^INSTALL = \/usr\/bin\/install -c$/;" m INSTALL_DATA Makefile /^INSTALL_DATA = ${INSTALL} -m 644$/;" m INSTALL_PROGRAM Makefile /^INSTALL_PROGRAM = ${INSTALL}$/;" m JOEHTG bvi.h 41;" d KEY_BACKSPACE bvi.h 150;" d KEY_BACKSPACE doscur.h 42;" d KEY_DC doscur.h 45;" d KEY_DOWN doscur.h 34;" d KEY_ENTER doscur.h 41;" d KEY_F doscur.h 33;" d KEY_F0 doscur.h 32;" d KEY_HOME doscur.h 43;" d KEY_IC doscur.h 46;" d KEY_LEFT doscur.h 36;" d KEY_LL doscur.h 44;" d KEY_NPAGE doscur.h 38;" d KEY_PPAGE doscur.h 39;" d KEY_RETURN doscur.h 40;" d KEY_RIGHT doscur.h 37;" d KEY_UP doscur.h 35;" d LDFLAGS Makefile /^LDFLAGS= $/;" m LIBS Makefile /^LIBS = -lncurses $/;" m LINES dosio.c /^int LINES = 25;$/;" v LROTATE bvi.h 86;" d LSHIFT bvi.h 84;" d MAXCMD bmore.h 114;" d MAXCMD bvi.h 130;" d MAXNAME comm.c 57;" d file: MAX_ONE_ARG comm.c 62;" d file: MAX_ONE_FILE comm.c 64;" d file: NEED_PUTC_CHAR acconfig.h 9;" d NEED_PUTC_CHAR bm_unix.c 52;" d file: NEG bvi.h 91;" d NEW bmore.h 71;" d NEW bvi.h 61;" d NL bmore.h 86;" d NL bvi.h 99;" d NODEL dosio.c /^int NODEL = FALSE;$/;" v NOT bvi.h 92;" d NO_ADDR comm.c 59;" d file: NO_ARG comm.c 60;" d file: NO_SYSERRL acconfig.h 7;" d NULL bmore.h 94;" d NULL bvi.h 108;" d OBJS Makefile /^OBJS = bvi.o comm.o set.o re.o io.o edit.o recomp.o$/;" m OFF_T_MAX io.c 46;" d file: ONE bmore.h 79;" d ONE bvi.h 69;" d ONE_ARG comm.c 61;" d file: ONE_FILE comm.c 63;" d file: OR bvi.h 89;" d P set.h 75;" d PARTIAL bmore.h 75;" d PARTIAL bvi.h 65;" d PRINTF bmore.c 37;" d file: PRINTF bmore.c 39;" d file: PTR bmore.h 104;" d PTR bmore.h 110;" d PTR bvi.h 118;" d PTR bvi.h 126;" d P_AW set.h 53;" d P_BOOL set.h 41;" d P_CHANGED set.h 44;" d P_CM set.h 54;" d P_CO set.h 70;" d P_EB set.h 55;" d P_HL set.h 69;" d P_IC set.h 56;" d P_LI set.h 66;" d P_MA set.h 57;" d P_MM set.h 58;" d P_MO set.h 62;" d P_NUM set.h 42;" d P_OF set.h 59;" d P_RO set.h 60;" d P_SS set.h 61;" d P_TE set.h 64;" d P_TEXT set.h 43;" d P_TT set.h 63;" d P_US set.h 65;" d P_WL set.h 67;" d P_WS set.h 68;" d REGULAR bmore.h 70;" d REGULAR bvi.h 60;" d REPLACE bmore.h 90;" d RROTATE bvi.h 87;" d RSHIFT bvi.h 85;" d SEARCH bmore.h 89;" d SEARCH bvi.h 102;" d SHELL Makefile /^SHELL = \/bin\/sh$/;" m SIZEOF_INT config.h 73;" d SIZEOF_LONG config.h 76;" d SIZEOF_VOID_P config.h 79;" d SKIP_WHITE bvi.h 133;" d STAR bmore.h 80;" d STAR bvi.h 70;" d STDC_HEADERS config.h 82;" d STDC_HEADERS dosconf.h 28;" d S_GLOBAL bvi.h 81;" d S_ISBLK bvi.h 199;" d S_ISCHR bvi.h 198;" d S_ISDIR bvi.h 197;" d S_ISFIFO bvi.h 201;" d S_ISREG bvi.h 200;" d TBUFSIZ bm_dos.c 32;" d file: TBUFSIZ bm_unix.c 32;" d file: TRUE bmore.h 98;" d TRUE bvi.h 112;" d TRUE doscur.h 28;" d U_APPEND bvi.h 78;" d U_BACK bvi.h 77;" d U_DELETE bvi.h 76;" d U_EDIT bvi.h 73;" d U_INSERT bvi.h 75;" d U_TILDE bvi.h 79;" d U_TRUNC bvi.h 74;" d VERSION patchlevel.h 1;" d WINDOW doscur.h 60;" d WRITE comm.c 49;" d file: WRITE comm.c 52;" d file: XOR bvi.h 90;" d _block_datum bvi.h /^typedef enum _block_datum {$/;" g ac_fn_c_check_func configure /^ac_fn_c_check_func ()$/;" f ac_fn_c_check_header_compile configure /^ac_fn_c_check_header_compile ()$/;" f ac_fn_c_check_header_mongrel configure /^ac_fn_c_check_header_mongrel ()$/;" f ac_fn_c_check_type configure /^ac_fn_c_check_type ()$/;" f ac_fn_c_compute_int configure /^ac_fn_c_compute_int ()$/;" f ac_fn_c_try_compile configure /^ac_fn_c_try_compile ()$/;" f ac_fn_c_try_cpp configure /^ac_fn_c_try_cpp ()$/;" f ac_fn_c_try_link configure /^ac_fn_c_try_link ()$/;" f ac_fn_c_try_run configure /^ac_fn_c_try_run ()$/;" f act_pat re.c /^char act_pat[MAXCMD]; \/* found pattern *\/$/;" v addch doscur.h 95;" d addfile dosio.c /^addfile(char *fname)$/;" f addfile io.c /^addfile(fname)$/;" f addr_flag comm.c /^int addr_flag;$/;" v addr_form bmore.c /^char addr_form[15];$/;" v addr_form bvi.c /^char addr_form[15];$/;" v addstr doscur.h 99;" d again recomp.c /^int again = 0;$/;" v alloc_buf dosio.c /^alloc_buf(off_t n, char **buffer)$/;" f alloc_buf io.c /^alloc_buf(n, buffer)$/;" f altfile comm.c /^static char *altfile = NULL; \/* alternate file *\/$/;" v file: ambigous comm.c /^char *ambigous = "Ambigous|Too many file names";$/;" v ambvalue comm.c /^char *ambvalue = "Ambigous|Too many values";$/;" v arrnum bmore.c /^int arrnum = 0;$/;" v arrnum bvi.c /^int arrnum = 0;$/;" v as_fn_append config.status /^ as_fn_append ()$/;" f as_fn_append configure /^ as_fn_append ()$/;" f as_fn_arith config.status /^ as_fn_arith ()$/;" f as_fn_arith configure /^ as_fn_arith ()$/;" f as_fn_error config.status /^as_fn_error ()$/;" f as_fn_error configure /^as_fn_error ()$/;" f as_fn_exit config.status /^as_fn_exit ()$/;" f as_fn_exit configure /^as_fn_exit ()$/;" f as_fn_failure configure /^as_fn_failure () { as_fn_return 1; }$/;" f as_fn_mkdir_p config.status /^as_fn_mkdir_p ()$/;" f as_fn_mkdir_p configure /^as_fn_mkdir_p ()$/;" f as_fn_ret_failure configure /^as_fn_ret_failure () { return 1; }$/;" f as_fn_ret_success configure /^as_fn_ret_success () { return 0; }$/;" f as_fn_set_status config.status /^as_fn_set_status ()$/;" f as_fn_set_status configure /^as_fn_set_status ()$/;" f as_fn_success configure /^as_fn_success () { as_fn_return 0; }$/;" f as_fn_unset config.status /^as_fn_unset ()$/;" f as_fn_unset configure /^as_fn_unset ()$/;" f ascii_comp recomp.c /^ascii_comp(smem, pattern)$/;" f ascii_flag bmore.c /^int ascii_flag = 0;$/;" v attrset dosio.c /^attrset(int attr)$/;" f backsearch re.c /^backsearch(start, mode)$/;" f beep doscur.h 76;" d bindir Makefile /^bindir = $(DESTDIR)${exec_prefix}\/bin$/;" m block_begin bvi.c /^off_t block_begin, block_end, block_size;$/;" v block_datum bvi.h /^} block_datum;$/;" t typeref:enum:_block_datum block_end bvi.c /^off_t block_begin, block_end, block_size;$/;" v block_flag bvi.c /^int block_flag = 0;$/;" v block_read io.c /^static off_t block_read;$/;" v file: block_size bvi.c /^off_t block_begin, block_end, block_size;$/;" v bmbeep bmore.c /^bmbeep() {$/;" f bmore_search_pat bmore.c /^char bmore_search_pat[BUFFER]; \/* \/ or ? command *\/$/;" v bmregexec bmore.c /^bmregexec(scan)$/;" f bmsearch bmore.c /^bmsearch(ch)$/;" f bregexec re.c /^bregexec(start, scan)$/;" f buf comm.c /^static struct stat buf;$/;" v typeref:struct:stat file: buf dosio.c /^static struct stat buf;$/;" v typeref:struct:stat file: buf io.c /^static struct stat buf;$/;" v typeref:struct:stat file: buf set.c /^static char buf[64];$/;" v file: buffer1 bmore.c /^char buffer1[MAXCMD], buffer2[MAXCMD];$/;" v buffer2 bmore.c /^char buffer1[MAXCMD], buffer2[MAXCMD];$/;" v bvi_init dosio.c /^bvi_init(char *dir)$/;" f bvi_init io.c /^bvi_init(dir)$/;" f bytepos bmore.c /^off_t bytepos, oldpos;$/;" v c_argc comm.c /^static int c_argc = 0;$/;" v file: c_argv comm.c /^static char *c_argv[9];$/;" v file: c_flag bmore.c /^int c_flag = 0, d_flag = 0;$/;" v calc_addr re.c /^calc_addr(pointer, def_addr)$/;" f calc_size bvi.c /^calc_size(arg)$/;" f cbreak doscur.h 136;" d chk_comm comm.c /^chk_comm(flag)$/;" f chtype doscur.h 58;" d clear doscur.h 83;" d clear_marks edit.c /^clear_marks()$/;" f clear_sc bm_unix.c /^char *clear_sc; \/* clear screen *\/$/;" v clearscreen bm_dos.c /^clearscreen()$/;" f clearscreen bm_unix.c /^clearscreen()$/;" f clearstr comm.c /^clearstr()$/;" f cleartoeol bm_dos.c /^cleartoeol()$/;" f cleartoeol bm_unix.c /^cleartoeol()$/;" f clrtoeol doscur.h 79;" d cmdbuf bmore.c /^static char cmdbuf[MAXCMD];$/;" v file: cmdstr bvi.c /^char cmdstr[MAXCMD + 1] = "";$/;" v cnt bmore.c /^static int cnt = 0;$/;" v file: contrd edit.c /^char contrd[][4] = {"NUL", " ^A", " ^B", " ^C", " ^D", " ^E", " ^F", "BEL",$/;" v contru edit.c /^char contru[][4] = {"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",$/;" v copyright bmore.c /^char *copyright = "Copyright (C) 1990-2013 by Gerhard Buergmann";$/;" v copyright bvi.c /^char *copyright = "Copyright (C) 1996-2013 by Gerhard Buergmann";$/;" v corr bmore.c /^int corr = 0, do_header = 0, to_print;$/;" v cur_back edit.c /^cur_back()$/;" f cur_forw edit.c /^cur_forw(check)$/;" f curfile bvi.c /^int curfile; \/* number of the current file *\/$/;" v curpos bvi.c /^PTR curpos;$/;" v curr_file bmore.c /^FILE *curr_file = NULL, *help_file;$/;" v current bvi.c /^PTR current;$/;" v current_start bvi.c /^PTR current_start;$/;" v d_flag bmore.c /^int c_flag = 0, d_flag = 0;$/;" v d_memcpy dosio.c /^d_memcpy(PTR dest, PTR src, off_t n)$/;" f d_memmove dosio.c /^d_memmove(PTR dest, PTR src, off_t n)$/;" f datarootdir Makefile /^datarootdir = ${prefix}\/share$/;" m dbug bm_dos.c /^FILE *dbug;$/;" v delch dosio.c /^delch()$/;" f deleteln doscur.h 110;" d dlines bm_unix.c /^int dum_opt, dlines;$/;" v do_append bvi.c /^do_append(count, buf)$/;" f do_back edit.c /^do_back(n, start)$/;" f do_delete edit.c /^do_delete(n, start)$/;" f do_exit comm.c /^do_exit()$/;" f do_ft edit.c /^do_ft(ch, flag)$/;" f do_header bmore.c /^int corr = 0, do_header = 0, to_print;$/;" v do_ins_chg edit.c /^do_ins_chg(start, arg, mode)$/;" f do_logic set.c /^do_logic(mode, str)$/;" f do_mark edit.c /^do_mark(mark, addr)$/;" f do_next bmore.c /^do_next(n)$/;" f do_over bvi.c /^do_over(loc, n, buf)$/;" f do_put bvi.c /^do_put(loc, n, buf)$/;" f do_shell dosio.c /^do_shell()$/;" f do_shell io.c /^do_shell()$/;" f do_substitution re.c /^do_substitution(delim, line, startpos, endpos)$/;" f do_tilde bvi.c /^do_tilde(count)$/;" f do_undo bvi.c /^do_undo()$/;" f do_z edit.c /^do_z(mode)$/;" f docmdline comm.c /^docmdline(cmdline)$/;" f doecmd comm.c /^doecmd(arg, force)$/;" f doset set.c /^doset(arg)$/;" f doshell bm_dos.c /^doshell(cmd)$/;" f doshell bm_unix.c /^doshell(cmd)$/;" f doupdate doscur.h 143;" d dum_opt bm_unix.c /^int dum_opt, dlines;$/;" v dup_print_flag bmore.c /^int dup_print_flag = 0;$/;" v echo doscur.h 128;" d edit edit.c /^edit(mode)$/;" f edits bvi.c /^int edits = 0;$/;" v emptyclass bmore.c /^char *emptyclass = "Empty byte class '[]' or '[^]'";$/;" v emptyclass re.c /^char *emptyclass = "Bad character class|Empty byte class '[]' or '[^]' cannot match";$/;" v emsg bmore.c /^emsg(s)$/;" f emsg comm.c /^emsg(s)$/;" f end_addr comm.c /^PTR end_addr;$/;" v end_word re.c /^end_word(start)$/;" f endwin doscur.h 137;" d enlarge dosio.c /^enlarge(off_t add)$/;" f enlarge io.c /^enlarge(add)$/;" f env bvi.c /^jmp_buf env; \/* context for `longjmp' function *\/$/;" v erase doscur.h 81;" d erase_ln bm_unix.c /^char *erase_ln; \/* erase line *\/$/;" v erasechar doscur.h 75;" d estring bmore.c /^char estring[MAXCMD] = ""; \/* string for shell escape *\/$/;" v exec_prefix Makefile /^exec_prefix = ${prefix}$/;" m extra comm.c /^char *extra = "Extra chars|Extra characters at end of command";$/;" v exval bmore.c /^int exval = 0;$/;" v fbuf set.c /^static char fbuf[256];$/;" v file: ffp set.c /^static FILE *ffp;$/;" v file: file_nr bmore.c /^int file_nr = 0; \/* number of current input file *\/$/;" v fileinfo edit.c /^fileinfo(fname)$/;" f filemode dosio.c /^int filemode;$/;" v filemode io.c /^int filemode;$/;" v files bmore.c /^char **files; \/* list of input files *\/$/;" v files bvi.c /^char **files; \/* list of input files *\/$/;" v filesize bmore.c /^off_t screen_home, filesize;$/;" v filesize bvi.c /^off_t filesize, memsize, undosize;$/;" v flags set.h /^ int flags;$/;" m struct:param flash doscur.h 77;" d flushinp doscur.h 120;" d fnum bm_unix.c /^int fnum, no_intty, no_tty, slow_tty;$/;" v from_file set.c /^static int from_file = 0;$/;" v file: fsearch re.c /^fsearch(start, end, smem)$/;" f fsearch_end re.c /^fsearch_end(start, end, smem, s_end)$/;" f fullname set.h /^ char *fullname; \/* full parameter name *\/$/;" m struct:param getbegyx doscur.h 105;" d getcbuff edit.c /^static char getcbuff[BUFFER];$/;" v file: getch dosio.c /^getch()$/;" f getcmdstr set.c /^getcmdstr(p, x)$/;" f getcnext edit.c /^static char *getcnext = NULL;$/;" v file: getmaxyx doscur.h 106;" d getyx doscur.h 104;" d got_int bm_dos.c /^int got_int;$/;" v got_int bm_unix.c /^int got_int;$/;" v help_file bmore.c /^FILE *curr_file = NULL, *help_file;$/;" v helpdir Makefile /^helpdir = $(DESTDIR)${datarootdir}\/bvi$/;" m helppath bmore.c /^char helppath[MAXCMD];$/;" v hex_comp recomp.c /^hex_comp(smem, pattern)$/;" f hexchar recomp.c /^hexchar()$/;" f highlight bm_dos.c /^highlight()$/;" f highlight bm_unix.c /^highlight()$/;" f hl_spat edit.c /^long hl_spat = 0;$/;" v home bm_dos.c /^home()$/;" f home bm_unix.c /^home()$/;" f icnt bmore.c /^static int icnt = 0;$/;" v file: idlok doscur.h 141;" d ignore_case recomp.c /^int ignore_case = 0;$/;" v inch dosio.c /^inch()$/;" f init_byte bmore.c /^off_t init_byte = 0;$/;" v init_search bmore.c /^int init_search = 0;$/;" v initscr doscur.h 73;" d initterm bm_dos.c /^initterm()$/;" f initterm bm_unix.c /^initterm()$/;" f insch dosio.c /^insch(int c)$/;" f insertln doscur.h 108;" d jmpproc bvi.c /^jmpproc(sig)$/;" f keypad doscur.h 133;" d last_motion bvi.c /^PTR last_motion;$/;" v last_search bmore.c /^off_t last_search = 0;$/;" v libdir Makefile /^libdir = $(DESTDIR)${exec_prefix}\/lib$/;" m linbuf edit.c /^char linbuf[16384];$/;" v line bvi.c /^static char line[MAXCMD];$/;" v file: lineout edit.c /^lineout()$/;" f load dosio.c /^load(char *fname)$/;" f load io.c /^load(fname)$/;" f loc bvi.c /^int loc;$/;" v magic recomp.c /^int magic = 1;$/;" v main bmore.c /^main(argc, argv)$/;" f main bvi.c /^main(argc, argv)$/;" f man1dir Makefile /^man1dir = $(mandir)\/man1$/;" m mandir Makefile /^mandir = $(DESTDIR)${datarootdir}\/man$/;" m mark bvi.c /^static int mark;$/;" v file: markbuf bvi.c /^PTR markbuf[26];$/;" v maxpos bvi.c /^PTR maxpos;$/;" v maxx bmore.c /^int maxx, maxy;$/;" v maxx bvi.c /^int maxx, maxy, x, xx, y;$/;" v maxy bmore.c /^int maxx, maxy;$/;" v maxy bvi.c /^int maxx, maxy, x, xx, y;$/;" v mem bvi.c /^PTR mem = NULL;$/;" v memcpy bvi.h 123;" d memmove bm_unix.c /^memmove(s1, s2, n)$/;" f memmove bvi.h 124;" d memmove io.c /^memmove(s1, s2, n)$/;" f memsize bvi.c /^off_t filesize, memsize, undosize;$/;" v morefiles comm.c /^char *morefiles = "more files@to edit";$/;" v move doscur.h 91;" d movebyte edit.c /^movebyte()$/;" f msg comm.c /^msg(s)$/;" f mvaddch doscur.h 93;" d mvaddstr doscur.h 97;" d mvgetch doscur.h 112;" d mvgetstr doscur.h 115;" d mvinch dosio.c /^mvinch(int y, int x)$/;" f mvinsch doscur.h 125;" d mvprintw doscur.h 101;" d mvscanw doscur.h 122;" d mvwaddch doscur.h 92;" d mvwaddstr doscur.h 96;" d mvwgetch doscur.h 111;" d mvwgetstr doscur.h 114;" d mvwprintw doscur.h 100;" d mvwscanw doscur.h 121;" d mymaxx bmore.c /^int mymaxx = 0, mymaxy = 0;$/;" v mymaxy bmore.c /^int mymaxx = 0, mymaxy = 0;$/;" v name bmore.c /^char *name = NULL;$/;" v name bvi.c /^char *name = NULL;$/;" v new_screen edit.c /^new_screen()$/;" f newwin doscur.h 74;" d nextchar bmore.c /^nextchar()$/;" f nl doscur.h 131;" d no_intty bm_dos.c /^int no_intty, no_tty;$/;" v no_intty bm_unix.c /^int fnum, no_intty, no_tty, slow_tty;$/;" v no_tty bm_dos.c /^int no_intty, no_tty;$/;" v no_tty bm_unix.c /^int fnum, no_intty, no_tty, slow_tty;$/;" v noaddr comm.c /^char *noaddr = "No address allowed@on this command";$/;" v nobytes bvi.c /^char *nobytes = "No bytes@in the buffer";$/;" v nodelay doscur.h 127;" d noecho doscur.h 129;" d nonl doscur.h 132;" d noprev re.c /^char *noprev = "No previous expression";$/;" v noraw doscur.h 139;" d normal bm_dos.c /^normal()$/;" f normal bm_unix.c /^normal()$/;" f notfound re.c /^char *notfound = "Fail|Pattern not found";$/;" v notimeout doscur.h 140;" d noval comm.c /^char *noval = "No value@for binary operation";$/;" v nowrtmsg comm.c /^char *nowrtmsg = "No write@since last change (:%s! overrides)";$/;" v nstate bm_unix.c /^struct termios ostate, nstate;$/;" v typeref:struct: numarr bmore.c /^char numarr[64]; \/* string for collecting number *\/$/;" v numarr bvi.c /^char numarr[MAXCMD]; \/* string for collecting number *\/$/;" v numfiles bmore.c /^int numfiles; \/* number of input files *\/$/;" v numfiles bvi.c /^int numfiles; \/* number of input files *\/$/;" v nvalue set.h /^ off_t nvalue;$/;" m struct:param off_t bmore.h 105;" d off_t bvi.h 119;" d oldbuf comm.c /^static char oldbuf[CMDSZ]; \/** for :!! command **\/$/;" v file: oldpos bmore.c /^off_t bytepos, oldpos;$/;" v open_file bmore.c /^open_file(name)$/;" f ostate bm_unix.c /^struct termios ostate, nstate;$/;" v typeref:struct:termios out_len bmore.c /^int out_len;$/;" v outmsg comm.c /^outmsg(s)$/;" f pagepos bvi.c /^PTR pagepos;$/;" v param set.h /^struct param {$/;" s params set.c /^struct param params[] = {$/;" v typeref:struct:param patcpy re.c /^patcpy(s1, s2, delim)$/;" f pattern re.c /^char pattern[MAXCMD + 1];$/;" v poi recomp.c /^char *poi;$/;" v precount bmore.c /^long precount = -1; \/* number preceding command *\/$/;" v precount bvi.c /^long precount = -1;$/;" v prefix Makefile /^prefix = \/usr\/local$/;" m printline edit.c /^printline(mempos, scpos)$/;" f printout bmore.c /^printout(lns)$/;" f printw doscur.h 103;" d progname bmore.c /^static char progname[10];$/;" v file: progname bvi.c /^static char progname[8];$/;" v file: prompt bmore.c /^int prompt = 1;$/;" v prototypes configure /^ function prototypes and stuff, but not '\\xHH' hex character constants.$/;" f pushback bmore.c /^pushback(n, where)$/;" f putchr bm_unix.c /^putchr(ch)$/;" f putchr bm_unix.c /^putchr(char ch)$/;" f putline bmore.c /^putline(buf, num)$/;" f quit edit.c /^quit()$/;" f range bvi.c /^range(ch)$/;" f raw doscur.h 138;" d rdline bmore.c /^rdline(ch, sstring)$/;" f read_rc set.c /^read_rc(fn)$/;" f refresh doscur.h 134;" d rep_buf bvi.c /^char rep_buf[BUFFER];$/;" v repaint edit.c /^repaint() \/***** redraw screen *********************\/$/;" f repl_count comm.c /^int repl_count = -1;$/;" v reset_tty bm_dos.c /^reset_tty ()$/;" f reset_tty bm_unix.c /^reset_tty()$/;" f resetty doscur.h 145;" d rev_end bm_unix.c /^char *rev_start, *rev_end; \/* enter and exit standout mode *\/$/;" v rev_start bm_unix.c /^char *rev_start, *rev_end; \/* enter and exit standout mode *\/$/;" v rsearch re.c /^rsearch(start, end, smem)$/;" f save dosio.c /^save(char *fname, PTR start, PTR end, int flags)$/;" f save io.c /^save(fname, start, end, flags)$/;" f save_chk comm.c /^save_chk(fname, start, end, flags)$/;" f savetty doscur.h 144;" d sbracket bmore.c /^sbracket(start, scan, count)$/;" f sbracket re.c /^sbracket(start, scan, count)$/;" f file: scanw doscur.h 124;" d scr dosio.c /^struct WINDOW scr;$/;" v typeref:struct:WINDOW screen bvi.c /^int screen, status;$/;" v screen_home bmore.c /^off_t screen_home, filesize;$/;" v scrolldown edit.c /^scrolldown(lns)$/;" f scrollok doscur.h 142;" d scrollup edit.c /^scrollup(lns)$/;" f scrolly bvi.c /^static int scrolly;$/;" v file: search_pat re.c /^char search_pat[BUFFER]; \/* \/ or ? command *\/$/;" v searching re.c /^searching(ch, line, startpos, endpos, flag)$/;" f set_tty bm_dos.c /^set_tty ()$/;" f set_tty bm_unix.c /^set_tty()$/;" f setcur edit.c /^setcur()$/;" f setpage edit.c /^setpage(addr)$/;" f shell bvi.c /^char *shell;$/;" v shortname set.h /^ char *shortname; \/* permissible abbreviation *\/$/;" m struct:param showparms set.c /^showparms(all)$/;" f sig bm_dos.c /^sig()$/;" f sig bm_unix.c /^sig(sig)$/;" f size bvi.c /^off_t size;$/;" v slow_tty bm_unix.c /^int fnum, no_intty, no_tty, slow_tty;$/;" v smode bmore.c /^static int smode;$/;" v file: smode recomp.c /^int smode;$/;" v smsg comm.c /^smsg(s)$/;" f spos bvi.c /^PTR spos;$/;" v srcdir Makefile /^srcdir = .$/;" m sstring bmore.c /^char sstring[MAXCMD] = ""; \/* string for search *\/$/;" v standend doscur.h 89;" d standout doscur.h 88;" d start_addr comm.c /^PTR start_addr;$/;" v statpos edit.c /^statpos()$/;" f status bvi.c /^int screen, status;$/;" v stdscr dosio.c /^int stdscr = 0;$/;" v strcasecmp bmore.h 108;" d strcasecmp bvi.h 122;" d strdup io.c /^strdup(s)$/;" f string bmore.c /^char string[MAXCMD];$/;" v string bvi.c /^char string[MAXCMD];$/;" v strncasecmp bmore.h 107;" d strncasecmp bvi.h 121;" d stty bm_unix.c 34;" d file: stuffin edit.c /^stuffin(s)$/;" f svalue set.h /^ char *svalue;$/;" m struct:param sysemsg comm.c /^sysemsg(s)$/;" f terminal dosio.c /^char *terminal = "ansi";$/;" v terminal io.c /^char *terminal;$/;" v tmpbuf edit.c /^char tmpbuf[10];$/;" v to_print bmore.c /^int corr = 0, do_header = 0, to_print;$/;" v toggle edit.c /^toggle()$/;" f trunc_cur bvi.c /^trunc_cur()$/;" f undo_buf bvi.c /^char *undo_buf = NULL;$/;" v undo_count bvi.c /^off_t undo_count;$/;" v undo_start bvi.c /^PTR undo_start;$/;" v undosize bvi.c /^off_t filesize, memsize, undosize;$/;" v usage bmore.c /^usage()$/;" f usage bvi.c /^usage()$/;" f vgetc bm_dos.c /^vgetc()$/;" f vgetc bm_unix.c /^vgetc()$/;" f vgetc edit.c /^vgetc()$/;" f waddch doscur.h 94;" d waddstr doscur.h 98;" d wait_return comm.c /^wait_return(flag)$/;" f wclear doscur.h 82;" d wclrtoeol doscur.h 78;" d wdeleteln doscur.h 109;" d werase doscur.h 80;" d wgetch doscur.h 113;" d wgetstr doscur.h 116;" d winsertln doscur.h 107;" d wmove doscur.h 90;" d wordsearch re.c /^wordsearch(start, mode)$/;" f wprintw doscur.h 102;" d wrefresh doscur.h 135;" d wrstat bvi.c /^static int wrstat = 1;$/;" v file: wscanw doscur.h 123;" d x bvi.c /^int maxx, maxy, x, xx, y;$/;" v xpos edit.c /^xpos()$/;" f xx bvi.c /^int maxx, maxy, x, xx, y;$/;" v y bvi.c /^int maxx, maxy, x, xx, y;$/;" v yank_buf bvi.c /^char *yank_buf = NULL;$/;" v yanked bvi.c /^off_t yanked = 0L;$/;" v yd_addr comm.c /^yd_addr()$/;" f bvi-1.4.0/bmore.hlp0000644000175000017500000000311212206452025013102 0ustar bgbg00000000000000 Most commands optionally preceded by integer argument k. Defaults in brackets. Star (*) indicates argument becomes new default. ------------------------------------------------------------------------------- Display next k lines of bytes [current screen size] z Display next k lines of bytes [current screen size]* Display next k lines of bytes [1]* d or ctrl-D Scroll k lines [current scroll size, initially 11]* q or Q or Exit from bmore s Skip forward k lines of bytes [1] f Skip forward k screenfuls of bytes [1] b or ctrl-B Skip backwards k screenfuls of bytes [1] ' Go to place where previous search started = Display current byte number / Search for kth occurrence of ascii regular expr [1] \ Search for kth occurrence of binary regular expr [1] n Search for kth occurrence of last r.e [1] ! or :! Execute in a subshell v Start up bvi at current position w Start up bvi reading only a screenful of bytes [screen] ctrl-L Redraw screen :n Go to kth next file [1] :p Go to kth previous file [1] :f Display current file name and byte position . Repeat previous command ------------------------------------------------------------------------------- bvi-1.4.0/bvi.10000644000175000017500000005170212415037560012150 0ustar bgbg00000000000000.rn '' }` ''' $RCSfile$$Revision$$Date$ ''' ''' $Log$ ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .ie n \{\ .ds -- \(*W- .ds PI pi .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch .ds L" "" .ds R" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH BVI 1 "BVI Version 1.4.0" "25/Aug/2013" "User Commands" .IX Title "BVI 1" .UC .IX Name "bvi, bview - visual display editor for binary files" .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" .IX Header "NAME" bvi, bview \- visual editor for binary files .SH "VERSION" .IX Header "VERSION" bvi-1.4.0 .SH "SYNOPSIS" .IX Header "SYNOPSIS" \fBbvi\fR\ \ \ [\fB\-R\fR]\ [\fB\-c\fR\ \fIcmd\fR]\ [\fB\-f\fR\ \fIscript\fR]\ [\fB\-s\fR\ \fIskip\fR]\ [\fB\-e\fR\ \fIend\fR]\ [\fB\-n\fR\ \fIlength\fR]\ \fIfile\fR... \fBbview\fR\ [\fB\-R\fR]\ [\fB\-c\fR\ \fIcmd\fR]\ [\fB\-f\fR\ \fIscript\fR]\ [\fB\-s\fR\ \fIskip\fR]\ [\fB\-e\fR\ \fIend\fR]\ [\fB\-n\fR\ \fIlength\fR]\ \fIfile\fR... .SH "OPTIONS" .IX Header "OPTIONS" .Ip "\fIfile\fR..." 4 .IX Item "\fIfile\fR..." A list of filenames. The first one will be the current file and will be read into the buffer. The cursor will be positioned on the first line of the buffer. You can get to the other files with the ":next" command. .Ip "\fB\-R\fR" 4 .IX Item "\fB\-R\fR" \*(L"Readonly": The readonly flag is set for all the files, preventing accidental overwriting with a write command. .Ip "\fB\-s\fR \fIskip\fR" 4 .IX Item "\fB\-s\fR \fIskip\fR" causes bvi to load a file not from the start but from offset \fIskip\fR. Skip offset bytes from the beginning of the input. By default, offset is interpreted as a decimal number. With a leading 0x or 0X, offset is interpreted as a hexadecimal number, otherwise, with a leading 0, offset is interpreted as an octal number. Appending the character b, k, or m to offset causes it to be interpreted as a multiple of 512, 1024, or 1048576, respectively. .Ip "\fB\-e\fR \fIend\fR" 4 .IX Item "\fB\-e\fR \fIend\fR" causes bvi to load a file not till end but till address \fIend\fR. .Ip "\fB\-n\fR \fIlength\fR" 4 .IX Item "\fB\-n\fR \fIlength\fR" causes bvi not to load the complete file but only \fIlength\fR bytes. .Ip "\fB\-c\fR \fIcmd\fR" 4 .IX Item "\fB\-c\fR \fIcmd\fR" \fIcmd\fR will be executed after the first file has been read. If the \fIcmd\fR contains spaces it must be enclosed in double quotes (this depends on the shell that is used). .Ip "\fB\-f\fR \fIscript\fR" 4 .IX Item "\fB\-f\fR \fIscript\fR" This command provides a means for collecting a series of \*(L"ex\*(R" (colon) commands into a script file, then using this file to edit other files. Since there is no binary stream editor \*(L"bsed\*(R", you can use this option to make several global changes in a binary file. .SH "DESCRIPTION" .IX Header "DESCRIPTION" Bvi stands for \*(L"Binary VIsual editor\*(R". Bvi is a screen oriented editor for binary files; its command set is based on that of the \fIvi\fR\|(1) text editor. As a binary editor does not have the concept of \*(L"lines\*(R" there are differences from Vi commands wherever the latter are line orientate. .SH "COMPARISON" .IX Header "COMPARISON" The main differences between Vi and Bvi are: .PP The screen is divided in three sections or panes: The byte offset (extreme left), the hex pane (middle), and an ascii pane (right) which shows as printable characters those bytes in the hex pane. On an 80 column terminal there will be sixteen hex values and their ASCII values on each screen line. Note that (as one would expect) the first byte has the offset \*(L'0\*(R' (zero). .PP You can toggle between the hex and ascii windows with the tab key (TAB). Toggling between these two windows does not change the current position (offset) within the file. .PP No \*(L"lines\*(R" concept: Files are treated as one long stream of bytes. The characters \*(L"newline\*(R" and \*(L"carriage return\*(R" are not special, id est they never mark the end of lines. Therefore the lines on the screen do not represent lines in the usual way. Data is broken across screen lines arbitarily. As a consequence there are no commands in bvi from ex or vi that are based on line numbers, eg \*(L"dd\*(R", \*(L"yy\*(R", \*(L'C\*(R', \*(L'S\*(R', \*(L'o\*(R', \*(L'O\*(R'. This also changes the meaning of \*(L"range\*(R" before the \*(L":write\*(R" command to a byte offset, ie the command \*(L":100,200w foo\*(R" writes all *bytes* (not lines) from offset 100 to offset 200 to the file \*(L"foo\*(R". .PP No \*(L"text objects": There are also no text-specific arrangements like words, paragraphs, sentences, sections and so on. .PP Extended \*(L"ruler": The bottom line of the screen shows the current address (byte offset) and the current character in these notations: .PP .Vb 1 \& octal, hexadecimal, decimal and ascii. .Ve Search patterns: All search commands understand these special characters: .PP .Vb 3 \& . any character \& [] set of characters \& * zero or more occurrences of previous char or set .Ve But as there is no concept of lines you cannot use the standard symbols ("anchors") for \*(L"begin-of-line\*(R" ('^') and \*(L"end-of-line\*(R" ('$'). Searching for the start/end of lines must be done explicitly by adding these special characters to your search pattern using these meta sequences: .PP .Vb 4 \& \en newline \& \er return \& \et tab \& \e0 binary zero .Ve Additional search commands: Similar to the text search commands there are additional hex-search functions \*(L'\e\*(R' and \*(L'#\*(R' which allow to search for any byte value. Example: \*(L"\e62 76 69\*(R" will search for the string \*(L"bvi\*(R". Spaces between hex value are optional, so searching for \*(L"6775636B6573\*(R" will find \*(L"guckes\*(R". .PP Changing the length of data (insertion, deletion) moves the data to other addresses; this is bad for many cases (eg. databases, program files) and is thus disabled by default. You can enable this commands by typing .PP \f(CW :set memmove\fR .PP \fBBVI Modes:\fR .PP Command Mode (Normal Mode): .PP Input is treated as command. Note that command mode is the default mode after startup and after escaping from input mode. Use ESC (escape) to cancel a partial (uncompleted) command. .PP Input Mode: .PP Input is treated as replacement of current characters or (after the end of the file) is appended to the current file. This mode is entered from command mode by typing one of \*(L'i\*(R', \*(L'I\*(R', \*(L'A\*(R', \*(L'r\*(R', or \*(L'R\*(R'. You can enter the characters from the keyboard (in the ASCII window) or hexadecimal values (in the HEX window). Type TAB to switch between these two windows. Type ESC to finish the current input and return to command mode. Type CTRL\-C to cancel current command abnormally. .PP Command line mode (Last Line Mode or : mode): .PP Similar to vi, this mode is entered by typing one of the characters : / ? \e # ! The command is terminated and executed by typing a carriage return; to cancel a partially typed command, type ESC to cancel the current command and return to command mode. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" The editor recognizes the environment variable BVIINIT as a command (or list of commands) to run when it starts up. If this variable is undefined, the editor checks for startup commands in the file \fI~/.bvirc\fR file, which you must own. However, if there is a \fI.bvirc\fR owned by you in the current directory, the editor takes its startup commands from this file \- overriding both the file in your home directory and the environment variable. .SH "TERMINOLOGY" .IX Header "TERMINOLOGY" Characters names are abbreviated as follows: Abbr. ASCII name aka CR 010 carriage return ^A 001 control-a ^H 008 control-h ^I 009 control-i aka TAB ^U 021 control-u ^Z 026 control-z ESC 027 escape aka ESC DEL 127 delete LEFT --- left arrow RIGHT --- right arrow DOWN --- down arrow UP --- up arrow .SH "COMMAND SUMMARY" .IX Header "COMMAND SUMMARY" See the TERMINOLOGY for a summary on key name abbreviations used within the following description of commands. .PP \fBAbstract:\fR Arrow keys move the cursor on the screen within the current window. .PP \fBSample commands:\fR :version show version info <\- v ^ \-> arrow keys move the cursor h j k l same as arrow keys u undo previous change ZZ exit bvi, saving changes :q! quit, discarding changes /\fItext\fR search for \fItext\fR ^U ^D scroll up or down .PP \fBCounts before bvi commands:\fR Numbers may be typed as a prefix to some commands. They are interpreted in one of these ways. .PP .Vb 4 \& screen column | \& byte of file G \& scroll amount ^D ^U \& repeat effect most of the rest .Ve \fBInterrupting, canceling\fR ESC end insert or incomplete command DEL (delete or rubout) interrupts .PP \fBFile manipulation:\fR ZZ if file modified, write and exit; otherwise, exit :w write changed buffer to file :w! write changed buffer to file, overriding read-only ("forced\*(R" write) :q quit when no changes have been made :q! quit and discard all changes :e \fIfile\fR edit \fIfile\fR :e! re-read current file, discard all changes :e # edit the alternate file :e! # edit the alternate file, discard changes :w \fIfile\fR write current buffer to \fIfile\fR :w! \fIfile\fR write current buffer to \fIfile\fR overriding read-only (this \*(L"overwrites\*(R" the file) :sh run the command as set with option \*(L"shell\*(R", then return :!\fIcmd\fR run the command \fIcmd\fR from \*(L"shell\*(R", then return :n edit next file in the argument list :f show current filename, modified flag, current byte offset, and percentage of current position within buffer ^G same as :f .PP \fBAdditional edit commands\fR You can insert/append/change bytes in ASCII/binary/decimal/ hexadecimal or octal representation. You can enter several (screen) lines of input. A line with only a period (.) in it will terminate the command. You must not type in values greater than a byte value. This causes an abandonment of the command. Pressing the CR key does not insert a newline \- character into the file. If you use ASCII mode you can use the special characters \en, \er, \et and \e0. .PP .Vb 3 \& :i aCR insert bytes (ASCII) at cursor position \& :a bCR append bytes (Binary) at end of file \& :c hCR change bytes (hexadecimal) at cursor position .Ve \fBBit-level operations\fR :and \fIn\fR bitwise \*(L'and\*(R' operation with value \fIn\fR :or \fIn\fR bitwise \*(L'or\*(R' operation with value \fIn\fR :xor \fIn\fR bitwise \*(L'xor\*(R' operation with value \fIn\fR :neg two's complement :not logical negation :sl \fIi\fR shift each byte \fIi\fR bits to the left :sr \fIi\fR shift each byte \fIi\fR bits to the right :rl \fIi\fR rotate each byte \fIi\fR bits to the left :rr \fIi\fR rotate each byte \fIi\fR bits to the right .PP \fBCommand mode addresses\fR :w foo write current buffer to a file named \*(L"foo\*(R" :5,10w foo copy byte 5 through 100 into as file named foo :.,.+20w foo copy the current byte and the next 20 bytes to foo :^,'aw foo write all bytes from the beginning through marker \*(L'a\*(R' :/\fIpat\fR/,$ foo search pattern \fIpat\fR and and copy through end of file .PP \fBPositioning within file:\fR ^B backward screen ^F forward screen ^D scroll down half screen ^U scroll up half screen \fIn\fRG go to the specified character (end default), where \fIn\fR is a decimal address /\fIpat\fR next line matching \fIpat\fR ?\fIpat\fR previous line matching \fIpat\fR \e\fIhex\fR jump to next occurrence of hex string \fIhex\fR #\fIhex\fR jump to previous occurrence of hex string \fIhex\fR n repeat last search command N repeat last search command, but in opposite direction .PP \fBAdjusting the screen:\fR ^L clear and redraw screen zCR redraw screen with current line at top of screen z- redraw screen with current line at bottom of screen z. redraw screen with current line at center of screen /\fIpat\fR/z- search for pattern \fIpat\fR and then move currents line to bottom ^E scroll screen down 1 line ^Y scroll screen up 1 line .PP \fBMarking and returning:\fR m\fIx\fR mark current position with lower-case letter \fIx\fR Note: this command works for all lower-case letters \*(L'\fIx\fR move cursor to mark \fIx\fR in ASCII section `\fIx\fR move cursor to mark \fIx\fR in HEX section \*(L'\*(R' move cursor to previous context in ASCII section `` move cursor to previous context in HEX section \fBLine positioning:\fR H jump to first line on screen ("top") L jump to last line on screen ("low") M jump to middle line on screen ("middle") \- jump onto previous line on screen + jump onto next line on screen CR same as + DOWN or j next line, same column UP or k previous line, same column .PP \fBCharacter positioning:\fR ^ first byte in HEX window $ end of screen line l or RIGHT jump onto next byte (within current screen line) h or LEFT jump onto previous byte (within current screen line) ^H same as LEFT space same as RIGHT f\fIx\fR find next occurrence of character \fIx\fR F\fIx\fR find previous occurrence of character \fIx\fR \fIn\fR| jump onto \fIn\fRth byte/character within current line .PP \fBStrings:\fR (works similar to the \fIstrings\fR\|(1) command) Note: \*(L"Words\*(R" are defined as strings of \*(L"nonprinting characters\*(R". e jump to next end of word w jump to next begin of word b jump to previous begin of word W forward to next string delimited with a \e0 or \en B back to previous string delimited with a nonprinting char .PP \fBCorrections during insert:\fR ^H erase last character (backspace) erase your erase character, same as ^H (backspace) ESC ends insertion, back to command mode .PP \fBAppend and replace:\fR A append at end of file rx replace current bte with char \*(L'x\*(R' R enter replace mode; for all subsequent input, the current byte is overwritten with the next input character; leave replace mode with ESC. .PP \fBMiscellaneous Operations:\fR TAB toggle between ASCII and HEX section .PP \fBYank and Put:\fR 3ySPACE yank 3 characters p insert contents of yank buffer o replace text with content of yank buffer P put back at end of file .PP \fBUndo, Redo:\fR u undo last change Note: Only the last change can be undone. Therefore this commands toggles between the last and second-t-last state of the buffer. .PP \fBSetting Options:\fR With the :set command you can set options in bvi .PP .Vb 1 \& Option Default Description .Ve .Vb 19 \& autowrite noaw Save current file, if modified, if you \& give a :n, :r or ! command \& columns cm=16 on an 80 character wide terminal \& ignorecase noic Ignores letter case in searching \& magic nomagic Makes . [ * special in patterns \& memmove nomm enables insert and delete commands \& offset of=0 adds an offset to the diplayed addresses \& readonly noro If set, write fails unless you use ! after command \& scroll sc=1/2 window \& Number of lines scrolled by ^U and ^D \& showmode mo Displays statusline on bottom of the screen \& terse noterse Let you obtain shorter error messages \& window window=screensize \& Lines in window, can be reduced at slow terminals \& wordlength wl=4 Length of an ASCII-string found by w, W, b or B \& wrapscan ws Searches wrap around past the end of the file \& unixstyle nous The representation of ascii characters below \& 32 is displayed in the statusline as shown \& in ascii(7) if unset rather in DOS-style (^A) .Ve .SH "AUTHOR" .IX Header "AUTHOR" bvi was developed by Gerhard Buergmann, Vienna, Austria \fIGerhard.Buergmann@puon.at\fR .SH "WWW" .IX Header "WWW" Bvi\ Homepage:\ \ http://bvi.sourceforge.net/ Vi\ Pages:\ \ \ \ \ \ http://www.guckes.net/vi/clones.php3 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (all\ about\ Vi\ and\ its\ clones) .SH "FILES" .IX Header "FILES" \fI\ $HOME/.bvirc\fR\ \ \ \ \ \ \ \ \ \ editor\ startup\ file \fI\ ./.bvirc\fR\ \ \ \ \ \ \ \ \ \ \ \ \ \ editor\ startup\ file .SH "BUGS" .IX Header "BUGS" Bvi does not update the screen when the terminal changes its size. .SH "SEE ALSO" .IX Header "SEE ALSO" \fIvi\fR\|(1), \fIstrings\fR\|(1), \fIascii\fR\|(5) .rn }` '' bvi-1.4.0/io.c0000644000175000017500000002313112331233374012052 0ustar bgbg00000000000000/* io.c - file in/out and alloc subroutines for BVI * * 1996-02-28 V 1.0.0 * 1999-01-20 V 1.1.0 * 1999-04-27 V 1.1.1 * 1999-07-02 V 1.2.0 beta * 1999-10-15 V 1.2.0 final * 2000-03-23 V 1.3.0 beta * 2000-08-17 V 1.3.0 final * 2004-01-04 V 1.3.2 * 2010-06-02 V 1.3.4 * 2014-05-03 V 1.4.0 * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2014 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include "bvi.h" #include "set.h" #if 0 /* nowadays (2009) we should make sure that bvi is compiled with LFS support: */ /* defines _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64 */ /* if compiled without LFS support, stat() open() lseek() will fail with */ /* EOVERFLOW(75) Value too large for defined data type */ /* see README for configure arguments to enable lfs support in 32-bit executables */ /* cygwin enables lfs by default */ #endif #include # ifndef OFF_T_MAX # define OFF_T_MAX ULONG_LONG_MAX # endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_FCNTL_H # include #endif int filemode; static struct stat buf; static off_t block_read; char *terminal; /*********** Save the patched file ********************/ int save(fname, start, end, flags) char *fname; char *start; char *end; int flags; { int fd; char *string; char *newstr; off_t filesize; if (!fname) { emsg("No file|No current filename"); return 0; } string = malloc((size_t)strlen(fname) + MAXCMD); if (string == NULL) { emsg("Out of memory"); return 0; } if (stat(fname, &buf) == -1) { newstr = "[New file] "; } else { if (S_ISDIR(buf.st_mode)) { sprintf(string, "\"%s\" Is a directory", fname); msg(string); free(string); return 0; } else if (S_ISCHR(buf.st_mode)) { sprintf(string, "\"%s\" Character special file", fname); msg(string); free(string); return 0; } else if (S_ISBLK(buf.st_mode)) { /* sprintf(string, "\"%s\" Block special file", fname); msg(string); return 0; */ } newstr = ""; } if (filemode == PARTIAL) flags = O_RDWR; if ((fd = open(fname, flags, 0666)) < 0) { sysemsg(fname); free(string); return 0; } if (filemode == PARTIAL) { if (block_read) { filesize = block_read; sprintf(string, "\"%s\" range %llu-%llu", fname, (unsigned long long)block_begin, (unsigned long long)(block_begin - 1 + filesize)); if (lseek(fd, block_begin, SEEK_SET) < 0) { sysemsg(fname); free(string); return 0; } } else { msg("Null range"); free(string); return 0; } } else { filesize = end - start + 1L; sprintf(string, "\"%s\" %s%llu bytes", fname, newstr, (unsigned long long)filesize); } if (write(fd, start, filesize) != filesize) { sysemsg(fname); free(string); close(fd); return 0; } close(fd); edits = 0; msg(string); free(string); return 1; } /* loads a file, returns the filesize */ off_t load(fname) char *fname; { int fd = -1; char *string; buf.st_size = 0L; if (fname != NULL) { /* sprintf(string, "\"%s\"", fname); msg(string); refresh(); */ if (stat(fname, &buf) == -1) { /* check for EOVERFLOW 75 */ /* Value too large for defined data type */ /* means bvi is compiled without lfs support */ if (errno == ENOENT) { filemode = NEW; } else { move(maxy, 0); endwin(); perror(fname); exit(0); } /* } else if (S_ISDIR(buf.st_mode)) { filemode = DIRECTORY; */ } else if (S_ISCHR(buf.st_mode)) { filemode = CHARACTER_SPECIAL; } else if (S_ISBLK(buf.st_mode)) { filemode = BLOCK_SPECIAL; if (!block_flag) { block_flag = 1; block_begin = 0; block_size = 1024; block_end = block_begin + block_size - 1; } if ((fd = open(fname, O_RDONLY)) > 0) { P(P_RO) = TRUE; params[P_RO].flags |= P_CHANGED; } else { sysemsg(fname); filemode = ERROR; } } else if (S_ISREG(buf.st_mode) || S_ISDIR(buf.st_mode)) { #if 0 /* stat() call above will fail if file is too large */ /* this size check will never fail */ if ((unsigned long long)buf.st_size > (unsigned long long)OFF_T_MAX) { move(maxy, 0); endwin(); printf("File too large\n"); exit(0); } #endif if ((fd = open(fname, O_RDONLY)) > 0) { if (S_ISREG(buf.st_mode)) { filemode = REGULAR; } else { filemode = DIRECTORY; } if (access(fname, W_OK)) { P(P_RO) = TRUE; params[P_RO].flags |= P_CHANGED; } } else { sysemsg(fname); filemode = ERROR; } } } else { filemode = NEW; } if (mem != NULL) free(mem); memsize = 1024; if (block_flag) { if (block_flag == BLOCK_BEGIN) { block_size = buf.st_size - block_begin; } memsize += block_size; } else if (filemode == REGULAR) { memsize += buf.st_size; } if ((mem = (char *)malloc(memsize)) == NULL) { move(maxy, 0); endwin(); printf("Out of memory\n"); exit(0); } clear_marks(); if (fname != NULL) { string = malloc((size_t)strlen(fname) + MAXCMD); } else { string = malloc(MAXCMD); } if (string == NULL) { emsg("Out of memory"); return 0; } if (block_flag && ((filemode == REGULAR) || (filemode == BLOCK_SPECIAL))) { if (lseek(fd, block_begin, SEEK_SET) < 0) { sysemsg(fname); filemode = ERROR; } else { if ((filesize = read(fd, mem, block_size)) == 0) { sprintf(string, "\"%s\" Empty file", fname); filemode = ERROR; } else { sprintf(string, "\"%s\" range %llu-%llu", fname, (unsigned long long)block_begin, (unsigned long long)(block_begin + filesize - 1)); filemode = PARTIAL; block_read = filesize; P(P_OF) = block_begin; params[P_OF].flags |= P_CHANGED; } msg(string); refresh(); } } else if ((filemode == REGULAR) || (filemode == DIRECTORY)) { filesize = buf.st_size; if (read(fd, mem, filesize) != filesize) { sysemsg(fname); filemode = ERROR; } } else { filesize = 0L; } if (fd > 0) close(fd); if (fname != NULL) { switch (filemode) { case NEW: sprintf(string, "\"%s\" [New File]", fname); break; case REGULAR: sprintf(string, "\"%s\" %s%llu bytes", fname, P(P_RO) ? "[Read only] " : "", (unsigned long long)filesize); break; case DIRECTORY: sprintf(string, "\"%s\" Directory", fname); break; case CHARACTER_SPECIAL: sprintf(string, "\"%s\" Character special file", fname); break; case BLOCK_SPECIAL: sprintf(string, "\"%s\" Block special file", fname); break; } if (filemode != ERROR) msg(string); } pagepos = mem; maxpos = mem + filesize; loc = HEX; x = AnzAdd; y = 0; repaint(); free(string); return(filesize); } /* argument "dir" not used! * Needed for DOS version only */ void bvi_init(dir) char *dir; { char *initstr; char rcpath[MAXCMD]; terminal = getenv("TERM"); shell = getenv("SHELL"); if (shell == NULL || *shell == '\0') shell = "/bin/sh"; if ((initstr = getenv("BVIINIT")) != NULL) { docmdline(initstr); return; } #ifdef DJGPP strcpy(rcpath, "c:"); strcpy(rcpath, dir); poi = strrchr(rcpath, '\\'); *poi = '\0'; strcat(rcpath, "\\BVI.RC"); read_rc(rcpath); read_rc("BVI.RC"); #else strncpy(rcpath, getenv("HOME"), MAXCMD - 8); rcpath[MAXCMD - 8] = '\0'; strcat(rcpath, "/.bvirc"); if (stat(rcpath, &buf) == 0) { if (buf.st_uid == getuid()) read_rc(rcpath); } strcpy(rcpath, ".bvirc"); if (stat(rcpath, &buf) == 0) { if (buf.st_uid == getuid()) read_rc(rcpath); } #endif } int enlarge(add) off_t add; { char *newmem; off_t savecur, savepag, savemax, saveundo; savecur = curpos - mem; savepag = pagepos - mem; savemax = maxpos - mem; saveundo = undo_start - mem; if (mem == NULL) { newmem = malloc(memsize + add); } else { newmem = realloc(mem, memsize + add); } if (newmem == NULL) { emsg("Out of memory"); return 1; } mem = newmem; memsize += add; curpos = mem + savecur; pagepos = mem + savepag; maxpos = mem + savemax; undo_start = mem + saveundo; current = curpos + 1L; return 0; } void do_shell() { int ret; addch('\n'); savetty(); #ifdef DJGPP ret = system(""); #else ret = system(shell); #endif resetty(); } #ifndef HAVE_STRDUP char * strdup(s) char *s; { char *p; size_t n; n = strlen(s) + 1; if ((p = (char *)malloc(n)) != NULL) memcpy(p, s, n); return (p); } #endif #ifndef HAVE_MEMMOVE /* * Copy contents of memory (with possible overlapping). */ char * memmove(s1, s2, n) char *s1; char *s2; size_t n; { bcopy(s2, s1, n); return(s1); } #endif off_t alloc_buf(n, buffer) off_t n; char **buffer; { if (*buffer == NULL) { *buffer = (char *)malloc(n); } else { *buffer = (char *)realloc(*buffer, n); } if (*buffer == NULL) { emsg("No buffer space available"); return 0L; } return n; } int addfile(fname) char *fname; { int fd; off_t oldsize; if (stat(fname, &buf)) { sysemsg(fname); return 1; } if ((fd = open(fname, O_RDONLY)) == -1) { sysemsg(fname); return 1; } oldsize = filesize; if (enlarge(buf.st_size)) return 1; if (read(fd, mem + filesize, buf.st_size) == -1) { sysemsg(fname); return 1; } filesize += buf.st_size; maxpos = mem + filesize; close(fd); setpage(mem + oldsize); return 0; } bvi-1.4.0/bm_unix.c0000644000175000017500000001071712206452025013107 0ustar bgbg00000000000000/* bm_unix.c - Unix specific subroutines for BMORE * * 2000-05-31 V 1.3.0 beta * 2000-10-12 V 1.3.0 final * 2002-02-10 V 1.3.1 * 2003-07-04 V 1.3.2 * 2010-06-02 V 1.3.4 * 2013-08-22 V 1.4.0 * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2013 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include "bmore.h" #include #define TBUFSIZ 1024 #define stty(fd,argp) tcsetattr(fd,TCSAFLUSH,argp) struct termios ostate, nstate; char *rev_start, *rev_end; /* enter and exit standout mode */ char *Home; /* go to home */ char *clear_sc; /* clear screen */ char *erase_ln; /* erase line */ extern off_t bytepos, screen_home; extern FILE *curr_file; int got_int; int fnum, no_intty, no_tty, slow_tty; int dum_opt, dlines; #ifdef HAVE_NCURSES_H # undef NEED_PUTC_CHAR #endif /* * A real function, for the tputs routine */ #ifdef NEED_PUTC_CHAR int putchr(char ch) {return putchar((int)ch);} #else int putchr(ch) int ch; {return putchar(ch);} #endif void initterm() { char buf[TBUFSIZ]; static char clearbuf[TBUFSIZ]; char *term; char *clearptr; struct termios nstate; no_tty = tcgetattr(fileno(stdout), &ostate); if (!no_tty) { nstate = ostate; /* * is this really necessary?? * nstate.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHONL); */ nstate.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHONL); nstate.c_cc[VMIN] = 1; nstate.c_cc[VTIME] = 0; tcsetattr(fileno(stdin), TCSADRAIN, &nstate); } #ifdef DJGPP maxx = 80; maxy = 25; #else if ((term = getenv("TERM")) == 0 || tgetent(buf, term) <= 0) { printf("Dumb terminal\n"); maxx = 80; maxy = 24; } else { maxy = tgetnum("li"); maxx = tgetnum("co"); } clearptr = clearbuf; erase_ln = tgetstr("ce", &clearptr); clear_sc = tgetstr("cl", &clearptr); rev_start = tgetstr("so", &clearptr); rev_end = tgetstr("se", &clearptr); #endif no_intty = tcgetattr(fileno(stdin), &ostate); tcgetattr(fileno(stderr), &ostate); nstate = ostate; if (!no_tty) { ostate.c_lflag &= ~(ICANON|ECHO); } } void set_tty() { if (no_tty) return; ostate.c_lflag &= ~(ICANON|ECHO); stty(fileno(stderr), &ostate); } void reset_tty() { if (no_tty) return; ostate.c_lflag |= ICANON|ECHO; stty(fileno(stderr), &ostate); } void sig(sig) int sig; { reset_tty(); printf("\r\n"); exit(0); } /* * doshell() - run a command or an interactive shell */ void doshell(cmd) char *cmd; { int ret; #ifndef DJGPP char *getenv(); char *shell; char cline[128]; #endif printf("\n"); #ifndef DJGPP if ((shell = getenv("SHELL")) == NULL) shell = "sh"; else if(strrchr(shell,'/')) shell=(char *)(strrchr(shell,'/')+1); if (cmd[0] == '\0') { sprintf(cline, "%s -i", shell); cmd = cline; } else { sprintf(cline, "%s -c \"%s\"", shell, cmd); cmd = cline; } #endif reset_tty(); ret = system(cmd); set_tty(); printf("\r"); home(); fseeko(curr_file, screen_home, SEEK_SET); bytepos = screen_home; } void highlight() { #ifndef DJGPP if (rev_start && rev_end) tputs(rev_start, 1, putchr); #endif } void normal() { #ifndef DJGPP if (rev_start && rev_end) tputs(rev_end, 1, putchr); #endif } void clearscreen() { #ifdef DJGPP /* if (!no_tty) { int n; for (n = 0; n < maxy; n++) { cleartoeol(); printf("\n"); } } */ #else tputs(clear_sc, 1, putchr); #endif } void home() { #ifdef DJGPP if (!no_tty) printf("\r"); #else tputs(Home, 1, putchr); #endif } /* force clear to end of line */ void cleartoeol() { #ifdef DJGPP int n; home(); if (!no_tty) for (n = 1; n < maxx; n++) printf(" "); home(); #else tputs(erase_ln, 1, putchr); #endif } int vgetc() { char cha; extern int errno; errno = 0; if (read(2, &cha, 1) <= 0) { if (errno != EINTR) exit(2); } return (cha); } #ifndef HAVE_MEMMOVE /* * Copy contents of memory (with possible overlapping). */ char * memmove(s1, s2, n) char *s1; char *s2; size_t n; { bcopy(s2, s1, n); return(s1); } #endif bvi-1.4.0/script0000644000175000017500000000005112272220125012514 0ustar bgbg00000000000000set columns=8 set mm 0,20d w! %.new q bvi-1.4.0/bvi.h0000644000175000017500000001660612413047467012250 0ustar bgbg00000000000000/* BVI.H * * 1996-02-28 V 1.0.0 * 1999-01-21 V 1.1.0 * 1999-03-17 V 1.1.1 * 1999-07-01 V 1.2.0 beta * 1999-08-21 V 1.2.0 final * 2000-05-10 V 1.3.0 alpha * 2000-10-24 V 1.3.0 final * 2001-10-29 V 1.3.1 * 2003-07-04 V 1.3.2 * 2010-08-04 V 1.3.4 * 2014-10-01 V 1.4.0 * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2014 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include #include #include #include #include #include #include #include #define JOEHTG #if defined(__MSDOS__) && !defined(DJGPP) # include "patchlev.h" # include "dosconf.h" # include "doscur.h" # include #else # include "patchlevel.h" # include "config.h" #if HAVE_NCURSES_H # include #else # include #endif #endif /* defines for filemode */ #define ERROR -1 #define REGULAR 0 #define NEW 1 #define DIRECTORY 2 #define CHARACTER_SPECIAL 3 #define BLOCK_SPECIAL 4 #define PARTIAL 5 /* regular expressions */ #define END 0 #define ONE 1 #define STAR 2 /* undo modes */ #define U_EDIT 1 /* undo o r R */ #define U_TRUNC 2 /* undo D */ #define U_INSERT 4 /* undo i */ #define U_DELETE 8 /* undo x */ #define U_BACK 16 /* undo X */ #define U_APPEND 32 /* undo P A */ #define U_TILDE 64 /* ~ */ #define S_GLOBAL 0x100 /* logic modes */ #define LSHIFT 1 #define RSHIFT 2 #define LROTATE 3 #define RROTATE 4 #define AND 5 #define OR 6 #define XOR 7 #define NEG 8 #define NOT 9 #define HEX 0 #define ASCII 1 #define FORWARD 0 #define BACKWARD 1 #define CR '\r' #define NL '\n' #define BS 8 #define ESC 27 #define SEARCH 0 #define BVICTRL(n) (n&0x1f) #define ASCII_DEL 0x7f #define CMDLNG(a,b) (len <= a && len >= b) #ifndef NULL # define NULL ((void *)0) #endif #ifndef TRUE # define TRUE 1 # define FALSE 0 #endif #if defined(__MSDOS__) && !defined(DJGPP) # define ANSI # define PTR char huge * # define off_t long # define DELIM '\\' # define strncasecmp strnicmp # define strcasecmp stricmp # define memcpy d_memcpy # define memmove d_memmove #else # define PTR char * # define DELIM '/' #endif #define MAXCMD 255 #define BUFFER 1024 #define SKIP_WHITE while(*cmd!='\0'&&isspace(*cmd))cmd++; typedef enum _block_datum { BLOCK_BEGIN = 1, BLOCK_END = 2, BLOCK_LEN = 4 } block_datum; #ifdef DEBUG extern FILE *debug_fp; #endif #ifndef HAVE_STRERROR extern char *sys_errlist[]; #endif extern char *version; extern char addr_form[]; extern char search_pat[]; extern long hl_spat; extern char pattern[]; extern char rep_buf[]; extern int maxx, maxy, x, y; extern int filemode, loc; extern int edits, new; extern int AnzAdd; extern int Anzahl, Anzahl3; extern int addr_flag; extern int ignore_case, magic; extern int screen, status, statsize; extern PTR mem; extern PTR maxpos; extern PTR pagepos; extern PTR undo_start; extern PTR current_start; extern PTR curpos; extern PTR current; extern PTR start_addr; extern PTR end_addr; extern char *name, cmdstr[]; extern off_t filesize, memsize; extern PTR markbuf[]; extern PTR last_motion; extern off_t undo_count; extern off_t yanked; extern off_t undosize; extern char *copyright, *notfound; extern char *terminal; extern char *undo_buf; extern char *yank_buf; extern int repl_count; extern char string[]; extern char *shell; extern char *poi; extern int smode; extern int again; extern int block_flag; extern off_t block_begin, block_end, block_size; #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #endif #if defined(__MSDOS__) && !defined(DJGPP) void d_memcpy(PTR, PTR, off_t); void d_memmove(PTR, PTR, off_t); #endif #ifdef ANSI off_t alloc_buf(off_t, char **), yd_addr(void); off_t range(int); void do_dot(void), do_exit(void), do_shell(void), do_undo(void); void do_tilde(off_t), trunc_cur(void); void do_back(off_t, PTR), do_ins_chg(PTR, char *, int); void do_mark(int, PTR), badcmd(char *), movebyte(void); void docmdline(char *), do_over(PTR, off_t, PTR), do_put(PTR, off_t, PTR); void jmpproc(int), printline(PTR, int); int addfile(char *); int bregexec(PTR, char *); int chk_comm(int); int doecmd(char *, int); int do_append(off_t, char *), do_logic(int, char *); int do_delete(off_t, PTR); int doset(char *); int do_substitution(int, char *, PTR, PTR); int hexchar(void); int outmsg(char *); PTR searching(int, char *, PTR, PTR, int); PTR wordsearch(PTR, char); PTR backsearch(PTR, char); PTR fsearch(PTR, PTR, char *); PTR fsearch_end(PTR, PTR, char *, PTR *); PTR rsearch(PTR, PTR, char *); PTR end_word(PTR); PTR calc_addr(char **, PTR); PTR do_ft(int, int); char *patcpy(char *, char *, char); void setpage(PTR), msg(char *), emsg(char *), smsg(char *); void usage(void), bvi_init(char *), statpos(void), setcur(void); void showparms(int), toggle(void), scrolldown(int), scrollup(int); void fileinfo(char *); void clearstr(void), clear_marks(void), repaint(void), new_screen(void); void quit(void), sysemsg(char *), do_z(int), stuffin(char *); off_t edit(int), load(char *); off_t calc_size(char *); int ascii_comp(char *, char *), hex_comp(char *, char *); int cur_forw(int), cur_back(void); int lineout(void), save(char *, PTR, PTR, int); int at_least(char *, char *, int); int vgetc(void), xpos(void), enlarge(off_t); int getcmdstr(char *, int), read_rc(char *); int wait_return(int); #else int addfile(); off_t alloc_buf(), yd_addr(); off_t range(); off_t calc_size(); void do_mark(), badcmd(), movebyte(); void do_back(), do_ins_chg(); void jmpproc(), printline(); int chk_comm(); void docmdline(), do_over(), do_put(); int doecmd(); void do_dot(), do_exit(), do_shell(), do_undo(); void do_tilde(), trunc_cur(); int do_append(), do_logic(); int do_delete(); int doset(); int do_substitution(); int hexchar(); int outmsg(); PTR searching(); PTR wordsearch(); PTR backsearch(); /* int bregexec(); */ PTR bregexec(); PTR fsearch(); PTR fsearch_end(); PTR rsearch(); PTR end_word(); PTR calc_addr(); PTR do_ft(); char *patcpy(); void setpage(), msg(), emsg(), smsg(); void usage(), bvi_init(), statpos(), setcur(); void showparms(), toggle(), scrolldown(), scrollup(); void fileinfo(); void clearstr(), clear_marks(), new_screen(), repaint(); void quit(), sysemsg(), do_z(), stuffin(); off_t edit(), load(); int ascii_comp(), hex_comp(); int cur_forw(), cur_back(); int lineout(), save(), at_least(), read_rc(); int getcmdstr(), enlarge(); int vgetc(), xpos(); int wait_return(); #endif bvi-1.4.0/bmore.c0000644000175000017500000004565312213544534012566 0ustar bgbg00000000000000/* BMORE - binary more * * 1990-01-31 V 1.0.0 * 1990-09-04 V 1.1.0 * 2000-05-31 V 1.3.0 beta * 2000-10-18 V 1.3.0 final * 2002-01-16 V 1.3.1 * 2004-01-09 V 1.3.2 * 2013-08-23 V 1.4.0 * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1990-2013 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include #ifdef HAVE_LOCALE_H # include #endif #if defined(__MSDOS__) && !defined(DJGPP) # define PRINTF cprintf #else # define PRINTF printf #ifndef HELPFILE # ifdef DJGPP # define HELPFILE "/dev/env/DJDIR/lib/bmore.help" # else # define HELPFILE "/usr/local/lib/bmore.help" # endif #endif #endif #include "bmore.h" char *copyright = "Copyright (C) 1990-2013 by Gerhard Buergmann"; int maxx, maxy; int mymaxx = 0, mymaxy = 0; char *name = NULL; char sstring[MAXCMD] = ""; /* string for search */ char estring[MAXCMD] = ""; /* string for shell escape */ char string[MAXCMD]; FILE *curr_file = NULL, *help_file; int AnzAdd; long precount = -1; /* number preceding command */ char **files; /* list of input files */ int numfiles; /* number of input files */ int file_nr = 0; /* number of current input file */ int arrnum = 0; char numarr[64]; /* string for collecting number */ char addr_form[15]; int ascii_flag = 0; int dup_print_flag = 0; int c_flag = 0, d_flag = 0; int exval = 0; int init_search = 0; char buffer1[MAXCMD], buffer2[MAXCMD]; int out_len; int corr = 0, do_header = 0, to_print; off_t init_byte = 0; off_t last_search = 0; off_t screen_home, filesize; off_t bytepos, oldpos; int prompt = 1; char helppath[MAXCMD]; static char progname[10]; static char cmdbuf[MAXCMD]; static int cnt = 0; static int icnt = 0; static int smode; /* char search_pat[BUFFER]; */ /* / or ? command */ char bmore_search_pat[BUFFER]; /* / or ? command */ char *emptyclass = "Empty byte class '[]' or '[^]'"; /* -a ASCII mode * -d beginners mode * -c clear before displaying * -i ignore case * -n number of lines/screen * -w width of screen */ void usage() { fprintf(stderr, "Usage: %s [-acdi] [-lines] [+linenum | +/pattern] name1 name2 ...\n", progname); exit(1); } int main(argc, argv) int argc; char *argv[]; { int ch, ch1; int colon = 0, last_ch = 0; long last_pre = 0; int lflag, repeat; long count; int i, n = 1; int d_line, r_line, z_line; char *poi; #if defined(__MSDOS__) && !defined(DJGPP) strcpy(helppath, argv[0]); poi = strrchr(helppath, '\\'); *poi = '\0'; strcat(helppath, "\\BMORE.HLP"); #else strncpy(helppath, HELPFILE, MAXCMD - 1); #endif #ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); #endif poi = strrchr(argv[0], DELIM); if (poi) strncpy(progname, ++poi, 9); else strncpy(progname, argv[0], 9); strtok(progname, "."); while (n < argc) { switch (argv[n][0]) { case '-': if (argv[n][1] >= '0' && argv[n][1] <= '9') { sscanf(&argv[n][1], "%dx%d", &mymaxy, &mymaxx); } else if (argv[n][1] == 'n') { if (argv[n+1] == NULL || argv[n+1][0] == '-') { usage(); } else { sscanf(&argv[++n][0], "%d", &mymaxy); } } else if (argv[n][1] == 'w') { if (argv[n+1] == NULL || argv[n+1][0] == '-') { usage(); } else { sscanf(&argv[++n][0], "%d", &mymaxx); } } else { i = 1; while (argv[n][i] != '\0') { switch (argv[n][i]) { case 'a': ascii_flag++; break; case 'c': c_flag++; break; case 'd': d_flag++; break; case 'i': ignore_case++; break; default: usage(); } i++; } } n++; break; case '+': /* +cmd */ if (argv[n][1] == '/' || argv[n][1] == '\\') { init_search = argv[n][1]; strcpy(sstring, &argv[n][2]); } else { init_byte = strtoll(argv[n] + 1, NULL, 0); } n++; break; default: /* must be a file name */ name = strdup(argv[n]); files = &(argv[n]); numfiles = argc - n; n = argc; break; } } initterm(); set_tty(); maxy -= 2; if (mymaxy) { maxy = mymaxy; } z_line = maxy; d_line = maxy / 2; r_line = 1; if (numfiles == 0) { curr_file = stdin; if (isatty(fileno(stdin)) != 0) { reset_tty(); usage(); } } else { file_nr = 1; while (open_file(name)) { do_next(1); } if (exval) { } else { fseeko(curr_file, init_byte, SEEK_SET); bytepos += init_byte; } } screen_home = bytepos; AnzAdd = 10; strcpy(addr_form, "%08lX "); if (ascii_flag) out_len = ((maxx - AnzAdd - 1) / 4) * 4; else out_len = ((maxx - AnzAdd - 1) / 16) * 4; if (mymaxx) { out_len = mymaxx; } if (init_search) bmsearch(init_search); if (no_tty) { int fileloop; for (fileloop = 0; fileloop < numfiles; fileloop++) { while(!printout(1)); do_next(1); open_file(name); } if (curr_file) fclose(curr_file); reset_tty(); exit(exval); } if (!exval) { if (printout(maxy)) { do_next(1); } } signal(SIGINT, sig); signal(SIGQUIT, sig); /* main loop */ do { to_print = 0; dup_print_flag = 0; if (prompt) { if (prompt == 2) { while (open_file(name)) { do_next(1); } } highlight(); PRINTF("--More--"); if (prompt == 2) { PRINTF("(Next file: %s)", name); } else if (!no_intty && filesize) { PRINTF("(%d%%)", (int)((bytepos * 100) / filesize)); } if (d_flag) PRINTF("[Press space to continue, 'q' to quit]"); normal(); fflush(stdout); } ch = vgetc(); /* if (prompt == 2) { open_file(name); } */ prompt = 1; PRINTF("\r"); while (ch >= '0' && ch <= '9') { numarr[arrnum++] = ch; ch = vgetc(); } numarr[arrnum] = '\0'; if (arrnum != 0) precount = strtol(numarr, (char **)NULL, 10); else precount = -1; lflag = arrnum = 0; if (ch == '.') { precount = last_pre; ch = last_ch; repeat = 1; } else { last_pre = precount; last_ch = ch; if (ch == ':') colon = vgetc(); repeat = 0; } switch (ch) { case ' ': /* Display next k lines of text [current screen size] */ dup_print_flag = 1; if (precount > 0) to_print = precount; else to_print = maxy; break; case 'z': /* Display next k lines of bytes [current screen size]* */ dup_print_flag = 1; if (precount > 0) z_line = precount; to_print = z_line; break; case '\r': case '\n': /* Display next k lines of text [current screen size]* */ dup_print_flag = 1; if (precount > 0) r_line = precount; to_print = r_line; break; case 'q': case 'Q': cleartoeol(); fclose(curr_file); reset_tty(); exit(exval); case ':' : switch (colon) { case 'f': prompt = 0; if (!no_intty) PRINTF("\"%s\" line %lu", name, (unsigned long)(bytepos - out_len)); else PRINTF("[Not a file] line %lu", (unsigned long)(bytepos - out_len)); fflush(stdout); break; case 'n': if (precount < 1) precount = 1; do_next(precount); PRINTF("\r"); cleartoeol(); PRINTF("\n...Skipping to file %s\r\n\r\n", name); prompt = 2; break; case 'p': if (precount < 1) precount = 1; do_next(-precount); PRINTF("\r"); cleartoeol(); PRINTF("\n...Skipping back to file %s\r\n\r\n", name); prompt = 2; break; case 'q': cleartoeol(); fclose(curr_file); reset_tty(); exit(exval); break; case '!': if (!no_intty) { cleartoeol(); if (rdline(colon, estring)) break; doshell(estring); PRINTF("------------------------\r\n"); break; } default: bmbeep(); } break; case '!': if (!no_intty) { cleartoeol(); if (rdline(ch, estring)) break; doshell(estring); PRINTF("------------------------\r\n"); break; } case 'd': /* Scroll k lines [current scroll size, initially 11]* */ case BVICTRL('D'): if (precount > 0) d_line = precount; to_print = d_line; break; case BVICTRL('L'): /*** REDRAW SCREEN ***/ if (no_intty) { bmbeep(); } else { clearscreen(); to_print = maxy + 1; fseeko(curr_file, screen_home, SEEK_SET); bytepos = screen_home; } break; case 'b': /* Skip backwards k screenfuls of text [1] */ case BVICTRL('B'): if (no_intty) { bmbeep(); } else { if (precount < 1) precount = 1; PRINTF("...back %ld page", precount); if (precount > 1) { PRINTF("s\r\n"); } else { PRINTF("\r\n"); } screen_home -= (maxy + 1) * out_len; if (screen_home < 0) screen_home = 0; fseeko(curr_file, screen_home, SEEK_SET); bytepos = screen_home; to_print = maxy + 1; } break; case 'f': /* Skip forward k screenfuls of bytes [1] */ case 's': /* Skip forward k lines of bytes [1] */ if (precount < 1) precount = 1; if (ch == 'f') { count = maxy * precount; } else { count = precount; } putchar('\r'); cleartoeol(); PRINTF("\n...skipping %ld line", count); if (count > 1) { PRINTF("s\r\n\r\n"); } else { PRINTF("\r\n\r\n"); } screen_home += (count + maxy) * out_len; fseeko(curr_file, screen_home, SEEK_SET); bytepos = screen_home; to_print = maxy; break; case '\\': if (ascii_flag) { bmbeep(); break; } case '/': /**** Search String ****/ if (!repeat) { cleartoeol(); if (rdline(ch, sstring)) break; } case 'n': /**** Search Next ****/ case 'N': bmsearch(ch); /* to_print--; */ break; case '\'': if (no_intty) { bmbeep(); } else { bytepos = last_search; fseeko(curr_file, bytepos, SEEK_SET); screen_home = bytepos; to_print = maxy; PRINTF("\r"); cleartoeol(); PRINTF("\n\r\n***Back***\r\n\r\n"); } break; case '=': prompt = 0; cleartoeol(); PRINTF("%lX hex %lu dec", (unsigned long)bytepos, (unsigned long)bytepos); fflush(stdout); break; case '?': case 'h': if ((help_file = fopen(helppath, "r")) == NULL) { emsg("Can't open help file"); break; } while ((ch1 = getc(help_file)) != EOF) putchar(ch1); fclose(help_file); to_print = 0; break; case 'w': case 'v': if (!no_intty) { cleartoeol(); if (ch == 'v') { sprintf(string, "bvi +%lu %s", (unsigned long)(screen_home + (maxy + 1) / 2 * out_len), name); } else { if (precount < 1) precount = bytepos - screen_home; sprintf(string, "bvi -b %lu -s %lu %s", (unsigned long)screen_home, (unsigned long)precount, name); } doshell(string); to_print = maxy + 1; break; } default : if (d_flag) { emsg("[Press 'h' for instructions.]"); } else { bmbeep(); } break; } if (to_print) { if (printout(to_print)) { do_next(1); } } } while (1); } int rdline(ch, sstring) int ch; char *sstring; { int i = 0; int ch1 = 0; char bstring[MAXCMD]; if (ch == '!') { strcpy(bstring, sstring); sstring[0] = '\0'; } putchar(ch); fflush(stdout); while (i < MAXCMD) { ch1 = vgetc(); if (ch1 == '\n' || ch1 == '\r' || ch1 == ESC) { break; } else if (ch1 == 8) { if (i) { sstring[--i] = '\0'; PRINTF("\r%c%s", ch, sstring); cleartoeol(); } else { ch1 = ESC; break; } } else if (ch1 == '!' && i == 0) { if (bstring[0] == '\0') { emsg("No previous command"); return 1; } putchar(ch1); PRINTF("\r%c%s", ch, bstring); strcat(sstring, bstring); i = strlen(sstring); } else { putchar(ch1); sstring[i++] = ch1; } fflush(stdout); } if (ch1 == ESC) { putchar('\r'); cleartoeol(); return 1; } if (i) sstring[i] = '\0'; return 0; } void do_next(n) int n; { if (numfiles) { if (n == 1 && file_nr == numfiles) { if (curr_file) fclose(curr_file); reset_tty(); exit(exval); } if ((file_nr + n) > numfiles) file_nr = numfiles; else if ((file_nr + n) < 1) file_nr = 1; else file_nr += n; prompt = 2; free(name); name = strdup(*(files + file_nr - 1)); } else { if (curr_file) fclose(curr_file); reset_tty(); exit(exval); } } int open_file(name) char *name; { struct stat buf; if (stat(name, &buf) > -1) { filesize = buf.st_size; } if (curr_file) fclose(curr_file); if (numfiles > 1) do_header = 1; if ((curr_file = fopen(name, "rb")) == NULL) { perror(name); exval = 1; return 1; } bytepos = screen_home = 0; return 0; } void putline(buf, num) char *buf; int num; { int print_pos; unsigned char ch; PRINTF(addr_form, (unsigned long)bytepos); for (print_pos = 0; print_pos < num; print_pos++) { ch = buf[print_pos]; if (!ascii_flag) { PRINTF("%02X ", ch); } ++bytepos; if ((ch > 31) && (ch < 127)) *(string + print_pos) = ch; else *(string + print_pos) = '.'; } for (; print_pos < out_len; print_pos++) { if (!ascii_flag) { PRINTF(" "); } ++bytepos; *(string + print_pos) = ' '; } *(string + num) = '\0'; if (no_tty) PRINTF("%s\n", string); else PRINTF("%s\r\n", string); } int printout(lns) int lns; { int c, num; int doub = 0; static int flag; if (c_flag) { clearscreen(); } if (do_header) { if (no_tty) { PRINTF("::::::::::::::\n%s\n::::::::::::::\n", name); } else { PRINTF("\r"); cleartoeol(); PRINTF("::::::::::::::\r\n%s\r\n::::::::::::::\r\n", name); } do_header = 0; corr = 2; } if (corr && (lns > maxy - 2)) lns -= corr; corr = 0; do { for (num = 0; num < out_len; num++) { if ((c = nextchar()) == -1) break; buffer1[num] = c; } if (!num) return 1; if (memcmp(buffer1, buffer2, num) || !bytepos || !dup_print_flag) { memcpy(buffer2, buffer1, num); putline(buffer2, num); if (!no_tty) flag = TRUE; lns--; } else { if (flag) { cleartoeol(); PRINTF("*\r\n"); lns--; } else { doub++; } flag = FALSE; bytepos += num; } if (lns == 0) { screen_home = bytepos - ((maxy + 1 + doub) * out_len); if (screen_home < 0) screen_home = 0; return 0; } dup_print_flag = 1; } while(num); return 1; } int nextchar() { if (cnt == 0) return fgetc(curr_file); cnt--; return cmdbuf[icnt++] & 0xff; } void pushback(n, where) int n; char *where; { if (cnt) memmove(cmdbuf + n, cmdbuf, n); memcpy(cmdbuf, where, n); icnt = 0; cnt += n; } /* Return: * -1 EOF * 0 not found at current position * 1 found */ int bmregexec(scan) char *scan; { char *act; int count, test; int l; char act_pat[MAXCMD]; /* found pattern */ act = act_pat; l = 0; while (*scan != 0) { if ((test = nextchar()) == -1) return -1; *act++ = test; if (++l == MAXCMD) { pushback(l, act_pat); return 0; } if (ignore_case && smode == ASCII) test = toupper(test); switch (*scan++) { case ONE: /* exactly one character */ count = *scan++; if (count == 1) { if (test != *scan) { bytepos++; if (l > 1) pushback(--l, act_pat + 1); return 0; } scan++; } else if (count > 1) { if (sbracket(test, scan, count)) { bytepos++; if (l > 1) pushback(--l, act_pat + 1); return 0; } scan += count; } break; case STAR: /* zero or more characters */ count = *scan++; if (count == 1) { /* only one character, 0 - n times */ while (test == *scan) { if ((test = nextchar()) == -1) return -2; *act++ = test; if (++l == MAXCMD) { pushback(l, act_pat); return 0; } if (ignore_case && smode == ASCII) test = toupper(test); } pushback(1, --act); l--; scan++; } else if (count > 1) { /* characters in bracket */ if (*scan == '^') { do { /* If we found something matching the next part of the expression, we * abandon the search for not-matching characters. */ if (bmregexec(scan + count)) { *act++ = test; /* May be wrong case !! */ l++; scan += count; bytepos--; break; } if (sbracket(test, scan, count)) { bytepos++; if (l > 1) pushback(--l, act_pat + 1); return 0; } else { if ((test = nextchar()) == -1) return -3; *act++ = test; if (++l == MAXCMD) { pushback(l, act_pat); return 0; } if (ignore_case && smode == ASCII) test = toupper(test); } } while(1); } else { while(!sbracket(test, scan, count)) { if ((test = nextchar()) == -1) return -4; *act++ = test; if (++l == MAXCMD) { pushback(l, act_pat); return 0; } if (ignore_case && smode == ASCII) test = toupper(test); } scan += count; pushback(1, --act); l--; } } else { /* ".*" */ do { if ((test = nextchar()) == -1) return -5; *act++ = test; if (++l == MAXCMD) { pushback(l, act_pat); return 0; } pushback(1, act - 1); bytepos--; } while (bmregexec(scan) == 0); bytepos++; act--; l--; } break; } } pushback(l, act_pat); return 1; /* found */ } int sbracket(start, scan, count) int start; char *scan; int count; { if (*scan++ == '^') { if (!memchr(scan, start, --count)) return 0; } else { if (memchr(scan, start, --count)) return 0; } return 1; } void bmsearch(ch) int ch; { int i; if (sstring[0] == '\0') { emsg("No previous regular expression"); return; } if (ch == '/') { /* if (ascii_comp(search_pat, sstring)) return; */ if (ascii_comp(bmore_search_pat, sstring)) return; } if (ch == '\\') { /* if (hex_comp(search_pat, sstring)) return; */ if (hex_comp(bmore_search_pat, sstring)) return; } oldpos = bytepos; last_search = screen_home; if (precount < 1) precount = 1; while (precount--) { /* while ((i = bmregexec(search_pat)) == 0); */ while ((i = bmregexec(bmore_search_pat)) == 0); if (i == 1) { screen_home = bytepos; to_print = maxy; } else { /* i == -1 -> EOF */ if (no_intty) { PRINTF("\r\nPattern not found\r\n"); do_next(1); } else { /* sprintf(string, "Pattern not found %d - %ul", i, (unsigned long)bytepos); emsg(string); */ emsg("Pattern not found"); bytepos = oldpos; fseeko(curr_file, bytepos, SEEK_SET); break; } } if (precount) { nextchar(); bytepos++; } } if (prompt) { PRINTF("\r\n...skipping\r\n"); } } void emsg(s) char *s; { putchar('\r'); cleartoeol(); highlight(); PRINTF("%s", s); normal(); fflush(stdout); prompt = 0; } void bmbeep() { putchar(7); } bvi-1.4.0/CREDITS0000644000175000017500000000343512412523227012323 0ustar bgbg00000000000000Patches: Guido sys_errlist Christian "naddy" Weisgerber {Free,Open}BSD Gunnar Larisch ^ZZ bug Peter J. Holzer setlocale Albert Chin-A-Young Makefile.in Ralf AIX fixes Claudio Nieder Makefile Nico Schmidt r-bug fix Steve Waltner Mac OS X support Andre Wobst AIX fixes SimoN bmore: subshell support fixes, DJGPP support Alastair Thomas Parker binary representation in status Tatsuyoshi bmore: 'b' bug fix Nathan Hougthon ';' - bug Christian "naddy" Weisgerber ';' - bug David Kelley Highlight patch, backspace patch Markus Ewert Apple backspace Michael Tautschnig Conflicting declaration of 'precoint' fixed Sebastian Kayser <> Offset handling fixed (Bug item #3036881) Josef Hinteregger ZZ write bug, lfs Richard Yao Buffer overflow at terminals > 255, ncurses with tinfo, configure fixed ~ operator dumps core Dave Keaton ASCII_DEL patch Packages: Christian "naddy" Weisgerber Source RPM Christian Kurz Debian package Stijn de Bekker Debian package Troy Engel i386 RPM package Thomas Steudten RH alpha and x86 RPM package John M. Huddleston Cygwin binaries Sam Hocevar Debian Packages Doc: Sven Guckes Ben bvi-1.4.0/doscur.h0000644000175000017500000001117512206452026012752 0ustar bgbg00000000000000/* DOSCUR.H - CURSES.H for TURBO C * * Copyright 1996-2002 by Gerhard Buergmann * Gerhard.Buergmann@puon.at * * 1996-02-28 V 1.0.0 * 1998-04-12 V 1.0.1 * 1999-01-14 V 1.1.1 * 1999-07-01 V 1.2.0 * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include #include #include #define TRUE 1 #define FALSE 0 #define ESC 27 #define KEY_F0 0x3A00 #define KEY_F(n) (KEY_F0+(n<<8)) #define KEY_DOWN 0x5000 #define KEY_UP 0x4800 #define KEY_LEFT 0x4B00 #define KEY_RIGHT 0x4D00 #define KEY_NPAGE 0x5100 #define KEY_PPAGE 0x4900 #define KEY_RETURN 0x0d #define KEY_ENTER 0x0a #define KEY_BACKSPACE 0x0E08 #define KEY_HOME 0x4700 #define KEY_LL 0x4f00 /* HOME DOWN, End */ #define KEY_DC 0x5300 #define KEY_IC 0x5200 #define A_NORMAL 3 #define A_STANDOUT 8 #define A_BOLD 8 #define A_REVERSE 127 #define A_BLINK 128 #define A_CHARTEXT 0x00ff #define A_ATTRIBUTES 0xff00 #define chtype unsigned int #define WINDOW text_info extern struct WINDOW scr; extern int stdscr; extern int COLS; extern int LINES; extern int ECHO; extern int NODEL; void attrset(int); #define initscr() clrscr();window(1,1,COLS,LINES);gettextinfo(&scr) #define newwin(h,b,y,x) window(x+1,y+1,x+b+1,y+h+1);gettextinfo(&scr) #define erasechar() KEY_ERASE #define beep() putch(7) #define flash() putch(7) #define wclrtoeol(w) clreol() #define clrtoeol() clreol() #define werase(w) window(scr.winleft,scr.wintop,scr.winright,scr.winbottom) #define erase() clrscr() #define wclear(w) werase(w) #define clear() clrscr() /* #define wattrset(w,a) textattr(a) #define attrset(a) textattr(a) */ #define standout() highvideo() #define standend() normvideo() #define wmove(w,y,x) gotoxy(x+1,y+1) #define move(y,x) gotoxy(x+1,y+1) #define mvwaddch(w,y,x,c) gotoxy(x+1,y+1);putch(c) #define mvaddch(y,x,c) gotoxy(x+1,y+1);putch(c) #define waddch(w,c) putch(c) #define addch(c) putch(c) #define mvwaddstr(w,y,x,s) gotoxy(x+1,y+1);cputs(s) #define mvaddstr(y,x,s) gotoxy(x+1,y+1);cputs(s) #define waddstr(s) cputs(s) #define addstr(s) cputs(s) #define mvwprintw(w,y,x,s) gotoxy(x+1,y+1);cprintf(s) #define mvprintw(y,x,s,a) gotoxy(x+1,y+1);cprintf(s,a) #define wprintw(w,s) cprintf(s) #define printw cprintf #define getyx(w,y,x) x=wherex()-1;y=wherey()-1 #define getbegyx(w,y,x) x=scr.winleft;y=scr.wintop; #define getmaxyx(w,y,x) x=(scr.winright)-(scr.winleft);y=(scr.winbottom)-(scr.wintop)+1 #define winsertln() insline() #define insertln() insline() #define wdeleteln(w) delline() #define deleteln() delline() #define mvwgetch(w,y,x) gotoxy(x+1,y+1);ugetch() #define mvgetch(y,x) gotoxy(x+1,y+1);ugetch() #define wgetch(w) ugetch() #define mvwgetstr(w,y,x,s) gotoxy(x+1,y+1);gets(s) #define mvgetstr(y,x,s) gotoxy(x+1,y+1);gets(s) #define wgetstr(w,s) gets(s) /* #define getstr(s) gets(s) */ #define flushinp() fflush(stdin) #define mvwscanw(w,y,x,s) gotoxy(x+1,y+1);cscanf(s) #define mvscanw(y,x,s) gotoxy(x+1,y+1);cscanf(s) #define wscanw(w,s) wscanw(s) #define scanw cscanf #define mvinsch(y,x,c) gotoxy(x+1,y+1);insch(c) #define nodelay(w,b) NODEL=b #define echo() ECHO=TRUE #define noecho() ECHO=FALSE #define nl() #define nonl() #define keypad(a,b) #define refresh() #define wrefresh(w) #define cbreak() #define endwin() #define raw() #define noraw() #define notimeout(w,t) #define idlok(w,b) #define scrollok(a,b) #define doupdate() #define savetty() #define resetty() #define ERR (-1) bvi-1.4.0/CHANGES0000644000175000017500000000727212415037452012304 0ustar bgbg00000000000000New in release 1.4.0 (stable) ============================= * Minor fixes New in release 1.4.0rc2 ======================= * Ubuntu bug #252604 fixed * set scroll fixed * adding ASCII_DEL 0x7f for backspace New in release 1.4.0rc ====================== * b B w W commands behave equally now (SF bug #5) * .bvirc empty line bug fixed (SF bug #6) * g-command bug fixed (SF bug #7) * several minor fixes New in release 1.4.0beta ======================== * ~ - bug fixed (by elo3456) * debian bug #469704 fixed (bmore) * debian bug #715687 fixed (bmore) * red hat bug #925119 fixed New in release 1.4.0alpha ========================== * highlight search result (by David Kelley) * Large File Support added (by Joe Hinteregger) * binary representation of byte in status line * command line options renamed for compability with hexdump * Offset handling fixed (Bug item #3036881) * noshowmode: fix length of statusline * bmore: 'b' bug fixed (by Tatsuyoshi) * ';' bug fixed (by Nathan Hougthon and Christian Weisgerber) * ZZ write bug fixed (by Joe Hinteregger) * Buffer overflow if terminal > 255 columns (by Richard Yao) * configure fixed (by Richard Yao) * ncurses with tinfo fixed (by Richard Yao) New in release 1.3.2 ==================== * configure: checking term.h and ncurses/term.h * cast in bmore.c in putline(); * ported to compile under DJGPP v2.0 w/ PDCURSES (by simoN) * fixed multiple file handling for "bmore" (by simoN) * renamed several local screen processing routines to avoid compiler conflicts * several minor fixes to "bmore" code (by simoN) * reset tty after CTRL-C in bmore * -c option in bmore (clear before displaying) * -n num option in bmore (display the indicated number of lines in each screenful * -w num option in bmore (display the indicated number of bytes in each line) New in release 1.3.1 ==================== * autoconf 2.52 * do_back() fix * replace sys_errlist[errno] with strerror(errno) (Debian #106762) * deleting bytes in empty file fixed (Debian #121934) * no ":set mm" for x at eof (Debian #122240) * cast for alloc_buf() in set.c * r-bug fix in edit.c and bvi.c * renamed CTRL to BVICTRL (AIX problem) * bmore: nicer last line * bmore: bmbeep() instead of beep() * bmore: subshell support fixes New in release 1.3.0 ==================== * a "bmore" program has been added * --with-ncurses option to configure to specify an alternate search path for Ncurses outside the normal include/lib search path. * make uninstall option * Reading of Block Special Files * New Command line options: +cmd -b begin \ -e end > for partial file read -s size / * :e# bug fixed * Debian bug #68436 (Buffer overflow in io.c) fixed New in release 1.2.0 ==================== * configuration with GNU autoconfig * CR moves cursor to 1st column * alphabet. order for :set all * new settings: set columns=n set (no)memmove * insert and delete (a, d, i, I, x, X) * vi-syntax for y (yank), overwriting put o * new colon (ex) commands: :undo :delete :global :yank :put :overwrite :insert :change :append * new option: -f script New in release 1.1.1 ===================== * .bvirc not read in some cases, fixed * ":f newname" does not work, fixed * distribution tar file with no directory, fixed * freebsd and openbsd added to Makefile * undo of D command fixed New in release 1.1.0 ===================== * A lot of bugfixes * New option ":set offset=n" for counting the addresses beginning with n instead of 0 * New bit-wise commands :xor :and :or :not :neg :lshift :rshift :rrotate :lrotate * Byte addressing for colon commands, e.g. ":5,100w foo" writes byte 5 through 100 to file foo * Backwards hex search character % changed to # * Filename substitution with %, e.g. ":w %.new" bvi-1.4.0/install-sh0000755000175000017500000001425312206452026013306 0ustar bgbg00000000000000#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "$0: no input file specified" >&2 exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d "$dst" ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else echo "$0: $src does not exist" >&2 exit 1 fi if [ x"$dst" = x ] then echo "$0: no destination specified" >&2 exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d "$dst" ] then dst=$dst/`basename "$src"` else : fi fi ## this sed command emulates the dirname command dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp='' while [ $# -ne 0 ] ; do pathcomp=$pathcomp$1 shift if [ ! -d "$pathcomp" ] ; then $mkdirprog "$pathcomp" else : fi pathcomp=$pathcomp/ done fi if [ x"$dir_arg" != x ] then $doit $instcmd "$dst" && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename "$dst"` else : fi # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/#inst.$$# rmtmp=$dstdir/#rm.$$# # Trap to clean up temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && # Now remove or move aside any old file at destination location. We try this # two ways since rm can't unlink itself on some systems and the destination # file might be busy for other reasons. In this case, the final cleanup # might fail but the new file should still install successfully. { if [ -f "$dstdir/$dstfile" ] then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } bvi-1.4.0/bmore.h0000644000175000017500000000675312206452025012564 0ustar bgbg00000000000000/* BMORE.H * * 1996-02-28 V 1.0.0 * 1999-01-21 V 1.1.0 * 1999-03-17 V 1.1.1 * 1999-07-01 V 1.2.0 beta * 1999-08-21 V 1.2.0 final * 2000-05-31 V 1.3.0 beta * 2000-10-04 V 1.3.0 final * 2002-01-16 V 1.3.1 * 2003-02-20 V 1.3.2 * 2010-03-28 V 1.3.4 * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2010 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include #include #include #include #include #include #include #include #if defined(__MSDOS__) && !defined(DJGPP) # include "patchlev.h" # include "dosconf.h" # include # include # include #else # include "patchlevel.h" # include "config.h" # include # if HAVE_NCURSES_H # include # else # include # endif # if HAVE_TERM_H # include # else # if HAVE_NCURSES_TERM_H # include # else # include # endif # endif #endif /* defines for filemode */ #define ERROR -1 #define REGULAR 0 #define NEW 1 #define DIRECTORY 2 #define CHARACTER_SPECIAL 3 #define BLOCK_SPECIAL 4 #define PARTIAL 5 /* regular expressions */ #define END 0 #define ONE 1 #define STAR 2 #define ASCII 1 #define FORWARD 0 #define BACKWARD 1 #define CR '\r' #define NL '\n' #define BS 8 #define ESC 27 #define SEARCH 0 #define REPLACE 1 #define BVICTRL(n) (n&0x1f) #ifndef NULL # define NULL ((void *)0) #endif #ifndef TRUE # define TRUE 1 # define FALSE 0 #endif #if defined(__MSDOS__) && !defined(DJGPP) # define ANSI # define PTR char huge * # define off_t long # define DELIM '\\' # define strncasecmp strnicmp # define strcasecmp stricmp #else # define PTR char * # define DELIM '/' #endif #define MAXCMD 255 #define BUFFER 1024 #ifdef DEBUG extern FILE *debug_fp; #endif #ifndef HAVE_STRERROR extern char *sys_errlist[]; #endif extern char *version; extern int maxx, maxy; extern int ignore_case, magic; extern int no_tty, no_intty; #ifdef ANSI void initterm(void), set_tty(void), reset_tty(void); void cleartoeol(void), clearscreen(void), highlight(void); void normal(void), bmbeep(void), home(void), sig(void); void doshell(char *), emsg(char *); void do_next(int); void bmsearch(int); void pushback(int, char *); int open_file(void); int printout(int), rdline(int, char *); int nextchar(void), vgetc(void); int sbracket(int, char *, int); int bmregexec(char *); int ascii_comp(char *, char *), hex_comp(char *, char *); void putline(char *, int); #else void initterm(), set_tty(), reset_tty(); void cleartoeol(), clearscreen(), highlight(); void normal(), bmbeep(), home(), sig(); void doshell(), emsg(); void do_next(); void bmsearch(); void pushback(); int open_file(); int printout(), rdline(); int nextchar(), vgetc(); int sbracket(); int bmregexec(); int ascii_comp(), hex_comp(); void putline(); #endif bvi-1.4.0/patchlevel.h0000644000175000017500000000003012415037464013575 0ustar bgbg00000000000000#define VERSION "1.4.0" bvi-1.4.0/bmore.10000644000175000017500000001372112206452025012466 0ustar bgbg00000000000000.TH BMORE 1 "3 Jan 2004" .SH NAME bmore \- browse through a binary file .SH SYNOPSIS .B bmore [ .B \-acdi ] [ .B \-n \fIlines\fP ] [ .B \-w \fIcols\fP ] [ .B +\fIlinenumber\fP ] [ .B +/\fIASCII-pattern\fP ] [ .B +\\\\\fIHex-pattern\fP ] [ .I filename \&.\|.\|. ] .LP .if n .ti +05i .SH DESCRIPTION .IX "bmore command" "" "\fLbmore\fP \(em browse binary file" .IX "binary file, browse through" \fLbmore\fP .IX file "browse bmore" "" "browse through binary\(em \fLbmore\fP" .IX display "file by screenfuls \(em \fLbmore\fP" .LP .B more is a filter that displays the contents of a binary file on the terminal, one screenful at a time. It normally pauses after each screenful, and prints .B --More-- at the bottom of the screen. .B bmore provides a two-line overlap between screens for continuity. If .B bmore is reading from a file rather than a pipe, the percentage of characters displayed so far is also shown. .LP .B bmore scrolls up to display one more screen line in response to a .SM RETURN character; it displays another screenful in response to a .SM SPACE character. Other commands are listed below. .LP The screen is divided in three sections or panes: The byte offset (extreme left), the hex pane (middle), and an ascii pane (right) which shows as printable characters those bytes in the hex pane. On an 80 column terminal there will be sixteen hex values and their ASCII values on each screen line. Note that (as one would expect) the first byte has the offset \*(L'0\*(R' (zero). .LP .B bmore sets the terminal to .I noecho mode, so that the output can be continuous. Commands that you type do not normally show up on your terminal, except for the .B / , .B \\\\ and .B ! commands. .LP If the standard output is not a terminal, .B more acts just like .BR cat (1V), except that a header is printed before each file in a series. .SH OPTIONS .TP .B \-a ASCII mode: no hex representation of the contents. Non printable characters are displayed as a dot (.) .TP .B \-c Clear before displaying. Redrawing the screen instead of scrolling. .TP .B \-d Display error messages rather than ringing the terminal bell if an unrecognized command is used. This is helpful for inexperienced users. .TP .B \-i Ignore case for searching. .TP .B \-n \fIlines\fP Displays the indicated number of \fIlines\fP in each screenful, rather than the default (the number of lines in the terminal screen less two). .TP .B \-w \fIcols\fP Display number of \fIcols\fP in each line. .TP .BI + linenumber\fP Start up at .IR linenumber . .TP .BI +/ ASCII-pattern\fP Start up at the line containing the regular expression .IR pattern . Note: unlike editors, this construct should .I not end with a .RB ` / '. If it does, then the trailing slash is taken as a character in the search pattern. .TP .br .ne 8 .SH USAGE .SS Commands .LP The commands take effect immediately; it is not necessary to type a carriage return. Up to the time when the command character itself is given, the user may type the line kill character to cancel the numerical argument being formed. In addition, the user may type the erase character to redisplay the .RB ` "--More--(\fIxx\fP%)" ' message. .LP In the following commands, .I i is a numerical argument .RB ( 1 by default). .TP 10 .IR i \s-1SPACE\s0 Display another screenful, or .I i more lines if .I i is specified. .TP .IR i \s-1RETURN\s0 Display another line, or .I i more lines, if specified. .TP .IB i ^D (\s-1CTRL\s0\-D) Display (scroll down) 11 more lines. .I i is given, the scroll size is set to .IR i\| . .TP .IR i d Same as .BR ^D . .TP .IB i z Same as .SM SPACE, except that .IR i\| , if present, becomes the new default number of lines per screenful. .TP .IB i s Skip .I i\| lines and then print a screenful. .TP .IB i f Skip .I i screenfuls and then print a screenful. .TP .IB i ^B (\s-1CTRL-B\s0) Skip back .I i screenfuls and then print a screenful. .TP .I b Same as .B ^B (\s-1CTRL-D\s0). .TP .B q .PD 0 .TP .B Q .PD Exit from .BR more . .TP .B = Display the current line number. .TP .B v Drop into the .BR bvi (1) editor at the current offset of the current file. .TP .B w Drop into the .BR bvi (1) editor at the current offset of the current file. Only the portion of the file displayed on the screen will be loaded. .TP .B h Help. Give a description of all the .B more commands. .TP .IB i / pattern Search for the .IR i\| th occurrence of the regular expression .IR pattern . Display the screenful starting at the file position that contains the .IR i\| th match for the regular expression .IR ASCII-pattern , or the end of a pipe, whichever comes first. If .B bmore is displaying a file and there is no such match, its position in the file remains unchanged. Regular expressions can be edited using erase and kill characters. Erasing back past the first column cancels the search command. .TP .B \' Single quote. Go to the point from which the last search started. If no search has been performed in the current file, go to the beginning of the file. .TP .BI ! command Invoke a shell to execute .IR command\| . The characters .B % and .BR ! , when used within .I command are replaced with the current filename and the previous shell command, respectively. If there is no current filename, .B % is not expanded. Prepend a backslash to these characters to escape expansion. .TP .IB i :n Skip to the .IR i\| th next filename given in the command line, or to the last filename in the list if .I i is out of range. .TP .IB i :p Skip to the .IR i\| th previous filename given in the command line, or to the first filename if .I i is out of range. If given while .B more is positioned within a file, go to the beginning of the file. If .B more is reading from a pipe, .B more simply rings the terminal bell. .br .ne 2 .TP .B :f Display the current filename and offset number. .br .ne 5 .TP .B :q .PD 0 .TP .B :Q .PD Exit from .B bmore (same as .B q or .B Q ). .TP .B \&. Dot. Repeat the previous command. .TP .SH FILES .PD 0 .TP 20 .B /etc/termcap terminal data base .TP .B /usr/local/share/bmore.help help file .PD .SH "SEE ALSO" .BR bvi (1), .BR termcap (5) bvi-1.4.0/bmore.help0000644000175000017500000000306012206452025013251 0ustar bgbg00000000000000 Most commands optionally preceded by integer argument k. Defaults in brackets. Star (*) indicates argument becomes new default. ------------------------------------------------------------------------------- Display next k lines of bytes [current screen size] z Display next k lines of bytes [current screen size]* Display next k lines of bytes [1]* d or ctrl-D Scroll k lines [current scroll size, initially 11]* q or Q or Exit from bmore s Skip forward k lines of bytes [1] f Skip forward k screenfuls of bytes [1] b or ctrl-B Skip backwards k screenfuls of bytes [1] ' Go to place where previous search started = Display current byte number / Search for kth occurrence of ascii regular expr [1] \ Search for kth occurrence of binary regular expr [1] n Search for kth occurrence of last r.e [1] ! or :! Execute in a subshell v Start up bvi at current position w Start up bvi reading only a screenful of bytes [screen] ctrl-L Redraw screen :n Go to kth next file [1] :p Go to kth previous file [1] :f Display current file name and byte position . Repeat previous command ------------------------------------------------------------------------------- bvi-1.4.0/set.c0000644000175000017500000002061112412515565012243 0ustar bgbg00000000000000/* SET.C - performing :set - command * * NOTE: Edit this file with tabstop=4 ! * * 1996-02-29 created; * 1998-03-14 V 1.0.1 * 1999-01-14 V 1.1.0 * 1999-03-17 V 1.1.1 * 1999-07-02 V 1.2.0 beta * 1999-08-14 V 1.2.0 final * 2000-07-15 V 1.3.0 final * 2001-10-10 V 1.3.1 * 2003-07-03 V 1.3.2 * 2010-06-02 V 1.2.4 * 2014-09-30 V 1.4.0 * * Copyright 1996-2014 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include "bvi.h" #include "set.h" static int from_file = 0; static FILE *ffp; static char fbuf[MAXCMD+1]; static char buf[MAXCMD+1]; struct param params[] = { { "autowrite", "aw", FALSE, "", P_BOOL }, { "columns", "cm", 16, "", P_NUM }, { "errorbells", "eb", FALSE, "", P_BOOL }, { "ignorecase", "ic", FALSE, "", P_BOOL }, { "magic", "ma", TRUE, "", P_BOOL }, { "memmove", "mm", FALSE, "", P_BOOL }, { "offset", "of", 0, "", P_NUM }, { "readonly", "ro", FALSE, "", P_BOOL }, { "scroll", "scroll", 12, "", P_NUM }, { "showmode", "mo", TRUE, "", P_BOOL }, { "term", "term", 0, "", P_TEXT }, { "terse", "terse", FALSE, "", P_BOOL }, { "unixstyle", "us", FALSE, "", P_BOOL }, { "window", "window", 25, "", P_NUM }, { "wordlength", "wl", 4, "", P_NUM }, { "wrapscan", "ws", TRUE, "", P_BOOL }, { "highlight", "hl", TRUE, "", P_BOOL }, #if defined(__MSDOS__) && !defined(DJGPP) { "color", "co", 7, "", P_NUM }, #endif { "", "", 0, "", 0, } /* end marker */ }; int doset(arg) char *arg; /* parameter string */ { int i; char *s; int did_window = FALSE; int state = TRUE; /* new state of boolean parms. */ char string[80]; if (arg == NULL) { showparms(FALSE); return 0; } if (!strcmp(arg, "all")) { showparms(TRUE); return 0; } if (!strncmp(arg, "no", 2)) { state = FALSE; arg += 2; } for (i = 0; params[i].fullname[0] != '\0'; i++) { s = params[i].fullname; if (strncmp(arg, s, strlen(s)) == 0) /* matched full name */ break; s = params[i].shortname; if (strncmp(arg, s, strlen(s)) == 0) /* matched short name */ break; } if (params[i].fullname[0] != '\0') { /* found a match */ if (arg[strlen(s)] == '?') { if (params[i].flags & P_BOOL) sprintf(buf, " %s%s", (params[i].nvalue ? " " : "no"), params[i].fullname); else if (params[i].flags & P_TEXT) sprintf(buf, " %s=%s", params[i].fullname, params[i].svalue); else sprintf(buf, " %s=%lld", params[i].fullname, (long long)params[i].nvalue); msg(buf); return 0; } if (!strcmp(params[i].fullname, "term")) { emsg("Can't change type of terminal from within bvi"); return 1; } if (params[i].flags & P_NUM) { if ((i == P_LI) || (i == P_OF)) did_window++; if (arg[strlen(s)] != '=' || state == FALSE) { sprintf(string, "Option %s is not a toggle", params[i].fullname); emsg(string); return 1; } else { s = arg + strlen(s) + 1; params[i].nvalue = strtoll(s, &s, 0); params[i].flags |= P_CHANGED; #if defined(__MSDOS__) && !defined(DJGPP) if (i == P_CO) { textcolor(P(P_CO) & 0x07); textbackground((P(P_CO) & 0xf0) >> 4); clrscr(); repaint(); } #endif if (i == P_CM) { if (((COLS - AnzAdd - 1) / 4) >= P(P_CM)) { Anzahl = P(P_CM); } else { Anzahl = P(P_CM) = ((COLS - AnzAdd - 1) / 4); } maxx = Anzahl * 4 + AnzAdd + 1; Anzahl3 = Anzahl * 3; status = Anzahl3 + Anzahl - 17; screen = Anzahl * (maxy - 1); did_window++; stuffin("H"); /* set cursor at HOME */ } } } else { /* boolean */ if (arg[strlen(s)] == '=') { emsg("Invalid set of boolean parameter"); return 1; } else { params[i].nvalue = state; params[i].flags |= P_CHANGED; if (i == P_HL && state == FALSE) { hl_spat = FALSE; repaint(); } } } } else { emsg("No such option@- `set all' gives all option values"); return 1; } if (did_window) { maxy = P(P_LI) - 1; new_screen(); } return 0; } /* show ALL parameters */ void showparms(all) int all; { struct param *p; int n; n = 2; msg("Parameters:\n"); for (p = ¶ms[0]; p->fullname[0] != '\0' ;p++) { if (!all && ((p->flags & P_CHANGED) == 0)) continue; if (p->flags & P_BOOL) sprintf(buf, " %s%s\n", (p->nvalue ? " " : "no"), p->fullname); else if (p->flags & P_TEXT) sprintf(buf, " %s=%s\n", p->fullname, p->svalue); else sprintf(buf, " %s=%lld\n", p->fullname, (long long)p->nvalue); msg(buf); n++; if (n == params[P_LI].nvalue) { if (wait_return(FALSE)) return; n = 1; } } wait_return(TRUE); } /* reads the init file (.bvirc) */ int read_rc(fn) char *fn; { int i; if ((ffp = fopen(fn, "r")) == NULL) return -1; from_file = 1; while (fgets(fbuf, MAXCMD, ffp) != NULL) { i = strlen(fbuf) - 1; while ((i >= 0) && (fbuf[i] == NL || fbuf[i] == CR)) fbuf[i--] = '\0'; docmdline(fbuf); } fclose(ffp); from_file = 0; return 0; } int do_logic(mode, str) int mode; char *str; { int a, b; int value; size_t n; char *err_str ="Invalid value@for bit manipulation"; if (mode==LSHIFT || mode==RSHIFT || mode==LROTATE || mode==RROTATE) { value = atoi(str); if (value < 1 || value > 8) { emsg(err_str); return 1; } } else { if (strlen(str) == 8) { value = strtol(str, NULL, 2); for (n = 0; n < 8; n++) { if (str[n] != '0' && str[n] != '1') { value = -1; break; } } } else if (str[0] == 'b' || str[0] == 'B') { value = strtol(str + 1, NULL, 2); } else if (str[0] == '0') { value = strtol(str, NULL, 0); for (n = 0; n < strlen(str); n++) { if (!isxdigit(str[n])) { value = -1; break; } } } else { value = atoi(str); } if (value < 0 || value > 255) { emsg(err_str); return 1; } } if ((undo_count = alloc_buf((off_t)(end_addr - start_addr + 1), &undo_buf))) { memcpy(undo_buf, start_addr, undo_count); } undo_start = start_addr; edits = U_EDIT; while(start_addr <= end_addr) { a = *start_addr; a &= 0xff; switch(mode) { case LSHIFT: a <<= value; break; case RSHIFT: a >>= value; break; case LROTATE: a <<= value; b = a >> 8; a |= b; break; case RROTATE: b = a << 8; a |= b; a >>= value; /* b = a << (8 - value); a >>= value; a |= b; */ break; case AND: a &= value; break; case OR: a |= value; break; case XOR: case NOT: a ^= value; break; case NEG: a ^= value; a++; /* Is this true */ break; } *start_addr++ = (char)(a & 0xff); } repaint(); return(0); } int getcmdstr(p, x) char *p; int x; { int c; int i, n; char *buff, *q; if (from_file) { if (fgets(p, 255, ffp) != NULL) { // strtok(p, "\n\r"); i = strlen(p) - 1; while ((i >= 0) && (p[i] == NL || p[i] == CR)) p[i--] = '\0'; return 0; } else { return 1; } } signal(SIGINT, jmpproc); buff = p; move(maxy, x); do { switch (c = vgetc()) { case BVICTRL('H'): case ASCII_DEL: case KEY_BACKSPACE: case KEY_LEFT: if (p > buff) { p--; move(maxy, x); n = x; for (q = buff; q < p ;q++) { addch(*q); n++; } addch(' '); move(maxy, n); } else { *buff = '\0'; msg(""); signal(SIGINT, SIG_IGN); return 1; } break; case ESC: /* abandon command */ *buff = '\0'; msg(""); signal(SIGINT, SIG_IGN); return 1; #if NL != KEY_ENTER case NL: #endif #if CR != KEY_ENTER case CR: #endif case KEY_RIGHT: case KEY_UP: case KEY_DOWN: case KEY_ENTER: break; default: /* a normal character */ addch(c); *p++ = c; break; } refresh(); } while (c != NL && c != CR && c != KEY_ENTER); *p = '\0'; signal(SIGINT, SIG_IGN); return 0; } bvi-1.4.0/configure0000755000175000017500000055260212206452026013216 0ustar bgbg00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.65. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="bvi.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS EGREP GREP CPP INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM host_os host_vendor host_cpu host build_os build_vendor build_cpu build OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_largefile with_ncurses ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error "unrecognized option: \`$ac_option' Try \`$0 --help' for more information." ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-largefile omit support for large files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ncurses=DIR path to ncurses Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "no acceptable C compiler found in \$PATH See \`config.log' for more details." "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of object files: cannot compile See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if test "${ac_cv_sys_largefile_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if test "${ac_cv_sys_file_offset_bits+set}" = set; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if test "${ac_cv_sys_large_files+set}" = set; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do for ac_t in install-sh install.sh shtool; do if test -f "$ac_dir/$ac_t"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/$ac_t -c" break 2 fi done done if test -z "$ac_aux_dir"; then as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" case "$host_os" in sunos4*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"using /usr/5bin/cc\"" >&5 $as_echo "\"using /usr/5bin/cc\"" >&6; } CC="/usr/5bin/cc" ac_objext="o" ;; *) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "no acceptable C compiler found in \$PATH See \`config.log' for more details." "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ;; esac case "$host_os" in solaris*) CPPFLAGS="${CPPFLAGS} -D_MSE_INT_H" $as_echo "#define NEED_PUTC_CHAR 1" >>confdefs.h ;; hpux9*) DEFS=${DEFS-"-DMINICURSES"} ;; esac # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " eval as_val=\$$as_ac_Header if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if test "${ac_cv_sizeof_int+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "cannot compute sizeof (int) See \`config.log' for more details." "$LINENO" 5; }; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if test "${ac_cv_sizeof_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "cannot compute sizeof (long) See \`config.log' for more details." "$LINENO" 5; }; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if test "${ac_cv_sizeof_long_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "cannot compute sizeof (long long) See \`config.log' for more details." "$LINENO" 5; }; } else ac_cv_sizeof_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } if test "${ac_cv_sizeof_void_p+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : else if test "$ac_cv_type_void_p" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "cannot compute sizeof (void *) See \`config.log' for more details." "$LINENO" 5; }; } else ac_cv_sizeof_void_p=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 $as_echo "$ac_cv_sizeof_void_p" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define off_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in fcntl.h termcap.h termio.h termios.h unistd.h term.h ncurses/term.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" eval as_val=\$$as_ac_Header if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done _cppflags="${CPPFLAGS}" _ldflags="${LDFLAGS}" # Check whether --with-ncurses was given. if test "${with_ncurses+set}" = set; then : withval=$with_ncurses; if test "$withval" != "no"; then CPPFLAGS="${CPPFLAGS} -I$withval/include -I$withval/include/ncurses" LDFLAGS="${LDFLAGS} -L$withval/lib" fi fi ac_fn_c_check_header_mongrel "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default" if test "x$ac_cv_header_ncurses_h" = x""yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing initscr" >&5 $as_echo_n "checking for library containing initscr... " >&6; } if test "${ac_cv_search_initscr+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF for ac_lib in '' ncurses; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_initscr=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_initscr+set}" = set; then : break fi done if test "${ac_cv_search_initscr+set}" = set; then : else ac_cv_search_initscr=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_initscr" >&5 $as_echo "$ac_cv_search_initscr" >&6; } ac_res=$ac_cv_search_initscr if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_NCURSES_H 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5 $as_echo_n "checking for library containing tputs... " >&6; } if test "${ac_cv_search_tputs+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tputs (); int main () { return tputs (); ; return 0; } _ACEOF for ac_lib in '' tinfo; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_tputs=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_tputs+set}" = set; then : break fi done if test "${ac_cv_search_tputs+set}" = set; then : else ac_cv_search_tputs=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tputs" >&5 $as_echo "$ac_cv_search_tputs" >&6; } ac_res=$ac_cv_search_tputs if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing initscr" >&5 $as_echo_n "checking for library containing initscr... " >&6; } if test "${ac_cv_search_initscr+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF for ac_lib in '' curses; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_initscr=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_initscr+set}" = set; then : break fi done if test "${ac_cv_search_initscr+set}" = set; then : else ac_cv_search_initscr=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_initscr" >&5 $as_echo "$ac_cv_search_initscr" >&6; } ac_res=$ac_cv_search_initscr if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_CURSES_H 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5 $as_echo_n "checking for library containing tputs... " >&6; } if test "${ac_cv_search_tputs+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tputs (); int main () { return tputs (); ; return 0; } _ACEOF for ac_lib in '' tinfo; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_tputs=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_tputs+set}" = set; then : break fi done if test "${ac_cv_search_tputs+set}" = set; then : else ac_cv_search_tputs=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tputs" >&5 $as_echo "$ac_cv_search_tputs" >&6; } ac_res=$ac_cv_search_tputs if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else as_fn_error "bvi requires the curses library" "$LINENO" 5 fi fi else ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" if test "x$ac_cv_header_curses_h" = x""yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing initscr" >&5 $as_echo_n "checking for library containing initscr... " >&6; } if test "${ac_cv_search_initscr+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF for ac_lib in '' curses; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_initscr=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_initscr+set}" = set; then : break fi done if test "${ac_cv_search_initscr+set}" = set; then : else ac_cv_search_initscr=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_initscr" >&5 $as_echo "$ac_cv_search_initscr" >&6; } ac_res=$ac_cv_search_initscr if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_CURSES_H 1" >>confdefs.h else as_fn_error "bvi requires the curses library" "$LINENO" 5 fi else as_fn_error "bvi requires the curses library" "$LINENO" 5 fi fi for ac_func in strdup strtol strtoll strerror memmove do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" eval as_val=\$$as_ac_var if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 $as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } if test "${ac_cv_sys_largefile_source+set}" = set; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=no; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=1; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_cv_sys_largefile_source=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 $as_echo "$ac_cv_sys_largefile_source" >&6; } case $ac_cv_sys_largefile_source in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source _ACEOF ;; esac rm -rf conftest* # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug # in glibc 2.1.3, but that breaks too many other things. # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. if test $ac_cv_sys_largefile_source != unknown; then $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit $? fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi bvi-1.4.0/config.h.in0000644000175000017500000000407212206452026013323 0ustar bgbg00000000000000/* config.h.in. Generated automatically from configure.in by autoheader. */ /***** begin user configuration section *****/ #undef HAVE_NCURSES_H #undef HAVE_CURSES_H #undef NO_SYSERRL #undef NEED_PUTC_CHAR #undef HAVE_NCURSES_TERM_H /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define if you have the header file. */ #undef HAVE_MEMORY_H /* Define if you have the header file. */ #undef HAVE_NCURSES_TERM_H /* Define if you have the header file. */ #undef HAVE_STDINT_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define if you have the header file. */ #undef HAVE_STRINGS_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define if you have the header file. */ #undef HAVE_TERMCAP_H /* Define if you have the header file. */ #undef HAVE_TERMIOS_H /* Define if you have the header file. */ #undef HAVE_TERMIO_H /* Define if you have the header file. */ #undef HAVE_TERM_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of a `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to `int' if does not define. */ #undef off_t /* Define to `unsigned int' if does not define. */ #undef size_t bvi-1.4.0/config.sub0000644000175000017500000010621612415231773013271 0ustar bgbg00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-09-26' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: bvi-1.4.0/edit.c0000644000175000017500000004567312412515520012403 0ustar bgbg00000000000000/* edit - the edit commands * * NOTE: Edit this file with tabstop=4 ! * * 1999-04-19 V 1.1.2 * 1999-07-02 V 1.2.0 beta * 1999-10-30 V 1.2.0 final * 2000-05-14 V 1.3.0 alpha * 2000-07-15 V 1.3.0 final * 2001-12-07 V 1.3.1 * 2003-07-04 V 1.3.2 * 2006-04-05 V 1.3.3 alpha - binary representation * 2014-09-30 V 1.4.0 * * Copyright 1996-2014 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include "bvi.h" #include "set.h" extern long precount; char contrd[][4] = {"NUL", " ^A", " ^B", " ^C", " ^D", " ^E", " ^F", "BEL", " BS", "TAB", " NL", "HOM", "CLR", " CR", " ^N", " ^O", " ^P", " ^Q", " ^R", " ^S", " ^T", " ^U", " ^V", " ^W", " ^X", " ^Y", " ^Z", "ESC", " FS", " GS", " RS", " US", "DEL" }; char contru[][4] = {"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", " BS", " HT", " NL", " VT", " NP", " CR", " SO", " SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", " EM", "SUB", "ESC", " FS", " GS", " RS", " US", "DEL" }; char tmpbuf[10]; char linbuf[16384]; long hl_spat = 0; static char getcbuff[BUFFER]; static char *getcnext = NULL; /* mode: ('A') append * ('R') replace one or more different characters * ('r') replace 1 character * ('i') insert characters * ('a') insert after cursor * a precount can be used * * for insert and append we misuse the undo buffer for the inserted * characters (for "." command) */ off_t edit(mode) int mode; { int ch, ch1; size_t len; off_t count = 0L; off_t buffer = BUFFER; off_t psize; if (!filesize && mode == 'i') { mode = 'A'; } if (mode != 'A' && mode != 'a') { if (current - mem >= filesize) { beep(); return 0L; } } if (precount < 1) precount = 1; len = strlen(rep_buf); if (mode == 'r' && current + precount > maxpos) { beep(); rep_buf[len] = '\0'; return 0L; } if (alloc_buf(buffer, &undo_buf) == 0L) { rep_buf[len] = '\0'; return 0L; } switch(mode) { case 'A': edits = U_APPEND; break; case 'R': edits = U_EDIT; smsg("REPLACE MODE"); break; case 'r': edits = U_EDIT; smsg("REPLACE 1 CHAR"); break; case 'a': case 'i': edits = U_INSERT; smsg("INSERT MODE"); break; } undo_start = current; while((ch = vgetc()) != ESC) { ch &= 0xff; rep_buf[len++] = ch; if (ch == '\t') { toggle(); setcur(); continue; } if (ch == KEY_BACKSPACE || ch == ASCII_DEL || ch == BVICTRL('H')) { if (count > 0) { len--; count--; if (mode == 'A' || mode == 'a' || mode == 'i') { filesize--; maxpos--; } current--; cur_back(); setcur(); } else beep(); continue; } if (loc == HEX) { if (isxdigit(ch)) { mvaddch(y, x + 1, ' '); mvaddch(y, x, ch); do { ch1 = vgetc() & 0xff; if (ch1 == ESC) { mvaddch(y, x, ' '); current--; cur_back(); goto escape; } if (!isxdigit(ch1)) { beep(); ch1 = -1; } } while (ch1 == -1); rep_buf[len++] = ch1; mvaddch(y, x + 1, ch1); sprintf(tmpbuf, "%c%c", ch, ch1); sscanf(tmpbuf, "%2x", &ch); } else { beep(); len--; goto wrong; } } else { /*** ASCII - Bereich ***/ if (isprint(ch)) { mvaddch(y, x, ch); } else { beep(); goto wrong; } } curpos = current++; if (mode == 'i' || mode == 'a') { memmove(current, curpos, maxpos - curpos); } if (mode == 'A' || mode == 'i' || mode == 'a') { maxpos++; filesize++; /* NEU undo_buf[count++] = ch; */ count++; } else { undo_buf[count++] = *curpos; } if (count == buffer) { buffer += BUFFER; if (alloc_buf(buffer, &undo_buf) == 0L) { rep_buf[len] = '\0'; return count; } } *curpos = (char)ch; cur_forw(0); statpos(); if (mode == 'i' || mode == 'a') { repaint(); } else { lineout(); } setcur(); if (filesize > memsize - 2L) { if (enlarge(100L)) break; } if ((mode != 'A' && mode != 'a') && curpos == maxpos - 1) break; if (mode == 'r') { break; } wrong: continue; } rep_buf[len++] = ESC; rep_buf[len] = '\0'; if (!count) goto escape; if (precount > 1) { switch (mode) { case 'i': case 'a': case 'A': psize = count * (precount - 1); if (filesize + psize > memsize - 2L) { if (enlarge(psize + 100L)) return count; } if (psize + count > buffer) { if (alloc_buf(psize + count, &undo_buf) == 0L) return count; } if (mode == 'i' || mode == 'a') { memmove(current + psize, current, maxpos - curpos); } /* NEU undo_pos = undo_buf + count - 1L; */ while (--precount) { /* NEU memcpy(undo_pos + 1L, undo_pos - count + 1L, count); undo_pos += count; */ memcpy(curpos + 1L, curpos - count + 1L, count); curpos += count; } filesize += psize; count += psize; maxpos += psize; undo_count += psize; current = curpos + 1L; setpage(current); repaint(); break; case 'R': if (current + count * (precount - 1) > maxpos) break; psize = count; while (--precount) { memcpy(undo_buf + psize, curpos + 1L, count); psize += count; memcpy(curpos + 1L, curpos - count + 1L, count); curpos += count; } count = psize; setpage(++curpos); repaint(); break; case 'r': while (--precount) { undo_buf[count++] = *(++curpos); *curpos = (char)ch; cur_forw(0); statpos(); lineout(); } break; } } cur_back(); escape: setcur(); smsg(""); return(count); } /* Do the f, F, t or T command * If flag == 1 save the character in rep_buf * else setpage() */ PTR do_ft(ch, flag) int ch, flag; { static int chi; static int chp = 1; int dir; size_t n; PTR ptr; switch (ch) { /* case 1: beep(); return NULL; no previous command case -1: if (chp == 'f' || chp == 't') dir = BACKWARD; else dir = FORWARD; break; case 0: if (chp == 'f' || chp == 't') dir = FORWARD; else dir = BACKWARD; break; */ case -1: if (chp == 1) { beep(); return NULL; } if (chp == 'f' || chp == 't') dir = BACKWARD; else dir = FORWARD; break; case 0: if (chp == 1) { beep(); return NULL; } if (chp == 'f' || chp == 't') dir = FORWARD; else dir = BACKWARD; break; default: chp = ch; if (chp == 'f' || chp == 't') dir = FORWARD; else dir = BACKWARD; chi = vgetc(); if (flag) { n = strlen(rep_buf); rep_buf[n++] = chi; rep_buf[n] = '\0'; } } ptr = current; do { if (dir == FORWARD) { do { ptr++; if (ptr > maxpos) break; } while (*ptr != chi); if (ptr > maxpos) break; } else { do { ptr--; if (ptr < mem) break; } while (*ptr != chi); if (ptr < mem) break; } } while (--precount > 0); /* if (*ptr == chi) { */ if (ptr >= mem && ptr <= maxpos) { if (loc == HEX) toggle(); if (chp == 't') ptr--; if (chp == 'T') ptr++; if (!flag) { setpage(ptr); } return(ptr); } beep(); return NULL; } void do_z(mode) int mode; { switch (mode) { case '.': while (y != maxy / 2) { if (y > maxy / 2) { pagepos += Anzahl; y--; } else { if (pagepos == mem) break; pagepos -= Anzahl; y++; } } break; case '-': while (y < maxy - 1) { if (pagepos == mem) break; pagepos -= Anzahl; y++; } break; case '\0': case '\n': case '\r': while (y > 0) { y--; pagepos += Anzahl; } break; default : beep(); break; } repaint(); } void scrolldown(lns) int lns; { while (lns--) { if (maxpos >= (pagepos + Anzahl)) pagepos += Anzahl; else { beep(); lns = 0; } repaint(); refresh(); } } void scrollup(lns) int lns; { while (lns--) { if (mem <= (PTR)(pagepos - Anzahl)) pagepos -= Anzahl; else { beep(); lns = 0; } repaint(); refresh(); } } int xpos() { if (loc == HEX) return((x - AnzAdd) / 3); else return(x - AnzAdd - Anzahl3); } void toggle() { if (loc == HEX) { x = xpos() + AnzAdd + Anzahl3; loc = ASCII; } else { x = xpos() * 3 + AnzAdd; loc = HEX; } } void setcur() { move(y, x); refresh(); } /************* display current position *************/ void statpos() { char bin_val [9]; unsigned char Char1; int i; off_t bytepos; char string[MAXCMD+1], str[6]; if (!P(P_MO)) return; bytepos = current - mem; if (bytepos >= filesize) { // mvaddstr(maxy, status, " "); move(maxy, status); for (i = status; i < maxx; i++) addch(' '); return; } Char1 = *(mem + bytepos); if (isprint(Char1)) { sprintf(str, "'%c'", Char1); } else if (Char1 < 32) { if (P(P_US)) strcpy(str, contru[Char1]); else strcpy(str, contrd[Char1]); } else if (Char1 == 127) { if (P(P_US)) strcpy(str, contru[32]); else strcpy(str, contrd[32]); } else { strcpy(str, " "); } for (i = 0; i < 8; ++i) { if(Char1 & (1< maxpos) { strcpy(linbuf, "~ "); } else { sprintf(linbuf, addr_form, (long long)(mempos - mem + P(P_OF))); *string = '\0'; } mvaddstr(scpos, mv_pos, linbuf); mv_pos = AnzAdd; *linbuf = '\0'; if (hl_spat) { f_start = (mempos - Anzahl) < mem ? mem : (mempos - Anzahl); f_end = mempos + (2 * Anzahl); hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); } for (print_pos = 0; print_pos < Anzahl; print_pos++) { if (hl_spat) { while (hl_start != NULL) { if (hl_start < mempos) { if (hl_end < mempos) { f_start = hl_start + 1; hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); } else { attrset(A_STANDOUT); /* start out highlighted */ break; } } else if (hl_start >= mempos) { break; } } if (hl_start != NULL) { if ((hl_start - mempos) == print_pos) { mvaddstr(scpos, mv_pos, linbuf); mv_pos = AnzAdd + (3 * print_pos); *linbuf = '\0'; attrset(A_STANDOUT); } if ((hl_end - mempos) == print_pos) { mvaddstr(scpos, mv_pos, linbuf); *linbuf = '\0'; mv_pos = AnzAdd + (3 * print_pos); f_start = hl_end; hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); if (f_start != hl_start) { attrset(A_NORMAL); } } } } if (mempos + print_pos >= maxpos) { sprintf(tmpbuf, " "); cur_ch = ' '; } else { cur_ch = *(mempos + print_pos); sprintf(tmpbuf, "%02X ", cur_ch); } strcat(linbuf, tmpbuf); if (isprint(cur_ch)) *(string + print_pos) = cur_ch; else *(string + print_pos) = '.'; } mvaddstr(scpos, mv_pos, linbuf); mv_pos = AnzAdd + (3 * print_pos); attrset(A_NORMAL); *(string + Anzahl) = '\0'; mvaddstr(scpos, mv_pos, string); } /* displays a line on screen * at pagepos + line y */ int lineout() { off_t Adresse; Adresse = pagepos - mem + y * Anzahl; printline(mem + Adresse, y); move(y, x); return(0); } void new_screen() { screen = Anzahl * (maxy - 1); clear(); repaint(); } void repaint() /***** redraw screen *********************/ { int save_y; save_y = y; for (y = 0; y < maxy; y++) lineout(); y = save_y; } /******* display an arbitrary address on screen *******/ void setpage(addr) PTR addr; { if ((addr >= pagepos) && ((addr - pagepos) < screen)) { y = (addr - pagepos) / Anzahl; if (loc == HEX) x = AnzAdd + ((addr - pagepos) - y * Anzahl) * 3; else x = AnzAdd + Anzahl3 + ((addr - pagepos) - y * Anzahl); } else { pagepos = (((addr - mem) / Anzahl) * Anzahl + mem) - (Anzahl * (maxy / 2)); if (pagepos < mem) pagepos = mem; y = (addr - pagepos) / Anzahl; if (loc == HEX) x = AnzAdd + ((addr - pagepos) - y * Anzahl) * 3; else x = AnzAdd + Anzahl3 + ((addr - pagepos) - y * Anzahl); repaint(); } } int cur_forw(check) int check; { if (check) { if (current - mem >= filesize) { beep(); return 1; } } if (loc == ASCII) { if (x < AnzAdd - 1 + Anzahl3 + Anzahl) { x++ ; return 0; } else x = AnzAdd + Anzahl3; } else { if (x < 5 + Anzahl3) { x += 3; return 0; } else x = AnzAdd; } statpos(); lineout(); if (y < maxy - 1) { y++; return 0; } else { if (pagepos < (PTR)(mem + filesize)) { pagepos += Anzahl; repaint(); return 0; } else { beep(); return 1; } } } int cur_back() { if (loc == ASCII) { if (x > AnzAdd + Anzahl3) { x-- ; return 0; } else { x = AnzAdd - 1 + Anzahl3 + Anzahl; } } else { if (x > AnzAdd + 2) { x -= 3; return 0; } else { if (current == mem) return 0; x = AnzAdd + Anzahl3 - 3; } } statpos(); lineout(); if (y > 0) { y--; return 0; } else { if (pagepos > mem) { pagepos -= Anzahl; repaint(); return 0; } else { beep(); return 1; } } } void fileinfo(fname) char *fname; { off_t bytepos; char fstatus[MAXCMD]; char *string; if (fname) { string = malloc((size_t)strlen(fname) + MAXCMD); if (string == NULL) { emsg("Out of memory"); return; } sprintf(string, "\"%s\" ", fname); } else { string = malloc(MAXCMD); if (string == NULL) { emsg("Out of memory"); return; } strcpy(string, "No file "); } if (filemode != NEW && filemode != REGULAR) strcat(string, "[Not edited] "); if (P(P_RO)) strcat(string, "[Read only] "); if (edits) strcat(string, "[Modified] "); if (filesize) { bytepos = (pagepos + y * Anzahl + xpos()) - mem + 1L; sprintf(fstatus, "byte %llu of %llu --%llu%%--", (unsigned long long)bytepos, (unsigned long long)filesize, (unsigned long long)(bytepos * 100L / filesize)); strcat(string, fstatus); } else { strcat(string, " 0 bytes"); } msg(string); free(string); } /********** END ************/ void quit() { move(maxy, 0); endwin(); printf("\nbvi version %s %s\n", VERSION, copyright); exit(0); } int vgetc() { int nextc; if (getcnext != NULL) { nextc = *getcnext++; if (*getcnext == '\0') { *getcbuff = '\0'; getcnext = NULL; } return(nextc); } return getch(); } void stuffin(s) char *s; { if (s == NULL) { /* clear the stuff buffer */ getcnext = NULL; return; } if (getcnext == NULL) { strcpy(getcbuff, s); getcnext = getcbuff; } else strcat(getcbuff, s); } void do_back(n, start) off_t n; PTR start; { if (start - n < mem) { beep(); return; } if ((undo_count = alloc_buf(n, &undo_buf)) == 0L) return; yanked = alloc_buf(n, &yank_buf); edits = U_BACK; undo_start = start - n; memcpy(undo_buf, start - undo_count, undo_count); memcpy(yank_buf, start - undo_count, undo_count); memmove(start - undo_count, start, maxpos - start); filesize -= undo_count; maxpos -= undo_count; setpage(start - undo_count); repaint(); } int do_delete(n, start) off_t n; PTR start; { if (n + start > maxpos) { beep(); return 1; } if ((undo_count = alloc_buf(n, &undo_buf)) == 0L) return 1; yanked = alloc_buf(n, &yank_buf); edits = U_DELETE; undo_start = start; memcpy(undo_buf, start, undo_count); memcpy(yank_buf, start, undo_count); memmove(start, start + undo_count, maxpos - (start + undo_count)); filesize -= undo_count; maxpos -= undo_count; if (start == maxpos && start > mem) { start--; cur_back(); } setpage(start); repaint(); return 0; } /* * The :insert, :append and :change command */ void do_ins_chg(start, arg, mode) PTR start; char *arg; int mode; { int base; off_t buffer = BUFFER; off_t count = 0L; size_t len; long val; char *tempbuf = NULL; char *poi, *epoi; if ((mode == U_EDIT) && (current - mem >= filesize)) { beep(); return; } len = strlen(arg); if (!strncmp("ascii", arg, len) && CMDLNG(5, 1)) { base = 1; } else if (!strncmp("binary", arg, len) && CMDLNG(6, 1)) { base = 2; } else if (!strncmp("octal", arg, len) && CMDLNG(5, 1)) { base = 8; } else if (!strncmp("decimal", arg, len) && CMDLNG(7, 1)) { base = 10; } else if (!strncmp("hexadecimal", arg, len) && CMDLNG(11, 1)) { base = 16; } else { emsg("No such option"); return; } addch('\n'); if (getcmdstr(cmdstr, 0) == 1) { repaint(); return; } if (alloc_buf(buffer, &tempbuf) == 0L) return; while(strcmp(cmdstr, ".")) { poi = cmdstr; if (base == 1) { /* ASCII */ while (*poi != '\0') { if (*poi == '\\') { switch (*(++poi)) { case 'n': val = '\n'; break; case 'r': val = '\r'; break; case 't': val = '\t'; break; case '0': val = '\0'; break; case '\\': val = '\\'; break; default : val = '\\'; poi--; } poi++; } else { val = *poi++; } *(tempbuf + count++) = val; } } else { while (isspace(cmdstr[strlen(cmdstr) - 1])) cmdstr[strlen(cmdstr) - 1] = '\0'; while (*poi != '\0') { val = strtol(poi, &epoi, base); if (val > 255 || val < 0 || poi == epoi) { repaint(); emsg("Invalid value"); goto mfree; } poi = epoi; *(tempbuf + count++) = val; } } addch('\n'); if (getcmdstr(cmdstr, 0) == 1) { repaint(); goto mfree; } } if (count == 0) { repaint(); goto mfree; } switch (mode) { case U_INSERT: do_put(start, count, tempbuf); break; case U_EDIT: do_over(start, count, tempbuf); break; case U_APPEND: if ((undo_count = alloc_buf(count, &undo_buf)) == 0L) { repaint(); goto mfree; } do_append((off_t)count, tempbuf); memcpy(undo_buf, tempbuf, count); repaint(); break; } mfree: #if defined(__MSDOS__) && !defined(DJGPP) farfree(tempbuf); #else free(tempbuf); #endif } void clear_marks() { int n; for (n = 0; n < 26; markbuf[n++] = NULL); undo_count = 0; last_motion = mem; } void do_mark(mark, addr) int mark; PTR addr; { if (mark < 'a' || mark > 'z' || current >= maxpos) return; markbuf[mark - 'a'] = addr; } void movebyte() { emsg("Command disabled@- use ':set memmove' to enable "); } bvi-1.4.0/configure.ac0000644000175000017500000000423612206452026013570 0ustar bgbg00000000000000dnl Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([bvi.c]) AC_CONFIG_HEADER(config.h) AC_SYS_LARGEFILE AC_CANONICAL_HOST CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" dnl On SunOS4 systems you have to use the /usr/5bin/cc compiler dnl to get the SYSV curses library: case "$host_os" in sunos4*) AC_MSG_RESULT("using /usr/5bin/cc") CC="/usr/5bin/cc" ac_objext="o" ;; *) AC_PROG_CC ;; esac dnl Some curses specials dnl Solaris needs for tputs 'putc(char)' instead of 'putc(int)' case "$host_os" in solaris*) CPPFLAGS="${CPPFLAGS} -D_MSE_INT_H" AC_DEFINE(NEED_PUTC_CHAR) ;; hpux9*) DEFS=${DEFS-"-DMINICURSES"} ;; esac dnl Checks for programs. AC_PROG_INSTALL dnl Check for typedefs AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(void *) AC_CHECK_TYPE(size_t, unsigned int) AC_CHECK_TYPE(off_t, int) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h termcap.h termio.h termios.h unistd.h term.h ncurses/term.h) dnl Check if ncurses requested _cppflags="${CPPFLAGS}" _ldflags="${LDFLAGS}" AC_ARG_WITH(ncurses, [ --with-ncurses[=DIR] path to ncurses],[ if test "$withval" != "no"; then CPPFLAGS="${CPPFLAGS} -I$withval/include -I$withval/include/ncurses" LDFLAGS="${LDFLAGS} -L$withval/lib" fi ]) AC_CHECK_HEADER([ncurses.h],[ AC_SEARCH_LIBS([initscr], [ncurses],[ AC_DEFINE(HAVE_NCURSES_H) AC_SEARCH_LIBS([tputs], [tinfo])], [ AC_SEARCH_LIBS([initscr], [curses],[ AC_DEFINE(HAVE_CURSES_H) AC_SEARCH_LIBS([tputs], [tinfo])],[ AC_MSG_ERROR([bvi requires the curses library])])])],[ AC_CHECK_HEADER([curses.h],[ AC_SEARCH_LIBS([initscr], [curses], [ AC_DEFINE(HAVE_CURSES_H)],[ AC_MSG_ERROR([bvi requires the curses library])])],[ AC_MSG_ERROR([bvi requires the curses library])])]) dnl Checks for typedefs, structures, and compiler characteristics. dnl AC_TYPE_SIZE_T dnl Checks for library functions. dnl AC_TYPE_SIGNAL AC_CHECK_FUNCS(strdup strtol strtoll strerror memmove) AC_FUNC_FSEEKO AC_FUNC_MALLOC AC_FUNC_REALLOC AC_PROG_INSTALL AC_CONFIG_FILES([Makefile]) AC_OUTPUT bvi-1.4.0/acconfig.h0000644000175000017500000000024312206452025013215 0ustar bgbg00000000000000/***** begin user configuration section *****/ #undef HAVE_NCURSES_H #undef HAVE_CURSES_H #undef NO_SYSERRL #undef NEED_PUTC_CHAR #undef HAVE_NCURSES_TERM_H bvi-1.4.0/bm_dos.c0000644000175000017500000000337312206452025012711 0ustar bgbg00000000000000/* BM_DOS.C - DOS specific subroutines for BMORE * * 2000-05-10 V 1.3.0 alpha * 2000-07-07 V 1.3.0 final * 2001-12-07 V 1.3.1 * 2003-07-03 V 1.3.2 * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2003 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ /* #define DEBUG 1 */ #include "bmore.h" #define TBUFSIZ 1024 extern off_t bytepos, screen_home; extern FILE *curr_file; /* extern int screenlines; */ int got_int; int no_intty, no_tty; #ifdef DEBUG FILE *dbug; #endif void initterm() { maxx = 80; maxy = 25; } void set_tty () { } void reset_tty () { } void sig() { signal(SIGINT, sig); got_int = TRUE; } /* * doshell() - run a command or an interactive shell */ void doshell(cmd) char *cmd; { system(cmd); printf("\r"); clearscreen(); fseek(curr_file, screen_home, SEEK_SET); bytepos = screen_home; } void highlight() { highvideo(); } void normal() { normvideo(); } void clearscreen() { clrscr(); } void home() { gotoxy(1, 1); } /* force clear to end of line */ cleartoeol() { clreol(); } int vgetc() { return ((char)bioskey(0)); } bvi-1.4.0/bvi.c0000644000175000017500000005442512415044211012226 0ustar bgbg00000000000000/* BVI - Binary Visual Editor * * 1996-02-28 V 1.0.0 * 1999-01-27 V 1.1.0 * 1999-04-22 V 1.1.1 * 1999-07-01 V 1.2.0 beta * 1999-10-22 V 1.2.0 final * 2000-05-10 V 1.3.0 alpha * 2000-10-24 V 1.3.0 final * 2002-01-03 V 1.3.1 * 2004-01-04 V 1.3.2 * 2006-04-04 V 1.3.3 * 2013-08-23 V 1.4.0alpha * 2014-10-07 V 1.4.0 * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2014 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include #include "bvi.h" #include "set.h" #ifdef HAVE_LOCALE_H # include #endif char *copyright = "Copyright (C) 1996-2014 by Gerhard Buergmann"; jmp_buf env; /* context for `longjmp' function */ int loc; int maxx, maxy, x, xx, y; int screen, status, statsize; off_t size; PTR mem = NULL; PTR curpos; PTR maxpos; PTR pagepos; PTR spos; char *name = NULL; char *shell; char string[MAXCMD+1]; char cmdstr[MAXCMD+1] = ""; FILE *Ausgabe_Datei; int edits = 0; int AnzAdd, Anzahl, Anzahl3; off_t filesize, memsize, undosize; long precount = -1; int block_flag = 0; off_t block_begin, block_end, block_size; char **files; /* list of input files */ int numfiles; /* number of input files */ int curfile; /* number of the current file */ int arrnum = 0; char numarr[MAXCMD+1]; /* string for collecting number */ char rep_buf[BUFFER]; PTR current; PTR last_motion; PTR current_start; PTR undo_start; off_t undo_count; off_t yanked = 0L; char *yank_buf = NULL; char *undo_buf = NULL; PTR markbuf[26]; char addr_form[15]; char *nobytes = "No bytes@in the buffer"; static char progname[8]; static char line[MAXCMD+1]; static int mark; static int wrstat = 1; void usage() { fprintf(stderr, "Usage: %s [-R] [-c cmd | +cmd] [-f script]\n\ [-s skip] [-e end] [-n length] file ...\n\ file offset/size: 10k, 20m, 1g, 0x1000 hex, 0200 octal\n", progname); exit(1); } int main(argc, argv) int argc; char *argv[]; { int ch; int lflag; long count; int n = 1; int script = -1; off_t inaddr; char *poi; #ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); #endif poi = strrchr(argv[0], DELIM); if (poi) strncpy(progname, ++poi, 7); else strncpy(progname, argv[0], 7); strtok(progname, "."); if (!strcasecmp(progname, "bview")) { params[P_RO].flags |= P_CHANGED; P(P_RO) = TRUE; } else if (!strcasecmp(progname, "bvedit")) { /* This should be the beginners version */ } while (n < argc) { switch (argv[n][0]) { case '-': if (argv[n][1] == 'R') { params[P_RO].flags |= P_CHANGED; P(P_RO) = TRUE; } else if (argv[n][1] == 'c') { if (argv[n + 1] == NULL) { usage(); } else { strcpy(cmdstr, argv[++n]); } } else if (argv[n][1] == 'f') { if (argv[n + 1] == NULL || argv[n + 1][0] == '-') { usage(); } else { script = ++n; } } else if (argv[n][1] == 's') { if (argv[n + 1] == NULL || argv[n + 1][0] == '-') { usage(); } else { block_begin = calc_size(argv[++n]); block_flag |= BLOCK_BEGIN; } } else if (argv[n][1] == 'e') { if (argv[n + 1] == NULL || argv[n + 1][0] == '-') { usage(); } else { block_end = calc_size(argv[++n]); block_flag |= BLOCK_END; } } else if (argv[n][1] == 'n') { if (argv[n + 1] == NULL || argv[n + 1][0] == '-') { usage(); } else { block_size = calc_size(argv[++n]); block_flag |= BLOCK_LEN; } } else if (argv[n][1] == 'w') { if (argv[n][2] == '\0') { usage(); } else { params[P_LI].flags |= P_CHANGED; P(P_LI) = atoi(argv[n] + 2); } } else usage(); n++; break; case '+': /* +cmd */ if (argv[n][1] == '\0') { strcpy(cmdstr, "$"); } else { strcpy(cmdstr, &argv[n][1]); } n++; break; default: /* must be a file name */ name = strdup(argv[n]); files = &(argv[n]); numfiles = argc - n; n = argc; break; } } /* TODO default block_size - end of file up to max 64 KB with warning */ switch (block_flag) { case BLOCK_BEGIN: /* Acc. to SF-Error 3036881 we should use the whole rest of the file */ /* block_size = 1024; block_end = block_begin + block_size - 1; */ break; case BLOCK_END: block_begin = 0; block_size = block_end - block_begin + 1; break; case BLOCK_BEGIN|BLOCK_END: block_size = block_end - block_begin + 1; break; case BLOCK_LEN: block_begin = 0; block_end = block_begin + block_size - 1; break; case BLOCK_BEGIN|BLOCK_LEN: block_end = block_begin + block_size - 1; break; case BLOCK_END|BLOCK_LEN: block_begin = block_end + 1 - block_size; break; case BLOCK_BEGIN|BLOCK_END|BLOCK_LEN: if (block_end - block_begin != block_size + 1) { fprintf(stderr, "Ambigous block data\n"); exit(1); } break; } if (block_flag && !numfiles) { fprintf(stderr, "Cannot read a range of a nonexisting file\n"); exit(1); } if (numfiles > 1) fprintf(stderr, "%d files to edit\n", numfiles); curfile = 0; /****** Initialisation of curses ******/ initscr(); attrset(A_NORMAL); maxy = LINES; if (params[P_LI].flags & P_CHANGED) maxy = P(P_LI); P(P_SS) = maxy / 2; P(P_LI) = maxy; maxy--; keypad(stdscr, TRUE); scrollok(stdscr, TRUE); nonl(); cbreak(); noecho(); { /* address column width */ /* default is 8 + 2 blanks */ /* if block_begin has 8 hex digits or more */ /* reserve 1 hex digit more than required */ char tmp[sizeof(block_begin) * 2 + 3]; AnzAdd = sprintf(tmp, "%llX", (long long unsigned)block_begin) + 1; if (AnzAdd < 8) AnzAdd = 8; if (AnzAdd > sizeof(block_begin) * 2) AnzAdd = sizeof(block_begin) * 2; sprintf(addr_form, "%%0%dllX ", AnzAdd); AnzAdd = sprintf(tmp, addr_form, block_begin); } Anzahl = ((COLS - AnzAdd - 1) / 16) * 4; P(P_CM) = Anzahl; maxx = Anzahl * 4 + AnzAdd + 1; Anzahl3 = Anzahl * 3; statsize = 35; status = Anzahl3 + Anzahl - statsize; screen = Anzahl * (maxy - 1); signal(SIGINT, SIG_IGN); filesize = load(name); bvi_init(argv[0]); params[P_TT].svalue = terminal; if (block_flag && (P(P_MM) == TRUE)) { P(P_MM) = FALSE; params[P_TT].flags |= P_CHANGED; } if (script > -1) read_rc(argv[script]); if (*cmdstr != '\0') docmdline(cmdstr); /* main loop */ do { setjmp(env); current = (PTR)(pagepos + y * Anzahl + xpos()); if (wrstat) statpos(); wrstat = 1; setcur(); ch = vgetc(); while (ch >= '0' && ch <= '9') { if (arrnum < MAXCMD) numarr[arrnum++] = ch; ch = vgetc(); } numarr[arrnum] = '\0'; if (arrnum != 0) precount = strtoll(numarr, (char **)NULL, 10); else precount = -1; lflag = arrnum = 0; switch (ch) { case '^': x = AnzAdd; loc = HEX; break; /* case '0': x = AnzAdd + Anzahl3; loc = ASCII; break; */ case '$': x = AnzAdd - 1 + Anzahl3 + Anzahl; loc = ASCII; break; case '\t': toggle(); break; case '~': if (precount < 1) precount = 1; sprintf(rep_buf, "%ld~", precount); do_tilde((off_t)precount); lflag++; break; case KEY_HOME: case 'H': if (precount > 0) { y = --precount; if (y > maxy - 1) { scrolldown(y - maxy + 1); y = maxy - 1; } } else y = 0; if (loc == HEX) x = AnzAdd; else x = AnzAdd + Anzahl3; break; case 'M': y = maxy / 2; if ((PTR)(pagepos + screen) > maxpos) y = (int)(maxpos - pagepos) / Anzahl / 2; if (loc == HEX) x = AnzAdd; else x = AnzAdd + Anzahl3; break; case KEY_LL: case 'L': if (precount < 1) precount = 1; n = maxy - 1; if ((PTR)((pagepos + screen)) > maxpos) n = (int)(maxpos - pagepos) / Anzahl; if (precount < n) y = n + 1 - precount; if (loc == HEX) x = AnzAdd; else x = AnzAdd + Anzahl3; break; case BVICTRL('H'): case ASCII_DEL: case KEY_BACKSPACE: case KEY_LEFT: case 'h': do { if (x > (AnzAdd + 2) && x < (Anzahl3 + AnzAdd + 1)) x -= 3; else if (x > (Anzahl3 + AnzAdd - 2)) x--; } while (--precount > 0); if (x < AnzAdd + Anzahl3) loc = HEX; else loc = ASCII; break; case ' ': case KEY_RIGHT: case 'l': do { /* if (x < (Anzahl3 + 6)) x += 3; */ if (x < (Anzahl3 + AnzAdd - 2)) x += 3; else if (x > (Anzahl3 + 3) && x < (Anzahl3 + AnzAdd - 1 + Anzahl)) x++; } while (--precount > 0); if (x < AnzAdd + Anzahl3) loc = HEX; else loc = ASCII; break; case '-': case KEY_UP : case 'k': do { if (y > 0) y--; else scrollup(1); } while(--precount > 0); break; case '+': case CR: if (loc == HEX) x = AnzAdd; else x = AnzAdd + Anzahl3; case 'j': case BVICTRL('J'): case BVICTRL('N'): case KEY_DOWN: do { if ((PTR)((pagepos + (y + 1) * Anzahl)) > maxpos) break; if (y < (maxy - 1)) y++; else scrolldown(1); } while(--precount > 0); break; case '|': if (precount < 1) break; if (loc == ASCII) x = AnzAdd - 1 + Anzahl3 + precount; else x = 5 + 3 * precount; if (x > AnzAdd - 1 + Anzahl3 + Anzahl) { x = AnzAdd - 1 + Anzahl3 + Anzahl; loc = ASCII; } break; case ':' : clearstr(); addch(ch); refresh(); getcmdstr(cmdstr, 1); if (strlen(cmdstr)) docmdline(cmdstr); break; case BVICTRL('B'): case KEY_PPAGE: /**** Previous Page ****/ if (mem <= (PTR)(pagepos - screen)) pagepos -= screen; else pagepos = mem; repaint(); break; case BVICTRL('D'): if (precount > 1) P(P_SS) = precount; scrolldown(P(P_SS)); break; case BVICTRL('U'): if (precount > 1) P(P_SS) = precount; scrollup(P(P_SS)); break; case BVICTRL('E'): if (y > 0) y--; scrolldown(1); break; case BVICTRL('F'): case KEY_NPAGE: /**** Next Page *****/ if (maxpos >= (PTR)(pagepos + screen)) { pagepos += screen; current += screen; if (current - mem >= filesize) { current = mem + filesize; setpage((PTR)(mem + filesize - 1L)); } repaint(); } break; case BVICTRL('G'): fileinfo(name); wrstat = 0; break; case BVICTRL('L'): /*** REDRAW SCREEN ***/ new_screen(); break; case BVICTRL('Y'): if (y < maxy - 1) y++; scrollup(1); break; case 'A': smsg("APPEND MODE"); current = (PTR)(mem + filesize - 1L); setpage(current++); cur_forw(0); setcur(); undosize = filesize; undo_count = edit(ch); break; case 'B': case 'b': setpage(backsearch(current, ch)); break; case 'e': setpage(end_word(current)); break; case ',': do_ft(-1, 0); break; case ';': do_ft(0, 0); break; case 'F': case 'f': case 't': case 'T': do_ft(ch, 0); break; case 'G': last_motion = current; if (precount > -1) { if ((precount < P(P_OF)) || (precount - P(P_OF)) > (filesize - 1L)) { beep(); } else { setpage((PTR)(mem + precount - P(P_OF))); } } else { setpage((PTR)(mem + filesize - 1L)); } break; case 'g': last_motion = current; clearstr(); outmsg("Goto Hex Address:"); refresh(); getcmdstr(cmdstr, 18); clearstr(); if (cmdstr[0] == '^') { inaddr = P(P_OF); } else if (cmdstr[0] == '$') { inaddr = filesize + P(P_OF) - 1L; } else { off_t ltmp; sscanf(cmdstr, "%llx", (long long unsigned *)<mp); inaddr = ltmp; } if (inaddr < P(P_OF)) break; inaddr -= P(P_OF); if (inaddr < filesize) { setpage(mem + inaddr); } else { if (filesize == 0L) break; sprintf(string, "Max. address of current file : %06llX", (long long unsigned)(filesize - 1L + P(P_OF))); emsg(string); } break; case '?': case '/': /**** Search String ****/ case '#': case '\\': clearstr(); addch(ch); refresh(); if (getcmdstr(line, 1)) break; last_motion = current; hl_spat = P(P_HL); searching(ch, line, current, maxpos - 1, P(P_WS)); if (hl_spat) { repaint(); } break; case ESC: /* un-highlight */ hl_spat = FALSE; repaint(); break; case 'n': /**** Search Next ****/ case 'N': last_motion = current; hl_spat = P(P_HL); searching(ch, "", current, maxpos - 1, P(P_WS)); if (hl_spat) { repaint(); } break; case 'm': do_mark(vgetc(), current); break; case '\'': case '`': if ((ch == '`' && loc == ASCII) || (ch == '\'' && loc == HEX)) toggle(); mark = vgetc(); if (mark == '`' || mark == '\'') { setpage(last_motion); last_motion = current; } else { if (mark < 'a' || mark > 'z') { beep(); break; } else if (markbuf[mark - 'a'] == NULL) { beep(); break; } setpage(markbuf[mark - 'a']); } break; case 'D': if (precount < 1) precount = 1; sprintf(rep_buf, "%ldD", precount); trunc_cur(); break; case 'o': /* overwrite: this is an overwriting put */ if (precount < 1) precount = 1; sprintf(rep_buf, "%ldo", precount); do_over(current, yanked, yank_buf); break; case 'P': if (precount < 1) precount = 1; if ((undo_count = alloc_buf(yanked, &undo_buf)) == 0L) break; sprintf(rep_buf, "%ldP", precount); if (do_append((off_t)yanked, yank_buf)) break; /* we save it not for undo but for the dot command memcpy(undo_buf, yank_buf, yanked); */ repaint(); break; case 'r': case 'R': if (filesize == 0L) break; if (precount < 1) precount = 1; sprintf(rep_buf, "%ld%c", precount, ch); undo_count = edit(ch); lflag++; break; case 'u': do_undo(); break; case 'W': case 'w': // loc = ASCII; setpage(wordsearch(current, ch)); break; case 'y': count = range(ch); if (count > 0) { /* sprintf(string, "$%ld$", (long)yanked); msg(string); vgetc(); */ if ((yanked = alloc_buf((off_t)count, &yank_buf)) == 0L) { break; } memcpy(yank_buf, current, yanked); } else if (count < 0) { if ((yanked = alloc_buf(-(off_t)count, &yank_buf)) == 0L) { break; } memcpy(yank_buf, current, yanked); } else { break; } /* sprintf(string, "%ld bytes yanked", labs(count)); msg(string); */ break; case 'z': do_z(vgetc()); break; case 'Z': if (vgetc() == 'Z') do_exit(); else beep(); break; case '.': if (!strlen(rep_buf)) { beep(); } else { stuffin(rep_buf); } break; default : if P(P_MM) { if (precount < 1) precount = 1; switch (ch) { case 'I': sprintf(rep_buf, "%ldI", precount); current = mem; setpage(mem); repaint(); undo_count = edit('i'); lflag++; break; /* undo does not work correctly !!! */ case 's': sprintf(rep_buf, "%lds", precount); if (do_delete((off_t)precount, current)) break; precount = 1; undo_count = edit('i'); lflag++; break; case 'a': if (cur_forw(1)) break; current++; case 'i': sprintf(rep_buf, "%ld%c", precount, ch); undo_count = edit(ch); lflag++; break; case 'p': sprintf(rep_buf, "%ldp", precount); do_put(current, yanked, yank_buf); break; case 'c': case 'd': count = range(ch); if (count > 0) do_delete((off_t)count, current); else if (count < 0) do_back(-(off_t)count, current); if (ch == 'c') { precount = 1; undo_count = edit('i'); lflag++; } break; case 'x': sprintf(rep_buf, "%ldx", precount); do_delete((off_t)precount, current); break; case 'X': sprintf(rep_buf, "%ldX", precount); do_back((off_t)precount, current); break; default: flushinp(); beep(); } } else { switch (ch) { case 'x': if (precount < 1) precount = 1; if ((off_t)precount + current == maxpos) { sprintf(rep_buf, "%ldx", precount); do_delete((off_t)precount, current); } else { movebyte(); flushinp(); beep(); } break; case 'd': case 'i': case 'I': case 'p': case 'X': movebyte(); default: flushinp(); beep(); } } } if (lflag) lineout(); } while (1); } off_t calc_size(arg) char *arg; { off_t val; extern int errno; char *poi; errno = 0; val = strtoll(arg, &poi, 0); if (val < 0) { fprintf(stderr, "negative begin/size/end not allowed\n"); usage(); } if (poi == arg || errno != 0) { /* cygwin gdb displays errno incorrectly as 0 */ fprintf(stderr, "invalid begin/size/end (hex nr 0x#, octal 0#)\n"); usage(); } switch (*poi) { case 'k': case 'K': val *= 1024; break; case 'm': case 'M': val *= 1048576; break; case 'g': case 'G': val *= 1024*1024*1024LL; break; case '\0': break; default: usage(); } return (off_t)val; } void trunc_cur() { undosize = filesize; undo_count = (off_t)(maxpos - current); undo_start = current; filesize = pagepos - mem + y * Anzahl + xpos(); maxpos = (PTR)(mem + filesize); if (filesize == 0L) { emsg(nobytes); } else cur_back(); edits = U_TRUNC; repaint(); } int do_append(count, buf) off_t count; char *buf; { if (filesize + count > memsize) { if (enlarge(count + 100L)) return 1; } memcpy(mem + filesize, buf, count); undo_start = mem + filesize - 1L; setpage(undo_start + count); edits = U_APPEND; undosize = filesize; filesize += count; maxpos += count; return 0; } void do_tilde(count) off_t count; { if (filesize == 0L) return; undo_start = current; if (current + count > maxpos) { beep(); return; } if ((undo_count = alloc_buf(count, &undo_buf)) == 0L) return; memcpy(undo_buf, current, undo_count); while (count--) { if (isupper((int)(*current))) *current = tolower((int)(*current)); else if (islower((int)(*current))) *current = toupper((int)(*current)); current++; cur_forw(0); } edits = U_TILDE; setcur(); } void do_undo() { off_t n, tempsize; char temp; PTR set_cursor; PTR s; PTR d; if (undo_count == 0L) { emsg("Nothing to undo"); return; } set_cursor = undo_start; switch (edits) { case U_EDIT: case U_TILDE: n = undo_count; s = undo_buf; d = undo_start; while (n--) { temp = *d; *d = *s; *s = temp; s++; d++; } break; case U_APPEND: case U_TRUNC: tempsize = filesize; filesize = undosize; undosize = tempsize; maxpos = (PTR)(mem + filesize); if (filesize) set_cursor = maxpos - 1L; else set_cursor = maxpos; break; case U_INSERT: filesize -= undo_count; maxpos -= undo_count; memcpy(undo_buf, undo_start, undo_count); memmove(undo_start, undo_start + undo_count, maxpos - undo_start); edits = U_DELETE; break; case U_BACK: case U_DELETE: filesize += undo_count; maxpos += undo_count; memmove(undo_start + undo_count, undo_start, maxpos - undo_start); memcpy(undo_start, undo_buf, undo_count); edits = U_INSERT; break; } setpage(set_cursor); if (edits == U_TRUNC && undosize > filesize) cur_back(); repaint(); } void do_over(loc, n, buf) PTR loc; off_t n; PTR buf; { if (n < 1L) { emsg(nobytes); return; } if (loc + n > maxpos) { beep(); return; } if ((undo_count = alloc_buf(n, &undo_buf)) == 0L) return; undo_start = loc; memcpy(undo_buf, loc, n); memcpy(loc, buf, n); edits = U_EDIT; setpage(loc + n - 1); repaint(); } void do_put(loc, n, buf) PTR loc; off_t n; PTR buf; { if (n < 1L) { emsg(nobytes); return; } if (loc > maxpos) { beep(); return; } if (filesize + n > memsize) { if (enlarge(n + 1024)) return; } if ((undo_count = alloc_buf(n, &undo_buf)) == 0L) return; undo_start = loc + 1; edits = U_INSERT; filesize += n; maxpos += n; memmove(undo_start + n, undo_start, maxpos - loc); memcpy(undo_start, buf, n); setpage(loc + n); repaint(); } /* argument sig not used, because only SIGINT will be catched */ void jmpproc(sig) int sig; { if (P(P_EB)) beep(); repaint(); clearstr(); signal(SIGINT, SIG_IGN); longjmp(env, 0); } off_t range(ch) int ch; { int ch1; long count; ch1 = vgetc(); while (ch1 >= '0' && ch1 <= '9') { numarr[arrnum++] = ch1; ch1 = vgetc(); } numarr[arrnum] = '\0'; if (arrnum != 0) count = strtol(numarr, (char **)NULL, 10); else count = 1; arrnum = 0; sprintf(rep_buf, "%ld%c%s%c", precount, ch, numarr, ch1); switch (ch1) { case '/': /**** Search String ****/ case '\\': strcat(rep_buf, "\n"); clearstr(); addch(ch1); refresh(); if (getcmdstr(line, 1)) break; end_addr = searching(ch1, line, current, maxpos - 1, FALSE); if (!end_addr) { beep(); return 0; } return(end_addr - current); case '?': case '#': strcat(rep_buf, "\n"); clearstr(); addch(ch1); refresh(); if (getcmdstr(line, 1)) break; start_addr = searching(ch1, line, current, maxpos - 1, FALSE); if (!start_addr) { beep(); return 0; } return(start_addr - current); case 'f': case 't': precount = count; end_addr = do_ft(ch1, 1); if (!end_addr) { beep(); return 0; } return (end_addr + 1 - current); case 'F': case 'T': precount = count; start_addr = do_ft(ch1, 1); if (!start_addr) { beep(); return 0; } return (start_addr - current); case '$': trunc_cur(); return 0; case 'G': if (count == -1) { trunc_cur(); return 0; } else if ((count < P(P_OF)) || (count - (off_t)P(P_OF)) > (filesize - 1L)) { beep(); return 0; } else { if (mem + count < current) { return(mem + count - current); } else { return(count - (current - mem)); } } case ' ': return precount; case '`': case '\'': mark = vgetc(); if (mark < 'a' || mark > 'z') { beep(); return 0; } end_addr = markbuf[mark - 'a']; if (end_addr == NULL) { beep(); return 0; } if (end_addr < current) { return(end_addr - current); } else { return(end_addr - current + 1); } } beep(); return 0; } bvi-1.4.0/comm.c0000644000175000017500000004765612272213075012420 0ustar bgbg00000000000000/* COMM.C - Routines to parse and execute "command line" commands, such as * search or colon commands. * * 1996-01-16 created; * 1998-03-14 V 1.0.1 * 1999-02-03 V 1.1.0 * 1999-06-22 V 1.2.0 beta * 1999-09-10 V 1.2.0 final * 2000-03-03 V 1.3.0 beta * 2000-07-15 V 1.3.0 final * 2001-10-10 V 1.3.1 * 2003-07-04 V 1.3.2 * 2005-08-17 V 1.3.3 * 2010-06-02 V 1.3.4 * 2014-01-28 V 1.4.0 * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2014 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include "bvi.h" #include "set.h" #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_FCNTL_H # include #endif #if defined(__MSDOS__) && !defined(DJGPP) # include # include # define WRITE (O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) # define APPEND (O_WRONLY|O_APPEND|O_BINARY) #else # define WRITE (O_WRONLY|O_CREAT|O_TRUNC) # define APPEND (O_WRONLY|O_APPEND) #endif #define CMDSZ 256 /* size of the command buffer */ #define MAXNAME 10 /* size of a : command name */ #define NO_ADDR 1 #define NO_ARG 8 #define ONE_ARG 16 #define MAX_ONE_ARG 32 #define ONE_FILE 64 #define MAX_ONE_FILE 128 static char *altfile = NULL; /* alternate file */ static struct stat buf; static int c_argc = 0; static char *c_argv[9]; char *nowrtmsg = "No write@since last change (:%s! overrides)"; char *morefiles = "more files@to edit"; char *ambigous = "Ambigous|Too many file names"; char *ambvalue = "Ambigous|Too many values"; char *extra = "Extra chars|Extra characters at end of command"; char *noaddr = "No address allowed@on this command"; char *noval = "No value@for binary operation"; int repl_count = -1; int addr_flag; PTR start_addr; PTR end_addr; extern char *name; /* actual filename */ extern char **files; /* used for "next" and "rewind" */ extern int numfiles, curfile; extern int errno; static char oldbuf[CMDSZ]; /** for :!! command **/ /* * docmdline() - handle a colon command * * Handles a colon command received interactively by getcmdln() or from * the environment variable "BVIINIT" (or eventually .bvirc). */ void docmdline(cmdline) char *cmdline; { char buff[CMDSZ]; char cmdbuf[CMDSZ]; char cmdname[MAXNAME]; char *cmd; char *p; size_t len; int n, ok, ret; int force = 0; int saveflag; if (*cmdline == '\0') return; if (*cmdline == '"') return; /** comment **/ if (strlen(cmdline) > CMDSZ - 2) { emsg("Command too long"); return; } strcpy(buff, cmdline); cmd = buff; /* With no address given, we start at the beginning of the file and * go to the end of the file (not line like in vi). */ addr_flag = 0; start_addr = mem; end_addr = maxpos - 1; SKIP_WHITE if (*cmd == '%') { cmd++; addr_flag = 2; } else { if ((start_addr = calc_addr(&cmd, mem)) == NULL) { return; } if (*cmd == ',') { cmd++; addr_flag = 1; SKIP_WHITE if ((end_addr = calc_addr(&cmd, maxpos - 1)) == NULL) { return; } } else { if (addr_flag) { /* if we have only one address */ end_addr = start_addr; } } } SKIP_WHITE if (start_addr > (end_addr + 1)) { emsg("Addr1 > addr2|First address exceeds second"); return; } if ((end_addr + 1) > maxpos) { emsg("Not that many bytes@in buffer"); return; } if (start_addr < mem) { sprintf(string, "Negative address@- first byte is %lld", (long long)P(P_OF)); emsg(string); return; } SKIP_WHITE /**** End of address range calculation ****/ if (*cmd == '\0') { setpage(end_addr); return; } strcpy(cmdbuf, cmd); /* save the unmodified command */ if (*cmd == '!') { if (*(cmdbuf + 1) == '\0') { emsg("Incomplete shell escape command@- use 'shell' to get a shell"); return; } if (*(cmdbuf + 1) == '!') { if (oldbuf[0] != '\0') { strcpy(cmdbuf + 1, oldbuf); msg(oldbuf); } else { emsg("No previous command@to substitute for !"); return; } } else sprintf(oldbuf, "\n%s\n", cmdbuf + 1); if (P(P_AW)) { save(name, mem, maxpos, WRITE); edits = 0; } if (edits) msg("[No write]|[No write since last change]"); savetty(); endwin(); ret = system(cmdbuf + 1); fprintf(stderr, "[Hit return to continue]"); getchar(); doupdate(); repaint(); clearstr(); return; } n = 0; while (*cmd >= 'a' && *cmd <= 'z') { cmdname[n++] = *cmd++; if (n == MAXNAME) { sprintf(string, "What?|%s: Not an editor command", cmdbuf); emsg(string); return; } } cmdname[n] = '\0'; if (*cmd == '!') { force = 1; cmd++; } len = strlen(cmdname); SKIP_WHITE if (!strncmp("substitute", cmdname, len) && CMDLNG(10,1)) { repl_count = do_substitution(*cmd, cmd + 1, start_addr, end_addr); if (repl_count == -1) { emsg("No previous substitute re|No previous substitute regular expression"); return; /* No prev subst */ } repaint(); if (!repl_count) { emsg("Fail|Substitute pattern matching failed"); } else if (repl_count > 1) { sprintf(string, "%d subs|%d substitutions", repl_count, repl_count); msg(string); } return; } else if (!strncmp("global", cmdname, len) && CMDLNG(6,1)) { current = start_addr - 1; repl_count = 0; addch('\n'); while ((current = searching(*cmd, cmd + 1, current, end_addr, FALSE|S_GLOBAL)) != 0L) { addch('\n'); printline(current, maxy - 1); repl_count++; if (repl_count == LINES - 2) { if (wait_return(FALSE)) return; repl_count = 0; } } if (repl_count) { wait_return(TRUE); } else { repaint(); emsg(notfound); } return; } else if (cmdname[0] == 't') { if (!addr_flag) start_addr = current; cmd = cmdname + 1L; SKIP_WHITE do_mark(*cmd, start_addr); return; } if ((!strncmp("write", cmdname, len) && CMDLNG(5,1)) || !strcmp("wq", cmdname)) { if (*cmd == '>') { if (*(++cmd) == '>') { cmd++; saveflag = APPEND; } else { emsg("Write forms are 'w' and 'w>>'"); return; } } else if (*cmd == '!') { emsg("Not yet implemented"); return; } else { saveflag = WRITE; } SKIP_WHITE c_argc = 0; if ((c_argv[c_argc] = strtok(cmd, " \t")) != NULL) c_argc++; while ((c_argv[c_argc] = strtok(NULL, " \t")) != NULL) c_argc++; if (c_argc > 1) { emsg(ambigous); return; } if (c_argc == 1) { /* change '%' to Filename */ while ((p = strchr(c_argv[0], '%')) != NULL && *(p-1) != '\\') { if (name == NULL) { emsg("No filename@to substitute for %"); return; } *p = '\0'; strcpy (oldbuf, c_argv[0]); strcat (oldbuf, name); strcat (oldbuf, p + 1); c_argv[0] = oldbuf; } } if (name == NULL && c_argc != 0) name = strdup(c_argv[0]); if (force) { if (c_argc == 0) ok = save(name, start_addr, end_addr, saveflag); else ok = save(c_argv[0], start_addr, end_addr, saveflag); } else { if (c_argc == 0) { save_chk(name, start_addr, end_addr, saveflag); } else { if (!stat(c_argv[0], &buf)) { if (saveflag == WRITE) { sprintf(string, "File exists@- use \"%s! %s\" to overwrite", cmdname, c_argv[0]); emsg(string); return; } else { /* APPEND */ /* We can only append to a regular file! */ if (S_ISREG(buf.st_mode)) { if (filemode == PARTIAL) filemode = REGULAR; } else if (S_ISBLK(buf.st_mode)) { emsg("Cannot append to a block special file"); return; } ok = save(c_argv[0], start_addr, end_addr, saveflag); } } else { if (saveflag == APPEND) { emsg("No such file"); return; } else { /* WRITE */ /* If we write the block of a partial file to a new file, it will * become a regular file! */ if (filemode == PARTIAL) filemode = REGULAR; ok = save(c_argv[0], start_addr, end_addr, saveflag); } } } } if (!strcmp("wq", cmdname)) { if (ok) quit(); } return; } c_argc = 0; cmd = strtok(cmdbuf, " \t"); while ((c_argv[c_argc] = strtok(NULL, " \t")) != NULL) c_argc++; if (!strncmp("set", cmdname, len) && CMDLNG(3, 2)) { if (chk_comm(NO_ADDR)) return; if (c_argc == 0) { doset(NULL); } else { for (n = 0; n < c_argc; n++) { if (doset(c_argv[n])) return; } } } else if (!strncmp("args", cmdname, len) && CMDLNG(4, 2)) { if (chk_comm(NO_ADDR|NO_ARG)) return; string[0] = '\0'; for (n = 0; n < numfiles; n++) { if (n == curfile) strcat(string, "["); strcat(string, files[n]); if (n == curfile) strcat(string, "]"); strcat(string, " "); } msg(string); } else if (!strncmp("source", cmdname, len) && CMDLNG(6, 2)) { if (chk_comm(NO_ADDR|ONE_FILE)) return; if (read_rc(c_argv[0])) sysemsg(c_argv[0]); refresh(); } else if (!strncmp("cd", cmdname, len) && CMDLNG(2, 2)) { if (chk_comm(NO_ADDR|ONE_FILE)) return; if (!force) { if (edits) { if (P(P_AW)) { save(name, mem, maxpos, WRITE); edits = 0; } else { sprintf(string, nowrtmsg, "cd"); emsg(string); return; } } } if (c_argc == 0) { sprintf(string, "%c", DELIM); c_argv[0] = string; } if (chdir(c_argv[0])) sysemsg(c_argv[0]); } else if (!strncmp("edit", cmdname, len) && CMDLNG(4, 1)) { /* * The command ":e#" gets expanded to something like ":efile", so * detect that case here. */ if (*cmd == 'e' && c_argc == 0) { if (cmd[1] == '!') (void) doecmd(&cmd[2], TRUE); else (void) doecmd(&cmd[1], FALSE); return; } if (chk_comm(NO_ADDR|MAX_ONE_FILE)) return; doecmd(c_argv[0], force); } else if (!strncmp("file", cmdname, len) && CMDLNG(4, 1)) { if (chk_comm(NO_ADDR|MAX_ONE_FILE)) return; if (c_argc != 0) name = strdup(c_argv[0]); fileinfo(name); } else if (!strncmp("read", cmdname, len) && CMDLNG(4, 1)) { if (chk_comm(NO_ADDR|MAX_ONE_FILE)) return; /* read reads a file at EOF */ if (c_argc == 0) c_argv[0] = name; if (!addfile(c_argv[0])) { edits = U_TRUNC; undosize = filesize; repaint(); } } else if (!strncmp("xit", cmdname, len) && CMDLNG(3, 1)) { if (chk_comm(NO_ADDR|NO_ARG)) return; do_exit(); } else if (!strncmp("next", cmdname, len) && CMDLNG(4, 1)) { if (chk_comm(NO_ADDR|NO_ARG)) return; if (!force) { if (edits) { if (P(P_AW)) { save(name, mem, maxpos, WRITE); edits = 0; } else { sprintf(string, nowrtmsg, "next"); emsg(string); return; } } } if ((curfile + 1) < numfiles) { if (force) stuffin(":e! "); else stuffin(":e "); stuffin(files[++curfile]); stuffin("\n"); } else emsg("No more files@to edit!"); } else if (!strncmp("rewind", cmdname, len) && CMDLNG(6, 3)) { if (chk_comm(NO_ADDR|NO_ARG)) return; if (numfiles <= 1) /* nothing to rewind */ return; if (!force) { if (edits) { if (P(P_AW)) { save(name, mem, maxpos, WRITE); edits = 0; } else { sprintf(string, nowrtmsg, "rewind"); emsg(string); return; } } } curfile = 0; if (force) stuffin(":e! "); else stuffin(":e "); stuffin(files[0]); stuffin("\n"); } else if (!strncmp("append", cmdname, len) && CMDLNG(6, 1)) { if (chk_comm(NO_ADDR|MAX_ONE_ARG)) return; do_ins_chg(start_addr, c_argc == 1 ? c_argv[0] : "a", U_APPEND); } else if (!strncmp("change", cmdname, len) && CMDLNG(6, 1)) { if (chk_comm(MAX_ONE_ARG)) return; if (!addr_flag) start_addr = current; do_ins_chg(start_addr, c_argc == 1 ? c_argv[0] : "a", U_EDIT); } else if (!strncmp("mark", cmdname, len) && CMDLNG(4, 2)) { if (c_argc == 0) { emsg("Mark what?"); return; } if (c_argc > 1 || (strlen(c_argv[0]) > 1)) { emsg(extra); return; } if (!addr_flag) start_addr = current; do_mark(c_argv[0][0], start_addr); } else if (!strncmp("yank", cmdname, len) && CMDLNG(4, 1)) { if ((yanked = yd_addr()) == 0L) return; if ((yanked = alloc_buf(yanked, &yank_buf)) == 0L) return; memcpy(yank_buf, start_addr, yanked); sprintf(string, "%lu bytes", (long)yanked); msg(string); } else if (!strncmp("overwrite", cmdname, len) && CMDLNG(9, 1)) { if (chk_comm(NO_ARG)) return; if (!addr_flag) start_addr = current; do_over(start_addr, yanked, yank_buf); } else if (!strncmp("undo", cmdname, len) && CMDLNG(4, 1)) { if (chk_comm(NO_ADDR|NO_ARG)) return; do_undo(); } else if (!strncmp("version", cmdname, len) && CMDLNG(7, 2)) { if (chk_comm(NO_ADDR|NO_ARG)) return; sprintf(string, "bvi version %s %s", VERSION, copyright); msg(string); } else if (!strncmp("shell", cmdname, len) && CMDLNG(5, 2)) { if (chk_comm(NO_ADDR|NO_ARG)) return; do_shell(); clear(); repaint(); clearstr(); } else if (!strncmp("quit", cmdname, len) && CMDLNG(4, 1)) { if (chk_comm(NO_ADDR|NO_ARG)) return; if (!force) { if (edits) { sprintf(string, nowrtmsg, "quit"); emsg(string); } else { if ((curfile + 1) < numfiles) { sprintf(string, "%d %s", numfiles - curfile - 1, morefiles); emsg(string); } else quit(); } } else quit(); } else if (!strncmp("sleft", cmdname, len) && CMDLNG(5, 2)) { if (c_argc == 1) { do_logic(LSHIFT, c_argv[0]); } else if (c_argc == 0) { do_logic(LSHIFT, "1"); } else { emsg(ambvalue); return; } } else if (!strncmp("sright", cmdname, len) && CMDLNG(6, 2)) { if (c_argc == 1) { do_logic(RSHIFT, c_argv[0]); } else if (c_argc == 0) { do_logic(RSHIFT, "1"); } else { emsg(ambvalue); return; } } else if (!strncmp("rleft", cmdname, len) && CMDLNG(5, 2)) { if (c_argc == 1) { do_logic(LROTATE, c_argv[0]); } else if (c_argc == 0) { do_logic(LROTATE, "1"); } else { emsg(ambvalue); return; } } else if (!strncmp("rright", cmdname, len) && CMDLNG(6, 2)) { if (c_argc == 1) { do_logic(RROTATE, c_argv[0]); } else if (c_argc == 0) { do_logic(RROTATE, "1"); } else { emsg(ambvalue); return; } } else if (!strcmp("and", cmdname)) { if (c_argc == 1) { do_logic(AND, c_argv[0]); } else if (c_argc == 0) { emsg(noval); return; } else { emsg(ambvalue); return; } } else if (!strcmp("or", cmdname)) { if (c_argc == 1) { do_logic(OR, c_argv[0]); } else if (c_argc == 0) { emsg(noval); return; } else { emsg(ambvalue); return; } } else if (!strcmp("xor", cmdname)) { if (c_argc == 1) { do_logic(XOR, c_argv[0]); } else if (c_argc == 0) { emsg(noval); return; } else { emsg(ambvalue); return; } } else if (!strcmp("neg", cmdname)) { if (c_argc != 0) { emsg(extra); return; } do_logic(NEG, "255"); } else if (!strcmp("not", cmdname)) { if (c_argc != 0) { emsg(extra); return; } do_logic(NOT, "255"); } else { sprintf(string, "What?|%s: Not an editor command", cmd); if P(P_MM) { if (!strncmp("delete", cmdname, len) && CMDLNG(6, 1)) { if ((undo_count = yd_addr()) == 0L) return; do_delete(undo_count, start_addr); sprintf(string, "%lu bytes", (long)undo_count); msg(string); } else if (!strncmp("insert", cmdname, len) && CMDLNG(6, 1)) { if (chk_comm(MAX_ONE_ARG)) return; if (!addr_flag) start_addr = current; do_ins_chg(start_addr - 1, c_argc == 1 ? c_argv[0] : "a", U_INSERT); } else if (!strncmp("put", cmdname, len) && CMDLNG(3, 2)) { if (chk_comm(NO_ARG)) return; if (!addr_flag) start_addr = current; do_put(start_addr, yanked, yank_buf); } else { emsg(string); } } else { if (!strncmp("delete", cmdname, len) && CMDLNG(6, 1)) { movebyte(); } else if (!strncmp("insert", cmdname, len) && CMDLNG(6, 1)) { movebyte(); } else if (!strncmp("put", cmdname, len) && CMDLNG(3, 2)) { movebyte(); } else { emsg(string); } } } } /* calculate address range for :yank and :delete command */ off_t yd_addr() { off_t count = 0; if (c_argc == 0) { switch (addr_flag) { case 0: start_addr = current; case 1: count = 1; break; case 2: count = end_addr - start_addr + 1; break; } } else if (c_argc == 1) { count = atoi(c_argv[0]); switch (addr_flag) { case 0: start_addr = current; case 1: end_addr = start_addr + count - 1; break; case 2: start_addr = end_addr; end_addr = start_addr + count - 1; break; } } else { emsg(ambvalue); return 0; } return count; } /*********** Save file if not read only ********************/ int save_chk(fname, start, end, flags) char *fname; char *start; char *end; int flags; { if (P(P_RO)) { sprintf(string, "\"%s\" File is read only", name); emsg(string); return FALSE; } return save(fname, start, end, flags); } void do_exit() { if (edits) { if (!save_chk(name, mem, maxpos - 1L, WRITE)) return; } if ((curfile + 1) < numfiles) { sprintf(string, "%d %s", numfiles - curfile - 1, morefiles); emsg(string); } else quit(); } int doecmd(arg, force) char *arg; int force; { char *tmp; if (*arg == '\0') arg = NULL; if (!force && edits) { sprintf(string, nowrtmsg, "edit"); emsg(string); /* if (altfile) free(altfile); altfile = strdup(arg); */ return FALSE; } if (arg != NULL) { if (name != NULL && !strcmp(arg, name)) { if (!edits || (edits && !force)) return TRUE; } if (name != NULL && !strcmp(arg, "#")) { if (altfile == NULL) { emsg("No alternate filename@to substitute for #"); return FALSE; } tmp = name; name = altfile; altfile = tmp; } else { if (altfile) { free(altfile); } altfile = name; name = strdup(arg); } } if (name == NULL) { emsg("No file|No current filename"); return FALSE; } edits = 0; filesize = load(name); if (arg == NULL) { setpage(current < maxpos ? current : maxpos - 1L); } return TRUE; } void clearstr() { int n; move(maxy, 0); for (n = 0; n < maxx; n++) addch(' '); move(maxy, 0); } /**** displays an error message *****/ void emsg(s) char *s; { int cnt; int stchar; if (P(P_EB)) beep(); if (P(P_MO)) { stchar = statsize; } else { stchar = 0; } clearstr(); attrset(A_REVERSE); cnt = outmsg(s); attrset(A_NORMAL); if (cnt >= (maxx - stchar)) { addch('\n'); wait_return(TRUE); } } /*** System error message *****/ void sysemsg(s) char *s; { char string[256]; #ifdef HAVE_STRERROR sprintf(string, "%s: %s", s, strerror(errno)); #else sprintf(string, "%s: %s", s, sys_errlist[errno]); #endif emsg(string); } /*** displays mode if showmode set *****/ void smsg(s) char *s; { if (P(P_MO)) { msg(s); setcur(); } } /************* displays s on status line *****************/ void msg(s) char *s; { int stchar; if (P(P_MO)) { stchar = statsize; } else { stchar = 0; } clearstr(); if (outmsg(s) >= (maxx - stchar)) { addch('\n'); wait_return(TRUE); } } int outmsg(s) char *s; { char *poi; int cnt = 0; move(maxy, 0); poi = strchr(s, '|'); if (P(P_TE)) { poi = s; while (*poi != '\0' && *poi != '@' && *poi != '|') { addch(*poi++); cnt++; } } else { if (poi) poi++; else poi = s; while (*poi) { if (*poi == '@') addch(' '); else addch(*poi); poi++; cnt++; } } return cnt; } /* If flag == TRUE we do a repaint * */ int wait_return(flag) int flag; { int c; signal(SIGINT, jmpproc); clearstr(); attrset(A_REVERSE); mvaddstr(maxy, 0, "[Hit return to continue]"); attrset(A_NORMAL); refresh(); c = getch(); if (flag) { clear(); repaint(); } clearstr(); signal(SIGINT, SIG_IGN); if (c != CR && c != NL && c != ' ' && c != ':' && c != KEY_ENTER) return 1; return 0; } int chk_comm(flag) int flag; { if ((flag & NO_ADDR) && (addr_flag > 0)) { emsg(noaddr); return 1; } if ((flag & NO_ARG) && (c_argc > 0)) { emsg(extra); return 1; } if ((flag & MAX_ONE_ARG) && (c_argc > 1)) { emsg(ambvalue); return 1; } if ((flag & ONE_FILE) && (c_argc == 0)) { emsg("Missing filename"); return 1; } if ((flag & MAX_ONE_FILE) && (c_argc > 1)) { emsg(ambigous); return 1; } return 0; } bvi-1.4.0/dosio.c0000644000175000017500000002246612206452026012570 0ustar bgbg00000000000000/* DOSIO.C - file I/O and alloc subroutines for MSDOS - BVI * * 1996-02-28 V 1.0.0 * 1998-04-12 V 1.0.1 * 1999-01-14 V 1.1.0 * 1999-04-27 V 1.1.1 * 1999-07-02 V 1.2.0 beta * 1999-09-01 V 1.2.0 final * 2000-05-02 V 1.3.0 alpha * * NOTE: Edit this file with tabstop=4 ! * * Copyright 1996-2002 by Gerhard Buergmann * Gerhard.Buergmann@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include #include #include #include #include #include #include "bvi.h" #include "set.h" char *terminal = "ansi"; extern maxy; struct WINDOW scr; int stdscr = 0; int COLS = 80; int LINES = 25; int ECHO = TRUE; int NODEL = FALSE; static struct stat buf; int filemode; int inch(void); void attrset(int attr) { switch(attr) { case A_NORMAL: textcolor(P(P_CO) & 0x07); textbackground((P(P_CO) & 0xf0) >> 4); break; case A_BOLD: textcolor((P(P_CO) & 0x07) | 0x08); textbackground((P(P_CO) & 0xf0) >> 4); break; case A_REVERSE: textcolor((P(P_CO) & 0xf0) >> 4); textbackground(P(P_CO) & 0x0f); break; case A_BLINK: textcolor((P(P_CO) & 0xf0) >> 4); textbackground(P(P_CO) & 0x0f); break; } } int getch() { int x; if (NODEL) if (!kbhit()) return(ERR); x = bioskey(0); if ((x & 0xff) == 0) return(x); else { x &= 0xff; if (ECHO) putch(x); return(x); } } void delch() { int x, y; x = wherex(); y = wherey(); movetext(x + 1, y, COLS - x, y, x, y); gotoxy(COLS, y); putch(' '); gotoxy(x, y); } void insch(int c) { char line[80]; int x, y; x = wherex(); y = wherey(); gettext(x, y, COLS - x, y, line); puttext(x + 1, y, COLS - x + 1, y, line); putch(c); } int inch() { return peek(0xb800, (wherex() - 1) + (wherey() - 1) * COLS); } int mvinch(int y, int x) { gotoxy(x + 1, y + 1); return inch(); } /*********** Save the patched file ********************/ int save(char *fname, PTR start, PTR end, int flags) { int fd; char string[255]; char *newstr; off_t written; off_t filesize; unsigned n, to_write; if (!fname) { emsg("No file|No current filename"); return 0; } if (stat(fname, &buf) == -1) { newstr = "[New file] "; } else { if (S_ISDIR(buf.st_mode)) { sprintf(string, "\"%s\" Is a directory", fname); msg(string); return 0; } newstr = ""; } if (filemode == PARTIAL) flags = O_RDWR; if ((fd = open(fname, flags, 0666)) < 0) { sysemsg(fname); return 0; } if (filemode == PARTIAL) { if (block_read) { filesize = block_read; sprintf(string, "\"%s\" range %lu-%lu", fname, (unsigned long)block_begin, (unsigned long)(block_begin - 1 + filesize)); if (lseek(fd, block_begin, SEEK_SET) < 0) { sysemsg(fname); return 0; } } else { msg("Null range"); return 0; } } else { filesize = end - start + 1L; sprintf(string, "\"%s\" %s%lu@bytes", fname, newstr, (long)filesize); } written = 0; do { to_write = (filesize - written) > 0xfffe ? 0xfffe : (filesize - written); if ((n = write(fd, start + written, to_write)) == 0xffff) { sysemsg(fname); close(fd); return(0L); } written += (off_t)n; } while (written < filesize); close(fd); edits = 0; msg(string); return 1; } off_t load(char *fname) { int fd = -1; char string[MAXCMD]; unsigned chunk, n; buf.st_size = filesize = 0L; if (fname != NULL) { if (stat(fname, &buf) == -1) { filemode = NEW; } else if (S_ISDIR(buf.st_mode)) { filemode = DIRECTORY; } else if (S_ISREG(buf.st_mode)) { if ((fd = open(fname, O_RDONLY|O_BINARY)) > 0) { filemode = REGULAR; if (access(fname, 2)) { P(P_RO) = TRUE; params[P_RO].flags |= P_CHANGED; } } else { sysemsg(fname); filemode = ERROR; } } } else { filemode = NEW; } if (mem != NULL) farfree(mem); if (block_flag) { memsize = block_size + 1000; } else if (filemode == REGULAR) { memsize = buf.st_size + 100; } else { memsize = 1000; } if (farcoreleft() < memsize) { move(maxy, 0); endwin(); printf("\n\nOut of memory\n"); exit(0); } mem = (char huge *)farmalloc(memsize); clear_marks(); if (block_flag && (filemode == REGULAR)) { if (lseek(fd, block_begin, SEEK_SET) < 0) { sysemsg(fname); filemode = ERROR; } else { chunk = block_size > 0xfffe ? 0xfffe : block_size; do { if ((n = read(fd, mem + filesize, chunk)) == 0xffff) { sysemsg(fname); filemode = ERROR; break; } filesize += (off_t)n; } while (filesize < buf.st_size); if ((filesize == 0) { sprintf(string, "\"%s\" No such range: %lu-%lu", fname, (unsigned long)block_begin, (unsigned long)(block_end)); } else { sprintf(string, "\"%s\" range %lu-%lu", fname, (unsigned long)block_begin, (unsigned long)(block_begin + filesize - 1)); } filemode = PARTIAL; block_read = filesize; msg(string); P(P_OF) = block_begin; params[P_OF].flags |= P_CHANGED; } } else if (filemode == REGULAR) { chunk = buf.st_size > 0xfffe ? 0xfffe : buf.st_size; do { if ((n = read(fd, mem + filesize, chunk)) == 0xffff) { sysemsg(fname); filemode = ERROR; break; } filesize += (off_t)n; } while (filesize < buf.st_size); } if (fd > 0) close(fd); if (filemode != REGULAR) { filesize = 0L; } if (fname != NULL) { switch (filemode) { case NEW: sprintf(string, "\"%s\" [New File]", fname); break; case REGULAR: sprintf(string, "\"%s\" %s%lu bytes", fname, P(P_RO) ? "[Read only] " : "", (long)filesize); break; case DIRECTORY: sprintf(string, "\"%s\" Directory", fname); break; } if (filemode != ERROR) msg(string); } pagepos = mem; maxpos = (PTR)(mem + filesize); loc = HEX; x = AnzAdd; y = 0; repaint(); return(filesize); } int addfile(char *fname) { int fd; off_t oldsize; unsigned chunk, n; if (stat(fname, &buf)) { sysemsg(fname); return 1; } if ((fd = open(fname, O_RDONLY)) == -1) { sysemsg(fname); return 1; } oldsize = filesize; if (enlarge(buf.st_size)) return 1; chunk = buf.st_size > 0xfffe ? 0xfffe : buf.st_size; do { if ((n = read(fd, mem + filesize, chunk)) == 0xffff) { sysemsg(fname); filemode = ERROR; return 1; } filesize += (off_t)n; } while (filesize < buf.st_size); maxpos = mem + filesize; close(fd); setpage(mem + oldsize); return 0; } void bvi_init(char *dir) { char *poi; char *initstr; char rcpath[255]; shell = getenv("COMSPEC"); if (shell == NULL || *shell == '\0') shell = "COMMAND.COM"; strcpy(rcpath, dir); poi = strrchr(rcpath, '\\'); *poi = '\0'; strcat(rcpath, "\\BVI.RC"); if ((initstr = getenv("BVIINIT")) != NULL) { docmdline(initstr); } read_rc("BVI.RC"); read_rc(rcpath); } int enlarge(off_t add) { PTR newmem; off_t savecur, savepag, savemax, saveundo; savecur = curpos - mem; savepag = pagepos - mem; savemax = maxpos - mem; saveundo = undo_start - mem; newmem = (PTR)farrealloc(mem, memsize + add); if (newmem == NULL) { emsg("Out of memory"); return 1; } mem = newmem; memsize += add; curpos = mem + savecur; pagepos = mem + savepag; maxpos = mem + savemax; undo_start = mem + saveundo; current = curpos + 1; return 0; } void do_shell() { system(""); } off_t alloc_buf(off_t n, char **buffer) { if ((*buffer = (char *)farrealloc(*buffer, n)) == NULL) { emsg("No buffer space available"); return 0L; } return n; } void d_memmove(PTR dest, PTR src, off_t n) { unsigned len; long chunk; PTR source; PTR destin; chunk = n; if (dest < src) { /* copy forward */ source = src; destin = dest; while (chunk > 0L) { len = chunk > 0x7ffe ? 0x7ffe : chunk; movmem(source, destin, len); chunk -= len; source += len; destin += len; } } else { /* copy backward */ source = src + n; destin = dest + n; while (chunk > 0L) { len = chunk > 0x7ffe ? 0x7ffe : chunk; chunk -= len; source -= len; destin -= len; movmem(source, destin, len); } } } void d_memcpy(PTR dest, PTR src, off_t n) { unsigned len; long chunk; PTR source; PTR destin; source = src; destin = dest; chunk = n; while (chunk > 0L) { len = chunk > 0x7ffe ? 0x7ffe : chunk; movmem(source, destin, len); chunk -= len; source += len; destin += len; } }