[BACK]Return to help.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot

Diff for /OpenXM_contrib/gnuplot/Attic/help.c between version 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2000/01/22 14:15:58 version 1.1.1.3, 2003/09/15 07:09:25
Line 36  static char *RCSid = "$Id$";
Line 36  static char *RCSid = "$Id$";
   
 #include "plot.h"  #include "plot.h"
   
 #define SAME    0               /* for strcmp() */  
   
 #include "help.h"               /* values passed back */  #include "help.h"               /* values passed back */
   
 void int_error __PROTO((char str[], int t_num));  void int_error __PROTO((char str[], int t_num));
Line 150  static FILE *helpfp = NULL;
Line 148  static FILE *helpfp = NULL;
   
 static int LoadHelp __PROTO((char *path));  static int LoadHelp __PROTO((char *path));
 static void sortkeys __PROTO((void));  static void sortkeys __PROTO((void));
 static int keycomp __PROTO((struct key_s * a, struct key_s * b));  int keycomp __PROTO((SORTFUNC_ARGS a, SORTFUNC_ARGS b));
 static LINEBUF *storeline __PROTO((char *text));  static LINEBUF *storeline __PROTO((char *text));
 static LINKEY *storekey __PROTO((char *key));  static LINKEY *storekey __PROTO((char *key));
 static KEY *FindHelp __PROTO((char *keyword));  static KEY *FindHelp __PROTO((char *keyword));
Line 187  TBOOLEAN *subtopics;  /* (in) - subtopics only? */
Line 185  TBOOLEAN *subtopics;  /* (in) - subtopics only? */
      ** Calling routine may access errno to determine cause of H_ERROR.       ** Calling routine may access errno to determine cause of H_ERROR.
      */       */
     errno = 0;      errno = 0;
     if (strncmp(oldpath, path, PATHSIZE) != SAME)      if (strncmp(oldpath, path, PATHSIZE) != 0)
         FreeHelp();          FreeHelp();
     if (keys == NULL) {      if (keys == NULL) {
         status = LoadHelp(path);          status = LoadHelp(path);
Line 290  char *text;
Line 288  char *text;
 {  {
     LINEBUF *new;      LINEBUF *new;
   
     new = (LINEBUF *) malloc(sizeof(LINEBUF));      new = (LINEBUF *) gp_alloc(sizeof(LINEBUF), "new line buffer");
     if (new == NULL)      if (text)
         int_error("not enough memory to store help file", -1);          new->line = gp_strdup(text);
     if (text != NULL) {      else
         new->line = (char *) malloc((unsigned int) (strlen(text) + 1));  
         if (new->line == NULL)  
             int_error("not enough memory to store help file", -1);  
         (void) strcpy(new->line, text);  
     } else  
         new->line = NULL;          new->line = NULL;
   
     new->next = NULL;      new->next = NULL;
Line 315  char *key;
Line 308  char *key;
   
     key[strlen(key) - 1] = NUL; /* cut off \n  */      key[strlen(key) - 1] = NUL; /* cut off \n  */
   
     new = (LINKEY *) malloc(sizeof(LINKEY));      new = (LINKEY *) gp_alloc(sizeof(LINKEY), "new key list");
     if (new == NULL)      if (key)
         int_error("not enough memory to store help file", -1);          new->key = gp_strdup(key);
     new->key = (char *) malloc((unsigned int) (strlen(key) + 1));  
     if (new->key == NULL)  
         int_error("not enough memory to store help file", -1);  
     (void) strcpy(new->key, key);  
   
     /* add to front of list */      /* add to front of list */
     new->next = keylist;      new->next = keylist;
Line 341  static void sortkeys()
Line 330  static void sortkeys()
     int i;                      /* index into key array */      int i;                      /* index into key array */
   
     /* allocate the array */      /* allocate the array */
     keys = (KEY *) malloc((unsigned int) ((keycount + 1) * sizeof(KEY)));      keys = (KEY *) gp_alloc((keycount + 1) * sizeof(KEY), "key array");
     if (keys == NULL)  
         int_error("not enough memory to store help file", -1);  
   
     /* copy info from list to array, freeing list */      /* copy info from list to array, freeing list */
     for (p = keylist, i = 0; p != NULL; p = n, i++) {      for (p = keylist, i = 0; p != NULL; p = n, i++) {
Line 363  static void sortkeys()
Line 350  static void sortkeys()
     /* sort the array */      /* sort the array */
     /* note that it only moves objects of size (two pointers + long + int) */      /* note that it only moves objects of size (two pointers + long + int) */
     /* it moves no strings */      /* it moves no strings */
     qsort((char *) keys, keycount, sizeof(KEY), (sortfunc) keycomp);      qsort((char *) keys, keycount, sizeof(KEY), keycomp);
 }  }
   
 static int keycomp(a, b)  /* HBB 20010720: changed to make this match the prototype qsort()
 KEY *a, *b;   * really expects. Casting function pointers, as we did before, is
    * illegal! */
   /* HBB 20010720: removed 'static' to avoid HP-sUX gcc bug */
   int
   keycomp(arg1, arg2)
       SORTFUNC_ARGS arg1;
       SORTFUNC_ARGS arg2;
 {  {
       const KEY *a = arg1;
       const KEY *b = arg2;
   
     return (strcmp(a->key, b->key));      return (strcmp(a->key, b->key));
 }  }
   
Line 515  TBOOLEAN *subtopics;  /* (in) - subtopics only? */
Line 511  TBOOLEAN *subtopics;  /* (in) - subtopics only? */
 /* ShowSubtopics:  /* ShowSubtopics:
  *  Print a list of subtopic names   *  Print a list of subtopic names
  */   */
   /* The maximum number of subtopics per line */
 #define PER_LINE 4  #define PER_LINE 4
   
 static void ShowSubtopics(key, subtopics)  static void ShowSubtopics(key, subtopics)

Legend:
Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>