~ubuntu-branches/ubuntu/lucid/vzctl/lucid

« back to all changes in this revision

Viewing changes to src/vzcfgvalidate.c

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2008-01-27 10:24:49 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080127102449-ivjpirh4dyshc0cl
Tags: 3.0.22-3
Correction for #459717. Thanks to eyck <eyck.debian@kuszelas.eu> for the
report.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "validate.h"
27
27
#include "logger.h"
28
28
 
29
 
log_param g_log;
30
 
 
31
 
void usage()
 
29
void usage(int rc)
32
30
{
33
 
        printf("Usage: vzcfgvalidate [-r|-i] <configfile>\n");
34
 
        printf("        -r repair mode\n");
35
 
        printf("        -i interactive repair mode\n");
 
31
        FILE *fp = rc ? stderr : stdout;
 
32
        fprintf(fp, "Usage: vzcfgvalidate [-r|-i] <configfile>\n");
 
33
        fprintf(fp, "   -r repair mode\n");
 
34
        fprintf(fp, "   -i interactive repair mode\n");
 
35
        exit(rc);
36
36
}
37
37
 
38
38
int main(int argc, char **argv)
42
42
        char *infile = NULL;
43
43
        int ret, opt, recover = 0, ask = 0;
44
44
 
45
 
        while ((opt = getopt(argc, argv, "ri")) > 0)
 
45
        while ((opt = getopt(argc, argv, "rih")) > 0)
46
46
        {
47
47
                switch(opt) {
48
48
                case 'r'        :
51
51
                case 'i'        :
52
52
                        ask = 1;
53
53
                        break;
 
54
                case 'h'        :
 
55
                        usage(0);
54
56
                default :
55
 
                        usage();
56
 
                        exit(1);
 
57
                        usage(1);
57
58
                }
58
59
        }
59
 
        if (optind >= argc) {
60
 
                usage();
61
 
                exit(1);
62
 
        }
 
60
        if (optind >= argc)
 
61
                usage(1);
63
62
        infile = strdup(argv[optind]);
64
63
        if (stat(infile, &st)) {
65
64
                fprintf(stderr,"VE configuration file: %s not found\n", infile);