2000-07-26 13:52:19 -04:00
|
|
|
#!/usr/bin/perl
|
|
|
|
#
|
|
|
|
# This script reads the syntaces of commands from irssi source tree.
|
|
|
|
# Then it browses through all '.in' files in the current directory and
|
|
|
|
# substitutes '@SYNTAX:foo@' tags with real syntaces found. This data
|
|
|
|
# is written into the corresponding files without the '.in' extension.
|
|
|
|
# For example: help.in -> ../help
|
|
|
|
#
|
|
|
|
# This path has to be changed. It should point to your irssi/src directory
|
|
|
|
# Remember to include the asterisk ('*').
|
2000-07-31 08:50:57 -04:00
|
|
|
$SRC_PATH='src';
|
2000-07-26 13:52:19 -04:00
|
|
|
|
2000-10-17 19:45:00 -04:00
|
|
|
$FOO = `find src -name '*.c' -exec ./findsyntax.pl \{\} \\; | sed 's/.*SYNTAX: //' > irssi_syntax`;
|
|
|
|
|
2000-07-31 08:50:57 -04:00
|
|
|
|
2000-07-26 13:52:19 -04:00
|
|
|
while (<docs/help/in/*.in>) {
|
|
|
|
open (FILE, "$_");
|
|
|
|
@data = <FILE>;
|
|
|
|
close (FILE);
|
|
|
|
foreach $DATARIVI (@data) {
|
|
|
|
if ($DATARIVI =~ /\@SYNTAX\:(.+)\@/) {
|
|
|
|
$etsittava = "\U$1 ";
|
|
|
|
$SYNTAX = `grep \'^$etsittava\' irssi_syntax`;
|
2000-10-17 19:45:00 -04:00
|
|
|
$SYNTAX =~ s/\*\///g;
|
|
|
|
$SYNTAX =~ s/ *$//; $SYNTAX =~ s/ *\n/\n/g;
|
2000-07-26 13:52:19 -04:00
|
|
|
$DATARIVI = $SYNTAX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$newfilename = $_; $newfilename =~ s/\.in$//;
|
|
|
|
$newfilename =~ s/\/in\//\//;
|
|
|
|
open (NEWFILE, ">$newfilename");
|
|
|
|
print NEWFILE @data;
|
|
|
|
close (NEWFILE);
|
|
|
|
}
|
2000-07-26 14:18:28 -04:00
|
|
|
unlink "irssi_syntax";
|