root/maint/gnulib/tests/test-supersede.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /* Tests for opening a file without destroying an old file with the same name.
   2 
   3    Copyright (C) 2020-2021 Free Software Foundation, Inc.
   4 
   5    This program is free software: you can redistribute it and/or modify
   6    it under the terms of the GNU General Public License as published by
   7    the Free Software Foundation; either version 3 of the License, or
   8    (at your option) any later version.
   9 
  10    This program 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
  13    GNU General Public License for more details.
  14 
  15    You should have received a copy of the GNU General Public License
  16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  17 
  18 /* Written by Bruno Haible, 2020.  */
  19 
  20 #include <config.h>
  21 
  22 /* Specification.  */
  23 #include "supersede.h"
  24 
  25 #include <errno.h>
  26 #include <fcntl.h>
  27 #include <stdbool.h>
  28 #include <stdlib.h>
  29 #include <string.h>
  30 #include <sys/stat.h>
  31 #include <unistd.h>
  32 
  33 #include "filenamecat.h"
  34 #include "read-file.h"
  35 #include "macros.h"
  36 
  37 /* The name of the "always silent" device.  */
  38 #if defined _WIN32 && ! defined __CYGWIN__
  39 /* Native Windows API.  */
  40 # define DEV_NULL "NUL"
  41 #else
  42 /* Unix API.  */
  43 # define DEV_NULL "/dev/null"
  44 #endif
  45 
  46 #include "test-supersede-open.h"
  47 #include "test-supersede-fopen.h"
  48 
  49 int
  50 main (void)
     /* [previous][next][first][last][top][bottom][index][help] */
  51 {
  52   test_open_supersede (false, false);
  53   test_open_supersede (false, true);
  54   test_open_supersede (true, false);
  55   test_open_supersede (true, true);
  56 
  57   test_fopen_supersede (false, false);
  58   test_fopen_supersede (false, true);
  59   test_fopen_supersede (true, false);
  60   test_fopen_supersede (true, true);
  61 
  62   return 0;
  63 }

/* [previous][next][first][last][top][bottom][index][help] */