X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=filebrowser%2Fpath.c;h=a3d6b46ebd3aea54727e9f84d0c50950586a9f4b;hb=4874d4beeab3424c79e343c5be80f4dd7eea8808;hp=6379e79968a70609e0bff835d8fe6b2987519fda;hpb=373488935bf19680e26a3b51e617c9586dd438c6;p=xboard.git diff --git a/filebrowser/path.c b/filebrowser/path.c index 6379e79..a3d6b46 100644 --- a/filebrowser/path.c +++ b/filebrowser/path.c @@ -36,6 +36,11 @@ #include "xstat.h" #include +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif /* ndef MAXPATHLEN */ + + #if defined(SVR4) || defined(SYSV) || defined(USG) extern uid_t getuid(); extern void qsort(); @@ -75,14 +80,14 @@ SFchdir(path) if (strcmp(path, SFcurrentDir)) { result = chdir(path); if (!result) { - (void) strcpy(SFcurrentDir, path); + (void) strncpy(SFcurrentDir, path, MAXPATHLEN); } } return result; } -static +static void SFfree(i) int i; { @@ -103,17 +108,19 @@ SFfree(i) XtFree(dir->dir); dir->dir = NULL; + return; } -static +static void SFstrdup(s1, s2) char **s1; char *s2; { *s1 = strcpy(XtMalloc((unsigned) (strlen(s2) + 1)), s2); + return; } -static +static void SFunreadableDir(dir) SFDir *dir; { @@ -125,6 +132,7 @@ SFunreadableDir(dir) dir->entries[0].shown = dir->entries[0].real; dir->nEntries = 1; dir->nChars = strlen(cannotOpen); + return; } #ifdef SEL_FILE_IGNORE_CASE @@ -172,7 +180,7 @@ SFstrncmp(p, q, n) } #endif /* def SEL_FILE_IGNORE_CASE */ -static +static void SFreplaceText(dir, str) SFDir *dir; char *str; @@ -193,6 +201,7 @@ SFreplaceText(dir, str) } SFtextChanged(); + return; } static void @@ -356,7 +365,7 @@ SFfindFile(dir, str) return 0; } -static +static void SFunselect() { SFDir *dir; @@ -367,6 +376,7 @@ SFunselect() } dir->beginSelection = -1; dir->endSelection = -1; + return; } static int @@ -376,7 +386,7 @@ SFcompareLogins(p, q) return strcmp(p->name, q->name); } -static +static void SFgetHomeDirs() { struct passwd *pw; @@ -452,6 +462,7 @@ SFgetHomeDirs() for (i--; i >= 0; i--) { (void) strcat(entries[i].real, "/"); } + return; } static int @@ -469,8 +480,9 @@ SFfindHomeDir(begin, end) if (!strcmp(SFhomeDir.entries[i].real, begin)) { *end = save; SFstrdup(&theRest, end); - (void) strcat(strcat(strcpy(SFcurrentPath, - SFlogins[i].dir), "/"), theRest); + (void) strcat(strcat(strncpy(SFcurrentPath,SFlogins[i].dir, + MAXPATHLEN), "/"), + theRest); XtFree(theRest); SFsetText(SFcurrentPath); SFtextChanged(); @@ -483,6 +495,7 @@ SFfindHomeDir(begin, end) return 0; } +void SFupdatePath() { static int alloc; @@ -670,8 +683,10 @@ SFupdatePath() } } } + return; } +void SFsetText(path) char *path; { @@ -684,6 +699,8 @@ SFsetText(path) XawTextReplace(selFileField, 0, strlen(SFtextBuffer), &text); XawTextSetInsertionPoint(selFileField, strlen(SFtextBuffer)); + + return; } /* ARGSUSED */