a slim holiday present, cpic

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

a slim holiday present, cpic

Eliot Miranda-2
Hi All,

    don't know if this is useful to you or whether you've already written it yourself but I finally caved and wrote a shell command that copies an image/changes file pair, replacing the hundreds of times I've issued the two parallel commands, cpic = copy image and changes.  Happy holidays
-------8<-------
#!/bin/sh
# copy image and changes
force=0
if [ "$1" = -f ]; then
    force=1
    shift
fi
if [ $# != 2 -o "$1" = "-?" -o "$1" = --help ]; then
    echo "usage: $0 [-f] image-name-no-ext [image-name-no-ext|dir]"
    test $# != 2 && exit 1
    exit 0
fi
if [ -f "$2.image" -o -f "$2.changes" ]; then
    if [ "$force" = 0 ]; then
        echo "$2.image and/or $2.changes already exist." 1>&2
        exit 1
    fi
elif [ -d "$2" ]; then
    if [ -f "$2/$1.image" -o -f "$2/$1.changes" ]; then
        if [ "$force" = 0 ]; then
            echo "$2/$1.image and/or $2/$1.changes already exist." 1>&2
            exit 1
        fi
    fi
    cp "$1.image" "$1.changes" "$d"
    exit 0
fi
cp "$1.image" "$2.image"
cp "$1.changes" "$2.changes"

cpic (910 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] a slim holiday present, cpic

David T. Lewis
On Fri, Dec 17, 2010 at 02:33:08PM -0800, Eliot Miranda wrote:
> Hi All,
>
>     don't know if this is useful to you or whether you've already written it
> yourself but I finally caved and wrote a shell command that copies an
> image/changes file pair, replacing the hundreds of times I've issued the two
> parallel commands, cpic = copy image and changes.  Happy holidays

Very nice holiday stocking stuffer, works a champ. Thanks!

Dave


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] a slim holiday present, cpic

Igor Stasenko
On 18 December 2010 01:44, David T. Lewis <[hidden email]> wrote:

> On Fri, Dec 17, 2010 at 02:33:08PM -0800, Eliot Miranda wrote:
>> Hi All,
>>
>>     don't know if this is useful to you or whether you've already written it
>> yourself but I finally caved and wrote a shell command that copies an
>> image/changes file pair, replacing the hundreds of times I've issued the two
>> parallel commands, cpic = copy image and changes.  Happy holidays
>
> Very nice holiday stocking stuffer, works a champ. Thanks!
>

