FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
rephost.c
Go to the documentation of this file.
1 /****************************************************************
2 rephost: display the host to the file.
3 
4 Copyright (C) 2007-2011 Hewlett-Packard Development Company, L.P.
5 
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License version 2.1 as published by the Free Software Foundation.
9 
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public License
16 along with this library; if not, write to the Free Software Foundation, Inc.0
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 ****************************************************************/
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include "libfossrepo.h"
30 
31 #ifdef COMMIT_HASH
32 char BuildVersion[]="Build version: " COMMIT_HASH ".\n";
33 #endif
34 
35 int main(int argc, char* argv[])
36 {
37  char* Host;
38  int i;
39 
40  if ((argc % 2) != 1)
41  {
42  fprintf(stderr, "Usage: %s type filename [type filename [...]]\n", argv[0]);
43  exit(-1);
44  }
45 
46  for (i = 1; i < argc; i += 2)
47  {
48  Host = fo_RepGetHost(argv[i], argv[i + 1]);
49  if (!Host) printf("localhost\n");
50  else
51  {
52  printf("%s\n", Host);
53  free(Host);
54  }
55  }
56  return (0);
57 } /* main() */
58 
char BuildVersion[]
Definition: buckets.c:79
char * fo_RepGetHost(char *Type, char *Filename)
Determine the host for a filename.
Definition: libfossrepo.c:233