Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtcreate / af_aux.c
1 /* $TOG: af_aux.c /main/6 1998/04/06 13:14:19 mgreess $ */
2 /******************************************************************************/
3 /*                                                                            */
4 /* af_aux - auxiliary functions for add filetype                              */
5 /*                                                                            */
6 /* Functions to get/set values from/to interface.                             */
7 /* Callback routines for AF interface.                                        */
8 /*                                                                            */
9 /******************************************************************************/
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <sys/signal.h>
14 #include <errno.h>
15 #include <unistd.h>
16 #include <X11/cursorfont.h>
17 #include <X11/Xlib.h>
18 #include <X11/Xatom.h>
19 #include <Xm/Xm.h>
20 #include <Xm/TextF.h>
21 #include <Xm/RowColumnP.h>
22 #include <Xm/MessageB.h>
23 #include <Xm/FileSB.h>
24 #include <sys/stat.h>
25 #if defined(AIXV3)
26 #    include <sys/dir.h>
27 #else
28 #  if defined(__osf__) || defined(linux)
29 #    include <dirent.h>
30 #  else
31 #    include <sys/dirent.h>
32 #  endif
33 #endif
34
35 #include <Dt/Icon.h>
36
37 #include "dtcreate.h"
38 #include "af_aux.h"
39 #include "cmnutils.h"
40 #include "cmnrtns.h"
41
42 /******************************************************************************/
43 /*                                                                            */
44 /*  External Variables                                                        */
45 /*                                                                            */
46 /******************************************************************************/
47
48 /******************************************************************************/
49 /*                                                                            */
50 /*  Variables                                                                 */
51 /*                                                                            */
52 /******************************************************************************/
53
54 /******************************************************************************/
55 /*                                                                            */
56 /*         CALLBACK FUNCTIONS                                                 */
57 /*                                                                            */
58 /******************************************************************************/
59
60 /******************************************************************************/
61 /*                                                                            */
62 /* get_selected_filetype_icon - determines which filetype icon is currently   */
63 /*                              selected.                                     */
64 /*                                                                            */
65 /* INPUT: none                                                                */
66 /* OUTPUT: Widget wid - id of selected icon gadget                            */
67 /*                                                                            */
68 /******************************************************************************/
69 Widget get_selected_filetype_icon (void)
70 {
71   if (!last_filetype_pushed) {
72     last_filetype_pushed = AF_MED_IconGadget;
73   }
74   return (last_filetype_pushed);
75 }
76
77 /******************************************************************************/
78 /*                                                                            */
79 /* activateCB_filetype_icon                                                   */
80 /*                                                                            */
81 /* INPUT: Widget wid - id of icon gadget                                      */
82 /*        XtPointer client_data - not used                                    */
83 /*        XmPushButtonCallbackStruct *cbs - not used                          */
84 /* OUTPUT: none                                                               */
85 /*                                                                            */
86 /******************************************************************************/
87 void activateCB_filetype_icon (Widget wid, XtPointer client_data,
88                                DtIconCallbackStruct *cbs)
89 {
90   Time    lts, mct = 0;
91   static  Time prev_lts = 0;
92
93   if (cbs->reason == XmCR_ACTIVATE) {
94
95 #ifdef DEBUG
96     printf("In activate_filetype_icon callback.\n");
97 #endif
98     if (last_filetype_pushed && (last_filetype_pushed != wid)) {
99        XtVaSetValues(XtParent(last_filetype_pushed), XmNborderWidth, 0, NULL);
100     }
101     XtVaSetValues(XtParent(wid), XmNborderWidth, ICON_BORDER_WIDTH, NULL);
102
103     last_filetype_pushed = wid;
104
105     /********************************************************************/
106     /* This is the support needed to provide double-click functionality */
107     /* to the icon gadgets.  When double-clicked, the icon editor will  */
108     /* be launched.                                                     */
109     /********************************************************************/
110     XtVaSetValues(wid, XmNpushButtonClickTime, 0, NULL);
111
112     lts = XtLastTimestampProcessed(XtDisplay(wid));
113     mct = XtGetMultiClickTime(XtDisplay(wid));
114
115     if ((prev_lts + mct) > lts) {
116        prev_lts = XtLastTimestampProcessed(XtDisplay(wid));
117     } else {
118        prev_lts = XtLastTimestampProcessed(XtDisplay(wid));
119        return;
120     }
121
122 #ifdef DEBUG
123     printf("DblClick icon callback.\n");
124 #endif
125
126     activateCB_edit_icon(wid, CA_FILETYPE_ICONS, cbs);
127
128   }
129
130   return;
131 }
132
133 /******************************************************************************/
134 /*                                                                            */
135 /*   readAFFromGUI -                                                          */
136 /*                                                                            */
137 /*                                                                            */
138 /*                                                                            */
139 /******************************************************************************/
140 void readAFFromGUI (FiletypeData *pFiletypedata)
141 {
142   getAF_FiletypeName(pFiletypedata);
143   getAF_HelpText(pFiletypedata);
144   getAF_OpenCmd(pFiletypedata);
145   getAF_PrintCmd(pFiletypedata);
146   getAF_Icons(pFiletypedata);
147
148   return;
149 }
150
151 /******************************************************************************/
152 /*                                                                            */
153 /* getAF_FiletypeName - get name of filetype family                           */
154 /*                                                                            */
155 /* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure    */
156 /* OUTPUT: none                                                               */
157 /*                                                                            */
158 /******************************************************************************/
159 void getAF_FiletypeName (FiletypeData *pFiletypedata)
160 {
161   GetWidgetTextString(AF_FileTypeNameTextField, &(pFiletypedata->pszName));
162   return;
163 }
164
165 /******************************************************************************/
166 /*                                                                            */
167 /* getAF_HelpText - retrieve the Help text for the filetype                   */
168 /*                                                                            */
169 /* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure    */
170 /* OUTPUT: none                                                               */
171 /*                                                                            */
172 /******************************************************************************/
173 void getAF_HelpText (FiletypeData *pFiletypedata)
174 {
175   GetWidgetTextString(AF_FiletypeHelpText, &(pFiletypedata->pszHelp));
176   return;
177 }
178
179 /******************************************************************************/
180 /*                                                                            */
181 /* getAF_Icons - store temporary icon names.                                  */
182 /*                                                                            */
183 /* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure    */
184 /* OUTPUT: none                                                               */
185 /*                                                                            */
186 /******************************************************************************/
187 void getAF_Icons(FiletypeData *pFiletypedata)
188 {
189   IconData  *pIconData;
190
191   /***************************************************************/
192   /* Medium Pixmap                                               */
193   /***************************************************************/
194   pIconData = GetIconDataFromWid(AF_MED_IconGadget);
195   if ( (pIconData->pmDirtyBit) &&
196        (pIconData->pmFileName) &&
197        (strlen(pIconData->pmFileName)) ) {
198      pFiletypedata->pszMedPmIcon = XtMalloc(strlen(pIconData->pmFileName) + 1);
199      if (pFiletypedata->pszMedPmIcon) {
200         strcpy(pFiletypedata->pszMedPmIcon, pIconData->pmFileName);
201      }
202   }
203   pIconData->pmDirtyBit = False;
204   strcpy(pIconData->pmFileName, "");
205
206   /***************************************************************/
207   /* Medium Bitmap                                               */
208   /***************************************************************/
209   if ( (pIconData->bmDirtyBit) &&
210        (pIconData->bmFileName) &&
211        (strlen(pIconData->bmFileName)) ) {
212      pFiletypedata->pszMedBmIcon = XtMalloc(strlen(pIconData->bmFileName) + 1);
213      if (pFiletypedata->pszMedBmIcon) {
214         strcpy(pFiletypedata->pszMedBmIcon, pIconData->bmFileName);
215      }
216   }
217   pIconData->bmDirtyBit = False;
218   strcpy(pIconData->bmFileName, "");
219
220   /***************************************************************/
221   /* Tiny Pixmap                                                 */
222   /***************************************************************/
223   pIconData = GetIconDataFromWid(AF_TINY_IconGadget);
224   if ( (pIconData->pmDirtyBit) &&
225        (pIconData->pmFileName) &&
226        (strlen(pIconData->pmFileName)) ) {
227      pFiletypedata->pszTinyPmIcon = XtMalloc(strlen(pIconData->pmFileName) + 1);
228      if (pFiletypedata->pszTinyPmIcon) {
229         strcpy(pFiletypedata->pszTinyPmIcon, pIconData->pmFileName);
230      }
231   }
232   pIconData->pmDirtyBit = False;
233   strcpy(pIconData->pmFileName, "");
234
235   /***************************************************************/
236   /* Tiny Bitmap                                                 */
237   /***************************************************************/
238   if ( (pIconData->bmDirtyBit) &&
239        (pIconData->bmFileName) &&
240        (strlen(pIconData->bmFileName)) ) {
241      pFiletypedata->pszTinyBmIcon = XtMalloc(strlen(pIconData->bmFileName) + 1);
242      if (pFiletypedata->pszTinyBmIcon) {
243         strcpy(pFiletypedata->pszTinyBmIcon, pIconData->bmFileName);
244      }
245   }
246   pIconData->bmDirtyBit = False;
247   strcpy(pIconData->bmFileName, "");
248
249
250 #if 0
251   Widget    AF_wids[2];
252   int       i;
253
254
255   AF_wids[0] = AF_MED_IconGadget;
256   AF_wids[1] = AF_TINY_IconGadget;
257
258   for (i=0; i < 2; i++) {
259      /* pixmap */
260      pIconData = GetIconDataFromWid(AF_wids[i]);
261      if ( (pIconData->pmDirtyBit) &&
262           (pIconData->pmFileName) &&
263           (strlen(pIconData->pmFileName)) ) {
264         pFiletypedata->pszMedPmIcon = XtMalloc(strlen(pIconData->pmFileName) + 1);
265         if (pFiletypedata->pszMedPmIcon) {
266            strcpy(pFiletypedata->pszMedPmIcon, pIconData->pmFileName);
267         }
268      }
269      pIconData->pmDirtyBit = False;
270      strcpy(pIconData->pmFileName, "");
271
272      /* bitmap */
273      if ( (pIconData->bmDirtyBit) &&
274           (pIconData->bmFileName) &&
275           (strlen(pIconData->bmFileName)) ) {
276         pFiletypedata->pszMedBmIcon = XtMalloc(strlen(pIconData->bmFileName) + 1);
277         if (pFiletypedata->pszMedBmIcon) {
278            strcpy(pFiletypedata->pszMedBmIcon, pIconData->bmFileName);
279         }
280      }
281      pIconData->bmDirtyBit = False;
282      strcpy(pIconData->bmFileName, "");
283   }
284 #endif
285
286
287 }
288
289 /******************************************************************************/
290 /*                                                                            */
291 /* getAF_OpenCmd - retrieve the Open command string                           */
292 /*                                                                            */
293 /* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure    */
294 /* OUTPUT: none                                                               */
295 /*                                                                            */
296 /******************************************************************************/
297 void getAF_OpenCmd (FiletypeData *pFiletypedata)
298 {
299   GetWidgetTextString(AF_OpenCmdText, &(pFiletypedata->pszOpenCmd));
300   return;
301 }
302
303 /******************************************************************************/
304 /*                                                                            */
305 /* getAF_PrintCmd - retrieve Print command string                             */
306 /*                                                                            */
307 /* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure    */
308 /* OUTPUT: none                                                               */
309 /*                                                                            */
310 /******************************************************************************/
311 void getAF_PrintCmd (FiletypeData *pFiletypedata)
312 {
313   GetWidgetTextString(AF_FiletypePrintCmdTextField, &(pFiletypedata->pszPrintCmd));
314   return;
315 }
316
317 /******************************************************************************/
318 /*                                                                            */
319 /* init_AddFiletype_dialog_fields                                             */
320 /*                                                                            */
321 /* INPUT:  FiletypeData * - pointer to FiletypeData structure                 */
322 /* OUTPUT: none                                                               */
323 /*                                                                            */
324 /******************************************************************************/
325 void init_AddFiletype_dialog_fields(FiletypeData *pFtD)
326 {
327   char *pszIconFileName = (char *)NULL;
328   char *pszTmpFile;
329
330   if (pFtD->pszName) {
331      PutWidgetTextString(AF_FileTypeNameTextField, pFtD->pszName);
332   }
333
334   ParseAndUpdateID(pFtD);
335
336   if (pFtD->pszHelp) {
337      PutWidgetTextString(AF_FiletypeHelpText, pFtD->pszHelp);
338   }
339
340   if (pFtD->pszIcon) {
341
342      if (bShowPixmaps) {
343
344         /*************************/
345         /* Medium Pixmap         */
346         /*************************/
347         if (pFtD->pszMedPmIcon) {
348            SET_ICONGADGET_ICON(AF_MED_IconGadget, pFtD->pszMedPmIcon);
349         } else {
350            pszIconFileName = (char *)NULL;
351            FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtMEDIUM);
352            pszTmpFile = GetCorrectIconType(pszIconFileName);
353            SET_ICONGADGET_ICON(AF_MED_IconGadget, pszTmpFile);
354            if (pszIconFileName) XtFree(pszIconFileName);
355            if (pszTmpFile) XtFree(pszTmpFile);
356         }
357
358         /*************************/
359         /* Tiny Pixmap           */
360         /*************************/
361         if (pFtD->pszTinyPmIcon) {
362            SET_ICONGADGET_ICON(AF_TINY_IconGadget, pFtD->pszTinyPmIcon);
363         } else {
364            pszIconFileName = (char *)NULL;
365            FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtTINY);
366            pszTmpFile = GetCorrectIconType(pszIconFileName);
367            SET_ICONGADGET_ICON(AF_TINY_IconGadget, pszTmpFile);
368            if (pszIconFileName) XtFree(pszIconFileName);
369            if (pszTmpFile) XtFree(pszTmpFile);
370         }
371      } else {
372         /*************************/
373         /* Medium Pixmap         */
374         /*************************/
375         if (pFtD->pszMedBmIcon) {
376            SET_ICONGADGET_ICON(AF_MED_IconGadget, pFtD->pszMedBmIcon);
377         } else {
378            pszIconFileName = (char *)NULL;
379            FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtMEDIUM);
380            pszTmpFile = GetCorrectIconType(pszIconFileName);
381            SET_ICONGADGET_ICON(AF_MED_IconGadget, pszTmpFile);
382            if (pszIconFileName) XtFree(pszIconFileName);
383            if (pszTmpFile) XtFree(pszTmpFile);
384         }
385
386         /*************************/
387         /* Tiny Pixmap           */
388         /*************************/
389         if (pFtD->pszTinyBmIcon) {
390            SET_ICONGADGET_ICON(AF_TINY_IconGadget, pFtD->pszTinyBmIcon);
391         } else {
392            pszIconFileName = (char *)NULL;
393            FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtTINY);
394            pszTmpFile = GetCorrectIconType(pszIconFileName);
395            SET_ICONGADGET_ICON(AF_TINY_IconGadget, pszTmpFile);
396            if (pszIconFileName) XtFree(pszIconFileName);
397            if (pszTmpFile) XtFree(pszTmpFile);
398         }
399      }
400
401
402 #if 0
403         /*************************/
404         /* Tiny Pixmap           */
405         /*************************/
406         pszIconFileName = (char *)NULL;
407         if (pFtD->pszTinyPmIcon) {
408            pszTmpFile = pFtD->pszTinyPmIcon;
409         } else {
410            FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtTINY);
411            pszTmpFile = pszIconFileName;
412         }
413         SET_ICONGADGET_ICON(AF_TINY_IconGadget, pszTmpFile);
414         if (pszIconFileName) XtFree(pszIconFileName);
415
416      } else {
417
418         /*************************/
419         /* Medium Bitmap         */
420         /*************************/
421         pszIconFileName = (char *)NULL;
422         if (pFtD->pszMedBmIcon) {
423            pszTmpFile = pFtD->pszMedBmIcon;
424         } else {
425            FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtMEDIUM);
426            pszTmpFile = pszIconFileName;
427         }
428         SET_ICONGADGET_ICON(AF_MED_IconGadget, pszTmpFile);
429         if (pszIconFileName) XtFree(pszIconFileName);
430
431         /*************************/
432         /* Tiny Bitmap           */
433         /*************************/
434         pszIconFileName = (char *)NULL;
435         if (pFtD->pszTinyBmIcon) {
436            pszTmpFile = pFtD->pszTinyBmIcon;
437         } else {
438            FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtTINY);
439            pszTmpFile = pszIconFileName;
440         }
441         SET_ICONGADGET_ICON(AF_TINY_IconGadget, pszTmpFile);
442         if (pszIconFileName) XtFree(pszIconFileName);
443      }
444 #endif
445
446   }
447
448   if (pFtD->pszOpenCmd) {
449      PutWidgetTextString(AF_OpenCmdText, pFtD->pszOpenCmd);
450   }
451   if (pFtD->pszPrintCmd) {
452      PutWidgetTextString(AF_FiletypePrintCmdTextField, pFtD->pszPrintCmd);
453   }
454
455   return;
456 }
457
458 /******************************************************************************/
459 /*                                                                            */
460 /* clear_AddFiletype_dialog_fields                                            */
461 /*                                                                            */
462 /* INPUT:  FiletypeData * - pointer to FiletypeData structure                 */
463 /* OUTPUT: none                                                               */
464 /*                                                                            */
465 /******************************************************************************/
466 void clear_AddFiletype_dialog_fields(void)
467 {
468   /*char pszFile[MAXBUFSIZE];*/
469
470   clear_text(AF_FileTypeNameTextField);
471   clear_text(AF_IdCharacteristicsText);
472   clear_text(AF_FiletypeHelpText);
473   createCB_IconGadget(AF_MED_IconGadget, FALSE, Medium_Icon);
474   createCB_IconGadget(AF_TINY_IconGadget, FALSE, Tiny_Icon);
475   /*
476   SET_ICONGADGET_ICON_AND_EXT(AF_MED_IconGadget, af_med_icon_default, pszFile);
477   SET_ICONGADGET_ICON_AND_EXT(AF_TINY_IconGadget, af_tiny_icon_default, pszFile);
478   */
479   clear_text(AF_OpenCmdText);
480   clear_text(AF_FiletypePrintCmdTextField);
481
482   return;
483 }
484
485 /******************************************************************************/
486 /*                                                                            */
487 /* free_Filetypedata                                                          */
488 /*                                                                            */
489 /* INPUT:  FiletypeData * - pointer to FiletypeData structure                 */
490 /* OUTPUT: none                                                               */
491 /*                                                                            */
492 /******************************************************************************/
493 void free_Filetypedata(FiletypeData *pFtD)
494 {
495   char buffer[MAXFILENAME];
496
497 #ifdef DEBUG
498   printf("Free FiletypeData structure\n"); /* debug */
499 #endif
500
501   if (pFtD->pszName) XtFree(pFtD->pszName);
502 #if DEBUG
503   printf("Freed Name\n");
504 #endif
505
506   if (pFtD->pszIcon) XtFree(pFtD->pszIcon);
507   if (pFtD->pszMedPmIcon) {
508 #if DEBUG
509      printf("free_Filetypedata: unlink '%s'\n", pFtD->pszMedPmIcon);  /* debug */
510 #endif
511      unlink(pFtD->pszMedPmIcon);
512      XtFree(pFtD->pszMedPmIcon);
513   }
514   if (pFtD->pszMedBmIcon) {
515 #if DEBUG
516      printf("free_Filetypedata: unlink '%s'\n", pFtD->pszMedBmIcon);  /* debug */
517 #endif
518      unlink(pFtD->pszMedBmIcon);
519      /**** remove the mask if it exists ****/
520      sprintf(buffer, "%s_m", pFtD->pszMedBmIcon);
521      unlink(buffer);
522      XtFree(pFtD->pszMedBmIcon);
523   }
524   if (pFtD->pszTinyPmIcon) {
525 #if DEBUG
526      printf("free_Filetypedata: unlink '%s'\n", pFtD->pszTinyPmIcon);  /* debug */
527 #endif
528      unlink(pFtD->pszTinyPmIcon);
529      XtFree(pFtD->pszTinyPmIcon);
530   }
531   if (pFtD->pszTinyBmIcon) {
532 #if DEBUG
533      printf("free_Filetypedata: unlink '%s'\n", pFtD->pszTinyBmIcon);  /* debug */
534 #endif
535      unlink(pFtD->pszTinyBmIcon);
536      /**** remove the mask if it exists ****/
537      sprintf(buffer, "%s_m", pFtD->pszTinyBmIcon);
538      unlink(buffer);
539      XtFree(pFtD->pszTinyBmIcon);
540   }
541
542   if (pFtD->pszHelp) XtFree(pFtD->pszHelp);
543   if (pFtD->pszOpenCmd) XtFree(pFtD->pszOpenCmd);
544   if (pFtD->pszPrintCmd) XtFree(pFtD->pszPrintCmd);
545   if (pFtD->pszPattern) XtFree(pFtD->pszPattern);
546   if (pFtD->pszPermissions) XtFree(pFtD->pszPermissions);
547   if (pFtD->pszContents) XtFree(pFtD->pszContents);
548   XtFree((char *) pFtD);
549   return;
550 }
551
552 /******************************************************************************/
553 /*                                                                            */
554 /* AddFiletypeToList                                                          */
555 /*                                                                            */
556 /* INPUT:  none                                                               */
557 /* OUTPUT: none                                                               */
558 /*                                                                            */
559 /******************************************************************************/
560 void AddFiletypeToList(void)
561 {
562   if (!XmListItemExists(CA_FiletypesList, XmStringCreateSimple(XmTextFieldGetString(AF_FileTypeNameTextField)))) {
563     XmListAddItem(CA_FiletypesList, XmStringCreateSimple(XmTextFieldGetString(AF_FileTypeNameTextField)), 0);
564   }
565 }
566
567 /******************************************************************************/
568 /*                                                                            */
569 /* UpdateFiletypeDataArray                                                    */
570 /*                                                                            */
571 /* INPUT:  none                                                               */
572 /* OUTPUT: none                                                               */
573 /*                                                                            */
574 /******************************************************************************/
575 void UpdateFiletypeDataArray(FiletypeData *pFtD)
576 {
577   FiletypeData  **papArray;
578   int           i;
579
580   /**************************************************************************/
581   /* Add this structure to the filetype array in the ActionData structure.  */
582   /**************************************************************************/
583   papArray = (FiletypeData **) XtMalloc(sizeof(FiletypeData *) * (AD.cFiletypes + 1));
584   for (i=0; i < AD.cFiletypes; i++) {
585      papArray[i] = AD.papFiletypes[i];
586   }
587   papArray[AD.cFiletypes] = pFtD;
588   if (AD.papFiletypes) {
589     XtFree((char *) AD.papFiletypes);
590   }
591   AD.papFiletypes = papArray;
592   AD.cFiletypes++;
593 }
594
595 /******************************************************************************/
596 /*                                                                            */
597 /* AddFiletypeCheckFields                                                     */
598 /*                                                                            */
599 /* INPUT:  none                                                               */
600 /* OUTPUT: FALSE  - no errors found                                           */
601 /*         TRUE   - found errors                                              */
602 /*                                                                            */
603 /******************************************************************************/
604 Boolean AddFiletypeCheckFields(void)
605 {
606
607   char    *ptr = (char *)NULL;
608   Boolean bError = FALSE;
609   char    *msgPtr, *errPtr;
610
611   /**************************************************************************/
612   /* Check if filetype name is present.                                     */
613   /**************************************************************************/
614   if (!bError) {
615      ptr = (char *)NULL;
616      GetWidgetTextString(AF_FileTypeNameTextField, &ptr);
617 #ifdef DEBUG
618      printf("Filetype Family Name = '%s'\n", ptr);
619 #endif
620      if (!ptr) {
621         msgPtr = GETMESSAGE(8, 10, "The Datatype Family Name is missing.\n\
622 Enter a name in the 'Name of Datatype Family' field.");
623         errPtr = XtNewString(msgPtr);
624         display_error_message(AddFiletype, errPtr);
625         XtFree(errPtr);
626         XmProcessTraversal(AF_FileTypeNameTextField, XmTRAVERSE_CURRENT);
627         bError = TRUE;
628      } else {
629         XtFree(ptr);
630      }
631   }
632
633   /**************************************************************************/
634   /* Check if identifying characteristics are present.                      */
635   /**************************************************************************/
636   if (!bError) {
637      ptr = (char *)NULL;
638      GetWidgetTextString(AF_IdCharacteristicsText, &ptr);
639 #ifdef DEBUG
640      printf("Identifying Chars = '%s'\n", ptr);
641 #endif
642      if (!ptr) {
643         msgPtr = GETMESSAGE(8, 15,
644              "The Identifying Characteristics are missing.\n\
645 You must specify the characteristics before the datatype\n\
646 can be created. Select the Edit button next to the\n\
647 Identifying Characteristics list to specify the characteristics.");
648         errPtr = XtNewString(msgPtr);
649         display_error_message(AddFiletype, errPtr);
650         XtFree(errPtr);
651         XmProcessTraversal(AF_IdCharacteristicsEdit, XmTRAVERSE_CURRENT);
652         bError = TRUE;
653      } else {
654         XtFree(ptr);
655      }
656   }
657
658   return(bError);
659 }
660