3 // Little cms sources filter utility
4 // Copyright (C) 1998-2001 Marti Maria
6 // THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
7 // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
8 // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
10 // IN NO EVENT SHALL MARTI MARIA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
11 // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
12 // OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
13 // WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
14 // LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
18 // This library is free software; you can redistribute it and/or
19 // modify it under the terms of the GNU Lesser General Public
20 // License as published by the Free Software Foundation; either
21 // version 2 of the License, or (at your option) any later version.
23 // This library is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 // Lesser General Public License for more details.
28 // You should have received a copy of the GNU Lesser General Public
29 // License along with this library; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 // A simple filter to strip CR and ^Z, and replace //-like comments to old style
43 static FILE *In
, *Out
;
56 } while (ch
== '\r' || ch
== '\032'); /* Ignore CR and ^Z */
75 if (ch
== '/') { /* Found comment */
79 /* Cleanup white spaces */
80 while (ch
== ' ' && !IsEof
)
83 if (ch
== '\n' && !IsEof
) /* Comment is empty */
86 /* Comment contains something */
92 while (ch
!= '\n' && !IsEof
) {
115 int main(int argc
, char *argv
[])
120 fprintf(stderr
, "Usage: %s infile outfile\n", argv
[0]);
125 if (access(argv
[2], 0) == 0)
127 fprintf(stderr
, "%s already exist, please erase manually\n", argv
[2]);
131 In
= fopen(argv
[1], "rb");
132 if (!In
) { perror(argv
[1]); return 1;};
134 Out
= fopen(argv
[2], "wb");
135 if (!Out
) { perror(argv
[2]); return 2;};
139 fclose(In
); fclose(Out
);