wmpInit.c
Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002  *---------------------           RT-WMP              --------------------
00003  *------------------------------------------------------------------------
00004  *                                                         V7.0B  11/05/10
00005  *
00006  *
00007  *  File: ./src/platforms/linux_us/wmpInit.c
00008  *  Authors: Danilo Tardioli
00009  *  ----------------------------------------------------------------------
00010  *  Copyright (C) 2000-2010, Universidad de Zaragoza, SPAIN
00011  *
00012  *  Contact Addresses: Danilo Tardioli                   dantard@unizar.es
00013  *
00014  *  RT-WMP is free software; you can  redistribute it and/or  modify it
00015  *  under the terms of the GNU General Public License  as published by the
00016  *  Free Software Foundation;  either  version 2, or (at  your option) any
00017  *  later version.
00018  *
00019  *  RT-WMP  is distributed  in the  hope  that  it will be   useful, but
00020  *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
00021  *  MERCHANTABILITY  or  FITNESS FOR A  PARTICULAR PURPOSE.    See the GNU
00022  *  General Public License for more details.
00023  *
00024  *  You should have received  a  copy of  the  GNU General Public  License
00025  *  distributed with RT-WMP;  see file COPYING.   If not,  write to the
00026  *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
00027  *  02111-1307, USA.
00028  *
00029  *  As a  special exception, if you  link this  unit  with other  files to
00030  *  produce an   executable,   this unit  does  not  by  itself cause  the
00031  *  resulting executable to be covered by the  GNU General Public License.
00032  *  This exception does  not however invalidate  any other reasons why the
00033  *  executable file might be covered by the GNU Public License.
00034  *
00035  *----------------------------------------------------------------------*/
00036 
00037 #include "config/compiler.h"
00038 #include <string.h>
00039 #include <stdio.h>
00040 #include <stdio.h>
00041 #include <stdlib.h>
00042 #include "core/include/global.h"
00043 #include "core/include/wmp_misc.h"
00044 
00045 int wmpReadConfiguration(Status * status) {
00046         int i, j;
00047         FILE *f;
00048         char param[30], val[20], fname[256], line[256];
00049 
00050         snprintf(fname, 256, "%s/.rt-wmp/rt-wmp.cfg", getenv("HOME"));
00051 
00052         f = fopen(fname, "r");
00053         WMP_MSG(stderr, "Reading %s...\n", fname);
00054         if (f == 0) {
00055                 WMP_MSG(
00056                                 stderr,
00057                                 "File rt-wmp.cfg not found...\nUsing default values (timeout: %d).\n",
00058                                 status->TIMEOUT);
00059                 return -1;
00060         }
00061         WMP_MSG(stderr, "Reading Configuration file...\n");
00062         while (fgets(line,256,f) != NULL) {
00063                 int exists = 0;
00064                 if (line[0]<65 || line[0]>90){
00065                         continue;
00066                 }
00067                 sscanf(line,"%s %s",param,val);
00068 
00069                 exists = apply_config(status, param, val);
00070 
00071                 if (exists) {
00072                         WMP_MSG(stderr, "READ OPTION: %s = %s\n", param, val);
00073                 } else {
00074                         WMP_MSG(stderr, "*** UKNOWN OPTION %s = %s\n", param, val);
00075                 }
00076         }
00077         WMP_MSG(stderr, "Done.\n");
00078         return 1;
00079 }
00080 
00081 
00082 


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Mon Oct 6 2014 08:27:11