Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
justify.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file justify.c
5 
6  \version V1.2
7  \date 07.07.14
8  \brief
9 
10  \copyright (c) Dr. Andrew C. R. Martin, University of Reading, 2002-14
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 30.05.02 Original
50 - V1.1 18.06.02 Added string.h
51 - V1.2 07.07.14 Use bl prefix for functions By: CTP
52 
53 *************************************************************************/
54 /* Doxygen
55  -------
56  #GROUP General Programming
57  #SUBGROUP String handling
58  #FUNCTION blRightJustify()
59  Right justifies a string in place
60 */
61 /************************************************************************/
62 /* Includes
63 */
64 #include <string.h>
65 
66 /************************************************************************/
67 /* Defines and macros
68 */
69 
70 /************************************************************************/
71 /* Globals
72 */
73 
74 /************************************************************************/
75 /* Prototypes
76 */
77 
78 /************************************************************************/
79 /*>void blRightJustify(char *string)
80  ---------------------------------
81 *//**
82 
83  \param[in,out] *string A string
84 
85  Right justifies a string in place
86 
87 - 30.05.02 Original By: ACRM
88 - 07.07.14 Use bl prefix for functions By: CTP
89 */
90 void blRightJustify(char *string)
91 {
92  int len, dec;
93 
94  len = strlen(string);
95  len--;
96 
97  if(len)
98  {
99  while(string[len] == ' ')
100  {
101  for(dec = len; dec; dec--)
102  {
103  string[dec] = string[dec-1];
104  }
105  string[0] = ' ';
106  }
107  }
108 }
109 
void blRightJustify(char *string)
Definition: justify.c:90