Ohh.. today is a day of shell scripts.
I did one too. costs me about 2 hours to make it right. It simply gets
the freetype library
and builds it with right arch.
Because by default this piece of ... builds with x64 target arch,
which obviously does not fits
for Cog :(

-----

if [ ! -d freetype2 ]
then
   /usr/local/git/bin/git clone git://git.sv.gnu.org/freetype/freetype2.git
fi

cd freetype2
/usr/local/git/bin/git checkout VER-2-4-4

/bin/sh autogen.sh
./configure CFLAGS="-arch i386" LDFLAGS="-arch i386" --without-zlib

/usr/bin/make clean
/usr/bin/make 2>1 > ../build.log
cd ..
cp ./freetype2/objs/.libs/libfreetype.a ./

-----

but i'm still not satisfied how it integrated into xcode  to build FT2Plugin.
Well, at least i got it built.

> Dave
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: a slim holiday present, cpic

Eliot Miranda-2
In reply to this post by Eliot Miranda-2
Here's an update to cpic that fixes cases where one copies images from other than the current directory
-------8<-------
#!/bin/sh
# copy image and changes
force=0
if [ "$1" = -f ]; then
force=1
shift
fi
if [ $# != 2 -o "$1" = "-?" -o "$1" = --help ]; then
echo "usage: $0 [-f] image-name-no-ext [image-name-no-ext|dir]"
test $# != 2 && exit 1
exit 0
fi
if [ -f "$2.image" -o -f "$2.changes" ]; then
if [ "$force" = 0 ]; then
echo "$2.image and/or $2.changes already exist." 1>&2
exit 1
fi
elif [ -d "$2" ]; then
if [ -f "$2/`basename "$1"`.image" -o -f "$2/`basename "$1"`.changes" ]; then
if [ "$force" = 0 ]; then
echo "$2/`basename "$1"`.image and/or $2/`basename "$1"`.changes already exist." 1>&2
exit 1
fi
fi
cp "$1.image" "$1.changes" "$d"
exit 0
fi
cp "$1.image" "$2.image"
cp "$1.changes" "$2.changes"

On Fri, Dec 17, 2010 at 2:33 PM, Eliot Miranda <[hidden email]> wrote:
Hi All,

    don't know if this is useful to you or whether you've already written it yourself but I finally caved and wrote a shell command that copies an image/changes file pair, replacing the hundreds of times I've issued the two parallel commands, cpic = copy image and changes.  Happy holidays
-------8<-------
#!/bin/sh
# copy image and changes
force=0
if [ "$1" = -f ]; then
    force=1
    shift
fi
if [ $# != 2 -o "$1" = "-?" -o "$1" = --help ]; then
    echo "usage: $0 [-f] image-name-no-ext [image-name-no-ext|dir]"
    test $# != 2 && exit 1
    exit 0
fi
if [ -f "$2.image" -o -f "$2.changes" ]; then
    if [ "$force" = 0 ]; then
        echo "$2.image and/or $2.changes already exist." 1>&2
        exit 1
    fi
elif [ -d "$2" ]; then
    if [ -f "$2/$1.image" -o -f "$2/$1.changes" ]; then
        if [ "$force" = 0 ]; then
            echo "$2/$1.image and/or $2/$1.changes already exist." 1>&2
            exit 1
        fi
    fi
    cp "$1.image" "$1.changes" "$d"
    exit 0
fi
cp "$1.image" "$2.image"
cp "$1.changes" "$2.changes"

Reply | Threaded
Open this post in threaded view
|

Re: a slim holiday present, cpic

Eliot Miranda-2
In reply to this post by Eliot Miranda-2
Argh!  Here's a fix to a bad bug in the last version (cp "$1.image" "$1.changes" "$d" => cp "$1.image" "$1.changes" "$2")!!
-------8<-------
#!/bin/sh
# copy image and changes
force=0
if [ "$1" = -f ]; then
force=1
shift
fi
if [ $# != 2 -o "$1" = "-?" -o "$1" = --help ]; then
echo "usage: $0 [-f] image-name-no-ext [image-name-no-ext|dir]"
test $# != 2 && exit 1
exit 0
fi
if [ -f "$2.image" -o -f "$2.changes" ]; then
if [ "$force" = 0 ]; then
echo "$2.image and/or $2.changes already exist." 1>&2
exit 1
fi
elif [ -d "$2" ]; then
if [ -f "$2/`basename "$1"`.image" -o -f "$2/`basename "$1"`.changes" ]; then
if [ "$force" = 0 ]; then
echo "$2/`basename "$1"`.image and/or $2/`basename "$1"`.changes already exist." 1>&2
exit 1
fi
fi
cp "$1.image" "$1.changes" "$2"
exit 0
fi
cp "$1.image" "$2.image"
cp "$1.changes" "$2.changes"


On Fri, Dec 17, 2010 at 2:33 PM, Eliot Miranda <[hidden email]> wrote:
Hi All,

    don't know if this is useful to you or whether you've already written it yourself but I finally caved and wrote a shell command that copies an image/changes file pair, replacing the hundreds of times I've issued the two parallel commands, cpic = copy image and changes.  Happy holidays
-------8<-------
#!/bin/sh
# copy image and changes
force=0
if [ "$1" = -f ]; then
    force=1
    shift
fi
if [ $# != 2 -o "$1" = "-?" -o "$1" = --help ]; then
    echo "usage: $0 [-f] image-name-no-ext [image-name-no-ext|dir]"
    test $# != 2 && exit 1
    exit 0
fi
if [ -f "$2.image" -o -f "$2.changes" ]; then
    if [ "$force" = 0 ]; then
        echo "$2.image and/or $2.changes already exist." 1>&2
        exit 1
    fi
elif [ -d "$2" ]; then
    if [ -f "$2/$1.image" -o -f "$2/$1.changes" ]; then
        if [ "$force" = 0 ]; then
            echo "$2/$1.image and/or $2/$1.changes already exist." 1>&2
            exit 1
        fi
    fi
    cp "$1.image" "$1.changes" "$d"
    exit 0
fi
cp "$1.image" "$2.image"
cp "$1.changes" "$2.changes"