public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/y2038] support: Add 'touch' command
Date: Thu,  4 Mar 2021 17:36:43 +0000 (GMT)	[thread overview]
Message-ID: <20210304173643.BF2B73AA903D@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f39fc7d5966f4a1f864ad2d3c167d3af3e33f434

commit f39fc7d5966f4a1f864ad2d3c167d3af3e33f434
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Aug 5 14:05:54 2020 -0300

    support: Add 'touch' command
    
    It allow creates empty files with an specific mode.

Diff:
---
 support/test-container.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/support/test-container.c b/support/test-container.c
index 28cc44d9f1..0d85bfb357 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -104,6 +104,7 @@ int verbose = 0;
 	 cwd PATH
 	 exec FILE
 	 mkdirp MODE DIR
+	 touch MODE FILE
 
        variables:
 	 $B/ build dir, equivalent to $(common-objpfx)
@@ -129,6 +130,7 @@ int verbose = 0;
 	 - 'cwd': set test working directory
 	 - 'exec': change test binary location (may end in /)
 	 - 'mkdirp': A minimal "mkdir -p FILE" command.
+	 - 'touch': A minimal 'touch' command to create empty files.
 
    * mytest.root/postclean.req causes fresh rsync (with delete) after
      test if present
@@ -1018,6 +1020,15 @@ main (int argc, char **argv)
 		TEST_COMPARE (errno, 0);
 		xmkdirp (the_words[2], m);
 	      }
+	    else if (nt == 3 && strcmp (the_words[0], "touch") == 0)
+	      {
+		long int m;
+		errno = 0;
+		m = strtol (the_words[1], NULL, 0);
+		TEST_COMPARE (errno, 0);
+
+		xclose (xopen (the_words[2], O_WRONLY | O_TRUNC | O_CREAT, m));
+	      }
 	    else if (nt > 0 && the_words[0][0] != '#')
 	      {
 		fprintf (stderr, "\033[31minvalid [%s]\033[0m\n", the_words[0]);


             reply	other threads:[~2021-03-04 17:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 17:36 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-05 19:19 Adhemerval Zanella
2021-03-04 11:29 Adhemerval Zanella
2021-03-02 12:30 Adhemerval Zanella
2021-03-01 17:35 Adhemerval Zanella
2021-02-26 20:41 Adhemerval Zanella
2021-02-23 20:39 Adhemerval Zanella
2021-02-23 12:36 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210304173643.BF2B73AA903D@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).