~ubuntu-branches/ubuntu/quantal/lxc/quantal-201206191543

« back to all changes in this revision

Viewing changes to src/lxc/arguments.c

  • Committer: Package Import Robot
  • Author(s): Daniel Baumann
  • Date: 2012-03-09 13:05:03 UTC
  • mto: (3.1.38 sid)
  • mto: This revision was merged to the branch mainline in revision 94.
  • Revision ID: package-import@ubuntu.com-20120309130503-j0prgw9tsp967bbv
Tags: upstream-0.8.0~rc1
ImportĀ upstreamĀ versionĀ 0.8.0~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
        return ret;
207
207
}
208
208
 
209
 
extern char **lxc_arguments_dup(const char *file, struct lxc_arguments *args)
210
 
{
211
 
        char **argv;
212
 
        int opt, nbargs = args->argc + 2;
213
 
 
214
 
        if (args->quiet)
215
 
                nbargs += 1;
216
 
 
217
 
        argv = malloc((nbargs + 1) * sizeof(*argv));
218
 
        if (!argv)
219
 
                return NULL;
220
 
 
221
 
        nbargs = 0;
222
 
 
223
 
        argv[nbargs] = strdup(file);
224
 
        if (!argv[nbargs])
225
 
                return NULL;
226
 
        nbargs++;
227
 
 
228
 
        if (args->quiet)
229
 
                argv[nbargs++] = "--quiet";
230
 
 
231
 
        argv[nbargs++] = "--";
232
 
 
233
 
        for (opt = 0; opt < args->argc; opt++) {
234
 
                argv[nbargs] = strdup(args->argv[opt]);
235
 
                if (!argv[nbargs])
236
 
                        return NULL;
237
 
                nbargs++;
238
 
        }
239
 
 
240
 
        argv[nbargs] = NULL;
241
 
 
242
 
        return argv;
243
 
}
244
 
 
245
209
int lxc_arguments_str_to_int(struct lxc_arguments *args, const char *str)
246
210
{
247
211
        long val;