home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------
- * The GMT-system: @(#)gmtset.c 2.10 2/9/95
- *
- * Copyright (c) 1991-1995 by P. Wessel and W. H. F. Smith
- * See README file for copying and redistribution conditions.
- *--------------------------------------------------------------------*/
- /*
- * gmtset will set the specified options to the argument that follows them.
- *
- * Author: Paul Wessel
- * Date: 1-JUN-1993
- * Version: 2.0
- */
-
- #include "gmt.h"
-
- main (argc, argv)
- int argc;
- char **argv; {
- int i, j;
- char *file = 0;
-
- if (argc == 2 && argv[1][0] == '-' && argv[1][1] == 0) gmt_quick = TRUE;
-
- if (argc == 1 || gmt_quick) {
- fprintf (stderr, "gmtset %s - To set individual default parameters\n\n", GMT_VERSION);
- fprintf (stderr, "usage: gmtset [-G<defaultsfile> PARAMETER1 value1 PARAMETER2 value2 PARAMETER3 value3 ...\n");
- fprintf (stderr, " For available PARAMETERS, see gmtdefaults man page\n");
-
- if (gmt_quick) exit(-1);
-
- fprintf (stderr, "\n\tOPTIONS:\n");
- fprintf (stderr, " -G sets name of specific .gmtdefaults file to modify\n");
- fprintf (stderr, " [Default looks for file in current directory, If not fould,\n");
- fprintf (stderr, " it looks in the home directory, if not found it uses GMT defaults.\n");
- fprintf (stderr, " The modified defaults are written to the current directory]\n");
-
- exit (-1);
- }
-
- gmt_program = argv[0];
-
- for (i = 1, j = 0; i < argc && j == 0; i++) {
- if (!strncmp (argv[i], "-G", 2)) {
- file = &argv[i][2];
- j = i;
- }
- }
-
- if (j) {
- for (i = j + 1; i < argc; i++, j++) argv[j] = argv[i]; /* Remove the -G string */
- argc--;
- }
-
- get_gmtdefaults (file);
-
- gmt_setdefaults (argc, argv);
-
- if (file)
- gmt_savedefaults (file);
- else
- gmt_savedefaults (".gmtdefaults");
-
- exit (0);
- }
-