2 * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan
4 * Permission to use, copy, modify, and distribute this software and its
5 * documentation for any purpose and without fee is hereby granted, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Software Research Associates not be used
9 * in advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. Software Research Associates
11 * makes no representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
14 * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
15 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
16 * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES BE LIABLE FOR ANY SPECIAL,
17 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
19 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
22 * Author: Erik M. van der Poel
23 * Software Research Associates, Inc., Tokyo, Japan
32 * erik%sra.co.jp@uunet.uu.net
34 * erik%sra.co.jp@mcvax.uucp
36 * try junet instead of co.jp
38 * Erik M. van der Poel
39 * Software Research Associates, Inc.
40 * 1-1-1 Hirakawa-cho, Chiyoda-ku
41 * Tokyo 102 Japan. TEL +81-3-234-2692
46 /* BSD 4.3 errno.h does not declare errno */
48 //extern int sys_nerr;
49 //extern char *sys_errlist[]; // [HGM] this produced a compile error in Ubuntu 8.04
51 #include <sys/param.h>
52 #include <X11/cursorfont.h>
53 #include <X11/Intrinsic.h>
54 #include <X11/StringDefs.h>
55 #include <X11/Composite.h>
56 #include <X11/Shell.h>
57 #include <X11/Xaw/Form.h>
58 #include <X11/Xaw/Command.h>
59 #include <X11/Xaw/Scrollbar.h>
60 #include <X11/Xaw/Label.h>
61 #include <X11/Xaw/Cardinals.h>
66 #define MAXPATHLEN 1024
67 #endif /* ndef MAXPATHLEN */
69 #if !defined(SVR4) && !defined(SYSV) && !defined(USG)
71 #endif /* !defined(SVR4) && !defined(SYSV) && !defined(USG) */
73 int SFstatus = SEL_FILE_NULL;
76 SFstartDir[MAXPATHLEN],
77 SFcurrentPath[MAXPATHLEN],
78 SFcurrentDir[MAXPATHLEN];
96 Atom SFwmDeleteWindow;
98 XSegment SFsegs[2], SFcompletionSegs[2];
100 XawTextPosition SFtextPos;
102 int SFupperX, SFlowerY, SFupperY;
104 int SFtextX, SFtextYoffset;
106 int SFentryWidth, SFentryHeight;
108 int SFlineToTextH = 3;
110 int SFlineToTextV = 3;
112 int SFbesideText = 3;
114 int SFaboveAndBelowText = 2;
116 int SFcharsPerEntry = 15;
120 int SFworkProcAdded = 0;
124 int SFpathScrollWidth, SFvScrollHeight, SFhScrollWidth;
126 char SFtextBuffer[MAXPATHLEN];
128 XtIntervalId SFdirModTimerId;
132 static char *oneLineTextEditTranslations = "\
133 <Key>Return: redraw-display()\n\
134 Ctrl<Key>M: redraw-display()\n\
139 SFexposeList(w, n, event, cont)
145 if ((event->type == NoExpose) || event->xexpose.count) {
149 SFdrawList(n, SF_DO_NOT_SCROLL);
154 SFmodVerifyCallback(w, client_data, event, cont)
156 XtPointer client_data;
163 (XLookupString(&(event->xkey), buf, 2, NULL, NULL) == 1) &&
166 SFstatus = SEL_FILE_OK;
168 SFstatus = SEL_FILE_TEXT;
174 SFokCallback(w, cl, cd)
178 SFstatus = SEL_FILE_OK;
181 static XtCallbackRec SFokSelect[] = {
182 { SFokCallback, (XtPointer) NULL },
183 { NULL, (XtPointer) NULL },
188 SFcancelCallback(w, cl, cd)
192 SFstatus = SEL_FILE_CANCEL;
195 static XtCallbackRec SFcancelSelect[] = {
196 { SFcancelCallback, (XtPointer) NULL },
197 { NULL, (XtPointer) NULL },
202 SFdismissAction(w, event, params, num_params)
206 Cardinal *num_params;
208 if (event->type == ClientMessage &&
209 event->xclient.data.l[0] != SFwmDeleteWindow) return;
211 SFstatus = SEL_FILE_CANCEL;
214 static char *wmDeleteWindowTranslation = "\
215 <Message>WM_PROTOCOLS: SelFileDismiss()\n\
218 static XtActionsRec actions[] = {
219 {"SelFileDismiss", SFdismissAction},
223 SFcreateWidgets(toplevel, prompt, ok, cancel)
230 int listWidth, listHeight;
231 int listSpacing = 10;
232 int scrollThickness = 15;
233 int hScrollX, hScrollY;
234 int vScrollX, vScrollY;
242 XtSetArg(arglist[i], XtNtransientFor, toplevel); i++;
244 selFile = XtAppCreateShell("Browse", "SelFile",
245 transientShellWidgetClass, SFdisplay, arglist, i);
247 /* Add WM_DELETE_WINDOW protocol */
248 XtAppAddActions(XtWidgetToApplicationContext(selFile),
249 actions, XtNumber(actions));
250 XtOverrideTranslations(selFile,
251 XtParseTranslationTable(wmDeleteWindowTranslation));
254 XtSetArg(arglist[i], XtNdefaultDistance, 30); i++;
255 selFileForm = XtCreateManagedWidget("selFileForm",
256 formWidgetClass, selFile, arglist, i);
259 XtSetArg(arglist[i], XtNlabel, prompt); i++;
260 XtSetArg(arglist[i], XtNresizable, True); i++;
261 XtSetArg(arglist[i], XtNtop, XtChainTop); i++;
262 XtSetArg(arglist[i], XtNbottom, XtChainTop); i++;
263 XtSetArg(arglist[i], XtNleft, XtChainLeft); i++;
264 XtSetArg(arglist[i], XtNright, XtChainLeft); i++;
265 XtSetArg(arglist[i], XtNborderWidth, 0); i++;
266 selFilePrompt = XtCreateManagedWidget("selFilePrompt",
267 labelWidgetClass, selFileForm, arglist, i);
270 XtSetArg(arglist[i], XtNforeground, &SFfore); i++;
271 XtSetArg(arglist[i], XtNbackground, &SFback); i++;
272 XtGetValues(selFilePrompt, arglist, i);
276 SFentryWidth = SFbesideText + SFcharsPerEntry * SFcharWidth +
278 SFentryHeight = SFaboveAndBelowText + SFcharHeight +
281 listWidth = SFlineToTextH + SFentryWidth + SFlineToTextH + 1 +
283 listHeight = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
284 SFlineToTextV + SFlistSize * SFentryHeight +
285 SFlineToTextV + 1 + scrollThickness;
287 SFpathScrollWidth = NR * listWidth + (NR-1) * listSpacing + 4;
290 hScrollY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
291 SFlineToTextV + SFlistSize * SFentryHeight +
293 SFhScrollWidth = SFlineToTextH + SFentryWidth + SFlineToTextH;
295 vScrollX = SFlineToTextH + SFentryWidth + SFlineToTextH;
296 vScrollY = SFlineToTextV + SFentryHeight + SFlineToTextV;
297 SFvScrollHeight = SFlineToTextV + SFlistSize * SFentryHeight +
300 SFupperX = SFlineToTextH + SFentryWidth + SFlineToTextH - 1;
301 SFlowerY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
303 SFupperY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
304 SFlineToTextV + SFlistSize * SFentryHeight - 1;
306 SFtextX = SFlineToTextH + SFbesideText;
307 SFtextYoffset = SFlowerY + SFaboveAndBelowText + SFcharAscent;
310 SFsegs[0].y1 = vScrollY;
311 SFsegs[0].x2 = vScrollX - 1;
312 SFsegs[0].y2 = vScrollY;
313 SFsegs[1].x1 = vScrollX;
315 SFsegs[1].x2 = vScrollX;
316 SFsegs[1].y2 = vScrollY - 1;
318 SFcompletionSegs[0].x1 = SFcompletionSegs[0].x2 = SFlineToTextH;
319 SFcompletionSegs[1].x1 = SFcompletionSegs[1].x2 =
320 SFlineToTextH + SFentryWidth - 1;
323 XtSetArg(arglist[i], XtNwidth, NR * listWidth + (NR - 1) * listSpacing + 4);
325 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
327 XtSetArg(arglist[i], XtNfromVert, selFilePrompt); i++;
328 XtSetArg(arglist[i], XtNvertDistance, 10); i++;
329 XtSetArg(arglist[i], XtNresizable, True); i++;
330 XtSetArg(arglist[i], XtNtop, XtChainTop); i++;
331 XtSetArg(arglist[i], XtNbottom, XtChainTop); i++;
332 XtSetArg(arglist[i], XtNleft, XtChainLeft); i++;
333 XtSetArg(arglist[i], XtNright, XtChainLeft); i++;
334 XtSetArg(arglist[i], XtNstring, SFtextBuffer); i++;
335 XtSetArg(arglist[i], XtNlength, MAXPATHLEN); i++;
336 XtSetArg(arglist[i], XtNeditType, XawtextEdit); i++;
337 XtSetArg(arglist[i], XtNwrap, XawtextWrapWord); i++;
338 XtSetArg(arglist[i], XtNresize, XawtextResizeHeight); i++;
339 XtSetArg(arglist[i], XtNuseStringInPlace, True); i++;
340 selFileField = XtCreateManagedWidget("selFileField",
341 asciiTextWidgetClass, selFileForm, arglist, i);
343 XtOverrideTranslations(selFileField,
344 XtParseTranslationTable(oneLineTextEditTranslations));
345 XtSetKeyboardFocus(selFileForm, selFileField);
348 XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); i++;
349 XtSetArg(arglist[i], XtNwidth, SFpathScrollWidth); i++;
350 XtSetArg(arglist[i], XtNheight, scrollThickness); i++;
351 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
352 XtSetArg(arglist[i], XtNfromVert, selFileField); i++;
353 XtSetArg(arglist[i], XtNvertDistance, 30); i++;
354 XtSetArg(arglist[i], XtNtop, XtChainTop); i++;
355 XtSetArg(arglist[i], XtNbottom, XtChainTop); i++;
356 XtSetArg(arglist[i], XtNleft, XtChainLeft); i++;
357 XtSetArg(arglist[i], XtNright, XtChainLeft); i++;
358 selFileHScroll = XtCreateManagedWidget("selFileHScroll",
359 scrollbarWidgetClass, selFileForm, arglist, i);
361 XtAddCallback(selFileHScroll, XtNjumpProc,
362 SFpathSliderMovedCallback, (XtPointer) NULL);
363 XtAddCallback(selFileHScroll, XtNscrollProc,
364 SFpathAreaSelectedCallback, (XtPointer) NULL);
367 XtSetArg(arglist[i], XtNwidth, listWidth); i++;
368 XtSetArg(arglist[i], XtNheight, listHeight); i++;
369 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
370 XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++;
371 XtSetArg(arglist[i], XtNvertDistance, 10); i++;
372 XtSetArg(arglist[i], XtNtop, XtChainTop); i++;
373 XtSetArg(arglist[i], XtNbottom, XtChainTop); i++;
374 XtSetArg(arglist[i], XtNleft, XtChainLeft); i++;
375 XtSetArg(arglist[i], XtNright, XtChainLeft); i++;
376 selFileLists[0] = XtCreateManagedWidget("selFileList1",
377 compositeWidgetClass, selFileForm, arglist, i);
380 XtSetArg(arglist[i], XtNwidth, listWidth); i++;
381 XtSetArg(arglist[i], XtNheight, listHeight); i++;
382 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
383 XtSetArg(arglist[i], XtNfromHoriz, selFileLists[0]); i++;
384 XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++;
385 XtSetArg(arglist[i], XtNhorizDistance, listSpacing); i++;
386 XtSetArg(arglist[i], XtNvertDistance, 10); i++;
387 XtSetArg(arglist[i], XtNtop, XtChainTop); i++;
388 XtSetArg(arglist[i], XtNbottom, XtChainTop); i++;
389 XtSetArg(arglist[i], XtNleft, XtChainLeft); i++;
390 XtSetArg(arglist[i], XtNright, XtChainLeft); i++;
391 selFileLists[1] = XtCreateManagedWidget("selFileList2",
392 compositeWidgetClass, selFileForm, arglist, i);
395 XtSetArg(arglist[i], XtNwidth, listWidth); i++;
396 XtSetArg(arglist[i], XtNheight, listHeight); i++;
397 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
398 XtSetArg(arglist[i], XtNfromHoriz, selFileLists[1]); i++;
399 XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++;
400 XtSetArg(arglist[i], XtNhorizDistance, listSpacing); i++;
401 XtSetArg(arglist[i], XtNvertDistance, 10); i++;
402 XtSetArg(arglist[i], XtNtop, XtChainTop); i++;
403 XtSetArg(arglist[i], XtNbottom, XtChainTop); i++;
404 XtSetArg(arglist[i], XtNleft, XtChainLeft); i++;
405 XtSetArg(arglist[i], XtNright, XtChainLeft); i++;
406 selFileLists[2] = XtCreateManagedWidget("selFileList3",
407 compositeWidgetClass, selFileForm, arglist, i);
409 for (n = 0; n < NR; n++) {
412 XtSetArg(arglist[i], XtNx, vScrollX); i++;
413 XtSetArg(arglist[i], XtNy, vScrollY); i++;
414 XtSetArg(arglist[i], XtNwidth, scrollThickness); i++;
415 XtSetArg(arglist[i], XtNheight, SFvScrollHeight); i++;
416 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
417 selFileVScrolls[n] = XtCreateManagedWidget("selFileVScroll",
418 scrollbarWidgetClass, selFileLists[n], arglist, i);
420 XtAddCallback(selFileVScrolls[n], XtNjumpProc,
421 SFvFloatSliderMovedCallback, (XtPointer) n);
422 XtAddCallback(selFileVScrolls[n], XtNscrollProc,
423 SFvAreaSelectedCallback, (XtPointer) n);
427 XtSetArg(arglist[i], XtNorientation, XtorientHorizontal);
429 XtSetArg(arglist[i], XtNx, hScrollX); i++;
430 XtSetArg(arglist[i], XtNy, hScrollY); i++;
431 XtSetArg(arglist[i], XtNwidth, SFhScrollWidth); i++;
432 XtSetArg(arglist[i], XtNheight, scrollThickness); i++;
433 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
434 selFileHScrolls[n] = XtCreateManagedWidget("selFileHScroll",
435 scrollbarWidgetClass, selFileLists[n], arglist, i);
437 XtAddCallback(selFileHScrolls[n], XtNjumpProc,
438 SFhSliderMovedCallback, (XtPointer) n);
439 XtAddCallback(selFileHScrolls[n], XtNscrollProc,
440 SFhAreaSelectedCallback, (XtPointer) n);
444 XtSetArg(arglist[i], XtNlabel, ok); i++;
445 XtSetArg(arglist[i], XtNresizable, True); i++;
446 XtSetArg(arglist[i], XtNcallback, SFokSelect); i++;
447 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
448 XtSetArg(arglist[i], XtNfromVert, selFileLists[0]); i++;
449 XtSetArg(arglist[i], XtNvertDistance, 30); i++;
450 XtSetArg(arglist[i], XtNtop, XtChainTop); i++;
451 XtSetArg(arglist[i], XtNbottom, XtChainTop); i++;
452 XtSetArg(arglist[i], XtNleft, XtChainLeft); i++;
453 XtSetArg(arglist[i], XtNright, XtChainLeft); i++;
454 selFileOK = XtCreateManagedWidget("selFileOK", commandWidgetClass,
455 selFileForm, arglist, i);
458 XtSetArg(arglist[i], XtNlabel, cancel); i++;
459 XtSetArg(arglist[i], XtNresizable, True); i++;
460 XtSetArg(arglist[i], XtNcallback, SFcancelSelect); i++;
461 XtSetArg(arglist[i], XtNborderColor, SFfore); i++;
462 XtSetArg(arglist[i], XtNfromHoriz, selFileOK); i++;
463 XtSetArg(arglist[i], XtNfromVert, selFileLists[0]); i++;
464 XtSetArg(arglist[i], XtNhorizDistance, 30); i++;
465 XtSetArg(arglist[i], XtNvertDistance, 30); i++;
466 XtSetArg(arglist[i], XtNtop, XtChainTop); i++;
467 XtSetArg(arglist[i], XtNbottom, XtChainTop); i++;
468 XtSetArg(arglist[i], XtNleft, XtChainLeft); i++;
469 XtSetArg(arglist[i], XtNright, XtChainLeft); i++;
470 selFileCancel = XtCreateManagedWidget("selFileCancel",
471 commandWidgetClass, selFileForm, arglist, i);
473 XtSetMappedWhenManaged(selFile, False);
474 XtRealizeWidget(selFile);
476 /* Add WM_DELETE_WINDOW protocol */
477 SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False);
478 XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1);
482 xtermCursor = XCreateFontCursor(SFdisplay, XC_xterm);
484 sbRightArrowCursor = XCreateFontCursor(SFdisplay, XC_sb_right_arrow);
485 dotCursor = XCreateFontCursor(SFdisplay, XC_dot);
487 XDefineCursor(SFdisplay, XtWindow(selFileForm), xtermCursor);
488 XDefineCursor(SFdisplay, XtWindow(selFileField), xtermCursor);
490 for (n = 0; n < NR; n++) {
491 XDefineCursor(SFdisplay, XtWindow(selFileLists[n]),
494 XDefineCursor(SFdisplay, XtWindow(selFileOK), dotCursor);
495 XDefineCursor(SFdisplay, XtWindow(selFileCancel), dotCursor);
497 for (n = 0; n < NR; n++) {
498 XtAddEventHandler(selFileLists[n], ExposureMask, True,
499 SFexposeList, (XtPointer) n);
500 XtAddEventHandler(selFileLists[n], EnterWindowMask, False,
501 SFenterList, (XtPointer) n);
502 XtAddEventHandler(selFileLists[n], LeaveWindowMask, False,
503 SFleaveList, (XtPointer) n);
504 XtAddEventHandler(selFileLists[n], PointerMotionMask, False,
505 SFmotionList, (XtPointer) n);
506 XtAddEventHandler(selFileLists[n], ButtonPressMask, False,
507 SFbuttonPressList, (XtPointer) n);
508 XtAddEventHandler(selFileLists[n], ButtonReleaseMask, False,
509 SFbuttonReleaseList, (XtPointer) n);
512 XtAddEventHandler(selFileField, KeyPressMask, False,
513 SFmodVerifyCallback, (XtPointer) NULL);
515 SFapp = XtWidgetToApplicationContext(selFile);
519 /* position widget under the cursor */
526 Dimension width, height, b_width;
527 int x, y, max_x, max_y;
530 unsigned int dummymask;
532 XQueryPointer(XtDisplay(w), XtWindow(w), &root, &child, &x, &y,
533 &dummyx, &dummyy, &dummymask);
535 XtSetArg(args[num_args], XtNwidth, &width); num_args++;
536 XtSetArg(args[num_args], XtNheight, &height); num_args++;
537 XtSetArg(args[num_args], XtNborderWidth, &b_width); num_args++;
538 XtGetValues(w, args, num_args);
540 width += 2 * b_width;
541 height += 2 * b_width;
543 x -= ( (Position) width/2 );
545 if ( x > (max_x = (Position) (XtScreen(w)->width - width)) ) x = max_x;
547 y -= ( (Position) height/2 );
549 if ( y > (max_y = (Position) (XtScreen(w)->height - height)) ) y = max_y;
552 XtSetArg(args[num_args], XtNx, x); num_args++;
553 XtSetArg(args[num_args], XtNy, y); num_args++;
554 XtSetValues(w, args, num_args);
558 SFopenFile(name, mode, prompt, failed)
568 if ((fp = fopen(name, mode)) == NULL) {
570 if (1) { // [HGM] always use strerror
571 buf = XtMalloc(strlen(failed) + strlen(strerror(errno)) +
574 strcat(buf, strerror(errno));
578 buf = XtMalloc(strlen(failed) + strlen(prompt) + 2);
583 XtSetArg(args[0], XtNlabel, buf);
584 XtSetValues(selFilePrompt, args, ONE);
595 if ((SFtextBuffer[0] == '/') || (SFtextBuffer[0] == '~')) {
596 (void) strncpy(SFcurrentPath, SFtextBuffer, MAXPATHLEN);
598 SFtextPos = XawTextGetInsertionPoint(selFileField);
600 (void) strcat(strncpy(SFcurrentPath, SFstartDir, MAXPATHLEN), SFtextBuffer);
602 SFtextPos = XawTextGetInsertionPoint(selFileField) +
606 if (!SFworkProcAdded) {
607 (void) XtAppAddWorkProc(SFapp, SFworkProc, NULL);
618 return strcpy(XtMalloc((unsigned) (strlen(SFtextBuffer) + 1)),
625 SFstatus = SEL_FILE_NULL;
626 XtRemoveGrab(selFile);
627 XtUnmapWidget(selFile);
628 XtRemoveTimeOut(SFdirModTimerId);
629 if (SFchdir(SFstartDir)) {
632 "XsraSelFile: can't return to current directory"
639 XsraSelFile(toplevel, prompt, ok, cancel, failed,
640 init_path, mode, show_entry, name_return)
651 static int firstTime = 1;
658 prompt = "Pathname:";
671 SFdisplay = XtDisplay(toplevel);
672 SFcreateWidgets(toplevel, prompt, ok, cancel);
676 XtSetArg(arglist[i], XtNlabel, prompt); i++;
677 XtSetValues(selFilePrompt, arglist, i);
680 XtSetArg(arglist[i], XtNlabel, ok); i++;
681 XtSetValues(selFileOK, arglist, i);
684 XtSetArg(arglist[i], XtNlabel, cancel); i++;
685 XtSetValues(selFileCancel, arglist, i);
688 SFpositionWidget(selFile);
689 XtMapWidget(selFile);
691 #if defined(SVR4) || defined(SYSV) || defined(USG) || 1
692 if (!getcwd(SFstartDir, MAXPATHLEN)) { // [HGM] always do this, as I do not know when exactly to do it
693 #else /* defined(SVR4) || defined(SYSV) || defined(USG) */
694 if (!getwd(SFstartDir)) {
695 #endif /* defined(SVR4) || defined(SYSV) || defined(USG) */
697 XtAppError(SFapp, "XsraSelFile: can't get current directory");
699 (void) strcat(SFstartDir, "/");
700 (void) strncpy(SFcurrentDir, SFstartDir, MAXPATHLEN);
703 if (init_path[0] == '/') {
704 (void) strncpy(SFcurrentPath, init_path, MAXPATHLEN);
710 SFsetText(SFcurrentPath);
712 SFsetText(&(SFcurrentPath[strlen(SFstartDir)]));
715 (void) strcat(strncpy(SFcurrentPath, SFstartDir, MAXPATHLEN),
717 SFsetText(&(SFcurrentPath[strlen(SFstartDir)]));
720 (void) strncpy(SFcurrentPath, SFstartDir, MAXPATHLEN);
727 XtAddGrab(selFile, True, True);
729 SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000,
730 SFdirModTimer, (XtPointer) NULL);
733 XtAppNextEvent(SFapp, &event);
734 XtDispatchEvent(&event);
737 SFstatus = SEL_FILE_NULL;
741 *name_return = SFgetText();
742 if (fp = SFopenFile(*name_return, mode,
747 SFstatus = SEL_FILE_NULL;
749 case SEL_FILE_CANCEL: