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

Diff for /OpenXM_contrib/gnuplot/Attic/plot.c between version 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2000/01/09 17:00:54 version 1.1.1.3, 2003/09/15 07:09:25
Line 34  static char *RCSid = "$Id$";
Line 34  static char *RCSid = "$Id$";
  * to the extent permitted by applicable law.   * to the extent permitted by applicable law.
 ]*/  ]*/
   
   #ifdef HAVE_CONFIG_H
   # include "config.h"
   #endif
   
 #include <signal.h>  #include <signal.h>
   #include <setjmp.h>
   
 #include "plot.h"  #include "plot.h"
 #include "fit.h"  #include "fit.h"
 #include "setshow.h"  #include "setshow.h"
 #include "fnproto.h"  #include "fnproto.h"
 #include <setjmp.h>  
   
   #ifdef HAVE_SYS_UTSNAME_H
   # include <sys/utsname.h>
   #endif
   
 #if defined(MSDOS) || defined(DOS386) || defined(__EMX__)  #if defined(MSDOS) || defined(DOS386) || defined(__EMX__)
 # include <io.h>  # include <io.h>
 #endif  #endif
Line 84  char *call_args[10] = { NULL, NULL, NULL, NULL, NULL, 
Line 92  char *call_args[10] = { NULL, NULL, NULL, NULL, NULL, 
   
 char *infile_name = NULL;       /* name of command file; NULL if terminal */  char *infile_name = NULL;       /* name of command file; NULL if terminal */
   
 #ifdef GNU_READLINE  #ifdef HAVE_LIBREADLINE
 extern char *rl_readline_name;  extern char *rl_readline_name;
 extern int rl_complete_with_tilde_expansion;  extern int rl_complete_with_tilde_expansion;
   extern char *rl_terminal_name;
 #endif  #endif
   
 #ifdef X11  #ifdef X11
Line 105  char HelpFile[MAXPATH];
Line 114  char HelpFile[MAXPATH];
   
 /* a longjmp buffer to get back to the command line */  /* a longjmp buffer to get back to the command line */
 #ifdef _Windows  #ifdef _Windows
 static jmp_buf far command_line_env;  static JMP_BUF far command_line_env;
 #else  #else
 static jmp_buf command_line_env;  static JMP_BUF command_line_env;
 #endif  #endif
   
 static void load_rcfile __PROTO((void));  static void load_rcfile __PROTO((void));
Line 216  static struct udvt_entry udv_pi = { NULL, "pi", FALSE 
Line 225  static struct udvt_entry udv_pi = { NULL, "pi", FALSE 
 struct udvt_entry *first_udv = &udv_pi;  struct udvt_entry *first_udv = &udv_pi;
 struct udft_entry *first_udf = NULL;  struct udft_entry *first_udf = NULL;
   
   static int exit_status = EXIT_SUCCESS;
   
 #ifdef OS2  #ifdef OS2
 # define INCL_DOS  # define INCL_DOS
 # define INCL_REXXSAA  # define INCL_REXXSAA
Line 252  int anint;
Line 263  int anint;
 #else  #else
     term_reset();      term_reset();
     (void) putc('\n', stderr);      (void) putc('\n', stderr);
     longjmp(command_line_env, TRUE);    /* return to prompt */      LONGJMP(command_line_env, TRUE);    /* return to prompt */
 #endif  #endif
 }  }
   
   #ifdef LINUXVGA
   /* utility functions to ensure that setuid gnuplot
    * assumes root privileges only for those parts
    * of the code which require root rights.
    *
    * By "Dr. Werner Fink" <werner@suse.de>
    */
   static uid_t euid, ruid;
   static gid_t egid, rgid;
   static int asked_privi = 0;
   
   void
   drop_privilege()
   {
       if (!asked_privi) {
           euid = geteuid();
           egid = getegid();
           ruid = getuid();
           rgid = getgid();
           asked_privi = 1;
       }
       if (setegid(rgid) == -1)
           (void) fprintf(stderr, "setegid(%d): %s\n",
                          (int) rgid, strerror(errno));
       if (seteuid(ruid) == -1)
           (void) fprintf(stderr, "seteuid(%d): %s\n",
                          (int) ruid, strerror(errno));
   }
   
   void
   take_privilege()
   {
       if (!asked_privi) {
           euid = geteuid();
           egid = getegid();
           ruid = getuid();
           rgid = getgid();
           asked_privi = 1;
       }
       if (setegid(egid) == -1)
           (void) fprintf(stderr, "setegid(%d): %s\n",
                          (int) egid, strerror(errno));
       if (seteuid(euid) == -1)
           (void) fprintf(stderr, "seteuid(%d): %s\n",
                          (int) euid, strerror(errno));
   }
   #endif /* LINUXVGA */
   
   
 /* a wrapper for longjmp so we can keep everything local */  /* a wrapper for longjmp so we can keep everything local */
 void bail_to_command_line()  void bail_to_command_line()
 {  {
     longjmp(command_line_env, TRUE);      LONGJMP(command_line_env, TRUE);
 }  }
   
 #if defined(_Windows) || defined(_Macintosh)  #if defined(_Windows) || defined(_Macintosh)
Line 329  char **argv;
Line 388  char **argv;
     unsigned int status[2] = { 1, 0 };      unsigned int status[2] = { 1, 0 };
 #endif  #endif
   
 #ifdef GNU_READLINE  #ifdef HAVE_LIBREADLINE
     rl_readline_name = argv[0];      rl_readline_name = argv[0];
     rl_complete_with_tilde_expansion = 1;      rl_complete_with_tilde_expansion = 1;
       rl_terminal_name = getenv("TERM");
 #endif  #endif
   
 #ifdef X11  #ifdef X11
Line 371  char **argv;
Line 431  char **argv;
 #endif  #endif
   
     gpoutfile = stdout;      gpoutfile = stdout;
     (void) Gcomplex(&udv_pi.udv_value, Pi, 0.0);      (void) Gcomplex(&udv_pi.udv_value, M_PI, 0.0);
   
     init_memory();      init_memory();
   
Line 396  char **argv;
Line 456  char **argv;
     else      else
         noinputfiles = TRUE;          noinputfiles = TRUE;
   
       /* Need this before show_version is called for the first time */
   
   #ifdef HAVE_SYS_UTSNAME_H
       {
           struct utsname uts;
   
           /* something is fundamentally wrong if this fails ... */
           if (uname(&uts) > -1) {
   # ifdef _AIX
               strcpy(os_name, uts.sysname);
               sprintf(os_name, "%s.%s", uts.version, uts.release);
   # elif defined(SCO)
               strcpy(os_name, "SCO");
               strcpy(os_rel, uts.release);
   # else
               strcpy(os_name, uts.sysname);
               strcpy(os_rel, uts.release);
   # endif
           }
       }
   #else /* ! HAVE_SYS_UTSNAME_H */
   
       strcpy(os_name, OS);
       strcpy(os_rel, "");
   
   #endif /* HAVE_SYS_UTSNAME_H */
   
     if (interactive)      if (interactive)
         show_version(stderr);          show_version(stderr);
   
Line 407  char **argv;
Line 494  char **argv;
         done(status[1]);          done(status[1]);
 #endif /* VMS */  #endif /* VMS */
   
     if (!setjmp(command_line_env)) {      if (!SETJMP(command_line_env, 1)) {
         /* first time */          /* first time */
         interrupt_setup();          interrupt_setup();
         load_rcfile();          load_rcfile();
Line 417  char **argv;
Line 504  char **argv;
             fprintf(stderr, "\nTerminal type set to '%s'\n", term->name);              fprintf(stderr, "\nTerminal type set to '%s'\n", term->name);
     } else {      } else {
         /* come back here from int_error() */          /* come back here from int_error() */
           if (interactive == FALSE)
               exit_status = EXIT_FAILURE;
   
 #ifdef AMIGA_SC_6_1  #ifdef AMIGA_SC_6_1
         (void) rawcon(0);          (void) rawcon(0);
 #endif  #endif
Line 472  char **argv;
Line 562  char **argv;
   
                 while (!com_line());                  while (!com_line());
   
                 /* interactive = FALSE; /* should this be here? */                  /* interactive = FALSE; */ /* should this be here? */
   
             } else              } else
                 load_file(fopen(*argv, "r"), *argv, FALSE);                  load_file(fopen(*argv, "r"), *argv, FALSE);
Line 499  char **argv;
Line 589  char **argv;
     if (aesid > -1)      if (aesid > -1)
         atexit(appl_exit);          atexit(appl_exit);
 #endif  #endif
     return (IO_SUCCESS);      return (exit_status);
 }  }
   
 #if (defined(ATARI) || defined(MTOS)) && defined(__PUREC__)  #if (defined(ATARI) || defined(MTOS)) && defined(__PUREC__)
