annotate lwar/lwar.c @ 208:06effa2faea1

Added some info on building gcc6809 to use lwtools
author lost
date Tue, 21 Apr 2009 02:57:37 +0000
parents cc41ccee8f64
children bae1e3ecdce1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
172
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
1 /*
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
2 lwar.c
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
3 Copyright © 2009 William Astle
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
4
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
5 This file is part of LWAR.
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
6
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
7 LWAR is free software: you can redistribute it and/or modify it under the
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
8 terms of the GNU General Public License as published by the Free Software
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
9 Foundation, either version 3 of the License, or (at your option) any later
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
10 version.
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
11
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
15 more details.
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
16
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
17 You should have received a copy of the GNU General Public License along with
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
18 this program. If not, see <http://www.gnu.org/licenses/>.
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
19
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
20
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
21 Implements the program startup code
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
22
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
23 */
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
24
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
25 #ifdef HAVE_CONFIG_H
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
26 #include "config.h"
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
27 #endif
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
28
174
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
29 #include <stdio.h>
172
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
30 #include <stdlib.h>
174
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
31 #include <sys/stat.h>
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
32 #include <sys/types.h>
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
33 #include <unistd.h>
172
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
34
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
35 #define __lwar_c_seen__
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
36 #include "lwar.h"
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
37 #include "util.h"
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
38
174
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
39 typedef struct
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
40 {
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
41 FILE *f;
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
42 } arhandle_real;
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
43
172
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
44 int debug_level = 0;
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
45 int operation = 0;
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
46 int nfiles = 0;
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
47 char *archive_file = NULL;
174
cc41ccee8f64 added --merge to lwar
lost
parents: 172
diff changeset
48 int mergeflag = 0;
172
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
49
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
50 char **files = NULL;
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
51
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
52 void add_file_name(char *fn)
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
53 {
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
54 files = lw_realloc(files, sizeof(char *) * (nfiles + 1));
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
55 files[nfiles] = fn;
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
56 nfiles++;
47427342e41d lwar now creates, lists, and adds to archive files
lost
parents:
diff changeset
57 }