michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /*********************************************************************** michael@0: ** michael@0: ** Name: op_filnf.c michael@0: ** michael@0: ** Description: Test Program to verify the PR_FILE_NOT_FOUND_ERROR michael@0: ** This test program also uses the TRUNCATE option michael@0: ** michael@0: ** Modification History: michael@0: ** 03-June-97 AGarcia- Initial version michael@0: ***********************************************************************/ michael@0: michael@0: /*********************************************************************** michael@0: ** Includes michael@0: ***********************************************************************/ michael@0: /* Used to get the command line option */ michael@0: #include "prinit.h" michael@0: #include "prmem.h" michael@0: #include "prio.h" michael@0: #include "prerror.h" michael@0: #include michael@0: #include "plgetopt.h" michael@0: michael@0: static PRFileDesc *t1; michael@0: PRIntn error_code; michael@0: michael@0: int main(int argc, char **argv) michael@0: { michael@0: PR_STDIO_INIT(); michael@0: t1 = PR_Open("/usr/tmp/ttools/err03.tmp", PR_TRUNCATE | PR_RDWR, 0666); michael@0: if (t1 == NULL) { michael@0: if (PR_GetError() == PR_FILE_NOT_FOUND_ERROR) { michael@0: printf ("error code is %d \n", PR_GetError()); michael@0: printf ("PASS\n"); michael@0: return 0; michael@0: } michael@0: else { michael@0: printf ("error code is %d \n", PR_GetError()); michael@0: printf ("FAIL\n"); michael@0: return 1; michael@0: } michael@0: } michael@0: PR_Close(t1); michael@0: printf ("opened a file that should not exist\n"); michael@0: printf ("FAIL\n"); michael@0: return 1; michael@0: }