Difference between revisions of "User:Colin"

From AMule Project FAQ
Jump to: navigation, search
(subh)
(awk ver)
Line 18: Line 18:
  
 
<pre>
 
<pre>
/*bin/true;exec rexx "$0" "$@";exit # REXX */
+
#!/bin/bash
 +
#
 +
# This script removes from the source code the arbitrary command-line parameter
 +
# required to launch aMule CVS.
 +
# Run it in the ../amule-cvs directory. It will make a backup of the original file.
 +
#
 +
FileIn=src/amule.cpp
 +
FileOut=_^$$.tmp
 +
[ -e $FileOut ] && rm -f $FileOut
 +
awk < "$FileIn" > "$FileOut" '
 +
Found < 1 && /.!cmdline\.Found/ {
 +
        n = 4
 +
print "//      ------ Commented out by amuleCVSfx ------"
 +
Found = 1
 +
  }
 +
n > 0 {
 +
        $0 = "// " $0
 +
        n--
 +
}
 +
{print}'
 +
mv -f $FileIn $FileIn~  2>&1
 +
mv -f $FileOut $FileIn  2>&1
 +
# end
  
/* --------- amuleCVSfx --------- */
 
 
/*
 
  run this script in ../amule-cvs
 
  It will modify src/amule.cpp and save the
 
  original at src/amule.cpp~
 
*/
 
 
FileIn  = "src/amule.cpp"
 
FileOut = "_tmp.tmp"
 
Found  = 0
 
 
do while lines(FileIn) > 0
 
OneLine = lineIn(FileIn)
 
if pos("!cmdline.Found",OneLine) > 1 & Found <> 1 then
 
do
 
call LineOut FileOut, "// ------ Commented out by amuleCVSfx ------ "
 
call LineOut FileOut, "//" OneLine
 
do i = 0 to 4
 
OneLine = lineIn(FileIn)
 
call LineOut FileOut, "//" OneLine
 
i = i + 1
 
end
 
Found = 1
 
    end
 
else
 
call LineOut FileOut, OneLine
 
end
 
if Found = 1 then
 
do
 
"mv -f"  FileIn FileIn || '~'  "2>&1"
 
"mv -f"  FileOut FileIn  "2>&1"
 
say "Fixed!"
 
end
 
else
 
do
 
say "Not found"
 
"rm -f" FileOut
 
end
 
return
 
 
</pre>
 
</pre>
 
+
You can view the changes with this command:
You need to run it in the "amule-cvs" directory before issuing the "make" command.
+
<pre>
 
+
$ diff -b --side-by-side --suppress-common-lines src/amule.cpp src/amule.cpp~
It is written in '''Rexx''', so you will need to have a Rexx interpreter on your system to run it. To install Rexx in Fedora, type
+
</pre>
"yum install oorexx". For Ubuntu, type "apt-get install rexx-regina". Other distros probably have Rexx in their repositories under one name or another. Or you can download the source in various forms from sourceforge: [http://sourceforge.net/project/showfiles.php?group_id=119701]
+
 
+
I originally wrote it as a shell script, but file I/O works much better in Rexx, which is designed for this kind of thing.
+

Revision as of 04:16, 22 December 2006

Satisfied amule user since September 2004.


I am also known as ezeltje in the forum (ezel means "mule" in Dutch, in case anyone is wondering).

Things I have done there:

  • created the Events pages with the example script
  • reorganized AMuleWeb and rewrote the intro
  • expanded AMuleCMD

and other smaller fixes elsewhere...

---

amuleCVSfx

Here is a simple script to remove the obligatory command-line parameter you need to use to run aMule CVS:

#!/bin/bash
#
# This script removes from the source code the arbitrary command-line parameter
# required to launch aMule CVS.
# Run it in the ../amule-cvs directory. It will make a backup of the original file.
#
FileIn=src/amule.cpp
FileOut=_^$$.tmp
[ -e $FileOut ] && rm -f $FileOut
awk < "$FileIn" > "$FileOut" '	
	Found < 1 && /.!cmdline\.Found/ {
        n = 4
	print "//      ------ Commented out by amuleCVSfx ------"
	Found = 1
  	}
	n > 0 {
        $0 = "// " $0
        n--	
}
{print}'
mv -f $FileIn $FileIn~  2>&1
mv -f $FileOut $FileIn  2>&1
# end

You can view the changes with this command:

$ diff -b --side-by-side --suppress-common-lines src/amule.cpp src/amule.cpp~