GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tools.c
Go to the documentation of this file.
1 
2 /***************************************************************************
3  * tools.c
4  *
5  * Mon Apr 18 15:00:13 2005
6  * Copyright 2005 Benjamin Ducke
7  ****************************************************************************/
8 
9 /*
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 #include "globals.h"
26 
27 
28 /* the following are for cross-platform compatibility. They may already exist
29  on a Linux or BSD system, but maybe absent e.g. in Win32, so we will define
30  them here. */
31 
32 
33 char *basename(char *path)
34 {
35  char *copy;
36  char *element;
37  char *backup;
38 
39  copy = strdup(path);
40 
41  backup = NULL;
42  element = strtok(copy, "/");
43  if (element == NULL) {
44  if (copy != NULL) {
45  free(copy);
46  }
47  return (NULL);
48  }
49 
50  backup = strdup(element);
51  while (element != NULL) {
52  element = strtok(NULL, "/");
53  if ((backup != NULL) && (element != NULL)) {
54  free(backup);
55  }
56  if ((element != NULL) && (*element != '\0')) {
57  backup = strdup(element);
58  }
59  }
60 
61  if (copy != NULL) {
62  free(copy);
63  }
64 
65  return (backup);
66 }
67 
68 
69 /* A shell version of mkdir ()
70  needed because the MINGW one does no accept unix style MOD specifications.
71  THIS DOES NOT CHECK FOR ERRORS !
72  */
73 void mkdir_s(char *pathname, char *mode)
74 {
75  char tmp[5000];
76 
77  sprintf(tmp, "mkdir %s --mode=%s -p", pathname, mode);
78  system(tmp);
79 
80 }
81 
82 /*
83  Removes all dangling white-spaces and EOL chars from the end of a string.
84  Returns total number of chopped-off characters.
85  */
86 int chop(char *string)
87 {
88  int i;
89  int chopped;
90  int stop = 0;
91 
92  chopped = 0;
93  i = strlen(string) - 1;
94  while (i >= 0) {
95  stop = 1;
96  if ((string[i] == '\n') || (string[i] == '\t') ||
97  (string[i] == ' ') || (string[i] == '\f') ||
98  (string[i] == '\r')) {
99  chopped++;
100  stop = 0;
101  }
102  if (stop == 1) {
103  /* got a non white-space char: stop chopping! */
104  break;
105  }
106  i--;
107  }
108 
109  /* chop string */
110  string[strlen(string) - chopped] = '\0';
111 
112  return (chopped);
113 }
114 
115 
116 /*
117  Inserts a string into an array of n strings; positions start at 0
118  The size of the array will be increased by one char*.
119  Returns new size of array.
120  String array must be NULL-terminated.
121  There must be at least one slots left after the NULL-terminator to
122  hold the new string! This function will not resize the string
123  array to accomodate the new string!
124  */
125 int insert_str(char *str, int pos, char **strarr)
126 {
127  char save[MAXSTR];
128  char insert[MAXSTR];
129  char last[MAXSTR];
130  int n, j;
131  int len;
132 
133  /* check for valid pos */
134  n = 0;
135  while (strarr[n] != NULL) {
136  n++;
137  }
138 
139  if ((pos < 0) || (pos > (n))) {
141  "insert: invalid line number %i.\n", pos);
142  }
143 
144  /* if a new string is to be added to the end of the array: */
145  if (pos == n) {
146  len = (1 + strlen(str)) * sizeof(char);
147  strarr[n] = malloc(len);
148  strcpy(strarr[n], str);
149  n = n + 2;
150  strarr[n - 1] = NULL;
151  return (n);
152  }
153 
154  strcpy(last, strarr[n - 1]);
155  strcpy(insert, strarr[pos]);
156  free(strarr[pos]);
157  strarr[pos] = malloc((1 + strlen(str)) * sizeof(char));
158  strcpy(strarr[pos], str);
159  /* now move all strings > pos up one */
160  for (j = pos; j < n - 1; j++) {
161  strcpy(save, strarr[j + 1]); /* save string to be overwritten */
162  free(strarr[j + 1]); /* overwrite string */
163  len = (1 + strlen(insert)) * sizeof(char); /* make room for string to be inserted */
164  strarr[j + 1] = malloc(len);
165  strcpy(strarr[j + 1], insert); /* insert string */
166 
167  strcpy(insert, save); /* set saved string to next to be inserted */
168 
169  }
170 
171  /* overwrite NULL terminator with last item */
172  strarr[n] = malloc((1 + strlen(last)) * sizeof(char));
173  strcpy(strarr[n], last);
174 
175  /* increase size of array by one */
176  n = n + 2;
177  strarr[n - 1] = NULL; /* set last element of array to NULL */
178 
179  return (n);
180 }
181 
182 
183 /*
184  Delete a string at position pos (o to n) from an array of n strings;
185  positions start at 0
186  The size of the array will be decreased by one char*.
187  Returns new size of array.
188  String array must be NULL-terminated.
189  */
190 int delete_str(int pos, char **strarr)
191 {
192  int i;
193 
194  /* check for valid pos */
195  i = 0;
196  while (strarr[i] != NULL) {
197  i++;
198  }
199 
200  if ((pos < 0) || (pos > (i))) {
202  "delete: invalid line number %i.\n", pos);
203  }
204 
205  /* now move all strings > pos down one */
206  i = pos;
207  while (strarr[i] != NULL) {
208  free(strarr[i]);
209  if (strarr[i + 1] != NULL) {
210  strarr[i] = malloc((1 + (strlen(strarr[i + 1]))) * sizeof(char));
211  strcpy(strarr[i], strarr[i + 1]);
212  }
213  i++;
214  }
215 
216  /* decrease size of array by one */
217  i = i - 1;
218  strarr[i] = NULL; /* set last element of array to NULL */
219 
220  return (i);
221 }
222 
223 
224  /*
225  Returns the first line number in which *str is found.
226  Search starts after line number 'start'.
227  Returns -1 if string not found.
228  String array must be NULL-terminated.
229  */
230 int find_pos(char *str, char **strarr, int start)
231 {
232  int i, j;
233 
234  /* check for valid pos */
235  i = 0;
236  while (strarr[i] != NULL) {
237  i++;
238  }
239 
240  if ((start < 0) || (start > (i))) {
242  }
243 
244  for (j = start; j < (i); j++) {
245  if (strstr(strarr[j], str) != NULL) {
246  return (j);
247  }
248  }
249 
250  return (-1);
251 }
252 
253 
254  /*
255  Dumps an array of strings to a file.
256  String array must be NULL-terminated.
257  */
258 void dump_str(FILE * f, char **strarr)
259 {
260  int i;
261 
262  i = 0;
263  while (strarr[i] != NULL) {
264  fprintf(f, "%i: %s", i, strarr[i]);
265  i++;
266  }
267 }
268 
269 /*
270  Get package name. Copies the package name as found in
271  the 'name' info file into the char array *name.
272  */
273 void get_package_name(char *path, char *name)
274 {
275  FILE *f;
276  char file[MAXSTR];
277  char tmp[MAXSTR];
278 
279  sprintf(file, "%s/%s", path, "name");
280 
281  /* get extension name */
282  f = fopen(file, "r");
283  if (f == NULL) {
284  print_error(ERR_INVALID_EXT, "'name' file not readable.\n");
285  }
286  else {
287  if (nc_fgets_nb(tmp, MAXSTR, f) == NULL) {
288  fclose(f);
290  "invalid or missing extension name.\n");
291  }
292  else {
293  chop(tmp);
294  strcpy(name, tmp);
295  }
296  }
297  fclose(f);
298 }
299 
300 /*
301  A replacement function for fgets to filter out comments and blank lines.
302  Useful for parsing settings files.
303  Returns a line from a file only if it does not start with '#'.
304  Returns only the part of the line left of '#'.
305  Otherwise, tries to read the next line from the file or returns NULL on EOF.
306  */
307 char *nc_fgets(char *s, int size, FILE * stream)
308 {
309  char *hashmark;
310  char *tmp;
311 
312  if (fgets(s, size, stream) == NULL) {
313  return (NULL);
314  }
315 
316  hashmark = strchr(s, '#');
317 
318  if (hashmark != NULL) {
319  if (s - hashmark == 0) {
320  /* line starts with a hashmark: recursively call nc_fgets() */
321  return (nc_fgets(s, size, stream));
322  }
323  else {
324  /* return only the part before '#' */
325  tmp = malloc(sizeof(char) * MAXSTR);
326  strcpy(tmp, s);
327  tmp = strtok(tmp, "#");
328  sprintf(s, "%s\n", tmp);
329  free(tmp);
330  }
331  }
332  return (s);
333 }
334 
335 
336 /*
337  Same as nc_fgets (). Additionally, this filters for HTML tags.
338  */
339 char *nc_fgets_html(char *s, int size, FILE * stream)
340 {
341  char *hashmark;
342  char *tmp;
343  char *tag;
344  char *tag_2;
345  char *tag_insert;
346  char *tag_content;
347  char *pos;
348  char *insert;
349  int space;
350 
351  if (fgets(s, size, stream) == NULL) {
352  return (NULL);
353  }
354 
355  /* look for HTML tags: this discards all text inside the tags except for:
356  <br> becomes \n
357  <p> becomes \n\n
358  */
359  tmp = malloc(sizeof(char) * (strlen(s) + 1));
360  tag_content = malloc(sizeof(char) * (strlen(s) + 1));
361 
362  insert = tmp;
363  pos = s;
364 
365  while (*pos != '\0') {
366  if (*pos == '<') { /* possibly an html open tag */
367  tag = pos;
368  tag_insert = tag_content;
369  pos--;
370  if (pos >= s) {
371  if (*pos == 32) {
372  space = 1;
373  }
374  else {
375  space = 0;
376  }
377  }
378  while (*tag != '\0') {
379  *tag_insert = *tag;
380  (*tag_insert)++;
381  if (*tag == '>') { /* OK, we got a tag */
382  *tag_insert = '\0';
383 
384  /* only add additional newlines, if this is not the end of the line already! */
385  tag_2 = tag;
386  tag_2++;
387  if (*tag_2 != '\n') {
388  if (strstr(tag_content, "<br>") != NULL) {
389  /* a <br> at the start of a line produce no additional linefeed! */
390  if (insert > tmp) {
391  *insert = '\n';
392  (*insert)++;
393  }
394  }
395  if (strstr(tag_content, "<BR>") != NULL) {
396  if (insert > tmp) {
397  *insert = '\n';
398  (*insert)++;
399  }
400  }
401  if (strstr(tag_content, "<p>") != NULL) {
402  if (insert > tmp) {
403  *insert = '\n';
404  (*insert)++;
405  }
406  *insert = '\n';
407  (*insert)++;
408  }
409  if (strstr(tag_content, "<P>") != NULL) {
410  if (insert > tmp) {
411  *insert = '\n';
412  (*insert)++;
413  }
414  *insert = '\n';
415  (*insert)++;
416  }
417  }
418 
419  pos = tag; /* skip this */
420 
421  /* if the next character is a space and there was none
422  before the tag: skip that, too
423  */
424  if (*pos == 32) {
425  if (space == 1) {
426  pos++;
427  space = 0;
428  }
429  }
430  break;
431  }
432  tag++;
433  }
434  }
435  if (*pos != '>') {
436  *insert = *pos;
437  insert++;
438  }
439  pos++;
440  }
441 
442  *insert = '\0';
443 
444  strcpy(s, tmp);
445 
446  free(tmp);
447  free(tag_content);
448 
449  hashmark = strchr(s, '#');
450 
451  if (hashmark != NULL) {
452  if (s - hashmark == 0) {
453  /* line starts with a hashmark: recursively call nc_fgets_html() */
454  return (nc_fgets_html(s, size, stream));
455  }
456  else {
457  /* return only the part before '#' */
458  tmp = malloc(sizeof(char) * MAXSTR);
459  strcpy(tmp, s);
460  tmp = strtok(tmp, "#");
461  sprintf(s, "%s\n", tmp);
462  free(tmp);
463  }
464  }
465 
466  return (s);
467 }
468 
469 
470 /*
471  Checks whether a string actually contains text or is a blank line/whitespace only.
472  Returns 1 if text , 0 if only blank/whitespace.
473  */
474 int is_text(char *s)
475 {
476  int i;
477  int nonws;
478 
479  /* check for a blank or white-space only line */
480  nonws = 0;
481  for (i = strlen(s) - 1; i >= 0; i--) {
482  if ((s[i] == ' ') || (s[i] == '\t') || (s[i] == '\n') ||
483  (s[i] == '\f') || (s[i] == '\r')) {
484  nonws = 0;
485  }
486  else {
487  nonws = 1;
488  break; /* break at first non-ws char! */
489  }
490  }
491 
492  return (nonws);
493 }
494 
495 
496 /*
497  Same as nc_fgets() but also skips over blank lines and those that contain only
498  whitespace chars.
499  */
500 char *nc_fgets_nb(char *s, int size, FILE * stream)
501 {
502  char *hashmark;
503  char *tmp;
504 
505  if (fgets(s, size, stream) == NULL) {
506  return (NULL);
507  }
508 
509 
510  if (is_text(s) == 0) {
511  /* line is ws only: recursively call nc_fgets() to get next line */
512  return (nc_fgets_nb(s, size, stream));
513  }
514 
515  hashmark = strchr(s, '#');
516 
517  if (hashmark != NULL) {
518  if (s - hashmark == 0) {
519  /* line starts with a hashmark: recursively call nc_fgets() */
520  return (nc_fgets_nb(s, size, stream));
521  }
522  else {
523  /* return only the part before '#' */
524  tmp = malloc(sizeof(char) * MAXSTR);
525  strcpy(tmp, s);
526  tmp = strtok(tmp, "#");
527  sprintf(s, "%s\n", tmp);
528  free(tmp);
529  }
530  }
531  return (s);
532 }
533 
534 
535 /*
536  This just dumps an ASCII file to stdout, line by line, but
537  skips over comments.
538  */
539 void dump_ascii(char *file, char *heading)
540 {
541  char tmp[MAXSTR];
542  FILE *f;
543 
544  fprintf(stdout, "%s\n", heading);
545  f = fopen(file, "r");
546  if (f == NULL) {
547  fprintf(stdout, " No information available.\n");
548  }
549  else {
550  while (nc_fgets_html(tmp, MAXSTR, f) != NULL) {
551  fprintf(stdout, " %s", tmp);
552  }
553  fprintf(stdout, "\n");
554  fclose(f);
555  }
556 }
557 
558 
559 /*
560  Dumps the contents of an ASCII file without comment lines but with blank lines
561  to a temporary file.
562  */
563 void dump_plain(char *file, char *tmpfile)
564 {
565  char tmp[MAXSTR];
566  FILE *f_in;
567  FILE *f_out;
568 
569  /* create a temporary menu.tcl file for write access */
570  /* TODO: Do not hardcode temp path */
571  strcpy(tmpfile, "/tmp/grass.extensions.db.XXXXXX"); /* TMP_GISMAN is a global variable */
572  mkstemp(tmpfile);
573 
574  f_out = fopen(tmpfile, "w+");
575  if (f_out == NULL) {
577  "could not create temp file '%s': %s\n \
578  Make sure that directory /tmp exists on your system and you have write permission.\n", tmpfile, strerror(errno));
579  }
580 
581  atexit(&exit_db); /* now need to register an at exit func to remove tmpfile automatically! */
582 
583  f_in = fopen(file, "r");
584  while (nc_fgets(tmp, MAXSTR, f_in) != NULL) {
585  fprintf(f_out, tmp);
586  }
587 
588  fclose(f_in);
589  fclose(f_out);
590 }
591 
592 
593 /*
594  Same as dump_plain() but adds a <br> after each newline in the stream.
595  Also replaces blank lines with a <p>.
596  */
597 void dump_html(char *file, char *tmpfile)
598 {
599  char tmp[MAXSTR];
600  char line[MAXSTR];
601  FILE *f_in;
602  FILE *f_out;
603  int fd;
604 
605  /* create a temporary menu.tcl file for write access */
606  /* TODO: Do not hardcode temp path */
607  strcpy(tmpfile, "/tmp/grass.extensions.db.XXXXXX"); /* TMP_GISMAN is a global variable */
608  mkstemp(tmpfile);
609 
610  f_out = fopen(tmpfile, "w+");
611  if (f_out == NULL) {
613  "could not create temp file '%s': %s\n \
614  Make sure that directory /tmp exists on your system and you have write permission.\n", tmpfile, strerror(errno));
615  }
616 
617  atexit(&exit_db); /* now need to register an at exit func to remove tmpfile automatically! */
618 
619  f_in = fopen(file, "r");
620  while (nc_fgets(line, MAXSTR, f_in) != NULL) {
621  chop(line);
622  if (!is_text(line)) { /* replace blank lines with a <p> */
623  fprintf(f_out, "<p>\n");
624  }
625  else {
626  sprintf(tmp, "%s <br>\n", line);
627  fprintf(f_out, tmp);
628  }
629  }
630 
631  fclose(f_in);
632  fclose(f_out);
633  close(fd);
634 }
635 
636 
637 /*
638  A pretty dumb function: this just lists all directories which are directly below
639  top level and not called "src". It is assumed that these contain binary distributions
640  which can be installed by just doing a "make install" in the respective directory.
641  */
642 void list_binaries(char *package)
643 {
644  char tmp[MAXSTR];
645  struct stat buf;
646  DIR *dir;
647  struct dirent *dir_entry;
648  int n_dirs = 0;
649 
650  fprintf(stdout, "Binary installation files\n");
651 
652  dir = opendir(package);
653  if (dir == NULL) {
654  fprintf(stdout, " None.\n\n");
655  return;
656  }
657 
658  dir_entry = readdir(dir);
659  while (dir_entry != NULL) {
660  if ((strcmp(dir_entry->d_name, ".")) &&
661  (strcmp(dir_entry->d_name, "..")) &&
662  (strcmp(dir_entry->d_name, "src"))
663  ) {
664  /* check if it is a directory */
665  sprintf(tmp, "%s/%s", package, dir_entry->d_name);
666  stat(tmp, &buf);
667  if (S_ISDIR(buf.st_mode)) {
668  if (n_dirs == 0) {
669  fprintf(stdout, " %s", dir_entry->d_name);
670  }
671  else {
672  fprintf(stdout, ", %s", dir_entry->d_name);
673  }
674  n_dirs++;
675  }
676  }
677  dir_entry = readdir(dir);
678  }
679  if (n_dirs == 0) {
680  fprintf(stdout, " None.");
681  }
682  fprintf(stdout, "\n\n");
683 }
684 
685 
686 /*
687  Just as dumb: checks, if a specified directory 'binaries' exists in addition to 'src'
688  Returns 1 if so, 0 otherwise
689  */
690 int binaries_exist(char *package, char *binaries)
691 {
692  char tmp[MAXSTR];
693  struct stat buf;
694  DIR *dir;
695  struct dirent *dir_entry;
696 
697  dir = opendir(package);
698  if (dir == NULL) {
699  return (0);
700  }
701 
702  dir_entry = readdir(dir);
703  while (dir_entry != NULL) {
704  if ((strcmp(dir_entry->d_name, ".")) &&
705  (strcmp(dir_entry->d_name, "..")) &&
706  (strcmp(dir_entry->d_name, "src"))
707  ) {
708  /* check if it is a directory */
709  sprintf(tmp, "%s/%s", package, dir_entry->d_name);
710  stat(tmp, &buf);
711  if (S_ISDIR(buf.st_mode)) {
712  if (!strcmp(dir_entry->d_name, binaries)) {
713  return (1); /* found it */
714  }
715  }
716  }
717  dir_entry = readdir(dir);
718  }
719  return (0);
720 }
721 
722 
723 /*
724  Tests for a known file-extension:
725  .tar.gz, .tgz
726  .tar.bz2, .tbz
727  .zip
728  Returns:
729  0 = unknown (TYPE_UNKNOWN)
730  1 = tar file with gzip compression (TAR_GZIP)
731  2 = tar file with bzip2 compression (TAR_BZIP2)
732  3 = zip archive (ZIP)
733  4 = plain tar archive, uncompressed (TAR)
734 
735  VERY primitive!
736  */
737 int check_filetype(char *myfile)
738 {
739 
740  if (strstr(myfile, ".tar.gz") != NULL) {
741  return (1);
742  }
743  if (strstr(myfile, ".tgz") != NULL) {
744  return (1);
745  }
746  if (strstr(myfile, ".tar.bz2") != NULL) {
747  return (2);
748  }
749  if (strstr(myfile, ".tbz") != NULL) {
750  return (2);
751  }
752  if (strstr(myfile, ".zip") != NULL) {
753  return (3);
754  }
755  if (strstr(myfile, ".tar") != NULL) {
756  return (4);
757  }
758 
759  return (0);
760 }
761 
762 /*
763  Retrieves an extension from the WWW using wget and
764  stores the file in the current directory.
765  */
766 void wget_extension(char *url)
767 {
768  char str[MAXSTR];
769  int error;
770 
771  fprintf(stdout, "Downloading...");
772 
773  if (VERBOSE) {
774  sprintf(str, "wget -N %s", url);
775  }
776  else {
777  sprintf(str, "wget -N -q %s", url);
778  }
779  error = system(str);
780  if (error == -1) {
782  "could not run 'wget' to download extension. Is it installed?\n");
783  }
784  if (error > 0) {
785  print_error(ERR_DOWNLOAD, "running command '%s'.\n", str);
786  }
787 
788  print_done();
789 }
790 
791 /*
792  This function checks if there is write access to the GRASS directory.
793  If not, it aborts with an error message.
794  Otherwise, 'cmd' is simply executed as currently running user.
795  */
796 void su(char *gisbase, char *cmd)
797 {
798  char tmpfile[MAXSTR];
799  int error;
800  static unsigned long next;
801  FILE *f;
802 
803  /* check for permission */
804  next = next * 1103515245 + 54321; /* generate a random file name */
805  next = (next / 65536) % 32768;
806  srand(next);
807  sprintf(tmpfile, "%s/gem.test.%i", gisbase, rand());
808 
809  f = fopen(tmpfile, "w+");
810 
811  if (errno == EACCES) { /* permission denied */
813  "You don't have write access to your local GRASS installation.\nPlease consult your system administrator.\n");
814  }
815  else {
816  remove(tmpfile);
817  fclose(f);
818  error = system(cmd);
819  if (error != 0) {
820  print_error(ERR_MISSING_CMD, "could not run '%s'.\n", cmd);
821  }
822  }
823 }
824 
825 
826 /*
827  Compares two version descriptions consisting of three ints each
828  returns: -1, if major.minor.revision < major2.minor2.revision2,
829  0, if equal
830  1, if major.minor.revision > major2.minor2.revision2,
831  */
832 int vercmp(int major, int minor, int revision, int major2, int minor2,
833  int revision2)
834 {
835  if ((major == major2) && (minor == minor2) && (revision == revision2)) {
836  return (0);
837  }
838  if (major2 > major) {
839  return (-1);
840  }
841  if (major2 < major) {
842  return (1);
843  }
844  if (minor2 > minor) {
845  return (-1);
846  }
847  if (minor2 < minor) {
848  return (1);
849  }
850  if (revision2 > revision) {
851  return (-1);
852  }
853  if (revision2 < revision) {
854  return (1);
855  }
856 
857  return (0);
858 }
EXTERN int VERBOSE
Definition: globals.h:147
void exit_db(void)
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
char * basename(char *path)
Definition: tools.c:33
DIR * opendir()
void print_done(void)
Definition: gem/error.c:70
#define MAXSTR
Definition: globals.h:59
#define ERR_MISSING_CMD
Definition: globals.h:85
tuple cmd
Definition: forms.py:2020
FILE * fd
Definition: g3dcolor.c:368
void get_package_name(char *path, char *name)
Definition: tools.c:273
string name
Definition: render.py:1314
void print_error(int err_code, char *msg,...)
Definition: gem/error.c:32
#define ERR_DUMP_PLAIN_TXT
Definition: globals.h:99
void dump_str(FILE *f, char **strarr)
Definition: tools.c:258
tuple pos
Definition: tools.py:1367
void dump_html(char *file, char *tmpfile)
Definition: tools.c:597
int delete_str(int pos, char **strarr)
Definition: tools.c:190
#define ERR_DOWNLOAD
Definition: globals.h:96
void mkdir_s(char *pathname, char *mode)
Definition: tools.c:73
tuple gisbase
Definition: forms.py:59
void wget_extension(char *url)
Definition: tools.c:766
int check_filetype(char *myfile)
Definition: tools.c:737
tuple size
value.Bind(wx.EVT_TEXT, self.OnVolumeIsosurfMap)
Definition: tools.py:2334
dir_entry * readdir()
#define ERR_INSTALL_EXT
Definition: globals.h:81
int stat
Definition: g3dcolor.c:369
void * malloc(YYSIZE_T)
void list_binaries(char *package)
Definition: tools.c:642
int vercmp(int major, int minor, int revision, int major2, int minor2, int revision2)
Definition: tools.c:832
char * nc_fgets(char *s, int size, FILE *stream)
Definition: tools.c:307
#define ERR_INVALID_EXT
Definition: globals.h:82
#define ERR_REGISTER_ENTRIES_GISMAN
Definition: globals.h:97
char * nc_fgets_html(char *s, int size, FILE *stream)
Definition: tools.c:339
int binaries_exist(char *package, char *binaries)
Definition: tools.c:690
int find_pos(char *str, char **strarr, int start)
Definition: tools.c:230
return NULL
Definition: dbfopen.c:1394
int chop(char *string)
Definition: tools.c:86
int insert_str(char *str, int pos, char **strarr)
Definition: tools.c:125
void dump_ascii(char *file, char *heading)
Definition: tools.c:539
fclose(fd)
int is_text(char *s)
Definition: tools.c:474
void free(void *)
#define file
void su(char *gisbase, char *cmd)
Definition: tools.c:796
int errno
struct dirent dir_entry
Definition: dirent.c:16
char * nc_fgets_nb(char *s, int size, FILE *stream)
Definition: tools.c:500
int n
Definition: dataquad.c:291
void dump_plain(char *file, char *tmpfile)
Definition: tools.c:563
tuple mode
Definition: tools.py:1481