Line 648  ULONG RexxInterface(PRXSTRING rxCmd, PUSHORT pusErr, P
Line 738  ULONG RexxInterface(PRXSTRING rxCmd, PUSHORT pusErr, P
  */   */
 {  {
     int rc;      int rc;
     static jmp_buf keepenv;      static JMP_BUF keepenv;
     int cmdlen;      int cmdlen;
   
     memcpy(keepenv, command_line_env, sizeof(jmp_buf));      memcpy(keepenv, command_line_env, sizeof(JMP_BUF));
     if (!setjmp(command_line_env)) {      if (!SETJMP(command_line_env, 1)) {
         /* set variable input_line.          /* set variable input_line.
          * Watch out for line length of NOT_ZERO_TERMINATED strings ! */           * Watch out for line length of NOT_ZERO_TERMINATED strings ! */
         cmdlen = rxCmd->strlength + 1;          cmdlen = rxCmd->strlength + 1;
Line 668  ULONG RexxInterface(PRXSTRING rxCmd, PUSHORT pusErr, P
Line 758  ULONG RexxInterface(PRXSTRING rxCmd, PUSHORT pusErr, P
         *pusErr = RXSUBCOM_ERROR;          *pusErr = RXSUBCOM_ERROR;
         RexxSetHalt(getpid(), 1);          RexxSetHalt(getpid(), 1);
     }      }
     memcpy(command_line_env, keepenv, sizeof(jmp_buf));      memcpy(command_line_env, keepenv, sizeof(JMP_BUF));
     return 0;      return 0;
 }  }
 #endif  #endif

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

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