00001 /* 00002 * $Id: gishelp.c,v 2.1 2006/02/09 03:08:56 glynn Exp $ 00003 * 00004 **************************************************************************** 00005 * 00006 * MODULE: GRASS 5 gis library, gishelp.c 00007 * AUTHOR(S): unknown 00008 * PURPOSE: Print help information 00009 * COPYRIGHT: (C) 2000 by the GRASS Development Team 00010 * 00011 * This program is free software under the GNU General Public 00012 * License (>=v2). Read the file COPYING that comes with GRASS 00013 * for details. 00014 * 00015 *****************************************************************************/ 00016 00017 /* 00018 ********************************************************************** 00019 * 00020 * G_gishelp(helpfile, request) 00021 * char *helpfile help directory where "request" is found 00022 * char *request help file desired 00023 * 00024 * Prints a helpfile to the screen. Helpfiles are stored in directories 00025 * associated with different GRID programs. A given file will be 00026 * found in $GISBASE/txt/"helpfile"/"request". 00027 * 00028 **********************************************************************/ 00029 00030 #include <grass/gis.h> 00031 #include <grass/glocale.h> 00032 #include <unistd.h> 00033 #include <stdlib.h> 00034 #define GEN_HELP "gen_help" 00035 00036 int G_gishelp( char *helpfile , char *request ) 00037 { 00038 char file[1024] ; 00039 char buffer[1024] ; 00040 00041 if (request == NULL) 00042 request = GEN_HELP ; 00043 00044 sprintf(file,"%s/txt/%s/%s", 00045 G_getenv("GISBASE"), helpfile, request) ; 00046 00047 if (! access(file, 04)) 00048 { 00049 fprintf(stderr, _("one moment...\n")) ; 00050 sprintf(buffer, "$GRASS_PAGER %s", file) ; 00051 system(buffer) ; 00052 } 00053 else 00054 { 00055 fprintf(stderr, _("No help available for command [%s]\n"), request) ; 00056 } 00057 00058 return 0; 00059 }