1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#!/bin/sh
chmod 644 mercury_getopt.h mercury_getopt.c mercury_getopt1.c
for file in getopt.h getopt.c getopt1.c
do
echo processing mercury_$file
cp GETOPT/$file mercury_$file
ex mercury_$file << END
g/#include/s/getopt/mercury_getopt/
g/\<getopt/s//MR_getopt/g
g/\<optarg/s//MR_optarg/g
g/\<optind/s//MR_optind/g
g/\<opterr/s//MR_opterr/g
g/\<optopt/s//MR_optopt/g
g/\<option/s//MR_option/g
g/\<_getopt/s//MR__getopt/g
g/\<_GETOPT/s//MERCURY_GETOPT/g
g/no_argument/s//MR_no_argument/g
g/required_argument/s//MR_required_argument/g
g/#ifndef/s/ELIDE_CODE/XXXELIDE_CODEXXX/
w
q
END
done
echo finalizing mercury_getopt.h
ex mercury_getopt.h << END
1i
#undef __GNU_LIBRARY__
#define __GNU_LIBRARY__
.
w
q
END
echo finalizing mercury_getopt.c
ex mercury_getopt.c << END
1i
extern char *getenv(const char *);
.
g/nextchar/s//MR_nextchar/g
g/ordering/s//MR_ordering/g
g/posixly_correct/s//MR_posixly_correct/g
g/first_nonopt/s//MR_first_nonopt/g
g/last_nonopt/s//MR_last_nonopt/g
g/__getopt_initialized/s//MR____getopt_initialized/g
g/%s: MR_option/s//%s: option/g
g/%s: unrecognized MR_option/s//%s: unrecognized option/g
g/%s: illegal MR_option/s//%s: illegal option/g
g/%s: invalid MR_option/s//%s: invalid option/g
w
q
END
chmod 444 mercury_getopt.h mercury_getopt.c mercury_getopt1.c
|