~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/build_tools/scrooge/scrooge.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3
 
 * http://www.gnu.org/licenses/gpl-3.0.html
4
 
 *
5
 
 * $Revision: 4909 $
6
 
 * $Id: scrooge.cpp 4909 2008-02-27 13:15:26Z mortenmacfly $
7
 
 * $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/build_tools/scrooge/scrooge.cpp $
8
 
 */
9
 
 
10
 
#include <stdio.h>
11
 
#include <string.h>
12
 
#include <dirent.h>
13
 
#include <sys/types.h>
14
 
#include <sys/stat.h>
15
 
 
16
 
#include "../../sdk/tinyxml/tinystr.h"
17
 
#include "../../sdk/tinyxml/tinyxml.h"
18
 
 
19
 
 
20
 
void ProcessFile(const char* fileName);
21
 
int main(int argc, char** argv);
22
 
void ls(char *dirname);
23
 
 
24
 
 
25
 
void ls(char *dirname)
26
 
{
27
 
        struct dirent *entry;
28
 
        struct stat buf;
29
 
 
30
 
    chdir(dirname);
31
 
        DIR *d = opendir(".");
32
 
 
33
 
        if(d == 0)
34
 
        return;
35
 
 
36
 
 
37
 
        for(entry = readdir(d); entry != NULL; entry = readdir(d))
38
 
        {
39
 
                if (stat(entry->d_name, &buf) < 0 || entry->d_name[0] == '.' || entry->d_name[0] == '_')
40
 
                        continue;
41
 
 
42
 
                if (S_ISDIR(buf.st_mode))
43
 
                {
44
 
            ls(entry->d_name);
45
 
                }
46
 
                else
47
 
                {
48
 
            if(strstr(entry->d_name, ".xrc"))
49
 
                ProcessFile(entry->d_name);
50
 
                }
51
 
        }
52
 
        closedir(d);
53
 
    chdir("..");
54
 
}
55
 
 
56
 
 
57
 
 
58
 
int main(int argc, char** argv)
59
 
{
60
 
    puts("Humbug!");
61
 
 
62
 
        if(argc != 2)
63
 
                return 0;
64
 
 
65
 
    ls(argv[1]);
66
 
 
67
 
    return 0;
68
 
}
69
 
 
70
 
 
71
 
void ProcessFile(const char* fileName)
72
 
{
73
 
        TiXmlDocument doc;
74
 
        doc.LoadFile(fileName);
75
 
                if(doc.Error())
76
 
                {
77
 
            printf("error in file %s: %s\n", fileName, doc.ErrorDesc());
78
 
                        return;
79
 
        }
80
 
                TiXmlPrinter printer;
81
 
                printer.SetStreamPrinting();
82
 
                doc.Accept(&printer);
83
 
 
84
 
                FILE *f = fopen(fileName, "wb");
85
 
                if(!f)
86
 
                        return;
87
 
 
88
 
                fwrite(printer.CStr(), printer.Size(), 1, f);
89
 
                fclose(f);
90
 
}
91