[GRASS-SVN] r32634 - in grass/trunk: db/base display/d.rast.arrow
display/d.thematic.area display/d.vect general/g.parser
general/manage general/manage/cmd general/manage/lib
gui/wxpython/vdigit imagery/i.gensig imagery/i.pca include
lib/display lib/gis lib/ogsf lib/proj lib/sites ps/ps.map
raster/r.in.ascii raster/r.le/r.le.patch
raster/r.le/r.le.pixel raster/r.le/r.le.trace
raster/r.out.bin raster/r.surf.fractal
raster/r.watershed/shed sites/s.in.ascii sites/s.out.ascii
vector/v.in.ogr vector/v.label.sa vector/v.out.svg
vector/v.transform
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Aug 8 01:31:22 EDT 2008
Author: glynn
Date: 2008-08-08 01:31:22 -0400 (Fri, 08 Aug 2008)
New Revision: 32634
Removed:
grass/trunk/general/manage/lib/ask.c
grass/trunk/lib/gis/squeeze.c
grass/trunk/lib/gis/store.c
grass/trunk/lib/gis/unix_socks.c
Modified:
grass/trunk/db/base/execute.c
grass/trunk/display/d.rast.arrow/arrow.c
grass/trunk/display/d.thematic.area/main.c
grass/trunk/display/d.vect/main.c
grass/trunk/general/g.parser/main.c
grass/trunk/general/manage/cmd/list.c
grass/trunk/general/manage/lib/read_list.c
grass/trunk/general/manage/list.h
grass/trunk/gui/wxpython/vdigit/line.cpp
grass/trunk/imagery/i.gensig/get_train.c
grass/trunk/imagery/i.pca/support.c
grass/trunk/include/gisdefs.h
grass/trunk/lib/display/tran_colr.c
grass/trunk/lib/gis/area.c
grass/trunk/lib/gis/bres_line.c
grass/trunk/lib/gis/cats.c
grass/trunk/lib/gis/cell_stats.c
grass/trunk/lib/gis/color_look.c
grass/trunk/lib/gis/color_str.c
grass/trunk/lib/gis/geodesic.c
grass/trunk/lib/gis/get_ellipse.c
grass/trunk/lib/gis/init_map.c
grass/trunk/lib/gis/plot.c
grass/trunk/lib/gis/strings.c
grass/trunk/lib/ogsf/GVL2.c
grass/trunk/lib/proj/convert.c
grass/trunk/lib/proj/ellipse.c
grass/trunk/lib/sites/sites.c
grass/trunk/ps/ps.map/main.c
grass/trunk/ps/ps.map/r_text.c
grass/trunk/ps/ps.map/r_vlines.c
grass/trunk/ps/ps.map/r_vpoints.c
grass/trunk/ps/ps.map/scale.c
grass/trunk/raster/r.in.ascii/gethead.c
grass/trunk/raster/r.le/r.le.patch/driver.c
grass/trunk/raster/r.le/r.le.patch/input.c
grass/trunk/raster/r.le/r.le.pixel/driver.c
grass/trunk/raster/r.le/r.le.pixel/input.c
grass/trunk/raster/r.le/r.le.trace/user_input.c
grass/trunk/raster/r.out.bin/main.c
grass/trunk/raster/r.surf.fractal/write_rast.c
grass/trunk/raster/r.watershed/shed/com_line.c
grass/trunk/sites/s.in.ascii/
grass/trunk/sites/s.in.ascii/get_site.c
grass/trunk/sites/s.in.ascii/main.c
grass/trunk/sites/s.out.ascii/
grass/trunk/vector/v.in.ogr/main.c
grass/trunk/vector/v.label.sa/labels.c
grass/trunk/vector/v.out.svg/main.c
grass/trunk/vector/v.transform/main.c
Log:
Remove socket code
Remove redundant string functions
Move G_squeeze, G_store to lib/gis/strings.c
Remove G_strdup(); use G_store() instead
Remove "register" qualifier
Remove ask_* functions from libgrass_manage
Modified: grass/trunk/db/base/execute.c
===================================================================
--- grass/trunk/db/base/execute.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/db/base/execute.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -145,7 +145,7 @@
G_chop(buf2);
len = strlen(buf2);
- G_strncpy(buf3, buf2, 6);
+ strncpy(buf3, buf2, 6);
if (G_strcasecmp(buf3, "select") == 0)
G_fatal_error(_("Use db.select for SELECT SQL statements"));
Modified: grass/trunk/display/d.rast.arrow/arrow.c
===================================================================
--- grass/trunk/display/d.rast.arrow/arrow.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/display/d.rast.arrow/arrow.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -186,7 +186,7 @@
exit(-1);
- G_strncpy(layer_name, opt1->answer, sizeof(layer_name) - 1);
+ strncpy(layer_name, opt1->answer, sizeof(layer_name) - 1);
if ((mapset = G_find_cell2(layer_name, "")) == NULL)
G_fatal_error(_("Raster map <%s> not found"), layer_name);
Modified: grass/trunk/display/d.thematic.area/main.c
===================================================================
--- grass/trunk/display/d.thematic.area/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/display/d.thematic.area/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -210,7 +210,7 @@
/* Read map options */
- G_strcpy(map_name, map_opt->answer);
+ strcpy(map_name, map_opt->answer);
/* Make sure map is available */
Modified: grass/trunk/display/d.vect/main.c
===================================================================
--- grass/trunk/display/d.vect/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/display/d.vect/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -420,7 +420,7 @@
}
}
- G_strcpy(map_name, map_opt->answer);
+ strcpy(map_name, map_opt->answer);
default_width = atoi(width_opt->answer);
if (default_width < 0)
Modified: grass/trunk/general/g.parser/main.c
===================================================================
--- grass/trunk/general/g.parser/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/general/g.parser/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -382,7 +382,7 @@
option->answer ? option->answer : "");
putenv(G_store(buff));
- G_strcpy(upper, option->key);
+ strcpy(upper, option->key);
G_str_to_upper(upper);
sprintf(buff, "GIS_OPT_%s=%s", upper,
option->answer ? option->answer : "");
Modified: grass/trunk/general/manage/cmd/list.c
===================================================================
--- grass/trunk/general/manage/cmd/list.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/general/manage/cmd/list.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -56,11 +56,11 @@
for (n = 0; n < nlist; n++) {
if (n) {
- G_strcat(str, ",");
- G_strcat(str, list[n].alias);
+ strcat(str, ",");
+ strcat(str, list[n].alias);
}
else
- G_strcpy(str, list[n].alias);
+ strcpy(str, list[n].alias);
}
element->options = str;
Deleted: grass/trunk/general/manage/lib/ask.c
===================================================================
--- grass/trunk/general/manage/lib/ask.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/general/manage/lib/ask.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -1,16 +0,0 @@
-#include "list.h"
-
-char *ask_old(int n, char *prompt, char *name)
-{
- return G_ask_old(prompt, name, list[n].element[0], list[n].desc[0]);
-}
-
-char *ask_new(int n, char *prompt, char *name)
-{
- return G_ask_new(prompt, name, list[n].element[0], list[n].desc[0]);
-}
-
-char *ask_in_mapset(int n, char *prompt, char *name)
-{
- return G_ask_in_mapset(prompt, name, list[n].element[0], list[n].desc[0]);
-}
Modified: grass/trunk/general/manage/lib/read_list.c
===================================================================
--- grass/trunk/general/manage/lib/read_list.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/general/manage/lib/read_list.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -37,7 +37,7 @@
any = 0;
if ((env = G__getenv("ELEMENT_LIST")))
- G_strcpy(element_list, env);
+ strcpy(element_list, env);
else
sprintf(element_list, "%s/etc/element_list", G_gisbase());
fd = fopen(element_list, "r");
Modified: grass/trunk/general/manage/list.h
===================================================================
--- grass/trunk/general/manage/list.h 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/general/manage/list.h 2008-08-08 05:31:22 UTC (rev 32634)
@@ -26,16 +26,10 @@
#define COPY 3
#define LIST 4
-char *ask_in_mapset();
/* add_elem.c */
int add_element(char *, char *);
-/* ask.c */
-char *ask_old(int, char *, char *);
-char *ask_new(int, char *, char *);
-char *ask_in_mapset(int, char *, char *);
-
/* copyfile.c */
int copyfile(char *, char *, char *, char *);
Modified: grass/trunk/gui/wxpython/vdigit/line.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/line.cpp 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/gui/wxpython/vdigit/line.cpp 2008-08-08 05:31:22 UTC (rev 32634)
@@ -835,7 +835,7 @@
BgMap = NULL;
if (!G__name_is_fully_qualified(bgmap, name, mapset)) {
- G_strncpy(name, bgmap, GNAME_MAX);
+ strncpy(name, bgmap, GNAME_MAX);
mapset[0] = '\0';
}
if (strcmp(G_fully_qualified_name((const char*) display->mapInfo->name, (const char*) G_mapset()),
Modified: grass/trunk/imagery/i.gensig/get_train.c
===================================================================
--- grass/trunk/imagery/i.gensig/get_train.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/imagery/i.gensig/get_train.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -1,4 +1,5 @@
#include <stdlib.h>
+#include <string.h>
#include <grass/imagery.h>
#include <grass/glocale.h>
#include "signature.h"
@@ -43,7 +44,7 @@
I_new_signature(S);
S->sig[n].status = 1;
S->sig[n].npoints = count;
- G_strncpy(S->sig[n].desc,
+ strncpy(S->sig[n].desc,
G_get_cat(cat, &files->training_labels),
sizeof(S->sig[n].desc)
);
Modified: grass/trunk/imagery/i.pca/support.c
===================================================================
--- grass/trunk/imagery/i.pca/support.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/imagery/i.pca/support.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -48,9 +48,9 @@
sprintf(tmpeigen, "( ");
for (j = 0; j < bands; j++) {
sprintf(tmpa, "%.2f ", eigmat[i][j]);
- G_strcat(tmpeigen, tmpa);
+ strcat(tmpeigen, tmpa);
}
- G_strcat(tmpeigen, ")");
+ strcat(tmpeigen, ")");
sprintf(hist.edhist[i + 1], tmpeigen);
Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/include/gisdefs.h 2008-08-08 05:31:22 UTC (rev 32634)
@@ -1086,29 +1086,17 @@
int G_snprintf(char *, size_t, const char *, ...)
__attribute__ ((format(printf, 3, 4)));
-/* squeeze.c */
-char *G_squeeze(char *);
-
-/* store.c */
-char *G_store(const char *);
-
/* strings.c */
-char *G_strcpy(char *, const char *);
-char *G_chrcpy(char *, const char *, int);
-char *G_strncpy(char *, const char *, int);
-char *G_strcat(char *, const char *);
-char *G_chrcat(char *, const char *, int);
-char *G_strmov(char *, const char *);
-char *G_chrmov(char *, const char *, int);
int G_strcasecmp(const char *, const char *);
-char *G_strstr(const char *, const char *);
-char *G_strdup(const char *);
+char *G_store(const char *);
char *G_strchg(char *, char, char);
char *G_str_replace(char *, const char *, const char *);
+int G_strip(char *);
+char *G_chop(char *);
void G_str_to_upper(char *);
void G_str_to_lower(char *);
int G_str_to_sql(char *);
-int G_strip(char *);
+char *G_squeeze(char *);
/* svd.c */
int G_svdcmp(double **, int, int, double *, double **);
@@ -1154,14 +1142,6 @@
/* unctrl.c */
char *G_unctrl(int);
-/* unix_socks.c */
-char *G_sock_get_fname(const char *);
-int G_sock_exists(const char *);
-int G_sock_bind(const char *);
-int G_sock_listen(int, unsigned int);
-int G_sock_accept(int);
-int G_sock_connect(const char *);
-
/* verbose.c */
int G_verbose(void);
int G_verbose_min(void);
Modified: grass/trunk/lib/display/tran_colr.c
===================================================================
--- grass/trunk/lib/display/tran_colr.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/display/tran_colr.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -63,7 +63,7 @@
char lowerstr[MAX_COLOR_LEN];
/* Make the color string lowercase for display colors */
- G_strcpy(lowerstr, str);
+ strcpy(lowerstr, str);
G_chop(lowerstr);
G_tolcase(lowerstr);
Modified: grass/trunk/lib/gis/area.c
===================================================================
--- grass/trunk/lib/gis/area.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/area.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -90,8 +90,8 @@
double G_area_of_cell_at_row(int row)
{
- register double south_value;
- register double cell_area;
+ double south_value;
+ double cell_area;
if (projection != PROJECTION_LL)
return square_meters;
Modified: grass/trunk/lib/gis/bres_line.c
===================================================================
--- grass/trunk/lib/gis/bres_line.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/bres_line.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -40,7 +40,7 @@
int dx, dy;
int xinc, yinc;
- register int res1;
+ int res1;
int res2;
xinc = 1;
Modified: grass/trunk/lib/gis/cats.c
===================================================================
--- grass/trunk/lib/gis/cats.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/cats.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -728,7 +728,7 @@
int G_unmark_raster_cats(struct Categories *pcats)
{ /* structure to hold category info */
- register int i;
+ int i;
for (i = 0; i < pcats->ncats; i++)
pcats->marks[i] = 0;
Modified: grass/trunk/lib/gis/cell_stats.c
===================================================================
--- grass/trunk/lib/gis/cell_stats.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/cell_stats.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -67,11 +67,11 @@
int G_update_cell_stats(const CELL * cell, int n, struct Cell_stats *s)
{
CELL cat;
- register int p, q;
+ int p, q;
int idx, offset;
int N;
- register NODE *node, *pnode;
- register NODE *new_node;
+ NODE *node, *pnode;
+ NODE *new_node;
if (n <= 0)
return 1;
@@ -163,8 +163,8 @@
static int init_node(NODE * node, int idx, int offset)
{
- register long *count;
- register int i;
+ long *count;
+ int i;
count = node->count = (long *)G_calloc(i = NCATS, sizeof(long));
while (i--)
@@ -203,8 +203,8 @@
int G_find_cell_stat(CELL cat, long *count, const struct Cell_stats *s)
{
- register int q;
- register int idx;
+ int q;
+ int idx;
int offset;
*count = 0;
Modified: grass/trunk/lib/gis/color_look.c
===================================================================
--- grass/trunk/lib/gis/color_look.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/color_look.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -237,7 +237,7 @@
struct _Color_Rule_ *rule;
DCELL dmin, dmax, val, dmod = 0L, shift;
CELL cat, min, max;
- register const void *ptr, *last_ptr = NULL;
+ const void *ptr, *last_ptr = NULL;
int invert;
int found, r, g, b;
int cell_type;
Modified: grass/trunk/lib/gis/color_str.c
===================================================================
--- grass/trunk/lib/gis/color_str.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/color_str.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -115,7 +115,7 @@
int num_names = G_num_standard_color_names();
int i;
- G_strcpy(buf, str);
+ strcpy(buf, str);
G_chop(buf);
G_debug(3, "G_str_to_color(): str = '%s'", buf);
Modified: grass/trunk/lib/gis/geodesic.c
===================================================================
--- grass/trunk/lib/gis/geodesic.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/geodesic.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -28,8 +28,6 @@
*/
-#define SWAP(a,b) temp=a;a=b;b=temp
-
static int adjust_lat(double *);
static int adjust_lon(double *);
@@ -46,10 +44,9 @@
adjust_lat(&lat1);
adjust_lat(&lat2);
if (lon1 > lon2) {
- register double temp;
-
- SWAP(lon1, lon2);
- SWAP(lat1, lat2);
+ double temp;
+ temp = lon1; lon1 = lon2; lon2 = temp;
+ temp = lat1; lat1 = lat2; lat2 = temp;
}
if (lon1 == lon2) {
A = B = 0.0;
Modified: grass/trunk/lib/gis/get_ellipse.c
===================================================================
--- grass/trunk/lib/gis/get_ellipse.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/get_ellipse.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -297,8 +297,8 @@
err++;
sprintf(buf, " %d", line);
if (*badlines)
- G_strcat(badlines, ",");
- G_strcat(badlines, buf);
+ strcat(badlines, ",");
+ strcat(badlines, buf);
continue;
}
@@ -317,8 +317,8 @@
err++;
sprintf(buf, " %d", line);
if (*badlines)
- G_strcat(badlines, ",");
- G_strcat(badlines, buf);
+ strcat(badlines, ",");
+ strcat(badlines, buf);
continue;
}
}
Modified: grass/trunk/lib/gis/init_map.c
===================================================================
--- grass/trunk/lib/gis/init_map.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/init_map.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -16,7 +16,7 @@
struct fileinfo *fcb = &G__.fileinfo[fd];
int row, col;
double zeroVal, *zeroValP;
- register XDR *xdrs;
+ XDR *xdrs;
xdrs = &fcb->xdrstream; /* xdr stream is initialized to write into */
xdr_setpos(xdrs, 0); /* G__.work_buf in 'opencell.c' */
@@ -56,7 +56,7 @@
struct fileinfo *fcb = &G__.fileinfo[fd];
int row, col;
float zeroVal, *zeroValP;
- register XDR *xdrs;
+ XDR *xdrs;
xdrs = &fcb->xdrstream; /* xdr stream is initialized to write into */
Modified: grass/trunk/lib/gis/plot.c
===================================================================
--- grass/trunk/lib/gis/plot.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/plot.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -660,7 +660,7 @@
static int edge(double x0, double y0, double x1, double y1)
{
- register double m;
+ double m;
double dy, x;
int ystart, ystop;
Deleted: grass/trunk/lib/gis/squeeze.c
===================================================================
--- grass/trunk/lib/gis/squeeze.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/squeeze.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -1,66 +0,0 @@
-
-/**
- * \file squeeze.c
- *
- * \brief GIS Library - String white space removal functions.
- *
- * (C) 2001-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1998-2008
- */
-
-#include <ctype.h>
-#include <string.h>
-#include <grass/gis.h>
-
-
-/*
- * last modification: 12 aug 81, j w hamilton
- *
- * 1998-04-04 WBH
- * Also squeezes out newlines -- easier to use with fgets()
- *
- * 1999-19-12 Werner Droege
- * changed line 37, line 48ff. -- return (strip_NL(line))
- */
-
-
-/**
- * \brief Remove superfluous white space.
- *
- * Leading and trailing white space is removed from the string
- * <b>line</b> and internal white space which is more than one character
- * is reduced to a single space character. White space here means
- * spaces, tabs, linefeeds, newlines, and formfeeds.
- *
- * \param[in,out] line
- * \return Pointer to <b>line</b>
- */
-
-char *G_squeeze(char *line)
-{
- register char *f = line, *t = line;
- int l;
-
- /* skip over space at the beginning of the line. */
- while (isspace(*f))
- f++;
-
- while (*f)
- if (!isspace(*f))
- *t++ = *f++;
- else if (*++f)
- if (!isspace(*f))
- *t++ = ' ';
- *t = '\0';
- l = strlen(line) - 1;
- if (*(line + l) == '\n')
- *(line + l) = '\0';
-
- return line;
-}
Deleted: grass/trunk/lib/gis/store.c
===================================================================
--- grass/trunk/lib/gis/store.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/store.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -1,40 +0,0 @@
-
-/**
- * \file store.c
- *
- * \brief GIS Library - String storage functions.
- *
- * (C) 2001-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2008
- */
-
-#include <grass/gis.h>
-#include <string.h>
-
-
-/**
- * \brief Copy string to allocated memory.
- *
- * This routine allocates enough memory to hold the string <b>s</b>,
- * copies <b>s</b> to the allocated memory, and returns a pointer
- * to the allocated memory.
- *
- * \param[in] s string
- * \return pointer to newly allocated string
- */
-
-char *G_store(const char *s)
-{
- char *buf;
-
- buf = G_malloc(strlen(s) + 1);
- strcpy(buf, s);
-
- return buf;
-}
Modified: grass/trunk/lib/gis/strings.c
===================================================================
--- grass/trunk/lib/gis/strings.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/strings.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -26,158 +26,7 @@
#define NULL 0
#endif
-static char *G_strend(const char *S)
-{
- while (*S)
- S++;
- return (char *)S;
-}
-
/*!
- * \brief Copies characters from the string F into the string T.
- *
- * This function has undefined results if the strings overlap.
- *
- * \param[out] T target string
- * \param[in] F source string
- *
- * \return pointer to T
- */
-char *G_strcpy(char *T, const char *F)
-{
- char *d = T;
-
- while ((*d++ = *F++)) ;
- return (T);
-}
-
-/*!
- * \brief Copies characters from the string F into the string T.
- *
- * Copies just the first n characters from the string F. At the end
- * the null terminator is written into the string T.
- *
- * \param[out] T target string
- * \param[in] F source string
- * \param[in] n number of characters to copy
- *
- * \return T value
- */
-char *G_chrcpy(char *T, const char *F, int n)
-{
- char *d = T;
-
- while (n--)
- *d++ = *F++;
- *d = '\0';
- return (T);
-}
-
-/*!
- * \brief This function is similar to G_chrcpy() but always copies at least
- * n characters into the string T.
- *
- * If the length of F is more than n, then copies just the first n
- * characters. At the end the null terminator is written into the
- * string T.
- *
- * \param[out] T target string
- * \param[in] F source string
- * \param[in] n number of characters to copy
- *
- * \return T value
- */
-char *G_strncpy(char *T, const char *F, int n)
-{
- char *d = T;
-
- while (n-- && *F)
- *d++ = *F++;
- *d = '\0';
- return (T);
-}
-
-/*!
- * \brief Copies characters from the string F (not including the
- * terminating null character) into the string T.
- *
- * \param[out] T target string
- * \param[in] F source string
- *
- * \return T value
- */
-char *G_strmov(char *T, const char *F)
-{
- char *d = T;
-
- while (*F)
- *d++ = *F++;
- return (T);
-}
-
-/*!
- * \brief This copies characters from the string F (exactly n
- * characters) into the string T.
- *
- * The terminating null character is not explicitly written into the
- * string T.
- *
- * \param[out] T target string
- * \param[in] F source string
- * \param[in] n number of characters to copy
- *
- * \return T value
- */
-char *G_chrmov(char *T, const char *F, int n)
-{
- char *d = T;
-
- while (n--)
- *d++ = *F++;
- return (T);
-}
-
-/*!
- * \brief This copies characters from the string F into the string T.
- *
- * This function is similar to G_strcpy(), except that the
- * characters from F are concatenated or appended to the end of
- * T, instead of overwriting it. That is, the first character from
- * F overwrites the null character marking the end of T.
- *
- * \param[out] T target string
- * \param[in] F source string
- *
- * \return T value
- */
-char *G_strcat(char *T, const char *F)
-{
- G_strcpy(G_strend(T), F);
- return (T);
-}
-
-/*!
- * \brief This function is like G_strcat() except that not more than n
- * characters from F are appended to the end of T.
- *
- * This function is similar to G_strcpy(), except that the
- * characters from F are concatenated or appended to the end of
- * T, instead of overwriting it. That is, the first character from
- * F overwrites the null character marking the end of T.
- *
- * \param[out] T target string
- * \param[in] F source string
- * \param[in] n number of character to copy
- *
- * \return T value
- */
-char *G_chrcat(char *T, const char *F, int n)
-{
- G_chrcpy(G_strend(T), F, n);
- return (T);
-}
-
-/*!
* \brief String compare ignoring case (upper or lower)
*
* Returning a value that has the same sign as the difference between
@@ -216,63 +65,25 @@
return 0;
}
-/*!
- * \brief Finds the first occurrence of the character C in the
- * null-terminated string beginning at mainString
+/**
+ * \brief Copy string to allocated memory.
*
- * \param[in] mainString string where to find sub-string
- * \param[in] subString sub-string
- *
- * \return a pointer to the first occurrence of subString in
- * mainString
- * \return NULL if no occurrences are found
+ * This routine allocates enough memory to hold the string <b>s</b>,
+ * copies <b>s</b> to the allocated memory, and returns a pointer
+ * to the allocated memory.
+ *
+ * \param[in] s string
+ * \return pointer to newly allocated string
*/
-char *G_strstr(const char *mainString, const char *subString)
-{
- const char *p;
- const char *q;
- int length;
- p = subString;
- q = mainString;
- length = strlen(subString);
-
- do {
- while (*q != '\0' && *q != *p) { /* match 1st subString char */
- q++;
- }
- } while (*q != '\0' && strncmp(p, q, length) != 0 && q++);
- /* Short-circuit evaluation is your friend */
-
- if (*q == '\0') { /* ran off end of mainString */
- return NULL;
- }
- else {
- return (char *)q;
- }
-}
-
-/*!
- * \brief Copies the null-terminated string into a newly
- * allocated string. The string is allocated using G_malloc().
- *
- * \param[in] string the string to duplicate
- *
- * \return pointer to a string that is a duplicate of the string
- * given to G_strdup().
- * \return NULL if unable to allocate the required space
- */
-char *G_strdup(const char *string)
+char *G_store(const char *s)
{
- char *p;
+ char *buf;
- p = G_malloc(strlen(string) + 1);
+ buf = G_malloc(strlen(s) + 1);
+ strcpy(buf, s);
- if (p != NULL) {
- strcpy(p, string);
- }
-
- return p;
+ return buf;
}
/*!
@@ -323,7 +134,7 @@
/* Make sure old_str and new_str are not NULL */
if (old_str == NULL || new_str == NULL)
- return G_strdup(buffer);
+ return G_store(buffer);
/* Make sure buffer is not NULL */
if (buffer == NULL)
return NULL;
@@ -332,7 +143,7 @@
B = strstr(buffer, old_str);
if (B == NULL)
/* return NULL; */
- return G_strdup(buffer);
+ return G_store(buffer);
if (strlen(new_str) > strlen(old_str)) {
/* Count occurences of old_str */
@@ -340,7 +151,7 @@
len = strlen(old_str);
B = buffer;
while (B != NULL && *B != '\0') {
- B = G_strstr(B, old_str);
+ B = strstr(B, old_str);
if (B != NULL) {
B += len;
count++;
@@ -388,7 +199,7 @@
*/
int G_strip(char *buf)
{
- register char *a, *b;
+ char *a, *b;
/* remove leading white space */
for (a = b = buf; *a == ' ' || *a == '\t'; a++) ;
@@ -417,7 +228,7 @@
*/
char *G_chop(char *line)
{
- register char *f = line, *t = line;
+ char *f = line, *t = line;
while (isspace(*f)) /* go to first non white-space char */
f++;
@@ -513,3 +324,38 @@
return count;
}
+
+/**
+ * \brief Remove superfluous white space.
+ *
+ * Leading and trailing white space is removed from the string
+ * <b>line</b> and internal white space which is more than one character
+ * is reduced to a single space character. White space here means
+ * spaces, tabs, linefeeds, newlines, and formfeeds.
+ *
+ * \param[in,out] line
+ * \return Pointer to <b>line</b>
+ */
+
+char *G_squeeze(char *line)
+{
+ char *f = line, *t = line;
+ int l;
+
+ /* skip over space at the beginning of the line. */
+ while (isspace(*f))
+ f++;
+
+ while (*f)
+ if (!isspace(*f))
+ *t++ = *f++;
+ else if (*++f)
+ if (!isspace(*f))
+ *t++ = ' ';
+ *t = '\0';
+ l = strlen(line) - 1;
+ if (*(line + l) == '\n')
+ *(line + l) = '\0';
+
+ return line;
+}
Deleted: grass/trunk/lib/gis/unix_socks.c
===================================================================
--- grass/trunk/lib/gis/unix_socks.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/gis/unix_socks.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -1,394 +0,0 @@
-
-/**
- * \file unix_sockets.c
- *
- * \brief GIS Library - Unix sockets support functions.
- *
- * Routines related to using UNIX domain sockets for IPC mechanisms
- * (such as XDRIVER).<br>
- *
- * Historically GRASS has used FIFO for interprocess communications for
- * display functions. Unfortunately, FIFO's are not available on all
- * target platforms. An attempt has been made to use IPC message
- * passing, but the semantics are variable and it also isn't available
- * on all target platforms. UNIX sockets, or local or domain sockets,
- * are much more widely available and consistent.<br>
- *
- * <b>Note:</b> This implementation of UNIX sockets provides zero
- * security checking so should not be used from untrusted clients.<br>
- *
- * (C) 2001-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author Eric G. Miller
- *
- * \date 1999-2008
- */
-
-#include <grass/config.h>
-
-#ifdef HAVE_SOCKET
-
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef __MINGW32__
-#define USE_TCP
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#define EADDRINUSE WSAEADDRINUSE
-#else
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#define INVALID_SOCKET (-1)
-#endif
-
-#include <grass/gis.h>
-#include <grass/version.h>
-#include <grass/glocale.h>
-
-/** For systems where the *_LOCAL (POSIX 1g) is not defined
- ** There's not really any difference between PF and AF in practice.
- **/
-
-static char *_get_make_sock_path(void);
-
-static void init_sockets(void)
-{
-#ifdef __MINGW32__
- static int ready;
- WSADATA wsadata;
-
- if (ready)
- return;
-
- ready = 1;
-
- WSAStartup(0x0001, &wsadata);
-#endif
-}
-
-/* ---------------------------------------------------------------------
- * _get_make_sock_path(), builds and tests the path for the socket
- * directory. Returns NULL on any failure, otherwise it returns the
- * directory path. The path will be like
- * "/tmp/grass7-$USER-$GIS_LOCK".
- * ($GIS_LOCK is set in lib/init/init.sh to PID)
- * ---------------------------------------------------------------------*/
-
-static char *_get_make_sock_path(void)
-{
- char *path, *user, *lock;
- const char *prefix = "/tmp/grass7";
- int len, status;
- struct stat theStat;
-
- user = G_whoami(); /* Don't G_free () return value ever! */
- if (user == NULL)
- return NULL;
- else if (user[0] == '?') { /* why's it do that? */
- return NULL;
- }
-
- if ((lock = getenv("GIS_LOCK")) == NULL)
- G_fatal_error(_("Unable to get GIS_LOCK enviroment variable value"));
-
- len = strlen(prefix) + strlen(user) + strlen(lock) + 3;
- path = G_malloc(len);
-
- sprintf(path, "%s-%s-%s", prefix, user, lock);
-
- if ((status = G_lstat(path, &theStat)) != 0) {
- status = G_mkdir(path);
- }
- else {
- if (!S_ISDIR(theStat.st_mode)) {
- status = -1; /* not a directory ?? */
- }
- else {
- status = chmod(path, S_IRWXU); /* fails if we don't own it */
- }
- }
-
- if (status) { /* something's wrong if non-zero */
- G_free(path);
- path = NULL;
- }
-
- return path;
-}
-
-#ifdef USE_TCP
-
-#define PROTO PF_INET
-typedef struct sockaddr_in sockaddr_t;
-
-static int set_port(const char *name, int port)
-{
- FILE *fp = fopen(name, "w");
-
- if (!fp)
- return -1;
-
- fprintf(fp, "%d\n", port);
-
- fclose(fp);
-
- return 0;
-}
-
-static int get_port(const char *name)
-{
- FILE *fp = fopen(name, "r");
- int port;
-
- if (!fp)
- return -1;
-
- if (fscanf(fp, "%d", &port) != 1)
- port = -1;
-
- fclose(fp);
-
- return port;
-}
-
-static int save_port(int sockfd, const char *name)
-{
- sockaddr_t addr;
- socklen_t size = sizeof(addr);
-
- if (getsockname(sockfd, (struct sockaddr *)&addr, &size) != 0)
- return -1;
-
- if (set_port(name, ntohs(addr.sin_port)) < 0)
- return -1;
-
- return 0;
-}
-
-static int make_address(sockaddr_t * addr, const char *name, int exists)
-{
- int port = exists ? get_port(name) : 0;
-
- if (port < 0)
- return -1;
-
- addr->sin_family = AF_INET;
- addr->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- addr->sin_port = htons((unsigned short)port);
-
- return 0;
-}
-
-#else
-
-#define PROTO PF_UNIX
-typedef struct sockaddr_un sockaddr_t;
-
-static int make_address(sockaddr_t * addr, const char *name, int exists)
-{
- addr->sun_family = AF_UNIX;
-
- /* The path to the unix socket must fit in sun_path[] */
- if (sizeof(addr->sun_path) < strlen(name) + 1)
- return -1;
-
- strncpy(addr->sun_path, name, sizeof(addr->sun_path) - 1);
-
- return 0;
-}
-
-#endif
-
-/**
- * \brief Builds full path for a UNIX socket.
- *
- * Caller should <i>G_free()</i> the return value when it is no longer
- * needed.
- *
- * \param[in] name
- * \return NULL on error
- * \return Pointer to string socket path on success
- */
-
-char *G_sock_get_fname(const char *name)
-{
- char *path, *dirpath;
- int len;
-
- if (name == NULL)
- return NULL;
-
- dirpath = _get_make_sock_path();
-
- if (dirpath == NULL)
- return NULL;
-
- len = strlen(dirpath) + strlen(name) + 2;
- path = G_malloc(len);
- sprintf(path, "%s/%s", dirpath, name);
- G_free(dirpath);
-
- return path;
-}
-
-
-/**
- * \brief Checks socket existence.
- *
- * \param[in] name
- * \return 1 if <b>name</b> exists
- * \return 0 if <b>name</b> does not exist
- */
-
-int G_sock_exists(const char *name)
-{
- struct stat theStat;
-
- if (name == NULL || stat(name, &theStat) != 0)
- return 0;
-
-#ifdef USE_TCP
- if (S_ISREG(theStat.st_mode))
-#else
- if (S_ISSOCK(theStat.st_mode))
-#endif
- return 1;
- else
- return 0;
-}
-
-
-/**
- * \brief Binds socket to file descriptor.
- *
- * Takes the full pathname for a UNIX socket and returns the file
- * descriptor to the socket after a successful call to <i>bind()</i>.
- *
- * \param[in] name
- * \return -1 and "errno" is set on error
- * \return file descriptor on success
- */
-
-int G_sock_bind(const char *name)
-{
- int sockfd;
- sockaddr_t addr;
- socklen_t size;
-
- if (name == NULL)
- return -1;
-
- init_sockets();
-
- /* Bind requires that the file does not exist. Force the caller
- * to make sure the socket is not in use. The only way to test,
- * is a call to connect().
- */
- if (G_sock_exists(name)) {
- errno = EADDRINUSE;
- return -1;
- }
-
- /* must always zero socket structure */
- memset(&addr, 0, sizeof(addr));
-
- size = sizeof(addr);
-
- if (make_address(&addr, name, 0) < 0)
- return -1;
-
- sockfd = socket(PROTO, SOCK_STREAM, 0);
- if (sockfd == INVALID_SOCKET)
- return -1;
-
- if (bind(sockfd, (const struct sockaddr *)&addr, size) != 0)
- return -1;
-
-#ifdef USE_TCP
- if (save_port(sockfd, name) < 0)
- return -1;
-#endif
-
- return sockfd;
-}
-
-/**
- * \brief Wrapper function to <i>listen()</i>.
- *
- * \param[in] sockfd
- * \param[in] queue_len
- * \return 0 on success
- * \return -1 and "errno" set on error
- */
-
-int G_sock_listen(int sockfd, unsigned int queue_len)
-{
- return listen(sockfd, queue_len);
-}
-
-
-/**
- * \brief Wrapper around <i>accept()</i>.
- *
- * <b>Note:</b> This call will usually block until a connection arrives.
- * <i>select()</i> can be used for a time out on the call.
- *
- * \param[in] sockfd
- * \return -1 and "errno" set on error
- * \return file descriptor on success
- */
-
-int G_sock_accept(int sockfd)
-{
- sockaddr_t addr;
- socklen_t len = sizeof(addr);
-
- return accept(sockfd, (struct sockaddr *)&addr, &len);
-}
-
-
-/**
- * \brief Tries to connect to the UNIX socket specified by <b>name</b>.
- *
- * \param[in] name
- * \return -1 and "errno" set on error
- * \return file descriptor on success
- */
-
-int G_sock_connect(const char *name)
-{
- int sockfd;
- sockaddr_t addr;
-
- init_sockets();
-
- if (!G_sock_exists(name))
- return -1;
-
- /* must always zero socket structure */
- memset(&addr, 0, sizeof(addr));
-
- if (make_address(&addr, name, 1) < 0)
- return -1;
-
- sockfd = socket(PROTO, SOCK_STREAM, 0);
- if (sockfd == INVALID_SOCKET)
- return -1;
-
- if (connect(sockfd, (struct sockaddr *)&addr, sizeof(addr)) != 0)
- return -1;
- else
- return sockfd;
-}
-
-#endif
Modified: grass/trunk/lib/ogsf/GVL2.c
===================================================================
--- grass/trunk/lib/ogsf/GVL2.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/ogsf/GVL2.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -16,6 +16,7 @@
Tomas Paudits (February 2004)
*/
+#include <string.h>
#include <grass/gis.h>
#include <grass/G3d.h>
#include <grass/gstypes.h>
@@ -276,7 +277,7 @@
return (-1);
}
- G_strcpy(filename, gvl_file_get_name(gvl->hfile));
+ strcpy(filename, gvl_file_get_name(gvl->hfile));
return (1);
}
@@ -781,7 +782,7 @@
*constant = isosurf->att[att].constant;
}
else if (src == MAP_ATT) {
- G_strcpy(mapname, gvl_file_get_name(isosurf->att[att].hfile));
+ strcpy(mapname, gvl_file_get_name(isosurf->att[att].hfile));
}
return (1);
Modified: grass/trunk/lib/proj/convert.c
===================================================================
--- grass/trunk/lib/proj/convert.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/proj/convert.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -156,8 +156,8 @@
else
ellpslong = G_store(ellps);
- startmod = G_strstr(wkt, "GEOGCS");
- lastpart = G_strstr(wkt, "PRIMEM");
+ startmod = strstr(wkt, "GEOGCS");
+ lastpart = strstr(wkt, "PRIMEM");
len = strlen(wkt) - strlen(startmod);
wkt[len] = '\0';
if (haveparams == 2) {
@@ -199,7 +199,7 @@
G_asprintf(&buff, ",UNIT[\"%s\",", osrunit);
- startmod = G_strstr(lastpart, buff);
+ startmod = strstr(lastpart, buff);
len = strlen(lastpart) - strlen(startmod);
lastpart[len] = '\0';
Modified: grass/trunk/lib/proj/ellipse.c
===================================================================
--- grass/trunk/lib/proj/ellipse.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/proj/ellipse.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -232,8 +232,8 @@
err++;
sprintf(buf, " %d", line);
if (*badlines)
- G_strcat(badlines, ",");
- G_strcat(badlines, buf);
+ strcat(badlines, ",");
+ strcat(badlines, buf);
continue;
}
@@ -256,8 +256,8 @@
err++;
sprintf(buf, " %d", line);
if (*badlines)
- G_strcat(badlines, ",");
- G_strcat(badlines, buf);
+ strcat(badlines, ",");
+ strcat(badlines, buf);
continue;
}
}
Modified: grass/trunk/lib/sites/sites.c
===================================================================
--- grass/trunk/lib/sites/sites.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/lib/sites/sites.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -96,13 +96,13 @@
for (i = 0; i < Map->n_site_dbl; i++)
s->dbl_att[i] = 0;
for (i = 0; i < Map->n_site_str; i++)
- G_strncpy(s->str_att[i], "", MAX_SITE_STRING);
+ strncpy(s->str_att[i], "", MAX_SITE_STRING);
}
else {
for (i = 0; i < Map->n_site_dbl; i++)
s->dbl_att[i] = sa->dbl[i];
for (i = 0; i < Map->n_site_str; i++)
- G_strncpy(s->str_att[i], sa->str[i], MAX_SITE_STRING);
+ strncpy(s->str_att[i], sa->str[i], MAX_SITE_STRING);
}
}
@@ -713,7 +713,7 @@
/* allow both prefixed and unprefixed strings */
if (c < s->str_alloc) {
if ((tmp = cleanse_string(buf)) > 0) {
- G_strncpy(s->str_att[c++], buf, tmp);
+ strncpy(s->str_att[c++], buf, tmp);
buf += tmp;
}
else
@@ -818,9 +818,9 @@
switch (*buf) {
case '#': /* category field */
sscanf(buf, "#%s ", ebuf);
- if (G_strstr(ebuf, ".") == NULL && sscanf(ebuf, "%d", &itmp) == 1)
+ if (strstr(ebuf, ".") == NULL && sscanf(ebuf, "%d", &itmp) == 1)
*cat = CELL_TYPE;
- else if (G_strstr(ebuf, ".") != NULL &&
+ else if (strstr(ebuf, ".") != NULL &&
sscanf(ebuf, "%f", &ftmp) == 1)
*cat = FCELL_TYPE;
else
@@ -1065,7 +1065,7 @@
for (i = 0; i < s->dim_alloc; ++i) {
format_double(s->dim[i], nbuf);
sprintf(xbuf, "%s%s", nfs, nbuf);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
}
nfs = (fs == NULL) ? " " : fs;
@@ -1073,19 +1073,19 @@
switch (s->cattype) {
case CELL_TYPE:
sprintf(xbuf, "%s%s%d ", nfs, ((id == 0) ? "" : "#"), (int)s->ccat);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
break;
case FCELL_TYPE:
case DCELL_TYPE:
sprintf(xbuf, "%s%s%g ", nfs, ((id == 0) ? "" : "#"), (float)s->fcat);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
break;
}
for (i = 0; i < s->dbl_alloc; ++i) {
format_double(s->dbl_att[i], nbuf);
sprintf(xbuf, "%s%s%s", nfs, ((id == 0) ? "" : "%"), nbuf);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
}
for (i = 0; i < s->str_alloc; ++i) {
@@ -1114,9 +1114,9 @@
else
*/
- G_strcpy(xbuf, s->str_att[i]);
+ strcpy(xbuf, s->str_att[i]);
- G_strcpy(s->str_att[i], xbuf);
+ strcpy(s->str_att[i], xbuf);
if (G_index(s->str_att[i], SPACE) != (char *)NULL)
sprintf(xbuf, "%s%s\"%s\"", nfs, ((id == 0) ? "" : "@"),
@@ -1124,7 +1124,7 @@
else
sprintf(xbuf, "%s%s%s", nfs, ((id == 0) ? "" : "@"),
s->str_att[i]);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
}
}
return buf;
Modified: grass/trunk/ps/ps.map/main.c
===================================================================
--- grass/trunk/ps/ps.map/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/ps/ps.map/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -162,11 +162,11 @@
/* set default paper */
set_paper("a4");
- G_strcpy(buf, "black");
+ strcpy(buf, "black");
BLACK = get_color_number(buf);
- G_strcpy(buf, "white");
+ strcpy(buf, "white");
WHITE = get_color_number(buf);
- G_strcpy(buf, "grey");
+ strcpy(buf, "grey");
GREY = get_color_number(buf);
/* initialize */
@@ -244,7 +244,7 @@
"scale", "scale", "scale");
can_reset_scale = isatty(0);
if (check_scale(map_scale->answer))
- G_strcpy(PS.scaletext, map_scale->answer);
+ strcpy(PS.scaletext, map_scale->answer);
else
error(map_scale->answer, "", "illegal scale request");
}
@@ -447,7 +447,7 @@
}
PS.do_scalebar = 1;
if (sscanf(data, "%s", sb.type) != 1)
- G_strcpy(sb.type, "f"); /* default to fancy scalebar */
+ strcpy(sb.type, "f"); /* default to fancy scalebar */
read_scalebar();
if (sb.length <= 0.) {
error(key, data, "Bad scalebar length");
Modified: grass/trunk/ps/ps.map/r_text.c
===================================================================
--- grass/trunk/ps/ps.map/r_text.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/ps/ps.map/r_text.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -74,7 +74,7 @@
rotate = 0.0;
xref = CENTER;
yref = CENTER;
- G_strcpy(fontname, "Helvetica");
+ strcpy(fontname, "Helvetica");
while (*text == ' ' || *text == '\t')
text++;
Modified: grass/trunk/ps/ps.map/r_vlines.c
===================================================================
--- grass/trunk/ps/ps.map/r_vlines.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/ps/ps.map/r_vlines.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -102,10 +102,10 @@
G_strip(data);
vector.layer[vec].ltype = 0;
- if (G_strstr(data, "line"))
+ if (strstr(data, "line"))
vector.layer[vec].ltype |= GV_LINE;
- if (G_strstr(data, "boundary"))
+ if (strstr(data, "boundary"))
vector.layer[vec].ltype |= GV_BOUNDARY;
continue;
Modified: grass/trunk/ps/ps.map/r_vpoints.c
===================================================================
--- grass/trunk/ps/ps.map/r_vpoints.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/ps/ps.map/r_vpoints.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -106,10 +106,10 @@
G_strip(data);
vector.layer[vec].ltype = 0;
- if (G_strstr(data, "point"))
+ if (strstr(data, "point"))
vector.layer[vec].ltype |= GV_POINT;
- if (G_strstr(data, "centroid"))
+ if (strstr(data, "centroid"))
vector.layer[vec].ltype |= GV_CENTROID;
continue;
Modified: grass/trunk/ps/ps.map/scale.c
===================================================================
--- grass/trunk/ps/ps.map/scale.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/ps/ps.map/scale.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -102,22 +102,22 @@
/* unit2: meters, miles, kilometers */
if (strncmp(unit2, "mile", 4) == 0) {
u2 = MILES_TO_INCHES;
- G_strcpy(unit2, "mile");
+ strcpy(unit2, "mile");
}
else if (strncmp(unit2, "meter", 5) == 0) {
u2 = METERS_TO_INCHES;
- G_strcpy(unit2, "meter");
+ strcpy(unit2, "meter");
}
else if (strncmp(unit2, "kilometer", 9) == 0) {
u2 = METERS_TO_INCHES * 1000;
- G_strcpy(unit2, "kilometer");
+ strcpy(unit2, "kilometer");
}
else
OOPS();
u2 *= n2;
- G_strcpy(unit1, "inch");
- G_strcpy(equals, "equal");
+ strcpy(unit1, "inch");
+ strcpy(equals, "equal");
if (n1 == 1)
strcat(equals, "s");
else
Modified: grass/trunk/raster/r.in.ascii/gethead.c
===================================================================
--- grass/trunk/raster/r.in.ascii/gethead.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.in.ascii/gethead.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -110,7 +110,7 @@
len = strlen(buf);
*label = *value = '\0';
- if (NULL == G_strstr(buf, ":"))
+ if (NULL == strstr(buf, ":"))
break;
if (sscanf(buf, "%[^:]:%s", label, value) != 2)
break;
Modified: grass/trunk/raster/r.le/r.le.patch/driver.c
===================================================================
--- grass/trunk/raster/r.le/r.le.patch/driver.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.le/r.le.patch/driver.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -2644,35 +2644,35 @@
}
if (i == 0)
- G_strcpy(istr, "1");
+ strcpy(istr, "1");
else if (i == 1)
- G_strcpy(istr, "2");
+ strcpy(istr, "2");
else if (i == 2)
- G_strcpy(istr, "3");
+ strcpy(istr, "3");
else if (i == 3)
- G_strcpy(istr, "4");
+ strcpy(istr, "4");
else if (i == 4)
- G_strcpy(istr, "5");
+ strcpy(istr, "5");
else if (i == 5)
- G_strcpy(istr, "6");
+ strcpy(istr, "6");
else if (i == 6)
- G_strcpy(istr, "7");
+ strcpy(istr, "7");
else if (i == 7)
- G_strcpy(istr, "8");
+ strcpy(istr, "8");
else if (i == 8)
- G_strcpy(istr, "9");
+ strcpy(istr, "9");
else if (i == 9)
- G_strcpy(istr, "10");
+ strcpy(istr, "10");
else if (i == 10)
- G_strcpy(istr, "11");
+ strcpy(istr, "11");
else if (i == 11)
- G_strcpy(istr, "12");
+ strcpy(istr, "12");
else if (i == 12)
- G_strcpy(istr, "13");
+ strcpy(istr, "13");
else if (i == 13)
- G_strcpy(istr, "14");
+ strcpy(istr, "14");
else if (i == 14)
- G_strcpy(istr, "15");
+ strcpy(istr, "15");
else if (i > 14) {
fprintf(stderr, "\n");
fprintf(stderr,
@@ -2700,8 +2700,8 @@
/* if a map of the sampling units
was requested */
if (choice->units) {
- G_strcpy(unitname, "units_");
- G_strcat(unitname, istr);
+ strcpy(unitname, "units_");
+ strcat(unitname, istr);
fd = G_open_raster_new(unitname, CELL_TYPE);
unit_buf = G_allocate_raster_buf(CELL_TYPE);
for (k = 1; k < wind.rows + 1; k++) {
Modified: grass/trunk/raster/r.le/r.le.patch/input.c
===================================================================
--- grass/trunk/raster/r.le/r.le.patch/input.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.le/r.le.patch/input.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -205,12 +205,12 @@
/* record the user inputs for map,
sam and out parameters */
- G_strcpy(choice->fn, name->answer);
+ strcpy(choice->fn, name->answer);
choice->wrum = sampling_method->answer[0];
if (out->answer && choice->wrum != 'm')
- G_strcpy(choice->out, out->answer);
+ strcpy(choice->out, out->answer);
else if (out->answer && choice->wrum == 'm') {
fprintf(stderr, "\n");
fprintf(stderr,
@@ -222,7 +222,7 @@
exit(EXIT_FAILURE);
}
else
- G_strcpy(choice->out, "");
+ strcpy(choice->out, "");
/* check for unacceptable values for
input parameters for sam */
@@ -405,7 +405,7 @@
if (!strcmp(sampling_method->answer, "r")) {
if (region->answer)
- G_strcpy(choice->reg, region->answer);
+ strcpy(choice->reg, region->answer);
else {
fprintf(stderr, "\n");
fprintf(stderr,
Modified: grass/trunk/raster/r.le/r.le.pixel/driver.c
===================================================================
--- grass/trunk/raster/r.le/r.le.pixel/driver.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.le/r.le.pixel/driver.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -1464,35 +1464,35 @@
}
if (i == 0)
- G_strcpy(istr, "1");
+ strcpy(istr, "1");
else if (i == 1)
- G_strcpy(istr, "2");
+ strcpy(istr, "2");
else if (i == 2)
- G_strcpy(istr, "3");
+ strcpy(istr, "3");
else if (i == 3)
- G_strcpy(istr, "4");
+ strcpy(istr, "4");
else if (i == 4)
- G_strcpy(istr, "5");
+ strcpy(istr, "5");
else if (i == 5)
- G_strcpy(istr, "6");
+ strcpy(istr, "6");
else if (i == 6)
- G_strcpy(istr, "7");
+ strcpy(istr, "7");
else if (i == 7)
- G_strcpy(istr, "8");
+ strcpy(istr, "8");
else if (i == 8)
- G_strcpy(istr, "9");
+ strcpy(istr, "9");
else if (i == 9)
- G_strcpy(istr, "10");
+ strcpy(istr, "10");
else if (i == 10)
- G_strcpy(istr, "11");
+ strcpy(istr, "11");
else if (i == 11)
- G_strcpy(istr, "12");
+ strcpy(istr, "12");
else if (i == 12)
- G_strcpy(istr, "13");
+ strcpy(istr, "13");
else if (i == 13)
- G_strcpy(istr, "14");
+ strcpy(istr, "14");
else if (i == 14)
- G_strcpy(istr, "15");
+ strcpy(istr, "15");
else if (i > 14) {
fprintf(stdout, "\n");
fprintf(stdout,
@@ -1522,8 +1522,8 @@
was requested */
if (choice->units) {
- G_strcpy(unitname, "units_");
- G_strcat(unitname, istr);
+ strcpy(unitname, "units_");
+ strcat(unitname, istr);
fd = G_open_raster_new(unitname, CELL_TYPE);
unit_buf = G_allocate_raster_buf(CELL_TYPE);
for (k = 1; k < wind.rows + 1; k++) {
Modified: grass/trunk/raster/r.le/r.le.pixel/input.c
===================================================================
--- grass/trunk/raster/r.le/r.le.pixel/input.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.le/r.le.pixel/input.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -151,7 +151,7 @@
/* record the user inputs for map,
sam, run, and out parameters */
- G_strcpy(choice->fn, name->answer);
+ strcpy(choice->fn, name->answer);
choice->wrum = sampling_method->answer[0];
@@ -217,7 +217,7 @@
if (!strcmp(sampling_method->answer, "r")) {
if (region->answer)
- G_strcpy(choice->reg, region->answer);
+ strcpy(choice->reg, region->answer);
else {
fprintf(stdout, "\n");
fprintf(stdout,
Modified: grass/trunk/raster/r.le/r.le.trace/user_input.c
===================================================================
--- grass/trunk/raster/r.le/r.le.trace/user_input.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.le/r.le.trace/user_input.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -54,12 +54,12 @@
exit(EXIT_FAILURE);
- G_strcpy(choice->fn, name->answer);
+ strcpy(choice->fn, name->answer);
if (out->answer)
- G_strcpy(choice->out, out->answer);
+ strcpy(choice->out, out->answer);
else
- G_strcpy(choice->out, "");
+ strcpy(choice->out, "");
/* if the 4 neighbor tracing flag -t
is specified, then set the
Modified: grass/trunk/raster/r.out.bin/main.c
===================================================================
--- grass/trunk/raster/r.out.bin/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.out.bin/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -112,9 +112,9 @@
name = parm.input->answer;
if (parm.output->answer)
- G_strncpy(outfile, parm.output->answer, sizeof(outfile) - 1);
+ strncpy(outfile, parm.output->answer, sizeof(outfile) - 1);
else {
- G_strncpy(outfile, name, sizeof(outfile) - 1 - 4);
+ strncpy(outfile, name, sizeof(outfile) - 1 - 4);
strcat(outfile, ".bin");
}
Modified: grass/trunk/raster/r.surf.fractal/write_rast.c
===================================================================
--- grass/trunk/raster/r.surf.fractal/write_rast.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.surf.fractal/write_rast.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -52,7 +52,7 @@
if (Steps != step)
sprintf(file_name, "%s.%d", rast_out_name, step);
else
- G_strcpy(file_name, rast_out_name);
+ strcpy(file_name, rast_out_name);
if ((fd_out = G_open_raster_new(file_name, DCELL_TYPE)) < 0) {
G_fatal_error(_("ERROR: Problem opening output file."));
Modified: grass/trunk/raster/r.watershed/shed/com_line.c
===================================================================
--- grass/trunk/raster/r.watershed/shed/com_line.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/raster/r.watershed/shed/com_line.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -417,14 +417,14 @@
int com_line_add(char **com_line, char *prompt, char *map_layer, char *mapset)
{
- G_strcat(*com_line, prompt);
- G_strcat(*com_line, "\"");
- G_strcat(*com_line, map_layer);
+ strcat(*com_line, prompt);
+ strcat(*com_line, "\"");
+ strcat(*com_line, map_layer);
if (mapset) {
- G_strcat(*com_line, "@");
- G_strcat(*com_line, mapset);
+ strcat(*com_line, "@");
+ strcat(*com_line, mapset);
}
- G_strcat(*com_line, "\"");
+ strcat(*com_line, "\"");
return 0;
}
@@ -439,7 +439,7 @@
if (i < 1)
i = 1;
sprintf(buf, " t=%d", i);
- G_strcat(*com_line, buf);
+ strcat(*com_line, buf);
return 0;
}
@@ -448,9 +448,9 @@
{
char buf[20];
- G_strcat(*com_line, prompt);
+ strcat(*com_line, prompt);
sprintf(buf, "%d", ril_value);
- G_strcat(*com_line, buf);
+ strcat(*com_line, buf);
return 0;
}
Property changes on: grass/trunk/sites/s.in.ascii
___________________________________________________________________
Name: svn:ignore
+ *.tmp.html
*OBJ*
Modified: grass/trunk/sites/s.in.ascii/get_site.c
===================================================================
--- grass/trunk/sites/s.in.ascii/get_site.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/sites/s.in.ascii/get_site.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -124,13 +124,13 @@
case '#': /* category field */
if (n == 0) {
sscanf(buf, "#%s ", ebuf);
- if (G_strstr(ebuf, ".") == NULL &&
+ if (strstr(ebuf, ".") == NULL &&
sscanf(ebuf, "%d", &itmp) == 1) {
site->cattype = CELL_TYPE;
site->ccat = itmp;
n++;
}
- else if (G_strstr(ebuf, ".") != NULL &&
+ else if (strstr(ebuf, ".") != NULL &&
sscanf(ebuf, "%f", &ftmp) == 1) {
site->cattype = FCELL_TYPE;
site->fcat = ftmp;
@@ -180,7 +180,7 @@
}
if ((err = cleanse_string(buf)) > 0) {
- G_strncpy(site->str_att[c++], buf, err);
+ strncpy(site->str_att[c++], buf, err);
buf += err;
}
else
@@ -209,7 +209,7 @@
}
if ((err = cleanse_string (buf)) > 0) {
- G_strncpy (site->str_att[c++], buf, err);
+ strncpy (site->str_att[c++], buf, err);
buf += err;
}
else *buf = '\0';
@@ -258,7 +258,7 @@
}
if ((err = cleanse_string(buf)) > 0) {
- G_strncpy(site->str_att[c++], buf, err);
+ strncpy(site->str_att[c++], buf, err);
buf += err;
}
else
Modified: grass/trunk/sites/s.in.ascii/main.c
===================================================================
--- grass/trunk/sites/s.in.ascii/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/sites/s.in.ascii/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -183,22 +183,22 @@
for (i = 0; i < s->dim_alloc; ++i) {
format_double(s->dim[i], nbuf);
sprintf(xbuf, "%s|", nbuf);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
}
if (has_cat) {
switch (s->cattype) {
case CELL_TYPE:
sprintf(xbuf, "#%d ", s->ccat);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
break;
case FCELL_TYPE:
sprintf(xbuf, "#%g ", s->fcat);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
break;
case DCELL_TYPE:
sprintf(xbuf, "#%g ", s->dcat);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
break;
}
}
@@ -207,14 +207,14 @@
/* we create a #cat entry in site_list from the current site number 11/99 */
sprintf(xbuf, "#%d ", loop);
loop++;
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
}
/* now import attributes */
for (i = 0; i < s->dbl_alloc; ++i) {
format_double(s->dbl_att[i], nbuf);
sprintf(xbuf, "%%%s ", nbuf);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
}
for (i = 0; i < s->str_alloc; ++i) {
@@ -238,16 +238,16 @@
xbuf[k] = (char)NULL;
}
else
- G_strcpy(xbuf, s->str_att[i]);
+ strcpy(xbuf, s->str_att[i]);
- G_strcpy(s->str_att[i], xbuf);
+ strcpy(s->str_att[i], xbuf);
if (G_index(s->str_att[i], SPACE) != (char *)NULL)
sprintf(xbuf, "@\"%s\" ", s->str_att[i]);
else
sprintf(xbuf, "@%s ", s->str_att[i]);
- G_strcat(buf, xbuf);
+ strcat(buf, xbuf);
}
}
fprintf(fptr, "%s\n", buf);
Property changes on: grass/trunk/sites/s.out.ascii
___________________________________________________________________
Name: svn:ignore
+ *.tmp.html
*OBJ*
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/vector/v.in.ogr/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -650,7 +650,7 @@
}
else {
/* Change column names to [A-Za-z][A-Za-z0-9_]* */
- Ogr_fieldname = G_strdup(OGR_Fld_GetNameRef(Ogr_field));
+ Ogr_fieldname = G_store(OGR_Fld_GetNameRef(Ogr_field));
G_debug(3, "Ogr_fieldname: '%s'", Ogr_fieldname);
G_str_to_sql(Ogr_fieldname);
Modified: grass/trunk/vector/v.label.sa/labels.c
===================================================================
--- grass/trunk/vector/v.label.sa/labels.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/vector/v.label.sa/labels.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -188,7 +188,7 @@
if (strlen(db_get_string(&value)) == 0)
continue;
- labels[i].text = G_strdup(db_get_string(&value));
+ labels[i].text = G_store(db_get_string(&value));
labels[i].cat = cat;
labels[i].type = type;
labels[i].shape = Points;
Modified: grass/trunk/vector/v.out.svg/main.c
===================================================================
--- grass/trunk/vector/v.out.svg/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/vector/v.out.svg/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -378,7 +378,7 @@
Column = db_get_table_column(Table, attr_cols[i]);
Value = db_get_column_value(Column);
db_convert_column_value_to_string(Column, &dbstring);
- G_strcpy(buf, db_get_column_name(Column));
+ strcpy(buf, db_get_column_name(Column));
fprintf(fpsvg, "gg:%s=\"", G_tolcase(buf));
print_escaped_for_xml(db_get_string(&dbstring));
fprintf(fpsvg, "\" ");
Modified: grass/trunk/vector/v.transform/main.c
===================================================================
--- grass/trunk/vector/v.transform/main.c 2008-08-08 04:35:12 UTC (rev 32633)
+++ grass/trunk/vector/v.transform/main.c 2008-08-08 05:31:22 UTC (rev 32634)
@@ -191,8 +191,8 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- G_strcpy(Current.name, vold->answer);
- G_strcpy(Trans.name, vnew->answer);
+ strcpy(Current.name, vold->answer);
+ strcpy(Trans.name, vnew->answer);
Vect_check_input_output_name(vold->answer, vnew->answer, GV_FATAL_EXIT);
@@ -219,7 +219,7 @@
}
if (pointsfile->answer != NULL && !shift_flag->answer) {
- G_strcpy(Coord.name, pointsfile->answer);
+ strcpy(Coord.name, pointsfile->answer);
}
else {
Coord.name[0] = '\0';
More information about the grass-commit
mailing list