FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
repexist.c
Go to the documentation of this file.
1 /****************************************************************
2 repexist: Check if a file exists
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 
19 ****************************************************************/
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include "libfossrepo.h"
31 
32 #ifdef COMMIT_HASH
33 char BuildVersion[]="Build version: " COMMIT_HASH ".\n";
34 #endif
35 
36 int main(int argc, char* argv[])
37 {
38  int rc;
39 
40  if (argc != 3)
41  {
42  fprintf(stderr, "Usage: %s type filename > output\n", argv[0]);
43  fprintf(stderr, " Returns: 0 if exists in repository, 1 if not in repository.\n");
44  exit(-1);
45  }
46 
47  rc = fo_RepExist(argv[1], argv[2]);
48  if (rc == 1)
49  {
50  printf("0\n");
51  return (0);
52  }
53  printf("1\n");
54  return (1);
55 } /* main() */
56 
char BuildVersion[]
Definition: buckets.c:79
int fo_RepExist(char *Type, char *Filename)
Determine if a file exists.
Definition: libfossrepo.c:498