~ubuntu-branches/ubuntu/quantal/tidy/quantal

« back to all changes in this revision

Viewing changes to console/tidy.c

  • Committer: Bazaar Package Importer
  • Author(s): Jason Thomas
  • Date: 2008-12-24 13:25:54 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081224132554-l7900667kdy9eeu5
Tags: 20081224cvs-1
* New cvs snapshot
* debian/control: add debhelper ${misc:Depends} to all packages
- add versioned depend on libtidy-0.99-0 (>= 20081224cvs-1) for tidy
  (closes: #470764)
- add Homepage field
- update standards-version from 3.7.3.0 to 3.8.0.0
* debian/tidy-doc.doc-base: change section from App/Text to Web Development
* debian/tidy.postinst + tidy.preinst: set the -e flag
* debian/README.source: new, how to build source tarball from upstream
* debian/README.Debian: add urls to more documentation
  (closes: #353912)
* debian/patches/03overview-tab-size.patch: add patch to fix tab-size
  (closes: #353907)
* tidy doc has been built from same source as tidy for a while
  (closes: #364960)
* debian/rules:
  - add -xml-config to generated manpage
  - clean up generated files
  (closes: #471107)
* manpage: -latin0 options has correct info as of 20080116cvs-1
  (closes: #506394 )

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
  tidy.c - HTML TidyLib command line driver
3
3
 
4
 
  Copyright (c) 1998-2007 World Wide Web Consortium
 
4
  Copyright (c) 1998-2008 World Wide Web Consortium
5
5
  (Massachusetts Institute of Technology, European Research 
6
6
  Consortium for Informatics and Mathematics, Keio University).
7
7
  All Rights Reserved.
9
9
  CVS Info :
10
10
 
11
11
    $Author: arnaud02 $ 
12
 
    $Date: 2007/06/13 08:47:46 $ 
13
 
    $Revision: 1.47 $ 
 
12
    $Date: 2008/03/22 20:53:08 $ 
 
13
    $Revision: 1.50 $ 
14
14
*/
15
15
 
16
16
#include "tidy.h"
27
27
#endif
28
28
}
29
29
 
 
30
static void outOfMemory(void)
 
31
{
 
32
    fprintf(stderr,"Out of memory. Bailing out.");
 
33
    exit(1);
 
34
}
 
35
 
30
36
static const char *cutToWhiteSpace(const char *s, uint offset, char *sbuf)
31
37
{
32
38
    if (!s)
66
72
    const char *pc1=c1, *pc2=c2;
67
73
    char *c1buf = (char *)malloc(l1+1);
68
74
    char *c2buf = (char *)malloc(l2+1);
 
75
    if (!c1buf) outOfMemory();
 
76
    if (!c2buf) outOfMemory();
69
77
 
70
78
    do
71
79
    {
86
94
    char *c1buf = (char *)malloc(l1+1);
87
95
    char *c2buf = (char *)malloc(l2+1);
88
96
    char *c3buf = (char *)malloc(l3+1);
 
97
    if (!c1buf) outOfMemory();
 
98
    if (!c2buf) outOfMemory();
 
99
    if (!c3buf) outOfMemory();
89
100
 
90
101
    do
91
102
    {
279
290
        len += 2+strlen(pos->name3);
280
291
 
281
292
    name = (tmbstr)malloc(len+1);
 
293
    if (!name) outOfMemory();
282
294
    strcpy(name, pos->name1);
283
295
    if (pos->name2)
284
296
    {
315
327
        }
316
328
 
317
329
    escpName = (tmbstr)malloc(len+1);
 
330
    if (!escpName) outOfMemory();
318
331
    escpName[0] = '\0';
319
332
 
320
333
    aux[1] = '\0';
755
768
        len += strlen(def);
756
769
    }
757
770
    val = (tmbstr)malloc(len+1);
 
771
    if (!val) outOfMemory();
758
772
    val[0] = '\0';
759
773
    pos = tidyOptGetPickList( topt );
760
774
    first = yes;
776
790
    if (d->vals)
777
791
    {
778
792
        tmbstr val = (tmbstr)malloc(1+strlen(d->vals));
 
793
        if (!val) outOfMemory();
779
794
        strcpy(val, d->vals);
780
795
        return val;
781
796
    }
857
872
    case TidyNewline:
858
873
        d->def = tidyOptGetCurrPick( tdoc, optId );
859
874
        break;
 
875
    default:
 
876
        break;
860
877
    }
861
878
 
862
879
    /* fix for http://tidy.sf.net/bug/873921 */
924
941
    /* look for env var "HTML_TIDY" */
925
942
    /* then for ~/.tidyrc (on platforms defining $HOME) */
926
943
 
927
 
    if ( cfgfil = getenv("HTML_TIDY") )
 
944
    if ( (cfgfil = getenv("HTML_TIDY")) != NULL )
928
945
    {
929
946
        status = tidyLoadConfig( tdoc, cfgfil );
930
947
        if ( status != 0 )
1166
1183
                uint c;
1167
1184
                ctmbstr s = argv[1];
1168
1185
 
1169
 
                while ( c = *++s )
 
1186
                while ( (c = *++s) != '\0' )
1170
1187
                {
1171
1188
                    switch ( c )
1172
1189
                    {