backout 29799f914cab, Bug 917642 - [Helix] Please update the helix blobs
[gecko.git] / nsprpub / pr / tests / op_filok.c
blob035765a86fc423897f8ac0b1adbd5cf510bef78f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /***********************************************************************
7 **
8 ** Name: op_filok.c
9 **
10 ** Description: Test Program to verify the PR_Open finding an existing file.
12 ** Modification History:
13 ** 03-June-97 AGarcia- Initial version
14 ***********************************************************************/
16 /***********************************************************************
17 ** Includes
18 ***********************************************************************/
19 /* Used to get the command line option */
20 #include "prinit.h"
21 #include "prmem.h"
22 #include "prio.h"
23 #include "prerror.h"
24 #include <stdio.h>
26 static PRFileDesc *t1;
28 int main(int argc, char **argv)
30 PR_STDIO_INIT();
32 t1 = PR_Open(argv[0], PR_RDONLY, 0666);
34 if (t1 == NULL) {
35 printf ("error code is %d \n", PR_GetError());
36 printf ("File %s should be found\n", argv[0]);
37 return 1;
38 } else {
39 if (PR_Close(t1) == PR_SUCCESS) {
40 printf ("Test passed \n");
41 return 0;
42 } else {
43 printf ("cannot close file\n");
44 printf ("error code is %d\n", PR_GetError());
45 return 1;