ftp.nice.ch/pub/next/unix/developer/pcn.2.0.s.tar.gz#/contrib/gauge/Xsw/FileObjects.c

This is FileObjects.c in view mode; [Download] [Up]

#if ( !defined(lint) && !defined(SABER))
  static char PCN_rcsid[] = "$Header: /ufs/comp/carl/PCN/IF/Xsw/RCS/FileObjects.c,v 1.3 1992/01/23 03:14:00 carl Exp $";
#endif
/******************************************************************************
*									      *
*	Copyright (C) The Aerospace Corporation 1991			      *
*									      *
*	This software was developed by The Aerospace Corporation as a 	      *
*	research endeavor for the United States Air Force 		      *
*	Space Systems Division.  The current version of the Gauge	      *
*	computer program is available for  release to you for		      *
*	educational and research purposes only.  It is not 		      *
*	to be used for commercial purposes.				      *
*									      *
*	In addition, the following conditions shall apply.		      *
*									      *
*	1) The computer software and documentation were designed to	      *
*	satisfy internal Aerospace requirements only.			      *
*	The software is provided ``as is,'' and The Aerospace Corporation     *
*	makes no warranty, expressed or implied, as to it accuracy,	      *
*	functioning, or fitness for a particular purpose.		      *
*									      *
*	2) The Aerospace Corporation and its personnel are not		      *
*	responsible for providing technical support or general assistance     *
*	with respect to the software.					      *
*									      *
*	3) Neither The Aerospace Corporation nor its personnel shall be	      *
*	liable for claims, losses, or damages arising out of or connected     *
*	with the use of this software.					      *
*	Your sole and exclusive remedy shall be to request a replacement      *
*	copy of the program.						      *
*									      *
******************************************************************************/

#include "Xsw.h"

String
XswGetExtension(extensions,file)
SCPair *extensions;
String file;
{
  int i, j;

  i = strlen(file);
  file  = file + i;
  while (extensions->string != NULL) {
    j = strlen(extensions->string);
    if (i > j && XswStrCmp(file - j, extensions->string)) 
      return file - j;
    else extensions++;
  }
  return "";
}
  
Boolean
XswSCPairListCall(list, string, w, call_data)
SCPair * list;
String string;
Widget w;
XtPointer call_data;
{
  static XtCallbackRec * callback_list;
  
  while (list->string != NULL) {
    if (XswStrCmp(string, list->string)) break;
    else list++;
  }
  if (list->string != NULL) {
    if (list->callback != NULL) {
      callback_list = list->callback;
      (*(callback_list[0].callback))(w, callback_list[0].closure,
				     call_data);
    }
    return True;
  } else {
    return False;
  }
}

/*************************************
Boolean
XswGetHelp(list, ext, w)
FileObjectData * list;
String ext;
Widget w;
{ 
  while (list->ext != NULL) {
    if (XswStrCmp(ext, list->ext)) break;
    else list++;
  }
  if (list->ext != NULL) {
    String lib_dir = XswLibDir(w);
    String help_file;
    help_file = XtMalloc(sizeof(char) *
			 (strlen(lib_dir)+strlen(list->help)+4));
    sprintf(help_file, "%s/%s", lib_dir, list->help);
    XswShowHelp(help_file, "Help Window");
    return True;
  } else {
    return False;
  }
}
***************************************/

StringList
XswSCPairListGetStrings(list)
SCPair * list;
{ 
  SCPair * temp = list;
  StringList slist;
  int cnt=0;
  int i;

  while (temp->string != NULL) { cnt++; temp++; }
  
  slist = (StringList)XtMalloc((cnt+1)*sizeof(String));

  for(i=0; i<cnt; i++) {
    slist[i] = list[i].string;
  }
  slist[i] = NULL;

  return slist;
}



These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.