Back to index

im-sdk  12.3.91
conf_info.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999 Sun Microsystems, Inc.
00003  * Copyright (c) 1999 Nihon Sun Microsystems K.K.
00004  * All rights reserved.
00005  */
00006 
00007 /*
00008  * "$Id: conf_info.c,v 1.1.1.1 2000/10/29 16:50:58 himi Exp $"
00009  */
00010 
00011 #pragma ident "@(#)conf_info.c 1.1 99/04/23 SMI"
00012 
00013 
00014 #include "config.h"
00015 
00016 #include <stddef.h>
00017 #include <stdio.h>
00018 
00019 #include "csconv.h"
00020 #include "csc_conf_info.h"
00021 
00022 #include "trace_message.h"
00023 
00024 main(int argc, char ** argv)
00025 {
00026        csc_conf_file_t *    conf_info;
00027        csc_conf_str_t              conf_str[10];
00028        int                  num;
00029        int                  i;
00030        int                  logical_line_number;
00031 
00032        TRACE_MESSAGE_INIT("CSC_TRACE");
00033 
00034        if (argc <= 1) {
00035               fprintf(stderr, "Usage: %s conf_file\n", *(argv + 0));
00036               exit(1);
00037        }
00038 
00039        conf_info = csc_conf_open(*(argv + 1), 0, NULL, 0);
00040        if (NULL == conf_info) {
00041               perror("csc_conf_open");
00042               exit(1);
00043        }
00044 
00045        logical_line_number = 0;
00046        while (0 < (num = csc_conf_read(conf_info, conf_str, 10))) {
00047               printf("%2d ", logical_line_number);
00048               for (i = 0; i < num; i++) {
00049                      if (0 != i) {
00050                             putchar(' ');
00051                      }
00052 
00053                      printf("%d:%.*s", i, conf_str[i].len, conf_str[i].ptr);
00054               }
00055               putchar('\n');
00056               logical_line_number += 1;
00057        }
00058 
00059        csc_conf_close(conf_info);
00060 
00061        exit(0);
00062 }