Applied Ashley Willis's perlbarry package.
[barry/pauldeden.git] / contrib / perlbarry / misc / split-jpeg
blobecb44f6c715e9c10a6af1b2a518965dfa75a0800
1 #!/usr/bin/perl
3 # split-jpeg version 0.1
5 # Copyright (C) 2008, ashley willis <barry@venamous.net>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE.
16 # See the GNU General Public License in the COPYING file at the
17 # root directory of this project for more details.
19 # takes resulting files of "./convert-dumps Content_Store" and outputs any
20 # jpeg files into current directory, as well as header into a separate file.
21 # the file "Content_Store" is created by
22 # "btool -d 'Content Store' > Content_Store".
24 $HEAD = 0;
26 foreach $file (@ARGV) {
27 open(IN, "$file");
28 $jpeg = 0;
29 read(IN, $head, 3);
30 if ($head =~ /^!\0\x01$/) { # barrybackup data, ipd2tgz
31 $header = $head;
33 else {
34 read(IN, $header, 15);
35 $header = $head . $header;
38 ($name, $remainder) = split(/\0/, <IN>, 2);
39 ($name =~ /\.jpg$/) or next;
41 $remainder = "