public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v9 2/5] Add script to generate arch(s) dependant syscalls
Date: Fri, 1 Nov 2024 18:02:33 +0100	[thread overview]
Message-ID: <20241101170233.GA1294836@pevik> (raw)
In-Reply-To: <d6bf0ba3-92eb-476e-8c6d-b6fcec1c258c@suse.com>

> Hi,

> On 11/1/24 12:30, Petr Vorel wrote:
> > Hi Andrea,

> > ...
> > > +		for syscall in $(cat ${TEMP}/syscall-names.txt); do
> > > +			printf "
> > > +		#ifdef __NR_$syscall
> > > +			printf(\"$syscall %%d"
> > > +			# i know the following print is ugly, but dash and bash
> > > +			# treat double quoted strings in a different way and we
> > > +			# really need to inject '\n' character in the C code
> > > +			# rather than carriage return
> > > +			printf '\\n'
> > > +			printf "\", __NR_$syscall);
> > How about using heredocs? IMHO more compatible way of echo/printf "" for new
> > lines:
> > cat << EOF
> > ...
> > EOF

> > I should have noted that at previous version.
> > Hint: looking into tst_test.sh can sometimes help.

> > Also there is echo/printf '' variant:
> > cat << 'EOF'
> > EOF
> > https://unix.stackexchange.com/questions/462593/how-to-escape-a-character-in-a-heredoc-bash-script/462595#462595

> > There is also ~EOF - ignore leading whitespace, even for terminating EOF.

> > Kind regards,
> > Petr

> This method is so ugly: basically the ending EOF must be in the first column
> of the next line, otherwise it won't be parsed. And this breaks readability
> of course (probably some debugging). I really would avoid this way..

I would say EOF if quite standard way of using shell + it allows you to use \n
unescaped:

syscall="XXX"
cat > foo.txt <<EOF
	printf(\"$syscall %%d"
	printf '\n'
EOF

prints into foo.txt:
	printf(\"XXX %%d"
	printf '\n'

But sure, it's just a suggestion based your comment.

Kind regards,
Petr

> Andrea


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-11-01 17:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 10:48 [LTP] [PATCH v9 0/5] Automatically generate syscalls.h Andrea Cervesato
2024-11-01 10:48 ` [LTP] [PATCH v9 1/5] Refactor regen.sh script to generate syscalls Andrea Cervesato
2024-11-01 10:48 ` [LTP] [PATCH v9 2/5] Add script to generate arch(s) dependant syscalls Andrea Cervesato
2024-11-01 11:30   ` Petr Vorel
2024-11-01 13:23     ` Andrea Cervesato via ltp
2024-11-01 17:02       ` Petr Vorel [this message]
2024-11-01 10:48 ` [LTP] [PATCH v9 3/5] Update arch(s) syscalls files Andrea Cervesato
2024-11-04  8:05   ` Petr Vorel
2024-11-04 11:12   ` Cyril Hrubis
2024-11-01 10:48 ` [LTP] [PATCH v9 4/5] Delete obsolete strip_syscall.awk file Andrea Cervesato
2024-11-01 10:48 ` [LTP] [PATCH v9 5/5] Add documentation about syscalls.h generator Andrea Cervesato
2024-11-04  8:17   ` Petr Vorel
2024-11-04 12:25   ` Cyril Hrubis
2024-11-05  8:55 ` [LTP] [PATCH v9 0/5] Automatically generate syscalls.h Andrea Cervesato via ltp

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=20241101170233.GA1294836@pevik \
    --to=pvorel@suse.cz \
    --cc=andrea.cervesato@suse.com \
    --cc=ltp@lists.linux.it \
    /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