1 /*
2    Common Routines
3    --------------------------------------------------------------------
4    Country Codes
5 
6    Copyright (C) 1999, 2000 Diego Javier Grigna <diego@grigna.com>
7 
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 */
22 
23 #include "common.h"
24 
25 /* The program name, argv[ 0] */
26 char *progname;
27 
cc_basename(char * name)28 char *cc_basename( char *name)
29 {
30  char *base;
31 
32  if( name == NULL) {
33      fprintf( stderr, "\n%s: cc_basename called with NULL argument\n\n", progname);
34      exit( -1);
35  }
36 
37  base = strrchr( name, '/');
38 
39  return ( ( base != NULL) ? base + 1 : name);
40 }
41 
cc_lowercase(char * str)42 void cc_lowercase( char *str)
43 {
44  char *a = str;
45 
46  while( a && *a) {
47         *a = tolower( *a);
48         a++;
49  }
50 
51 }
52 
cc_hyp(void)53 char *cc_hyp( void)
54 {
55  static char hyp[ 128];
56 
57  memset( &hyp, '-', 77);
58  hyp[ 77] = 0;
59 
60  return hyp;
61 }
62 
63