Page 2 of 3

Re: saf extractor

Posted: Tue Oct 08, 2013 1:31 am
by WellsMX524
MX PRODIGY 17 wrote:It's funny cause it's JLV

Re: saf extractor

Posted: Tue Oct 08, 2013 2:15 am
by gd1911
jlv wrote:Here you go:

Code: Select all

#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
	shift
	find "$@" -maxdepth 0 -printf '%s %p\n'
	echo -
	cat "$@"
elif test "_$1_" = _x_
then
	shift
	count=0

	while read size name && test "_${size##[^0-9]}_" = "_${size}_"
	do
		sizes[count]=$((size))
		names[count]=${name}
		count=$((count+1))
	done

	if test "_${size}_" != "_-_"
	then
		echo "Bad dir"
		exit
	fi

	i=0
	while let 'i<count'
	do
		echo ${names[i]} ${sizes[i]}
		if test "_${names[i]##*/}_" != "_${names[i]}_"
		then
			install -d "${names[i]%/*}"
		fi
		dd bs=${sizes[i]} count=1 >"${names[i]}" 2>/dev/null
		i=$((i+1))
	done

else
	echo "To create an archive use: saf.sf c files..."
	echo "To extract an archive use: saf.sf x"
fi
Image

Re: saf extractor

Posted: Sun Oct 13, 2013 4:50 pm
by wheels1758
jlv wrote:If you don't use Linux then FU!

Re: saf extractor

Posted: Fri Jun 06, 2014 7:32 pm
by isacult
wheels1758 wrote:
jlv wrote:If you don't use Linux then FU!
Ooooh no Unix love.. just Linux..?
It is possible to run this in windows, with cygwin.

jlv I am jealous of your bash knowledge.

Re: saf extractor

Posted: Sat Jun 07, 2014 2:41 am
by jlv
There might be some line ending issues in Cygwin. If there's a way to force it to binary mode it should work fine.

Re: saf extractor

Posted: Thu Mar 03, 2016 2:25 am
by ty casey
someone shoot me a link.

Re: saf extractor

Posted: Thu Mar 03, 2016 5:00 pm
by byrd55621
Just search puremxs saf extracter

Re: saf extractor

Posted: Thu Mar 03, 2016 5:49 pm
by Wahlamt
ty casey wrote:someone shoot me a link.
You have the code on page 1, why would you need a link?

Re: saf extractor

Posted: Thu Mar 03, 2016 6:55 pm
by ty casey
how do i use it

Re: saf extractor

Posted: Thu Mar 03, 2016 6:59 pm
by ty casey
do i just turn that into a .exe?

Re: saf extractor

Posted: Thu Mar 03, 2016 8:12 pm
by Wahlamt
Make it a shell script that you run.

Re: saf extractor

Posted: Sat Jun 11, 2016 10:06 pm
by Wahlamt
jlv wrote:Here you go:

[code]#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
shift
find "$@" -maxdepth 0 -printf '%s %p\n'
echo -
cat "$@"
elif test "_$1_" = _x_
then
shift
count=0

while read size name && test "_${size##[^0-9]}_" = "_${size}_"
do
sizes[count]=$((size))
names[count]=${name}
count=$((count+1))
done

if test "_${size}_" != "_-_"
then
echo "Bad dir"
exit
fi

i=0
while let 'i<count'
do
echo ${names} ${sizes}
if test "_${names##*/}_" != "_${names}_"
then
install -d "${names%/*}"
fi
dd bs=${sizes} count=1 >"${names}" 2>/dev/null
i=$((i+1))
done

else
echo "To create an archive use: saf.sf c files..."
echo "To extract an archive use: saf.sf x"
fi
[/code]

Sitting here doing this for fun. For some reason when I try to open an older .saf archive (from the old "needed object packs") I get the error message "Bad Dir" after trying:
./saf.sf x
NewTreespack.saf

Saf.sf is the script and NewTreespack.saf is what I am trying to open... Any clues?

Re: saf extractor

Posted: Sun Jun 12, 2016 1:58 am
by jlv
You have to redirect the saf as the standard input:

./saf.sf x <NewTreespack.saf

Without the redirect op < it should have just hung waiting for input until you pressed ctrl-c or ctrl-d.

Re: saf extractor

Posted: Mon Jun 13, 2016 8:15 am
by Wahlamt
jlv wrote:You have to redirect the saf as the standard input:

./saf.sf x <NewTreespack.saf

Without the redirect op < it should have just hung waiting for input until you pressed ctrl-c or ctrl-d.
Thanks! That worked. I though the new line after "./saf.sf x" was enough to insert "NewTreespack.saf" on, but apparently it wasn't. Thanks again!

Re: saf extractor

Posted: Wed Jan 30, 2019 6:21 pm
by Edo
sorry, can anyone explain me how should i run it? i really can't get it :(