nsprpub/pr/tests/op_filok.c

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

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

mercurial