--- flx/flx_show_dialog/flx_show_dialog.c 1998-01-11 10:51:40.000000000 -0500 +++ flx/flx_show_dialog/flx_show_dialog.c 2015-03-09 00:09:19.000000000 -0400 @@ -56,6 +56,6 @@ ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "forms.h" +#include +#include #include "flx.h" #include "flx_show_dialog.h" /* Internal to this routine */ @@ -68,9 +68,4 @@ static void usage(); -void flx_set_dialog_lcol(); -void flx_set_dialog_font(); -void flx_set_dialog_color(); -void flx_set_dialog_bgcolor(); - --- flx/flx_util/flx_justify_input.c 1998-02-20 20:00:26.000000000 -0500 +++ flx/flx_util/flx_justify_input.c 2015-03-08 23:15:09.000000000 -0400 @@ -30,13 +30,10 @@ -#include "forms.h" +#include +#include "flx.h" #include #include - -void flx_justify_input(FL_OBJECT *input_obj, char *string, int STYLE, int SIZE); - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void flx_justify_input(FL_OBJECT *input_obj, char *string, int STYLE, int SIZE) +void flx_justify_input(FL_OBJECT *input_obj, const char *string, int STYLE, int SIZE) --- flx/flx_util/flx_scale_form.c 1997-09-02 21:57:24.000000000 -0400 +++ flx/flx_util/flx_scale_form.c 2015-03-08 23:18:56.000000000 -0400 @@ -22,5 +22,5 @@ - -#include "forms.h" +#include +#include "flx.h" #include @@ -29,7 +30,4 @@ -void flx_scale_form(FL_FORM *form); - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Scales a form based on the current font */ --- flx/flx_filebox/flx_filebox.c 1998-02-21 12:38:23.000000000 -0500 +++ flx/flx_filebox/flx_filebox.c 2015-03-08 23:29:18.000000000 -0400 @@ -59,5 +59,5 @@ #include -#include "forms.h" +#include #include "flx.h" #include "flx_filebox.h" @@ -65,7 +65,4 @@ #define USE_COLOR 1 - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ char *flx_filebox(const char *directory, @@ -272,5 +269,5 @@ fl_set_object_posthandler(theForm->file_input, change_focus); - if ((default_file != "") && (default_file != NULL)) { + if (default_file != NULL && default_file[0] != '\0') { fl_set_input(theForm->file_input, default_file); flx_justify_input (theForm->file_input, default_file, @@ -589,21 +586,18 @@ struct dirent **dir_s; int i, numEntries; - - struct stat *stat_buf = (struct stat *) vmalloc (sizeof(struct stat)); + + struct stat *stat_buf = vmalloc (sizeof(struct stat)); int filetype; char *sfile; - char *file_color = "@C0"; /* default black */ - char *link_color = "@C0"; - char *dir_color = "@C0"; - char *chardev_color = "@C0"; - char *blockdev_color = "@C0"; - char *socket_color = "@C0"; - char *fifo_color = "@C0"; + const char *file_color = "@C0"; /* default black */ + const char *link_color = "@C0"; + const char *dir_color = "@C0"; + const char *chardev_color = "@C0"; + const char *blockdev_color = "@C0"; + const char *socket_color = "@C0"; + const char *fifo_color = "@C0"; char *currentFile; - int currentWidth, maxWidth = 0; - int min_browser_width = 175; - if (USE_COLOR) { @@ -656,5 +650,5 @@ */ - currentFile = (char *) vmalloc (strlen(theForm->dir) + strlen("/") + + currentFile = vmalloc (strlen(theForm->dir) + strlen("/") + strlen(dir_s[i]->d_name) + 1); sprintf(currentFile, "%s/%s", theForm->dir, dir_s[i]->d_name); @@ -683,5 +677,5 @@ /* Filename used for display in filebox: add color */ - sfile = (char *) vmalloc (strlen(dir_s[i]->d_name) + 3 + 1); + sfile = vmalloc (strlen(dir_s[i]->d_name) + 3 + 1); switch (filetype) { @@ -761,18 +755,5 @@ free(stat_buf); - -/* - if (maxWidth > min_browser_width) { - fl_set_object_geometry(theForm->file_browser, - 230, 40, wide_string_p + 20, 165); - } - else { - fl_set_object_geometry(theForm->file_browser, - 230, 40, 190, 165); - } -*/ - fl_unfreeze_form(theForm->main); - } /* end function parse_dir() */ @@ -804,5 +785,5 @@ - chunk = (void *) malloc (chunk_size); + chunk = malloc (chunk_size); if (chunk == NULL) { perror("flx_filebox"); --- flx/flx.h 1997-11-10 22:57:34.000000000 -0500 +++ flx/flx.h 2015-03-08 23:32:37.000000000 -0400 @@ -61,4 +61,16 @@ extern FL_FORM *flx_help_dialog(const char *help_text); +int flx_show_dialog (const char *type_str, const char *message_str); +void flx_set_dialog_bgcolor (int theBgColor); +void flx_set_dialog_color (int theInactiveColor, int theActiveColor); +void flx_set_dialog_font (int theLabelStyle, int theLabelSize); +void flx_set_dialog_lcol (int theLabelColor); + +void flx_justify_input(FL_OBJECT *input_obj, const char *string, int STYLE, int SIZE); + +void flx_scale_form(FL_FORM *form); +char *flx_filebox(const char *dir, const char *pattern, const char *default_file); + +char *flx_show_input (int type, const char *message_str, const char *initial); #endif /* FLX_H */ --- flx/flx_filebox/flx_filebox.h 1997-09-03 22:28:48.000000000 -0400 +++ flx/flx_filebox/flx_filebox.h 2015-03-08 23:37:08.000000000 -0400 @@ -55,5 +55,4 @@ static void FilterCB (FL_OBJECT *ob, long data); static void LocationCB (FL_OBJECT *ob, long data); -static void QuitCB (FL_OBJECT *ob, long data); /* --- src/build_pages.c 1998-02-22 22:53:11.000000000 -0500 +++ src/build_pages.c 2015-03-09 00:15:48.000000000 -0400 @@ -1,3 +1,4 @@ -#include "forms.h" +#include +#include "flx.h" #include "xfpovray.h" #include "pov-defaults.h" --- flx/flx_show_dialog/flx_show_input.c 1998-01-31 20:39:42.000000000 -0500 +++ flx/flx_show_dialog/flx_show_input.c 2015-03-09 00:36:57.000000000 -0400 @@ -48,6 +48,6 @@ ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "forms.h" +#include +#include "flx.h" #include "question.xpm" @@ -58,10 +58,4 @@ extern int FLX_DIALOG_LSTYLE; extern int FLX_DIALOG_LSIZE; - -void flx_set_dialog_lcol(); -void flx_set_dialog_font(); -void flx_set_dialog_color(); -void flx_set_dialog_bgcolor(); - @@ -73,5 +67,4 @@ FL_OBJECT *obj, *obj_input, *ret; - int button_width = 70; int button_height = 25; int min_x = 180; @@ -82,6 +75,4 @@ int label_width, label_height; - int button_label_width, button_label_height; - int status = 0; int form_x, form_y, yoffset, ymax_height; char **discriminator; --- src/xfpovray.h 1998-02-22 23:29:43.000000000 -0500 +++ src/xfpovray.h 2015-03-09 00:39:07.000000000 -0400 @@ -140,8 +140,10 @@ void YesNoCB (FL_OBJECT *obj, long data); -/* +/* ** Other utility functions */ -void write_config (char *ini_file); + +int read_config(const char *ini_file); +void write_config (const char *ini_file); void show_image (void); void save_state (void); @@ -320,3 +322,7 @@ #endif +int tokenize(char *command_string, char *tokenlist[], size_t maxtoken); +char *strtruncate (char *string, char endat); + +void showtip(FL_OBJECT *ob, char *s); #endif /* XFPOVRAY_H */ --- src/callbacks.c 1998-02-22 22:33:45.000000000 -0500 +++ src/callbacks.c 2015-03-09 00:38:37.000000000 -0400 @@ -3,6 +3,7 @@ */ - -#include "forms.h" +#include +#include +#include "flx.h" #include "xfpovray.h" #include "pov-defaults.h" @@ -29,10 +30,6 @@ extern char *TEMP_FILE; -extern void write_config(char *ini_file); extern int povray_pid; extern int auto_view; -extern void show_image(void); -extern int PovCheckCB(XEvent *ev, void *data); -extern void run_program (int count, ...); struct preview_options { @@ -157,5 +154,5 @@ temp = (char *) fl_calloc (1, strlen(fl_get_input (xfData->sceneFileInput)) + 1); - sprintf(temp, fl_get_input (xfData->sceneFileInput)); + strcpy(temp, fl_get_input (xfData->sceneFileInput)); path = (char *) fl_calloc (1, strlen(temp) + 1); @@ -168,5 +165,5 @@ } basename = (char *) fl_calloc (1, strlen(tokenList[i])+1); - sprintf(basename, tokenList[i]); + strcpy(basename, tokenList[i]); strtruncate (basename, '.'); strcat(basename, ".ini"); @@ -607,5 +604,4 @@ void GetFileCB(FL_OBJECT *ob, long data) { - int pid, type; char *temp; @@ -805,5 +801,5 @@ char temp[256]; char buf[256]; - int i, pid, key; + int key; char *t; @@ -1219,5 +1215,4 @@ void QuitCB(FL_OBJECT *ob, long data) { - int pid; char *temp; int menuItem = fl_get_menu(ob); --- src/config.c 1998-02-22 23:38:31.000000000 -0500 +++ src/config.c 2015-03-09 00:45:15.000000000 -0400 @@ -3,5 +3,7 @@ */ -#include "forms.h" +#include +#include +#include "flx.h" #include "xfpovray.h" #include "pov-defaults.h" @@ -29,14 +31,12 @@ ** Function to write the POV-Ray configuration file */ -void write_config(char *ini_file) +void write_config(const char *ini_file) { FILE *options_file; - int i, do_free = FALSE; - - + int i; + + if (ini_file == NULL) { - ini_file = (char *) fl_calloc (1, strlen(POV_INIFILE) + 1); - sprintf(ini_file, "%s", POV_INIFILE); - do_free = TRUE; + ini_file = POV_INIFILE; } @@ -228,9 +228,4 @@ fl_load_browser (configPage->configBrowser, ini_file); fl_unfreeze_form (configPage->form); - - if (do_free) - free (ini_file); - - } @@ -240,5 +235,5 @@ ** Function to read the POV-Ray configuration file, and update widget values */ -int read_config(char *ini_file) +int read_config(const char *ini_file) { --- src/run_program.c 1998-01-31 17:24:36.000000000 -0500 +++ src/run_program.c 2015-03-08 23:02:20.000000000 -0400 @@ -11,7 +11,11 @@ */ +#include #include +#include #include - +#include +#include +#include "xfpovray.h" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -24,5 +26,4 @@ - - arg_list = (char **) malloc ((count + 1) * sizeof(char *)); + arg_list = malloc ((count + 1) * sizeof(char *)); if (arg_list == NULL) { perror ("run_program"); @@ -49,18 +51,15 @@ ** Run the program as a child process */ - pid = fork(); + pid = vfork(); if (pid == 0) { if (execvp (program, arg_list) == -1) { - fprintf (stderr, "\nrun: could not exec() %s\n", arg_list[0]); + err(255, "\nrun: could not exec() %s", arg_list[0]); /* sigchld catcher handles the error */ - _exit (255); } } else if (pid < 0) - fprintf (stderr, "\nrun: could not fork()\n"); + warn("\nrun: could not vfork()"); free (arg_list); - - return; } --- src/state.c 1998-02-23 00:26:07.000000000 -0500 +++ src/state.c 2015-03-09 01:07:31.000000000 -0400 @@ -4,7 +4,10 @@ */ - -#include "forms.h" +#include +#include +#include #include + +#include "flx.h" #include "xfpovray.h" #include "pov-defaults.h" @@ -36,23 +39,19 @@ { FILE *state_file; - char filename[256]; - char temp[256]; + char filename[MAXPATHLEN]; int i; /* Get home directory, and set filepath */ - sprintf (filename, "%s/.xfpovray/xfpovray.state", getenv("HOME")); + snprintf (filename, sizeof filename, "%s/.xfpovray/xfpovray.state", getenv("HOME")); if ((state_file = fopen(filename, "w")) == NULL) { - fprintf (stderr, "Unable to open %s for writing! State not saved.\n", + warn("Unable to open %s for writing! State not saved.", filename); return; } - /* Write the current state */ - sprintf(temp, "; xfpovray %s, generated by state.c\n", xfp_version); - fprintf (state_file, temp); - + fprintf(state_file, "; xfpovray %s, generated by state.c\n", xfp_version); /* Parsing */ @@ -63,6 +62,5 @@ fl_get_input (parsingPage->libpathInput[i])); else - fprintf (state_file, "library_path=NULL\n", - fl_get_input (parsingPage->libpathInput[i])); + fprintf (state_file, "library_path=NULL\n"); } @@ -142,5 +140,5 @@ if (strcmp(fl_get_input (tracingPage->antialiasThreshold), "") == 0) - fprintf (state_file, "antialias_threshold=%d\n", + fprintf (state_file, "antialias_threshold=%f\n", POV_ANTIALIAS_THRESHOLD); else @@ -155,5 +153,5 @@ if (strcmp(fl_get_input (tracingPage->jitterInput), "") == 0) - fprintf (state_file, "jitter_amount=%d\n", POV_JITTER_AMOUNT); + fprintf (state_file, "jitter_amount=%f\n", POV_JITTER_AMOUNT); else fprintf (state_file, "jitter_amount=%s\n", @@ -240,7 +238,7 @@ FILE *state_file; char filename[512]; - int i, numLibs = 0; + int numLibs = 0; char buf[80]; - char *key; + const char *key; char *value; const char delimiter[] = "="; --- src/tips.c 1998-01-18 22:47:13.000000000 -0500 +++ src/tips.c 2015-03-09 01:10:51.000000000 -0400 @@ -1,5 +1,7 @@ -#include "forms.h" +#include #include +#include "xfpovray.h" + extern int show_tips; @@ -9,5 +11,6 @@ * use the post handler as a tipper */ -int post_handler(FL_OBJECT *ob, int event, +static int +post_handler(FL_OBJECT *ob, int event, FL_Coord mx, FL_Coord my, int key, void *xev) { --- src/util.c 1998-02-21 20:57:40.000000000 -0500 +++ src/util.c 2015-03-09 01:15:38.000000000 -0400 @@ -6,5 +6,6 @@ #include - +#include +#include "xfpovray.h" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -27,5 +28,5 @@ { static char tokensep[] = "/"; - int tokencount; + size_t tokencount; char *thistoken;