2
* makepmafile.c -- Create a small sparse file.
6
* Copyright (C) 2022, 2023,
7
* the Free Software Foundation, Inc.
9
* This file is part of GAWK, the GNU implementation of the
10
* AWK Programming Language.
12
* GAWK is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation; either version 3 of the License, or
15
* (at your option) any later version.
17
* GAWK is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
32
#include <sys/types.h>
37
main(int argc, char **argv)
39
size_t four_meg = 1024 * 1024 * 4;
41
int fd = creat("test.pma", 0600);
44
fprintf(stderr, "%s: could not create test.pma: %s\n",
45
argv[0], strerror(errno));
49
if (lseek(fd, four_meg - 1, SEEK_SET) < 0) {
50
fprintf(stderr, "%s: lseek failed: %s\n",
51
argv[0], strerror(errno));
55
if (write(fd, &c, 1) < 0) {
56
fprintf(stderr, "%s: write failed: %s\n",
57
argv[0], strerror(errno));