X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=filebrowser%2Fselfile.c;h=860ed8b4e60727ffeff42b0cab973ea54c667e16;hb=4d4d6305b409a21e22162ca25175aa6d60dc8916;hp=4298e3068ffd1aa739b34ca957b77c7486e6dd59;hpb=373488935bf19680e26a3b51e617c9586dd438c6;p=xboard.git diff --git a/filebrowser/selfile.c b/filebrowser/selfile.c index 4298e30..860ed8b 100644 --- a/filebrowser/selfile.c +++ b/filebrowser/selfile.c @@ -61,6 +61,16 @@ extern int errno; #include #include "selfile.h" +#include "xstat.h" + +/* added missing prototypes */ +extern void SFdrawList(int,int); +extern void SFinitFont(); +extern void SFcreateGC(); +extern int SFchdir(char *); +extern void SFupdatePath(); +extern void SFsetText(char *); +extern char SFstatChar(struct stat*); #ifndef MAXPATHLEN #define MAXPATHLEN 1024 @@ -146,7 +156,7 @@ SFexposeList(w, n, event, cont) return; } - SFdrawList(n, SF_DO_NOT_SCROLL); + SFdrawList((int)n, SF_DO_NOT_SCROLL); } /* ARGSUSED */ @@ -588,15 +598,16 @@ SFopenFile(name, mode, prompt, failed) return fp; } +void SFtextChanged() { if ((SFtextBuffer[0] == '/') || (SFtextBuffer[0] == '~')) { - (void) strcpy(SFcurrentPath, SFtextBuffer); + (void) strncpy(SFcurrentPath, SFtextBuffer, MAXPATHLEN); SFtextPos = XawTextGetInsertionPoint(selFileField); } else { - (void) strcat(strcpy(SFcurrentPath, SFstartDir), SFtextBuffer); + (void) strcat(strncpy(SFcurrentPath, SFstartDir, MAXPATHLEN), SFtextBuffer); SFtextPos = XawTextGetInsertionPoint(selFileField) + strlen(SFstartDir); @@ -608,6 +619,7 @@ SFtextChanged() } SFupdatePath(); + return; } static char * @@ -617,7 +629,7 @@ SFgetText() SFtextBuffer); } -static +static void SFprepareToReturn() { SFstatus = SEL_FILE_NULL; @@ -630,6 +642,7 @@ SFprepareToReturn() "XsraSelFile: can't return to current directory" ); } + return; } FILE * @@ -694,11 +707,11 @@ XsraSelFile(toplevel, prompt, ok, cancel, failed, XtAppError(SFapp, "XsraSelFile: can't get current directory"); } (void) strcat(SFstartDir, "/"); - (void) strcpy(SFcurrentDir, SFstartDir); + (void) strncpy(SFcurrentDir, SFstartDir, MAXPATHLEN); if (init_path) { if (init_path[0] == '/') { - (void) strcpy(SFcurrentPath, init_path); + (void) strncpy(SFcurrentPath, init_path, MAXPATHLEN); if (strncmp( SFcurrentPath, SFstartDir, @@ -709,12 +722,12 @@ XsraSelFile(toplevel, prompt, ok, cancel, failed, SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); } } else { - (void) strcat(strcpy(SFcurrentPath, SFstartDir), + (void) strcat(strncpy(SFcurrentPath, SFstartDir, MAXPATHLEN), init_path); SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); } } else { - (void) strcpy(SFcurrentPath, SFstartDir); + (void) strncpy(SFcurrentPath, SFstartDir, MAXPATHLEN); } SFfunc = show_entry;