The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
filename.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file filename.c
5 
6  \version V1.0
7  \date 12.03.15
8  \brief Extract parts of filename
9 
10  \copyright (c) Dr. Andrew C. R. Martin 2015
11  \author Dr. Andrew C. R. Martin
12  \par
13  Institute of Structural & Molecular Biology,
14  University College London,
15  Gower Street,
16  London.
17  WC1E 6BT.
18  \par
19  andrew@bioinf.org.uk
20  andrew.martin@ucl.ac.uk
21 
22 **************************************************************************
23 
24  This code is NOT IN THE PUBLIC DOMAIN, but it may be copied
25  according to the conditions laid out in the accompanying file
26  COPYING.DOC.
27 
28  The code may be modified as required, but any modifications must be
29  documented so that the person responsible can be identified.
30 
31  The code may not be sold commercially or included as part of a
32  commercial product except as described in the file COPYING.DOC.
33 
34 **************************************************************************
35 
36  Description:
37  ============
38 
39 
40 **************************************************************************
41 
42  Usage:
43  ======
44 
45 **************************************************************************
46 
47  Revision History:
48  =================
49 - V1.0 12.03.15 Original
50 
51 *************************************************************************/
52 /* Doxygen
53  -------
54  #GROUP General Programming
55  #SUBGROUP Filenames
56  #FUNCTION blCheckProgName()
57  Tests if a program name matches the specified name
58 */
59 /************************************************************************/
60 /* Includes
61 */
62 #include <string.h>
63 #include <stdlib.h>
64 #include <stdio.h>
65 #include "macros.h"
66 #include "SysDefs.h"
67 
68 /************************************************************************/
69 /* Defines and macros
70 */
71 
72 /************************************************************************/
73 /* Globals
74 */
75 
76 /************************************************************************/
77 /* Prototypes
78 */
79 
80 /************************************************************************/
81 /*>char *blCheckProgName()
82  --------------------------------
83 *//**
84 
85  \param[in] *filename A PDB filename containing a PDB code
86  \return The PDB code (lower case)
87  NULL if memory allocation fails
88  XXXX if filename blank or NULL or if
89  unable to find PDB code
90 
91  This routine attempts to convert a filename stem to a PDB code.
92 
93 - 12.03.15 Original By: ACRM
94 */
95 BOOL blCheckProgName(char *progname, char *expected)
96 {
97  char *chp;
98  char buffer[240];
99 
100  sprintf(buffer, "/%s", expected);
101 
102  /* Is the last thing after a path spec the expected program name */
103  if((chp = strstr(progname, buffer))!=NULL)
104  {
105  if(*(chp+9) == '\0')
106  return(TRUE);
107  }
108  /* Is the whole thing the expected program name */
109  if(!strcmp(progname, expected))
110  return(TRUE);
111 
112  return(FALSE);
113 }
114 
short BOOL
Definition: SysDefs.h:64
#define NULL
Definition: array2.c:99
#define FALSE
Definition: macros.h:223
Useful macros.
#define TRUE
Definition: macros.h:219
System-type variable type definitions.
BOOL blCheckProgName(char *progname, char *expected)
Definition: filename.c:95