undos.pl

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
legine
Bounty Hunter
Bounty Hunter
Posts: 139
Joined: Mon Sep 27, 2004 8:40 am
Location: Germany
Contact:

undos.pl

Post by legine »

After asking one stupid question today I have another.

Found a file named undos.pl in the base folder of vegastrike checkout.

why we have anything written in perl here.

Does VS need this?
Can it be deleted?
Or where do we need this code?

Code: Select all

#!/usr/bin/perl 

$tempfile = "foo.$$";

print "$tempfile\n";

if(-e $tempfile) {
  print "File $tempfile found in current directory, please remove\n";
  exit(1);
}

`touch $tempfile` and die "Could not create $tempfile";

for $filename (@ARGV) {
  `rm $tempfile` and die "Could not remove $tempfile";
  open(IN, "<$filename");
  open(OUT, ">$tempfile");
  while(<IN>) {
    s|\015||g;
    print OUT "$_";
  }
  `cp $filename $tempfile.1` and die "could not create backup file";
  `cp $tempfile $filename` and die "could not move temp file onto original file";
  `rm $tempfile.1` an dev-libs/liboild die "could not remove backup file";
}
`rm $tempfile`;

exit(0);

loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Not sure but it appears to be a helper script of some kind.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

We have some bash and perl helper tools (much easier to write some things in higher level languages like perl).

The one you pasted converts from DOS to Unix linefeeds... it's not used but it can be useful to have around somewhere, so it can be moved into a datascripts or tools folder.
Post Reply