]> the.earth.li Git - htag.git/blob - example-scripts/10dadadodo
Import Upstream version 0.0.19
[htag.git] / example-scripts / 10dadadodo
1 #!/usr/bin/perl -w
2
3 # Copyright (C) 2001 Simon Huggins
4
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 # for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc., 59
17 # Temple Place, Suite 330, Boston, MA 02111-1307  USA
18
19 use strict;
20
21 if (not $cfg{'dadadodo_file'}) {
22         htagdie "\$cfg{'dadadodo_file'} was not specified.\n";
23 }
24
25 # Or we could use the message file...
26
27 my $cmdline = "dadadodo -c 1 $cfg{'dadadodo_file'}";
28
29 my $tag;
30
31 # Unsafe open but if this is ever SUID then the person to do it needs shooting.
32 open(HANDLE, "$cmdline|") or htagdie "$cmdline failed: $!\n";
33 while (<HANDLE>) {
34         $tag .= $_;
35 }
36 close(HANDLE) or htagdie "$cmdline failed: $!\n";
37
38 open(OUT, ">$cfg{'tmptagfile'}") or htagdie "$0: Could not open $cfg{'tmptagfile'}: $!\n";
39 reg_deletion("$cfg{'tmptagfile'}");
40 chomp $tag;
41 print OUT $tag;
42 close(OUT);