diff -urN ed-1.4.orig/ChangeLog ed-1.4/ChangeLog --- ed-1.4.orig/ChangeLog 2009-07-10 11:54:33.000000000 +0000 +++ ed-1.4/ChangeLog 2010-05-11 14:18:39.000000000 +0000 @@ -1,3 +1,11 @@ +2010-05-11 Thomas Cort + + * configure: minix specific flags. + * Converted C99 style comments '// foo' to ANSI style comments /* foo */ + * carg_parser.c: fix constant declaration near line 156. + * regex.c: make se_max a constant. + * signal.c: include termios.h + 2009-07-10 Antonio Diaz Diaz * Version 1.4 released. diff -urN ed-1.4.orig/buffer.c ed-1.4/buffer.c --- ed-1.4.orig/buffer.c 2009-06-12 12:02:44.000000000 +0000 +++ ed-1.4/buffer.c 2010-05-11 13:46:44.000000000 +0000 @@ -81,8 +81,8 @@ /* remove node from circular queue */ -//static void remove_node( const line_t *node ) -// { link_nodes( node->q_back, node->q_forw ); } +/* static void remove_node( const line_t *node ) */ +/* { link_nodes( node->q_back, node->q_forw ); } */ /* add a line node in the editor buffer after the given line */ diff -urN ed-1.4.orig/carg_parser.c ed-1.4/carg_parser.c --- ed-1.4.orig/carg_parser.c 2009-06-06 10:10:21.000000000 +0000 +++ ed-1.4/carg_parser.c 2010-05-11 13:53:18.000000000 +0000 @@ -81,16 +81,16 @@ for( len = 0; opt[len+2] && opt[len+2] != '='; ++len ) ; - // Test all long options for either exact match or abbreviated matches. + /* Test all long options for either exact match or abbreviated matches. */ for( i = 0; options[i].code != 0; ++i ) if( options[i].name && !strncmp( options[i].name, &opt[2], len ) ) { - if( strlen( options[i].name ) == len ) // Exact match found + if( strlen( options[i].name ) == len ) /* Exact match found */ { index = i; exact = 1; break; } - else if( index < 0 ) index = i; // First nonexact match found + else if( index < 0 ) index = i; /* First nonexact match found */ else if( options[index].code != options[i].code || options[index].has_arg != options[i].has_arg ) - ambig = 1; // Second or later nonexact match found + ambig = 1; /* Second or later nonexact match found */ } if( ambig && !exact ) @@ -100,7 +100,7 @@ return 1; } - if( index < 0 ) // nothing found + if( index < 0 ) /* nothing found */ { add_error( ap, "unrecognized option `" ); add_error( ap, opt ); add_error( ap, "'" ); @@ -109,7 +109,7 @@ ++*argindp; - if( opt[len+2] ) // `--=' syntax + if( opt[len+2] ) /* `--=' syntax */ { if( options[index].has_arg == ap_no ) { @@ -146,14 +146,16 @@ const char * const opt, const char * const arg, const ap_Option options[], int * argindp ) { - int cind = 1; // character index in opt + int cind = 1; /* character index in opt */ while( cind > 0 ) { int index = -1; int i; const unsigned char code = opt[cind]; - const char code_str[2] = { code, 0 }; + char code_tmp[2] = { 0, 0 }; + const char *code_str = code_tmp; + code_tmp[0] = code; if( code != 0 ) for( i = 0; options[i].code; ++i ) @@ -166,7 +168,7 @@ return 1; } - if( opt[++cind] == 0 ) { ++*argindp; cind = 0; } // opt finished + if( opt[++cind] == 0 ) { ++*argindp; cind = 0; } /* opt finished */ if( options[index].has_arg != ap_no && cind > 0 && opt[cind] ) { @@ -193,9 +195,9 @@ char ap_init( Arg_parser * ap, const int argc, const char * const argv[], const ap_Option options[], const char in_order ) { - const char ** non_options = 0; // skipped non-options - int non_options_size = 0; // number of skipped non-options - int argind = 1; // index in argv + const char ** non_options = 0; /* skipped non-options */ + int non_options_size = 0; /* number of skipped non-options */ + int argind = 1; /* index in argv */ int i; ap->data = 0; @@ -209,13 +211,13 @@ const unsigned char ch1 = argv[argind][0]; const unsigned char ch2 = ( ch1 ? argv[argind][1] : 0 ); - if( ch1 == '-' && ch2 ) // we found an option + if( ch1 == '-' && ch2 ) /* we found an option */ { const char * const opt = argv[argind]; const char * const arg = (argind + 1 < argc) ? argv[argind+1] : 0; if( ch2 == '-' ) { - if( !argv[argind][2] ) { ++argind; break; } // we found "--" + if( !argv[argind][2] ) { ++argind; break; } /* we found "--" */ else if( !parse_long_option( ap, opt, arg, options, &argind ) ) return 0; } else if( !parse_short_option( ap, opt, arg, options, &argind ) ) return 0; diff -urN ed-1.4.orig/carg_parser.h ed-1.4/carg_parser.h --- ed-1.4.orig/carg_parser.h 2009-01-15 11:24:38.000000000 +0000 +++ ed-1.4/carg_parser.h 2010-05-11 13:47:38.000000000 +0000 @@ -43,8 +43,8 @@ typedef struct { - int code; // Short option letter or code ( code != 0 ) - const char * name; // Long option name (maybe null) + int code; /* Short option letter or code ( code != 0 ) */ + const char * name; /* Long option name (maybe null) */ ap_Has_arg has_arg; } ap_Option; @@ -75,11 +75,11 @@ const char * ap_error( const Arg_parser * ap ); - // The number of arguments parsed (may be different from argc) + /* The number of arguments parsed (may be different from argc) */ int ap_arguments( const Arg_parser * ap ); - // If ap_code( i ) is 0, ap_argument( i ) is a non-option. - // Else ap_argument( i ) is the option's argument (or empty). + /* If ap_code( i ) is 0, ap_argument( i ) is a non-option. */ + /* Else ap_argument( i ) is the option's argument (or empty). */ int ap_code( const Arg_parser * ap, const int i ); const char * ap_argument( const Arg_parser * ap, const int i ); diff -urN ed-1.4.orig/configure ed-1.4/configure --- ed-1.4.orig/configure 2009-07-10 11:54:33.000000000 +0000 +++ ed-1.4/configure 2010-05-11 14:19:41.000000000 +0000 @@ -33,6 +33,12 @@ CXXFLAGS='-Wall -W -O2' LDFLAGS= +if [ x"$(uname -s)" = x"Minix" ] +then + CFLAGS="-Wall -O2 -D_MINIX -D_POSIX" + CXXFLAGS="${CFLAGS}" +fi + # Loop over all args while [ x"$1" != x ] ; do diff -urN ed-1.4.orig/regex.c ed-1.4/regex.c --- ed-1.4.orig/regex.c 2009-06-12 11:15:28.000000000 +0000 +++ ed-1.4/regex.c 2010-05-11 13:55:45.000000000 +0000 @@ -38,6 +38,8 @@ static char *rbuf = 0; /* replace_matching_text buffer */ static int rbufsz = 0; /* replace_matching_text buffer size */ +/* max subexpressions in a regular expression */ +#define se_max (30) char prev_pattern( void ) { return global_pat != 0; } @@ -307,7 +309,6 @@ static int replace_matching_text( const line_t *lp, const int gflags, const int snum ) { - const int se_max = 30; /* max subexpressions in a regular expression */ regmatch_t rm[se_max]; char *txt = get_sbuf_line( lp ); char *eot; diff -urN ed-1.4.orig/signal.c ed-1.4/signal.c --- ed-1.4.orig/signal.c 2009-06-12 12:25:39.000000000 +0000 +++ ed-1.4/signal.c 2010-05-11 14:17:25.000000000 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include #include "ed.h"