1*ebfedea0SLionel Sambuc#!/usr/local/bin/perl 2*ebfedea0SLionel Sambuc# 3*ebfedea0SLionel Sambuc# tack error codes onto the end of a file 4*ebfedea0SLionel Sambuc# 5*ebfedea0SLionel Sambuc 6*ebfedea0SLionel Sambucopen(ERR,$ARGV[0]) || die "unable to open error file '$ARGV[0]':$!\n"; 7*ebfedea0SLionel Sambuc@err=<ERR>; 8*ebfedea0SLionel Sambucclose(ERR); 9*ebfedea0SLionel Sambuc 10*ebfedea0SLionel Sambucopen(IN,$ARGV[1]) || die "unable to open header file '$ARGV[1]':$!\n"; 11*ebfedea0SLionel Sambuc 12*ebfedea0SLionel Sambuc@out=""; 13*ebfedea0SLionel Sambucwhile (<IN>) 14*ebfedea0SLionel Sambuc { 15*ebfedea0SLionel Sambuc push(@out,$_); 16*ebfedea0SLionel Sambuc last if /BEGIN ERROR CODES/; 17*ebfedea0SLionel Sambuc } 18*ebfedea0SLionel Sambucclose(IN); 19*ebfedea0SLionel Sambuc 20*ebfedea0SLionel Sambucopen(OUT,">$ARGV[1]") || die "unable to open header file '$ARGV[1]':$1\n"; 21*ebfedea0SLionel Sambucprint OUT @out; 22*ebfedea0SLionel Sambucprint OUT @err; 23*ebfedea0SLionel Sambucprint OUT <<"EOF"; 24*ebfedea0SLionel Sambuc 25*ebfedea0SLionel Sambuc#ifdef __cplusplus 26*ebfedea0SLionel Sambuc} 27*ebfedea0SLionel Sambuc#endif 28*ebfedea0SLionel Sambuc#endif 29*ebfedea0SLionel Sambuc 30*ebfedea0SLionel SambucEOF 31*ebfedea0SLionel Sambucclose(OUT); 32*ebfedea0SLionel Sambuc 33*ebfedea0SLionel Sambuc 34