/* *libproc * *common utilities needed to process /proc. * *A library interface for finding process information from /proc. *This is also an interface into various things which haven't yet been integrated into sysfs, * as appropriate. Copyright (C) 2004 Joseph Pingenot This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*This reads in the file requested, and it then outputs a pointer to the head * of a singly-linked list which is used in subsequent operations. This pointer * is cast to null, and the interior data structure never revealed; this allows * the internals to be monkeyed with without breaking anything. */ void *readfile_init(const char *file, int *err); /*This grabs the appropriate line and returns the value for that line * as a string. If there are multiple appropriate lines, this returns the * first instance. */ char *readfile_getline(void *handle, const char *line, int *err); /*This grabs the nth value in the list*/ char *readfile_get_valuen(void *handle, unsigned int line, int *err); /*Just like the one above, but it returns the line, not the value*/ char *readfile_get_linen(void *handle, unsigned int line, int *err); /*This grabs the line number of the specified line.*/ int readfile_getlinenum(void *handle, const char* line, int *err); /*This frees the list when you're done with it. *NOTE: this will also free the strings!!! You'd better have backed them up before * you call this puppy! */ void readfile_end(void *handle); /*Convenience functions.*/ int readfile_getline_int(void *handle, const char *line, int *err); long int readfile_getline_lint(void *handle, const char *line, int *err); float readfile_getline_float(void *handle, const char *line, int *err); double readfile_getline_double(void *handle, const char *line, int *err);