diff options
| -rw-r--r-- | Makefile | 8 | ||||
| -rw-r--r-- | common.c | 22 | ||||
| -rw-r--r-- | common.h | 11 | 
3 files changed, 30 insertions, 11 deletions
| @@ -80,11 +80,14 @@ paramano:	bat_tray.o \  			tray.o \  			paramano_set_interface.o  	$(CC) -o $@ $? $(LDFLAGS) +######################################################################## +  ########################################################################  # Make paramano-set utility  paramano-set: \  			paramano_set.o \ +			common.o \  			getcore.o \  			getfreq.o \  			getgov.o @@ -122,9 +125,8 @@ paramano-extra:  # Strip all symbols from binaries  strip:  	strip -s paramano paramano-set -	  ######################################################################## -	 +  ########################################################################  # Remove generated files @@ -146,6 +148,8 @@ install:  	install -Dm 755 paramano $(DESTDIR)/$(PARAMANO)  	install -Dm 755 paramano-set $(DESTDIR)/$(PARAMANO_SET) + +	# These provide some compatability with trayfreq  	ln -s paramano $$(dirname $(DESTDIR)/$(PARAMANO))/trayfreq  	ln -s paramano-set $$(dirname $(DESTDIR)/$(PARAMANO))/trayfreq-set  ######################################################################## @@ -1,18 +1,18 @@  /************************************************************************ - * This file is part of paramano.                                       * + * This file is part of Paramano.                                       *   *                                                                      * - * paramano is free software; you can redistribute it and/or            * + * Paramano is free software; you can redistribute it and/or            *   * modify it under the terms of the GNU General Public License as       *   * published by the Free Software Foundation; either version 3 of the   *   * License, or (at your option) any later version.                      *   *                                                                      * - * paramano is distributed in the hope that it will be useful,          * + * Paramano is distributed in the hope that it will be useful,          *   * but WITHOUT ANY WARRANTY; without even the implied warranty of       *   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *   * GNU General Public License for more details.                         *   *                                                                      *   * You should have received a copy of the GNU General Public License    * - * along with paramano. If not, see                                     * + * along with Paramano. If not, see                                     *   * <http://www.gnu.org/licenses/>.                                      *   ************************************************************************/ @@ -67,6 +67,20 @@ bool file_has_line(const char *filename, const char *line)  /*********************************************************************** + * Calls fopen on the specified file, giving debug error message on + * failure. Returns the file descriptor in all cases. + **********************************************************************/ +FILE* check_for_file(char* path) +{ +	FILE* fd; +	if(!(fd = fopen(path, "r"))) +	{ +		debug("Couldn't open '%s'\n",path); +	} +	return fd; +} + +/***********************************************************************   * Fetches first number (ie the 35 of "35 123") from a   * string   **********************************************************************/ @@ -1,18 +1,18 @@  /************************************************************************ - * This file is part of paramano.                                       * + * This file is part of Paramano.                                       *   *                                                                      * - * paramano is free software; you can redistribute it and/or            * + * Paramano is free software; you can redistribute it and/or            *   * modify it under the terms of the GNU General Public License as       *   * published by the Free Software Foundation; either version 3 of the   *   * License, or (at your option) any later version.                      *   *                                                                      * - * paramano is distributed in the hope that it will be useful,          * + * Paramano is distributed in the hope that it will be useful,          *   * but WITHOUT ANY WARRANTY; without even the implied warranty of       *   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *   * GNU General Public License for more details.                         *   *                                                                      *   * You should have received a copy of the GNU General Public License    * - * along with paramano. If not, see                                     * + * along with Paramano. If not, see                                     *   * <http://www.gnu.org/licenses/>.                                      *   ************************************************************************/ @@ -20,12 +20,13 @@  #define COMMON_H  #include <stdbool.h> +#include <stdio.h>  int  get_int_value_from_file(const char* filename);  int  get_int(const char* string);  bool file_has_line(const char *filename, const char *line); +FILE* check_for_file(char* path); -#include <stdio.h>  // <ew> Stringification of line number  #define STRING2(x) #x  #define STRING(x) STRING2(x) | 
