/[machmon]/machmon/linux/source/conf.c
ViewVC logotype

Diff of /machmon/linux/source/conf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by clorets, Mon Jul 8 15:55:20 2002 UTC revision 1.3 by clorets, Mon Jul 8 16:19:55 2002 UTC
# Line 1  Line 1 
1  /* $Id$ */  /* $Id$ */
2  / * Copyright (c) 2002 Pedro Bastos <pbastos@rdc.puc-rio.br>  /* Copyright (c) 2002 Pedro Bastos <pbastos@rdc.puc-rio.br>
3   * All rights reserved.   * All rights reserved.
4   *   *
5   * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
# Line 51  struct _conf_param   conf_param[] = { Line 51  struct _conf_param   conf_param[] = {
51          { "proc"   , PR_F, d_procs  },          { "proc"   , PR_F, d_procs  },
52          { "mem"    , ME_F, d_mbufs  },          { "mem"    , ME_F, d_mbufs  },
53          { "ifs"    , IF_F, d_ifs    },          { "ifs"    , IF_F, d_ifs    },
54          { NULL     , NULL, NULL     },          {  0     , 0, 0     },
55  };  };
56    
57  static void conf_parse(char *, unsigned short int);  static void conf_parse(char *, unsigned short int);
# Line 59  static void conf_parse(char *, unsigned Line 59  static void conf_parse(char *, unsigned
59  int  int
60  get_conf(char *file)  get_conf(char *file)
61  {  {
62          char *buf, *dbuf;          char fop[BUFSIZ];
63            char *buf, *dbuf;
64          FILE *conf_file;          FILE *conf_file;
65          size_t l_len;          size_t l_len;
66    
67          if ((conf_file = (FILE *) fopen(file, "r")) == NULL)          if ((conf_file = (FILE *) fopen(file, "r")) == NULL)
68                  return (1);                  return (1);
69    
70          while ((buf = fgetln(conf_file, &l_len))) {  //      while ((buf== fgetln(conf_file, &l_len))) {
71                  if (buf[l_len - 1] == '\n')                  //if (buf[l_len - 1] == '\n')
72                          buf[--l_len] = '\0'; /* null terminate string */                  //      buf[--l_len] = '\0'; /* null terminate string */
73    
74                while(fgets(fop, BUFSIZ, conf_file)){
75                if(fop[strlen(fop) - 1] == '\n'){
76                fop[strlen(fop) - 1] = 0;}
77    
78                  else {                  else {
79                          dbuf = (char *) malloc(l_len + 1);                          dbuf = (char *) malloc(l_len + 1);
80                          if (dbuf == NULL)                          if (dbuf == NULL)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26