FOSSology  4.4.0
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  SPDX-FileCopyrightText: © 2007-2011 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: LGPL-2.1-only
6 */
15 #include <stdlib.h>
16 #include <stdio.h>
17 #include "libfossrepo.h"
18 
19 #ifdef COMMIT_HASH
20 char BuildVersion[]="Build version: " COMMIT_HASH ".\n";
21 #endif
22 
23 int main(int argc, char* argv[])
24 {
25  char* Host;
26  int i;
27 
28  if ((argc % 2) != 1)
29  {
30  fprintf(stderr, "Usage: %s type filename [type filename [...]]\n", argv[0]);
31  exit(-1);
32  }
33 
34  for (i = 1; i < argc; i += 2)
35  {
36  Host = fo_RepGetHost(argv[i], argv[i + 1]);
37  if (!Host) printf("localhost\n");
38  else
39  {
40  printf("%s\n", Host);
41  free(Host);
42  }
43  }
44  return (0);
45 } /* main() */
46 
char BuildVersion[]
Definition: buckets.c:68
char * fo_RepGetHost(char *Type, char *Filename)
Determine the host for a filename.
Definition: libfossrepo.c:221