1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2008, 2009, 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or (at
8 // your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #include <libaegis/os.h>
20 #include <libaegis/output/file.h>
21 #include <libaegis/output/wrap.h>
22 
23 #include <aemakegen/target/debian.h>
24 
25 
26 void
gen_copyright()27 target_debian::gen_copyright()
28 {
29     nstring text =
30         get_cp()->pconf_attributes_find("aemakegen:debian:copyright");
31     if (text == "false")
32         return;
33 
34     nstring who(get_cp()->pconf_copyright_owner_get());
35     nstring when(get_cp()->copyright_years_get_string());
36 
37     // write debian/copyright
38     os_become_orig();
39     output::pointer fp = output_file::open("debian/copyright");
40     os_become_undo();
41     fp->fputs("Copyright (C) ");
42     fp->fputs(when);
43     fp->fputc(' ');
44     fp->fputs(who);
45     fp->fputc('\n');
46 
47     if (!text.empty())
48     {
49         fp->fputc('\n');
50         output::pointer wop = output_wrap_open(fp, 80);
51         wop->fputs(text);
52         wop->end_of_line();
53     }
54 }
55 
56 
57 // vim: set ts=8 sw=4 et :
58