~ubuntu-branches/ubuntu/trusty/sblim-sfcb/trusty-proposed

« back to all changes in this revision

Viewing changes to mofc/mofparse.c

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2009-06-08 12:04:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090608120449-byfplk09rqz8rtg6
Tags: 1.3.3-0ubuntu1
* New upstream release.
* debian/rules: Removed rpath hacks, SFCB default build handles that now.
* Removed 1934753-remove-assignment.diff, now upstream.
* Refreshed patch cim-schema-location.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: mofparse.c,v 1.7 2006/10/27 13:14:21 sschuetz Exp $
 
2
 * $Id: mofparse.c,v 1.9 2009/01/08 16:46:33 buccella Exp $
3
3
 *
4
4
 * (C) Copyright IBM Corp. 2004
5
5
 * 
24
24
#include <symtab.h>
25
25
#include <mofdecl.h>
26
26
#include <sys/stat.h>
 
27
#include <stdlib.h>
27
28
#include "mofc.h"
28
29
#include "backend.h"
29
30
#ifdef HAVE_CONFIG_H
42
43
static char prefix[3000] = {0};
43
44
static char backendopt[300] = {0};
44
45
static char namespace[600] = {0};
 
46
static char instmigfile[600] = {0};
45
47
static size_t backendopt_used = 0;
46
48
static char * inclfile = NULL;
47
 
static char * valid_options = "b:o:I:i:d:n:hvV";
 
49
static char * valid_options = "b:o:I:i:d:n:m:hvV";
48
50
 
49
51
extern class_chain  * cls_chain_current;
50
52
extern class_chain  * inst_chain_current;
67
69
      strncpy(outfile,optarg,sizeof(outfile));
68
70
      break;
69
71
    case 'n': 
70
 
      strncpy(namespace,optarg,sizeof(outfile));
 
72
      strncpy(namespace,optarg,sizeof(namespace));
71
73
      break;      
72
74
    case 'd': 
73
75
      strncpy(outdir,optarg,sizeof(outdir));
91
93
    case 'i':
92
94
      inclfile = strdup(optarg);
93
95
      break;
 
96
    case 'm': 
 
97
      strncpy(instmigfile,optarg,sizeof(instmigfile));
 
98
      break;      
94
99
    default:
95
100
      return -1;
96
101
    }
101
106
static void usage(const char * name)
102
107
{
103
108
  fprintf(stderr,"usage: %s [-hvV] [-I includepath ...] [-i extrafile] [-o outfile] \
104
 
[-b backendopts] [-d outputdirectory] [-n namespace] filename ... \n",name);
 
109
[-b backendopts] [-d outputdirectory] [-n namespace] [-m instancefile] filename ... \n",name);
105
110
}
106
111
 
107
112
static void version()
112
117
static void help(const char * name)
113
118
{
114
119
  usage(name);
115
 
  version(name);
 
120
  version();
116
121
  printf(" Allowed options are\n");
117
122
  printf("  -h             display this message\n");
118
123
  printf("  -v             print some extra information\n");
123
128
  printf("  -b backendopts backend options, see backend documentation\n");
124
129
  printf("  -d output directory (recommended when parsing qualifiers and instances, as this creates more than one file)\n");
125
130
  printf("  -n target namespace, only needed for instances and qualifiers\n");
 
131
  printf("  -m filename    file that includes instances for import/migration\n");
126
132
}
127
133
 
128
134
static int error_occured = 0;
187
193
        strcat(prefix, outfile);
188
194
  }
189
195
  
190
 
  if (init_scanner(argv+argidx,argc-argidx,inclpath,inclfile,opt_verbose) != 0 ) {
 
196
  if (init_scanner(argv+argidx,argc-argidx,inclpath,inclfile,instmigfile,opt_verbose) != 0 ) {
191
197
    return 2;
192
198
  }
193
199
  if ( ( yyparse() || error_occured )) {
195
201
      fprintf( stderr, "error has occured in %s\n", argv[argidx] );
196
202
    }
197
203
    stop_scanner();
 
204
    if (inclfile)
 
205
        free(inclfile);
198
206
    return 3;
199
207
  }
200
208
  if (backend_ptr(cls_chain_current, inst_chain_current, qual_chain_current, prefix, outdir, namespace,  
201
209
                  opt_verbose ? BACKEND_VERBOSE : BACKEND_DEFAULT,
202
210
                  backendopt) ) {
203
211
    fprintf( stderr, "backend error has occured writing %s\n", outfile );
 
212
    stop_scanner();
 
213
    if (inclfile)
 
214
        free(inclfile);
 
215
    return 4;
204
216
  }
205
217
  stop_scanner();
 
218
  if (inclfile)
 
219
      free(inclfile);
206
220
  return 0;
207
221
}
208
222