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