FOSSology  4.4.0
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  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  int rc;
26 
27  if (argc != 3)
28  {
29  fprintf(stderr, "Usage: %s type filename > output\n", argv[0]);
30  fprintf(stderr, " Returns: 0 if exists in repository, 1 if not in repository.\n");
31  exit(-1);
32  }
33 
34  rc = fo_RepExist(argv[1], argv[2]);
35  if (rc == 1)
36  {
37  printf("0\n");
38  return (0);
39  }
40  printf("1\n");
41  return (1);
42 } /* main() */
43 
char BuildVersion[]
Definition: buckets.c:68
int fo_RepExist(char *Type, char *Filename)
Determine if a file exists.
Definition: libfossrepo.c:486