Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Usage: fortune -P [] -a [xsz] [Q: [file]] [rKe9] -v6[+] dataspec ... inputdir


computers / comp.os.linux.misc / Re: Why No "fcopy()" in 'C' ?

SubjectAuthor
* Why No "fcopy()" in 'C' ?MSB
+* Re: Why No "fcopy()" in 'C' ?The Natural Philosopher
|`- Re: Why No "fcopy()" in 'C' ?MSB
+* Re: Why No "fcopy()" in 'C' ?Dan Espen
|`* Re: Why No "fcopy()" in 'C' ?MSB
| +- Re: Why No "fcopy()" in 'C' ?Dan Espen
| +* Re: Why No "fcopy()" in 'C' ?Carlos E.R.
| |`* Re: Why No "fcopy()" in 'C' ?MSB
| | `* Re: Why No "fcopy()" in 'C' ?The Natural Philosopher
| |  `* Re: Why No "fcopy()" in 'C' ?Carlos E.R.
| |   `* Re: Why No "fcopy()" in 'C' ?MSB
| |    `* Re: Why No "fcopy()" in 'C' ?Rich
| |     +- Re: Why No "fcopy()" in 'C' ?Carlos E.R.
| |     +- Re: Why No "fcopy()" in 'C' ?Tauno Voipio
| |     +- Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
| |     `- Re: Why No "fcopy()" in 'C' ?The Natural Philosopher
| `* Re: Why No "fcopy()" in 'C' ?Rich
|  +- Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
|  `* Re: Why No "fcopy()" in 'C' ?MSB
|   +* Re: Why No "fcopy()" in 'C' ?The Natural Philosopher
|   |+- Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
|   |+* Re: Why No "fcopy()" in 'C' ?Lew Pitcher
|   ||`* Re: Why No "fcopy()" in 'C' ?Lew Pitcher
|   || `- Re: Why No "fcopy()" in 'C' ?MSB
|   |`* Re: Why No "fcopy()" in 'C' ?MSB
|   | `* Re: Why No "fcopy()" in 'C' ?Aragorn
|   |  `* Re: Why No "fcopy()" in 'C' ?MSB
|   |   `- Re: Why No "fcopy()" in 'C' ?John-Paul Stewart
|   +* Re: Why No "fcopy()" in 'C' ?Rich
|   |`* Re: Why No "fcopy()" in 'C' ?MSB
|   | +- Re: Why No "fcopy()" in 'C' ?Robert Latest
|   | `* Re: Why No "fcopy()" in 'C' ?Lew Pitcher
|   |  `* Re: Why No "fcopy()" in 'C' ?Rich
|   |   `* Re: Why No "fcopy()" in 'C' ?MSB
|   |    +* Re: Why No "fcopy()" in 'C' ?The Natural Philosopher
|   |    |`* Re: Why No "fcopy()" in 'C' ?MSB
|   |    | `- Re: Why No "fcopy()" in 'C' ?The Natural Philosopher
|   |    `- Re: Why No "fcopy()" in 'C' ?Rich
|   `* Re: Why No "fcopy()" in 'C' ?Robert Latest
|    `- Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
+* Re: Why No "fcopy()" in 'C' ?asdf
|+* Re: Why No "fcopy()" in 'C' ?MSB
||+* Re: Why No "fcopy()" in 'C' ?Robert Riches
|||`* Re: Why No "fcopy()" in 'C' ?MSB
||| `* Re: Why No "fcopy()" in 'C' ?Rich
|||  +* Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
|||  |`* Re: Why No "fcopy()" in 'C' ?Rich
|||  | `* Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
|||  |  `* Re: Why No "fcopy()" in 'C' ?MSB
|||  |   `* Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
|||  |    `* Re: Why No "fcopy()" in 'C' ?MSB
|||  |     `* Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
|||  |      +- Re: Why No "fcopy()" in 'C' ?Rich
|||  |      `* Re: Why No "fcopy()" in 'C' ?MSB
|||  |       +- Re: Why No "fcopy()" in 'C' ?Richard Kettlewell
|||  |       `* Re: Why No "fcopy()" in 'C' ?Giovanni
|||  |        `- Re: Why No "fcopy()" in 'C' ?MSB
|||  `* Re: Why No "fcopy()" in 'C' ?Eli the Bearded
|||   `- Re: Why No "fcopy()" in 'C' ?MSB
||`* Re: Why No "fcopy()" in 'C' ?Lew Pitcher
|| `- Re: Why No "fcopy()" in 'C' ?MSB
|`- Re: Why No "fcopy()" in 'C' ?The Natural Philosopher
`* Re: Why No "fcopy()" in 'C' ?Lew Pitcher
 `* Re: Why No "fcopy()" in 'C' ?Lew Pitcher
  `* Re: Why No "fcopy()" in 'C' ?Lew Pitcher
   `* Re: Why No "fcopy()" in 'C' ?Robert Heller
    `* Re: Why No "fcopy()" in 'C' ?Lew Pitcher
     `* Re: Why No "fcopy()" in 'C' ?Robert Heller
      `* Re: Why No "fcopy()" in 'C' ?Robert Riches
       `* Re: Why No "fcopy()" in 'C' ?MSB
        +* Re: Why No "fcopy()" in 'C' ?Rich
        |+- Re: Why No "fcopy()" in 'C' ?Eli the Bearded
        |`* Re: Why No "fcopy()" in 'C' ?MSB
        | `* Re: Why No "fcopy()" in 'C' ?Rich
        |  `- Re: Why No "fcopy()" in 'C' ?MSB
        `* Re: Why No "fcopy()" in 'C' ?Robert Latest
         +* Re: Why No "fcopy()" in 'C' ?Tauno Voipio
         |`* Re: Why No "fcopy()" in 'C' ?MSB
         | +- Re: Why No "fcopy()" in 'C' ?Rich
         | +* Re: Why No "fcopy()" in 'C' ?Giovanni
         | |`- Re: Why No "fcopy()" in 'C' ?MSB
         | `* Re: Why No "fcopy()" in 'C' ?Tauno Voipio
         |  +* Re: Why No "fcopy()" in 'C' ?Robert Riches
         |  |+- Re: Why No "fcopy()" in 'C' ?MSB
         |  |`- Re: Why No "fcopy()" in 'C' ?Tauno Voipio
         |  `* Re: Why No "fcopy()" in 'C' ?MSB
         |   `* Re: Why No "fcopy()" in 'C' ?Rich
         |    `* Re: Why No "fcopy()" in 'C' ?MSB
         |     `* Re: Why No "fcopy()" in 'C' ?Rich
         |      +* Re: Why No "fcopy()" in 'C' ?John-Paul Stewart
         |      |`- Re: Why No "fcopy()" in 'C' ?MSB
         |      `* Re: Why No "fcopy()" in 'C' ?MSB
         |       `- Re: Why No "fcopy()" in 'C' ?Rich
         `- Re: Why No "fcopy()" in 'C' ?MSB

Pages:1234
Re: Why No "fcopy()" in 'C' ?

<s7gur1$45u$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=4994&group=comp.os.linux.misc#4994

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Wed, 12 May 2021 17:13:21 +0100
Organization: A little, after lunch
Lines: 39
Message-ID: <s7gur1$45u$1@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
<s75ptp$n13$1@dont-email.me> <i3eh9gh0d7csidbq15k91otpdghimq2g3l@4ax.com>
<u1inmh-bqp.ln1@Telcontar.valinor>
<8svj9ghouubccv4o2lgoo2jlrfh1s3jvdq@4ax.com> <s7damq$obm$2@dont-email.me>
<p38qmh-eo7.ln1@Telcontar.valinor>
<n8nm9g5dfl6ngctfsbvlb47v8h73tactuh@4ax.com> <s7gk6a$ggn$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 12 May 2021 16:13:21 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="3749e32a0b5d334fff296165ade8258c";
logging-data="4286"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/EzmGR5uy7dnLf7pSZJg3dl9SZPNvNBOo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.6.1
Cancel-Lock: sha1:Qc1BB5Q0hnRuCdkstrBPG1tg0uE=
In-Reply-To: <s7gk6a$ggn$1@dont-email.me>
Content-Language: en-GB
 by: The Natural Philosop - Wed, 12 May 2021 16:13 UTC

On 12/05/2021 14:11, Rich wrote:
> MSB <Bit15_.us> wrote:
>> On Tue, 11 May 2021 13:58:17 +0200, "Carlos E.R."
>> <robin_listas@es.invalid> wrote:
>>
>>> On 11/05/2021 09.11, The Natural Philosopher wrote:
>>>> On 11/05/2021 05:44, MSB wrote:
>>>>>> Pascal doesn't. Not in the basic libraries, at least.
>>>>>    Um ... I seem to remember it being in Microsoft Pascal
>>>>
>>>> True pascal doesn't have any IO at all. As with any language designed by
>>>> an academic, it was completely useless for real world usage.
>>>>
>>>
>>> True pascal of course had IO. Input, output, and files. You defined them
>>> in the first line
>>>
>>> program hello (output);
>>>
>>>
>>> However, I have never seen "true" pascal. It doesn't exist.
>>
>> I tend to agree. Perhaps he's talking about some
>> alpha version Wirth hadn't fully fleshed out yet.
>
> No, he is talking about Wirth's actual Pascal (which Wirth never
> intended to build a compiler for). Wirth designed it to use in classes
> without ever being compiled/interpreted (other than by a human grader).
> So it never needed input/output, because it was never intended (by
> Wirth) to be compiled/interpreted (other than by a human grading
> assignments).
>
yes.
And I/O destroyed the integrity of its academic correctness.

--
“Puritanism: The haunting fear that someone, somewhere, may be happy.”

H.L. Mencken, A Mencken Chrestomathy

Re: Why No "fcopy()" in 'C' ?

<s7h17a$gqv$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=4995&group=comp.os.linux.misc#4995

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tauno.vo...@notused.fi.invalid (Tauno Voipio)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Wed, 12 May 2021 19:54:01 +0300
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <s7h17a$gqv$1@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
<s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me>
<s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com>
<s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com>
<slrns9mg94.rtj.spamtrap42@one.localnet>
<rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com>
<ig2bnkFu2j3U4@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 12 May 2021 16:54:02 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b2107a087f3332d2a9af552b52af4d29";
logging-data="17247"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1X4UaeW6yMDHApN1N0x042sUMe+n85nc="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
Gecko/20100101 Thunderbird/78.10.1
Cancel-Lock: sha1:hvHr5ceNQVvJAm/j/FoOGfdJYqo=
In-Reply-To: <ig2bnkFu2j3U4@mid.individual.net>
Content-Language: en-GB
 by: Tauno Voipio - Wed, 12 May 2021 16:54 UTC

On 12.5.21 18.49, Robert Latest wrote:
> MSB wrote:
>> Recently I re-invented the wheel yet again, writing an
>> fcopy(). I spent some time wondering whether to use
>> open/write/close -vs- fopen/fwrite/fclose. I shouldn't
>> have had to waste the time.
>
> You just answered your own question. If you had an idea of how a standardized
> fcopy() should work you'd have written it ONCE a long time ago and just used it
> in your projects. The fact that you keep re-writing it shows that there is no
> one answer to this problem.
>
>
>> They are NOT quite
>> the same ... fwrite() can sometimes try to "fix"
>> line endings - assuming you're writing text instead
>> of binary. I eventually settled on open/write/close
>> instead just because of that possibility. Just a dozen
>> lines - a few dedicated to immediate bail-out if the
>> caller screwed up and sent garbage params ( I like
>> to cover Stupid Users and send useful error codes
>> when they screw up).
>
> Next guy needs raw speed and has pre-verified data and doesn't want your
> fcopy() to waste time on checks. Next guy wants to copy between open file
> handles.

For simple copy we have cp, and for brute-force copy there is dd.

--

-TV

Re: Why No "fcopy()" in 'C' ?

<s7hfri$218$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=4996&group=comp.os.linux.misc#4996

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Wed, 12 May 2021 21:03:46 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 67
Message-ID: <s7hfri$218$1@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
<s75ptp$n13$1@dont-email.me> <i3eh9gh0d7csidbq15k91otpdghimq2g3l@4ax.com>
<s7bfd1$v8q$1@dont-email.me> <tt2k9gd0j7ua3trhe9n3qnhellm9ovfdun@4ax.com>
<s7drhh$l8j$1@dont-email.me> <haim9g1ircm44c537m6qu93fsqrgdp152m@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 12 May 2021 21:03:46 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5c00b34fff9c8db1ec983f4d64d79f24";
logging-data="2088"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1905iCTuQKfZZVKtDJV5uLC8u/w0lfQ9Bo="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:gcyo9BO2BMmQ5DxSDNwfFN3rtrk=
 by: Lew Pitcher - Wed, 12 May 2021 21:03 UTC

On Tue, 11 May 2021 23:49:05 -0400, MSB wrote:

> On Tue, 11 May 2021 11:58:41 -0000 (UTC), Rich <rich@example.invalid>
> wrote:
>
>>MSB <Bit15_.us> wrote:
>>>>> so why not fcopy() ???
>>>>
>>>>There is no "fcopy" syscall. So no 'fcopy' in libc.
>>>
>>> In Linux/Unix it's a "cp" or "mv" syscall. Didn't do
>>> everything I wanted.
>>
>>cp and mv are not syscalls. They are executables that you can use the
>>C system() function to execute.
>>
>>syscalls are the actual function entry points provided by the kernel.
>
> Technically true. However you won't find a terminal emulator
> without 'cp' in some form or another. If not stricty 'kernel' it
> is still a core function. NO sort of OS/system is going to be
> without a handy fcopy()-like command.

You seem to be confused.

A "terminal emulator" is one form of application program. Typically, such
a program provides an input/output conduit to /other/ application programs
(such as shells or text-editors or anything else that needs a keyboard input
and/or a character output). Terminal emulators /rarely/ have file copy support
built in.

"cp" is another form of application program. It's purpose is to make duplicates
of existing files. As an application program, it can be invoked by other application
programs (like shells, text-editors, etc.) through standard system calls.

Your asked-for fcopy() would be a function; a code fragment compiled into a linkable
object to be included in an application program. There are not many application
programs that /require/ a file-copy facility, and the function is trivial to write,
making it a poor candidate for standardization.

sendfile() is both a standard (in Linux) library function /and/ a system call; the
system call does the actual work, and the library function sanity-checks the
input parameters. sendfile() performs a file-to-file data copy, given two open file
descriptors.

See the hierarchy?
Terminal Emulator
Shell
cp
fcopy
sendfile()

Of these, the /only/ kernel component is the syscall part of the sendfile() standard
function.

(For sendfile(), you can substitute read()/write() if you wish).

And, bye the way, you moved the goalposts again.

You wanted to know why there was no standard library fcopy() /function/.
Now your point seems to be about a /command/ (an application program).
Well, Unix /has/ a /command/ that does fcopy; it is called cp(1)

[snip]
--
Lew Pitcher
"In Skills, We Trust"

Re: Why No "fcopy()" in 'C' ?

<878s4jzmia.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=4997&group=comp.os.linux.misc#4997

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!.POSTED.nntp.terraraq.uk!not-for-mail
From: inva...@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Wed, 12 May 2021 22:10:37 +0100
Organization: terraraq NNTP server
Message-ID: <878s4jzmia.fsf@LkoBDZeT.terraraq.uk>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
<s75ptp$n13$1@dont-email.me>
<i3eh9gh0d7csidbq15k91otpdghimq2g3l@4ax.com>
<s7bfd1$v8q$1@dont-email.me>
<tt2k9gd0j7ua3trhe9n3qnhellm9ovfdun@4ax.com>
<ig2b1fFu2j3U2@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: mantic.terraraq.uk; posting-host="nntp.terraraq.uk:2a00:1098:0:86:1000:3f:0:2";
logging-data="29627"; mail-complaints-to="usenet@mantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:lFzoXmpQCmF4AeN4cWufJbghHvk=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Wed, 12 May 2021 21:10 UTC

Robert Latest <boblatest@yahoo.com> writes:
> MSB wrote:
>>>> It's not a real impediment, just weird. A "hole" in the
>>>> overall paradigm.
>
> Name a single function in the C standard library that is remotely as
> complex and as implementation-dependent as your proposed
> fcopy(). Better yet, name a bunch of them so we can see the "hole"
> better.

There are many. printf and scanf are full of complexity even ignoring
the IO layer. Locale handling is pretty complex. Memory management is
complex (glibc’s malloc.c is nearly 6KLOC). Most of math.h is pretty
hairy if you don’t have floating point instructions and the rest even if
you do. multibyte<->wchar conversion can easily get complicated.

The theory that only simple functions got into the standard C library
doesn’t survive contact with reality. As for implementation dependence,
platform-dependent elements to a common activity are an argument _in
favour_ of standardization, not against. e.g. the kernel-level details
of IO are very platform-dependent, so having a common IO abstraction in
the language’s runtime library is useful.

I don’t understand why people are coming up with such nonsensical
retroactive justifications, and not even doing cursory checks to see if
they make any sense.

The reality is, probably, simply that nobody thought it very important.

--
https://www.greenend.org.uk/rjk/

Re: Why No "fcopy()" in 'C' ?

<s7hk7v$7g9$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=4998&group=comp.os.linux.misc#4998

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Wed, 12 May 2021 22:18:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <s7hk7v$7g9$1@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s75ptp$n13$1@dont-email.me> <i3eh9gh0d7csidbq15k91otpdghimq2g3l@4ax.com> <s7bfd1$v8q$1@dont-email.me> <tt2k9gd0j7ua3trhe9n3qnhellm9ovfdun@4ax.com> <s7drhh$l8j$1@dont-email.me> <haim9g1ircm44c537m6qu93fsqrgdp152m@4ax.com> <s7hfri$218$1@dont-email.me>
Injection-Date: Wed, 12 May 2021 22:18:39 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5677dc9e2f8a57a77f5a0dccf3242665";
logging-data="7689"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZXdlKd/m4aXTu2j19drWB"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:EkCUFxZgw5iRCUts6zLMfTHpkkA=
 by: Rich - Wed, 12 May 2021 22:18 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
> On Tue, 11 May 2021 23:49:05 -0400, MSB wrote:
>> Technically true. However you won't find a terminal emulator
>> without 'cp' in some form or another. If not stricty 'kernel' it
>> is still a core function. NO sort of OS/system is going to be
>> without a handy fcopy()-like command.
>
> You seem to be confused.

MSB seems to be *very* confused - or else MSB is doing a good job
trolling. I'm starting to believe MSB has been trolling this whole
time.

> And, bye the way, you moved the goalposts again.
>
> You wanted to know why there was no standard library fcopy() /function/.
> Now your point seems to be about a /command/ (an application program).
> Well, Unix /has/ a /command/ that does fcopy; it is called cp(1)

More evidence that MSB is trolling.

Re: Why No "fcopy()" in 'C' ?

<eli$2105121313@qaz.wtf>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=4999&group=comp.os.linux.misc#4999

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!goblin2!goblin1!goblin.stu.neva.ru!panix!qz!not-for-mail
From: *...@eli.users.panix.com (Eli the Bearded)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Wed, 12 May 2021 17:13:26 +0000 (UTC)
Organization: Some absurd concept
Lines: 15
Message-ID: <eli$2105121313@qaz.wtf>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <s7gknf$ggn$2@dont-email.me>
NNTP-Posting-Host: panix5.panix.com
X-Trace: reader1.panix.com 1620839606 10631 166.84.1.5 (12 May 2021 17:13:26 GMT)
X-Complaints-To: abuse@panix.com
NNTP-Posting-Date: Wed, 12 May 2021 17:13:26 +0000 (UTC)
X-Liz: It's actually happened, the entire Internet is a massive game of Redcode
X-Motto: "Erosion of rights never seems to reverse itself." -- kenny@panix
X-US-Congress: Moronic Fucks.
X-Attribution: EtB
XFrom: is a real address
Encrypted: double rot-13
User-Agent: Vectrex rn 2.1 (beta)
 by: Eli the Bearded - Wed, 12 May 2021 17:13 UTC

In comp.os.linux.misc, Rich <rich@example.invalid> wrote:
> If you genuinely wanted an answer, and were really looking for folks
> who would likely know, you'd have posted to 'comp.lang.c'. Posting
> here, in the wrong group for that question, looks very trollish.

Nah, this is off-topic in comp.lang.c, which isn't about "what functions
are in your libraries?" but "how does C work?" eg, understanding the
limits of specified behavior.

There probably is a better group than c.o.l.misc, but this doesn't seem
_entirely_ wrong for asking about Linux library functions.

Elijah
------
also off-topic in c.l.c: bogus solutions to the halting problem

Re: Why No "fcopy()" in 'C' ?

<eli$2105111314@qaz.wtf>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5000&group=comp.os.linux.misc#5000

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!paganini.bofh.team!goblin3!goblin.stu.neva.ru!panix!qz!not-for-mail
From: *...@eli.users.panix.com (Eli the Bearded)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Tue, 11 May 2021 17:14:29 +0000 (UTC)
Organization: Some absurd concept
Lines: 53
Message-ID: <eli$2105111314@qaz.wtf>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <slrns9jtvg.j96.spamtrap42@one.localnet> <tsuj9gh0qsqfge4vg0v742vjrc833i8bu1@4ax.com> <s7drtn$l8j$2@dont-email.me>
NNTP-Posting-Host: panix5.panix.com
X-Trace: reader1.panix.com 1620753269 6823 166.84.1.5 (11 May 2021 17:14:29 GMT)
X-Complaints-To: abuse@panix.com
NNTP-Posting-Date: Tue, 11 May 2021 17:14:29 +0000 (UTC)
X-Liz: It's actually happened, the entire Internet is a massive game of Redcode
X-Motto: "Erosion of rights never seems to reverse itself." -- kenny@panix
X-US-Congress: Moronic Fucks.
X-Attribution: EtB
XFrom: is a real address
Encrypted: double rot-13
User-Agent: Vectrex rn 2.1 (beta)
 by: Eli the Bearded - Tue, 11 May 2021 17:14 UTC

In comp.os.linux.misc, Rich <rich@example.invalid> wrote:
> And, you answered your own question. When "you can implement a
> full-featured fcopy() in about 15-20 lines or so" then that becomes a
> candidate for "don't bother adding it to libc, it is trivial to
> implement when/if someone wants it".
>
> Remember, the Unix philosophy is small, single purpose tools, that
> compose into larger tools. Libc provides all the necessary "small,
> single purpose tools" for an fcopy(), so the "composition" of those
> tools into a larger tool was left up to the end user.

As with Richard Kettlewell in another reply, I don't buy that. Let's
consider a real example.

ex version 1.1 (the first one to have a "vi"sual mode), was written
before system() was in a standard library, so it implements it itself:

invoked:
https://github.com/n-t-roff/ex-1.1/blob/master/ex_unix.c#L82

actual code:
https://github.com/n-t-roff/ex-1.1/blob/master/ex_unix.c#L105

The functions in that file do some other stuff, but the part that is
system() is just a few lines of code. And I really believe if system()
were available, Joy would have just done those things in a wrap of
system().

Yet even though it is so easy to implement, at some point system()
_was_ written and now it is a standard part of the library. Why not a
file copy function?

I think the reason is just plain copying a file, as opposed to doing
some transformation on a file, is a very rare task in programs. Users
copy files for backup, "installing", as a first step towards modifying.
Programs create new, different, files, and don't typically have a use
for unadulterated copying. Other than the "install" use case, I can't
think of the need for copying, and install has usually been done in
shell scripting, where we have `cp`.

I hear someone starting to object "but backups are copies". And there
are programs that do use ${original}.bak or ${original}~ backup files.
I have not examined all such cases, but the ones I have the backup is
not implemented with a copy() function. Instead it is a rename and
recreate, done when there are changes. The inode, which stays the same
for a rename, shows that the backup is the original file, and the
new file has the original name. This is the "doing some transformation"
thing just slightly obfuscated.

Elijah
------
has also seen popen() implemented in a few lines inside old code

Re: Why No "fcopy()" in 'C' ?

<9l5p9g5nrc9ki39gtr4bo09d2a08tp4gs3@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5001&group=comp.os.linux.misc#5001

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 12 May 2021 22:05:05 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Wed, 12 May 2021 23:05:05 -0400
Message-ID: <9l5p9g5nrc9ki39gtr4bo09d2a08tp4gs3@4ax.com>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <s7gknf$ggn$2@dont-email.me>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 24
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-O0SkzwGO20Op7kA7JhmwxiNRW15CEwkLFUWuROSIG8IjoDjpJGS9KIF5P46uus7RjQmwkcG63a2Gh9m!b6+uC4d5e8MmzKX9PP/9gHUJueCkToHHM7+hv8dSHRRHPRHTJeYaE4V/MPz+gQmrbpF1NC59wCx/!TJEFjHwxKUja6os=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2229
 by: MSB - Thu, 13 May 2021 03:05 UTC

On Wed, 12 May 2021 13:20:47 -0000 (UTC), Rich <rich@example.invalid>
wrote:

>MSB <Bit15_.us> wrote:
>> Geez ... my little inquiry seems to have gotten out of hand. I
>> assumed there'd be somebody a bit before my time who could clearly
>> explain why no standard fcopy() was in 'C'. Instead .............
>> :-)
>
>Yes, your trolling has been /loads of fun/...
>
>If you genuinely wanted an answer, and were really looking for folks
>who would likely know, you'd have posted to 'comp.lang.c'. Posting
>here, in the wrong group for that question, looks very trollish.

Sorry, but I almost exclusively use Linux and it's
written amost entirely in 'C' .... so this ISN'T a
stupid place to ask the question.

My next question is why you think I'm "trolling". It
was a perfectly legit historical question. I thought
there'd be ONE clear answer ... but no ......

Re: Why No "fcopy()" in 'C' ?

<a56p9glcnmfobp9tkodmdpg0l0l0vnvcea@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5002&group=comp.os.linux.misc#5002

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!goblin3!goblin.stu.neva.ru!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 12 May 2021 22:29:57 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Wed, 12 May 2021 23:29:57 -0400
Message-ID: <a56p9glcnmfobp9tkodmdpg0l0l0vnvcea@4ax.com>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <ig2bnkFu2j3U4@mid.individual.net>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 59
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-UqwxK9C06avtV9tffoQj46px1SyyWIEJqn1J8BlRrWGJLqrFzoWEFuMdMlJokqwv4JL5DVeGdthPBEP!VO1pt8IFUzEL6UIYHh3ahlfcwnRWRHzkpft/Ycq9sjnMzDRuXGp9XdCfDAffZK4ndvR5IGibrJqN!zOdwi2/uqfLTlAU=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3653
 by: MSB - Thu, 13 May 2021 03:29 UTC

On 12 May 2021 15:49:08 GMT, Robert Latest <boblatest@yahoo.com>
wrote:

>MSB wrote:
>> Recently I re-invented the wheel yet again, writing an
>> fcopy(). I spent some time wondering whether to use
>> open/write/close -vs- fopen/fwrite/fclose. I shouldn't
>> have had to waste the time.
>
>You just answered your own question. If you had an idea of how a standardized
>fcopy() should work you'd have written it ONCE a long time ago and just used it
>in your projects. The fact that you keep re-writing it shows that there is no
>one answer to this problem.

But then I'd have to go back over about 40 years of
old projects .....

Easier/funner to just re-write.

Besides, every project is a little different. For quite awhile
I was dealing with mass quantities of ASCII records ... and
fread()/fwrite() was appropriate - saved a few steps.

But THIS project, lots of binary files included in the mix.

So, a re-think, a few extra embellishments that fit the
task at hand .......

I'd think you'd understand that.

>> They are NOT quite
>> the same ... fwrite() can sometimes try to "fix"
>> line endings - assuming you're writing text instead
>> of binary. I eventually settled on open/write/close
>> instead just because of that possibility. Just a dozen
>> lines - a few dedicated to immediate bail-out if the
>> caller screwed up and sent garbage params ( I like
>> to cover Stupid Users and send useful error codes
>> when they screw up).
>
>Next guy needs raw speed and has pre-verified data and doesn't want your
>fcopy() to waste time on checks. Next guy wants to copy between open file
>handles.

Actually, I benchmarked fopen/fread/fwrite -vs- open/read/write and,
at least on my current box, there was no significant difference -
using a 4k xfer buffer.

As for the "next guy", he/she can write their OWN for
all I care. I've never worked in a cubicle-farm with a bunch
of Dilberts. I do like to leave "decent" heavily-commented
templates though, a touch of "legacy" I suppose.

Besides, with 'C', all the time is wasted in I/O ... so
there really isn't much in the way of "faster". NAS
or local drive - they only xfer data just SO fast. When
they come out with SATA-64k *then* .... :-)

Re: Why No "fcopy()" in 'C' ?

<3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5003&group=comp.os.linux.misc#5003

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!paganini.bofh.team!goblin3!goblin.stu.neva.ru!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 12 May 2021 23:02:41 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 00:02:41 -0400
Message-ID: <3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 57
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-E3f3ZnTKLE5LjXoWK1+fnZ7qYLRqXJEICJgEWIORD3vw90aKfOav+rBKHxXrgwt5hlA4Y2Ima0eKEid!X1AZVRYypAV9RpWc/jBoXtLprxLPOmb/gtpUCMO/g/+kH2u10FZmv67yZdpgSLqTghCJsGm94zPj!UDQ8+RFfzDBHTxk=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3854
 by: MSB - Thu, 13 May 2021 04:02 UTC

On Wed, 12 May 2021 19:54:01 +0300, Tauno Voipio
<tauno.voipio@notused.fi.invalid> wrote:

>On 12.5.21 18.49, Robert Latest wrote:
>> MSB wrote:
>>> Recently I re-invented the wheel yet again, writing an
>>> fcopy(). I spent some time wondering whether to use
>>> open/write/close -vs- fopen/fwrite/fclose. I shouldn't
>>> have had to waste the time.
>>
>> You just answered your own question. If you had an idea of how a standardized
>> fcopy() should work you'd have written it ONCE a long time ago and just used it
>> in your projects. The fact that you keep re-writing it shows that there is no
>> one answer to this problem.
>>
>>
>>> They are NOT quite
>>> the same ... fwrite() can sometimes try to "fix"
>>> line endings - assuming you're writing text instead
>>> of binary. I eventually settled on open/write/close
>>> instead just because of that possibility. Just a dozen
>>> lines - a few dedicated to immediate bail-out if the
>>> caller screwed up and sent garbage params ( I like
>>> to cover Stupid Users and send useful error codes
>>> when they screw up).
>>
>> Next guy needs raw speed and has pre-verified data and doesn't want your
>> fcopy() to waste time on checks. Next guy wants to copy between open file
>> handles.
>
>
>For simple copy we have cp, and for brute-force copy there is dd.

Most of the time I *do* just "cheap out" with system("cp ....").
It's easy, it works - albeit a bit ugly and "un-C".

I did find that "mv" doesn't always get it right ... if a filename
includes weirdo characters. "File ~$$$ Stuff.doc" can be
translated as an escape sequence no matter whether
you put quotes around the mess or not. 'C' rename()
works right every time though. In this case I was emulating
rsync's "--delete" option ... but with backup files that had been
changed so the names/sizes/etc weren't quite the same
as the originals. If you have a 3-digit IQ you NEVER *EVER*
put stuff on 'cloud' storage without first heavily encrypting
it all - "We Keep Your Data Safe" ... yea, sure ......... I wrote
a whole callable 'c' app to deal with THAT lie.

So, if rename(), why not a standard fcopy() with a few
useful options too ? If the Linux clique isn't sure I guess
we'll never know for sure. I've been informed that Ritchie
is deceased ......

'dd' - "Disk Destroyer :-)" does have its uses - but not in
anything I've done recently.

Re: Why No "fcopy()" in 'C' ?

<g89p9gp8fh0v9u9f8mhnjjn5cll0rr68u5@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5004&group=comp.os.linux.misc#5004

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!rocksolid2!i2pn.org!aioe.org!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 12 May 2021 23:52:09 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 00:52:09 -0400
Message-ID: <g89p9gp8fh0v9u9f8mhnjjn5cll0rr68u5@4ax.com>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s75ptp$n13$1@dont-email.me> <i3eh9gh0d7csidbq15k91otpdghimq2g3l@4ax.com> <s7bfd1$v8q$1@dont-email.me> <tt2k9gd0j7ua3trhe9n3qnhellm9ovfdun@4ax.com> <s7drhh$l8j$1@dont-email.me> <haim9g1ircm44c537m6qu93fsqrgdp152m@4ax.com> <s7hfri$218$1@dont-email.me> <s7hk7v$7g9$1@dont-email.me>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 39
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-yqC9+/pXOJSdffE++rMu0PJoclYTWdgLStjw+mKkTa9BRGNwfALP+lCfYl6XADrVXS+pBTtOMxejkSD!utR9+bXVhGpLBpqGwSu+ZLQs7/Z6SWWpRLv9tHHuXdOLJvJThU+7QLPav6RAXPIrqJ7smaRMzVO2!P3ulNqxC6LXmHLU=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2829
 by: MSB - Thu, 13 May 2021 04:52 UTC

On Wed, 12 May 2021 22:18:39 -0000 (UTC), Rich <rich@example.invalid>
wrote:

>Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
>> On Tue, 11 May 2021 23:49:05 -0400, MSB wrote:
>>> Technically true. However you won't find a terminal emulator
>>> without 'cp' in some form or another. If not stricty 'kernel' it
>>> is still a core function. NO sort of OS/system is going to be
>>> without a handy fcopy()-like command.
>>
>> You seem to be confused.
>
>MSB seems to be *very* confused - or else MSB is doing a good job
>trolling. I'm starting to believe MSB has been trolling this whole
>time.

Too much COVID lockdown time I suspect :-)

Next you'll begin believing 'Q' conspiracy theories ...
after that it's living in a sewer drain wearing a
tinfoil hat so "They" can't get to you .........

Meanwhile, let's try to keep things civil.

From WHERE comes 'cp' ? It is not strictly 'kernel'
but it's a standard, core, utility. NO system is complete
without it in some shape or form. A VIC-20 had it. ZX-81
as well. Ah ...audio cassette 'drives' .......

With microcontrollers you may have to write your own
alas ... fun with RAM often measured in bytes and
no such concept as a "storage device".

They don't make the PIC 16F84 (or 16C84JW before that)
anymore but it should be fun to look into looking into how
you make files/directories on I2C FRAMs/EEPROM/SD
using naught but assember. Coding that willl give you a buzz,
puts the FUN back in computing :-)

Re: Why No "fcopy()" in 'C' ?

<s7iq62$5hn$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5006&group=comp.os.linux.misc#5006

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 10:06:10 +0100
Organization: A little, after lunch
Lines: 15
Message-ID: <s7iq62$5hn$1@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
<s75ptp$n13$1@dont-email.me> <i3eh9gh0d7csidbq15k91otpdghimq2g3l@4ax.com>
<s7bfd1$v8q$1@dont-email.me> <tt2k9gd0j7ua3trhe9n3qnhellm9ovfdun@4ax.com>
<s7drhh$l8j$1@dont-email.me> <haim9g1ircm44c537m6qu93fsqrgdp152m@4ax.com>
<s7hfri$218$1@dont-email.me> <s7hk7v$7g9$1@dont-email.me>
<g89p9gp8fh0v9u9f8mhnjjn5cll0rr68u5@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 13 May 2021 09:06:10 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4915372ac80311e8583e2134dd4dc3c1";
logging-data="5687"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zpe41HaQx3IyWi1s+afcot4zXNTrCf1U="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.6.1
Cancel-Lock: sha1:TuROBbT2VFFZ8DGFHgdGCj+zhoI=
In-Reply-To: <g89p9gp8fh0v9u9f8mhnjjn5cll0rr68u5@4ax.com>
Content-Language: en-GB
 by: The Natural Philosop - Thu, 13 May 2021 09:06 UTC

On 13/05/2021 05:52, MSB wrote:
> They don't make the PIC 16F84 (or 16C84JW before that)
> anymore but it should be fun to look into looking into how
> you make files/directories on I2C FRAMs/EEPROM/SD
> using naught but assember. Coding that willl give you a buzz,
> puts the FUN back in computing

I certainly wrote assembler to access a dos formatted disk drive on an
8086 single board computer. And most of a libc too...

--
“The ultimate result of shielding men from the effects of folly is to
fill the world with fools.”

Herbert Spencer

Re: Why No "fcopy()" in 'C' ?

<s7j61a$1gd$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5007&group=comp.os.linux.misc#5007

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 12:28:26 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <s7j61a$1gd$1@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s75ptp$n13$1@dont-email.me> <i3eh9gh0d7csidbq15k91otpdghimq2g3l@4ax.com> <s7bfd1$v8q$1@dont-email.me> <tt2k9gd0j7ua3trhe9n3qnhellm9ovfdun@4ax.com> <s7drhh$l8j$1@dont-email.me> <haim9g1ircm44c537m6qu93fsqrgdp152m@4ax.com> <s7hfri$218$1@dont-email.me> <s7hk7v$7g9$1@dont-email.me> <g89p9gp8fh0v9u9f8mhnjjn5cll0rr68u5@4ax.com>
Injection-Date: Thu, 13 May 2021 12:28:26 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5677dc9e2f8a57a77f5a0dccf3242665";
logging-data="1549"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QOUvWZmtwXSKHp8O3wD+4"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:RC+B8XadYXJj4HDAgEEyHcdHsIg=
 by: Rich - Thu, 13 May 2021 12:28 UTC

MSB <Bit15_.us> wrote:
> On Wed, 12 May 2021 22:18:39 -0000 (UTC), Rich <rich@example.invalid>
> wrote:
>
>>Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
>>> On Tue, 11 May 2021 23:49:05 -0400, MSB wrote:
>>>> Technically true. However you won't find a terminal emulator
>>>> without 'cp' in some form or another. If not stricty 'kernel' it
>>>> is still a core function. NO sort of OS/system is going to be
>>>> without a handy fcopy()-like command.
>>>
>>> You seem to be confused.
>>
>>MSB seems to be *very* confused - or else MSB is doing a good job
>>trolling. I'm starting to believe MSB has been trolling this whole
>>time.
>
> From WHERE comes 'cp' ? It is not strictly 'kernel'
> but it's a standard, core, utility.

A bit of asking google or duckduckgo would answer these most basic
questions of yours, and remove some of your confusion.

For Linux distributions, 'cp' is from the GNU Core Utilities package:

https://en.wikipedia.org/wiki/GNU_Core_Utilities

It is just a binary executable, usually residing at /bin/cp on disk.

If you want to see the C implementation, then download and examine the
source for a version of the GNU Core Utilities (you can find where to
download by again asking a search engine).

Re: Why No "fcopy()" in 'C' ?

<s7j69l$1gd$2@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5008&group=comp.os.linux.misc#5008

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 12:32:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <s7j69l$1gd$2@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <s7gknf$ggn$2@dont-email.me> <9l5p9g5nrc9ki39gtr4bo09d2a08tp4gs3@4ax.com>
Injection-Date: Thu, 13 May 2021 12:32:53 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5677dc9e2f8a57a77f5a0dccf3242665";
logging-data="1549"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184BhAkcDKQ0XsX3dpTc6hU"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:BOr5Wcd/R8S11Q2wk6IUUze1QDM=
 by: Rich - Thu, 13 May 2021 12:32 UTC

MSB <Bit15_.us> wrote:
> On Wed, 12 May 2021 13:20:47 -0000 (UTC), Rich <rich@example.invalid>
> wrote:
>
>>MSB <Bit15_.us> wrote:
>>> Geez ... my little inquiry seems to have gotten out of hand. I
>>> assumed there'd be somebody a bit before my time who could clearly
>>> explain why no standard fcopy() was in 'C'. Instead .............
>>> :-)
>>
>>Yes, your trolling has been /loads of fun/...
>>
>>If you genuinely wanted an answer, and were really looking for folks
>>who would likely know, you'd have posted to 'comp.lang.c'. Posting
>>here, in the wrong group for that question, looks very trollish.
>
> Sorry, but I almost exclusively use Linux and it's
> written amost entirely in 'C' .... so this ISN'T a
> stupid place to ask the question.

Other than C's libc, and the group of functions provided therein, were
more or less standardized long before Linux existed. Linux may be
mostly written in C, but that does not mean the authors of Linux also
wrote the C compiler or the C library functions. There may be some
crossover between the two, but gcc (the C compiler from GNU) and
gnulibc (the C libraries, also from GNU) both existed before Linux.

> My next question is why you think I'm "trolling". It
> was a perfectly legit historical question. I thought
> there'd be ONE clear answer ... but no ......

Your initial post did not look like a troll. But your subsequent goal
post shifting, revisionist history, feigning confusion, and
argumentative posts look very trollish.

Re: Why No "fcopy()" in 'C' ?

<s7j795$1gd$3@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5009&group=comp.os.linux.misc#5009

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 12:49:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <s7j795$1gd$3@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me> <3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com>
Injection-Date: Thu, 13 May 2021 12:49:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5677dc9e2f8a57a77f5a0dccf3242665";
logging-data="1549"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hDE2JXGtLNKfD7rmYScUH"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:jFBx+fG4SbMXoJ9Hnzbroq7VU5A=
 by: Rich - Thu, 13 May 2021 12:49 UTC

MSB <Bit15_.us> wrote:
> On Wed, 12 May 2021 19:54:01 +0300, Tauno Voipio
>>For simple copy we have cp, and for brute-force copy there is dd.
>
> Most of the time I *do* just "cheap out" with system("cp ....").
> It's easy, it works - albeit a bit ugly and "un-C".
>
> I did find that "mv" doesn't always get it right ... if a filename
> includes weirdo characters. "File ~$$$ Stuff.doc" can be translated
> as an escape sequence no matter whether you put quotes around the
> mess or not. 'C' rename() works right every time though.

How can you possibly be a C programmer and not know, already, the
reasons why for your above issue.

man 3 system:
system() executes a command specified in command by calling /bin/sh -c
command,

If you use system(), your call goes through /bin/sh, which means you
have to quote shell-metacharacters appropriately to have them ignored
by the interpretation /bin/sh will attempt to perform.

The rename() function does not go through /bin/sh, it eventually
becomes a syscall into the kernel ABI to perform the rename.

> So, if rename(), why not a standard fcopy() with a few useful
> options too ?

No one here knows the actual answer. Many have given their guesses,
and more than a few others have argued why many of the guesses may
themselves be wrong.

You'd need to ask the people responsible for deciding what got put into
C's libc, and no one on the group here was involved in any of those
decisions, so everyone is just guessing.

> If the Linux clique isn't sure I guess we'll never know for sure.

Linux simply used the existing C libraries, but had no direct hand in
deciding what was included. The C library is distributed as an
independent entity:

https://en.wikipedia.org/wiki/GNU_C_Library
https://www.gnu.org/software/libc/

Linux just makes use of that pre-existing, independent entity.

Your question here to a Linux group about why no fcopy() in libc would
be similar to asking a Tailor who is showing you some fine wool cloth
for a suit you are having made what specific feedstock the sheep who
grew the wool were fed. The tailor likely has no idea what specific
feedstock the sheep ate. Correspondingly, Linux people, who had no had
in making the decisions as to what got included in GNU libc (and
everyone in the group here falls into this category), also have no
knowledge of the real reasons why an given function was chosen for
inclusion, or why some other function was never added.

All we have are guesses.

Re: Why No "fcopy()" in 'C' ?

<s7jeh0$e3d$1@milena.home.net.it>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5010&group=comp.os.linux.misc#5010

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
From: lsod...@home.net.it (Giovanni)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 16:53:20 +0200
Organization: G.Falzoni Home Network
Message-ID: <s7jeh0$e3d$1@milena.home.net.it>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
<s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me>
<s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com>
<s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com>
<slrns9mg94.rtj.spamtrap42@one.localnet>
<rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com>
<ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me>
<3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com>
Reply-To: gfalzoni@inwind.it
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 25
NNTP-Posting-Host: 242eb904.news.sunsite.dk
X-Trace: 1620917602 news.sunsite.dk 689 gfalzoni@inwind.it/151.48.25.255:44310
X-Complaints-To: staff@sunsite.dk
 by: Giovanni - Thu, 13 May 2021 14:53 UTC

On 05/13/2021 06:02 AM, MSB wrote:

> So, if rename(), why not a standard fcopy() with a few
> useful options too ? If the Linux clique isn't sure I guess
> we'll never know for sure. I've been informed that Ritchie
> is deceased ......

There is a rename() function because it has to access file-system
structures that are only known to the kernel.

fcopy() isn't a standard function which can be implemented in few lines
of code but in my long experience - I started in the late '70 using
punched cards on a IBM mainframe with PL/1 - never had to copy a file.

The standard libc is mostly a collection of standard functions whose
purpose is to interact with structures handled only by the kernel.
Most functions are defined in international standards as POSIX and ISO.
You can ask the committees that issue the standards.

Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
< http://giovanni.homelinux.net/ >

Re: Why No "fcopy()" in 'C' ?

<s7jhaa$5jm$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5011&group=comp.os.linux.misc#5011

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tauno.vo...@notused.fi.invalid (Tauno Voipio)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 18:40:57 +0300
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <s7jhaa$5jm$1@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
<s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me>
<s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com>
<s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com>
<slrns9mg94.rtj.spamtrap42@one.localnet>
<rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com>
<ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me>
<3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 13 May 2021 15:40:58 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e90d0333f422a4823254d31555d2ee15";
logging-data="5750"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DCv5cBK5Dr9sHUkaVAILioNjhNrvEv5M="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
Gecko/20100101 Thunderbird/78.10.1
Cancel-Lock: sha1:AZIT/RZtnlvti8BActDBXL3PMss=
In-Reply-To: <3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com>
Content-Language: en-GB
 by: Tauno Voipio - Thu, 13 May 2021 15:40 UTC

On 13.5.21 7.02, MSB wrote:
> On Wed, 12 May 2021 19:54:01 +0300, Tauno Voipio
> <tauno.voipio@notused.fi.invalid> wrote:
>
>> For simple copy we have cp, and for brute-force copy there is dd.
>
>
> Most of the time I *do* just "cheap out" with system("cp ....").
> It's easy, it works - albeit a bit ugly and "un-C".
>
> I did find that "mv" doesn't always get it right ... if a filename
> includes weirdo characters.

mv is *not* a copy operation, it is a shell cover for the rename()
system call.

--

-TV

Re: Why No "fcopy()" in 'C' ?

<slrns9rnfv.99t.spamtrap42@one.localnet>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5013&group=comp.os.linux.misc#5013

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: spamtra...@jacob21819.net (Robert Riches)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: 14 May 2021 02:18:40 GMT
Organization: none-at-all
Lines: 26
Message-ID: <slrns9rnfv.99t.spamtrap42@one.localnet>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
<s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me>
<s7eo6l$dcr$5@dont-email.me>
<z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com>
<s7essd$lur$2@dont-email.me>
<yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com>
<slrns9mg94.rtj.spamtrap42@one.localnet>
<rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com>
<ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me>
<3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com> <s7jhaa$5jm$1@dont-email.me>
Reply-To: spamtrap42@jacob21819.net
X-Trace: individual.net uij+buQsO8xpKUQuGGvo3gnh2FJbN03R91YXY2aOqL8hayuJr5
Cancel-Lock: sha1:IPqE2wWwPin5pbOjH4Z4J6IUrUg=
User-Agent: slrn/1.0.3 (Linux)
 by: Robert Riches - Fri, 14 May 2021 02:18 UTC

On 2021-05-13, Tauno Voipio <tauno.voipio@notused.fi.invalid> wrote:
> On 13.5.21 7.02, MSB wrote:
>> On Wed, 12 May 2021 19:54:01 +0300, Tauno Voipio
>> <tauno.voipio@notused.fi.invalid> wrote:
>>
>>> For simple copy we have cp, and for brute-force copy there is dd.
>>
>>
>> Most of the time I *do* just "cheap out" with system("cp ....").
>> It's easy, it works - albeit a bit ugly and "un-C".
>>
>> I did find that "mv" doesn't always get it right ... if a filename
>> includes weirdo characters.
>
> mv is *not* a copy operation, it is a shell cover for the rename()
> system call.

At least in old-days Unix, if the source and destination are on
different mountpoints, "mv" will copy the file to the destination
directory/file and then delete the source. Does the rename()
system call do that? The man page does not say it does.

--
Robert Riches
spamtrap42@jacob21819.net
(Yes, that is one of my email addresses.)

Re: Why No "fcopy()" in 'C' ?

<4urr9gtrhu2kd0fkj2q9h9n04rkmbe88ph@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5014&group=comp.os.linux.misc#5014

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!goblin1!goblin3!goblin.stu.neva.ru!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 13 May 2021 22:43:34 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 23:43:34 -0400
Message-ID: <4urr9gtrhu2kd0fkj2q9h9n04rkmbe88ph@4ax.com>
References: <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me> <3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com> <s7jeh0$e3d$1@milena.home.net.it>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 41
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-nl89txjlIwPtIit9tNN8aAtTJ3A/JflpG5Fudd/nv4j8HYIudH8TzGQTM6hk064sQ8QB/kb6xFVlDLI!HOLiGchU3HigiaqfdCNnkVHEUHRe/B/TtkD7Zbup/ai9ESYljKR5SOwRMWSkN8ymwEu1axskcWGT!+7EG+5wjQajOydA=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2959
 by: MSB - Fri, 14 May 2021 03:43 UTC

On Thu, 13 May 2021 16:53:20 +0200, Giovanni <lsodgf0@home.net.it>
wrote:

>On 05/13/2021 06:02 AM, MSB wrote:
>
>> So, if rename(), why not a standard fcopy() with a few
>> useful options too ? If the Linux clique isn't sure I guess
>> we'll never know for sure. I've been informed that Ritchie
>> is deceased ......
>
>There is a rename() function because it has to access file-system
>structures that are only known to the kernel.
>
>fcopy() isn't a standard function which can be implemented in few lines
>of code but in my long experience - I started in the late '70 using
>punched cards on a IBM mainframe with PL/1 - never had to copy a file.

Eh ??? I don't find that entirely credible.

Of course space WAS at a premium back then.

Not so good when your paper tape shredded ...

Now some of the peripherials of that era did a lot of
the work by themselves. "Duplicate To" could
sometimes be handled completely off the CPU.

According to IBM, in PL/1 you would do much as
you do now in 'C' ... read & write ... in order to copy.

>The standard libc is mostly a collection of standard functions whose
>purpose is to interact with structures handled only by the kernel.
>Most functions are defined in international standards as POSIX and ISO.
>You can ask the committees that issue the standards.

Not the perfect explaination, especially given the plethora of
functions in the standard libs, but it has a high truthiness
factor. Basically they saw no need and therefore didn't
bother.

Re: Why No "fcopy()" in 'C' ?

<6gsr9glh98d4vf0o8qc9jueb6r9h4bkrjl@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5015&group=comp.os.linux.misc#5015

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!goblin1!goblin3!goblin.stu.neva.ru!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 13 May 2021 22:50:46 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 23:50:46 -0400
Message-ID: <6gsr9glh98d4vf0o8qc9jueb6r9h4bkrjl@4ax.com>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me> <3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com> <s7jhaa$5jm$1@dont-email.me>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 25
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-L5JMboXVjXu0ba/DsCQAIB/MBDeKAIEt5DfH2idhzdv/LA05rXCaKySgT0QcaUhRInTXa04GUu1JiVH!ywEouHzUE/r1FAECESuYBYkoIE4TncgX1WFSw48DNt4D76vzFk6gPospBgcoBb8Jdy4WFNZi6r3p!LCg0MUjQsQwa7zI=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2378
 by: MSB - Fri, 14 May 2021 03:50 UTC

On Thu, 13 May 2021 18:40:57 +0300, Tauno Voipio
<tauno.voipio@notused.fi.invalid> wrote:

>On 13.5.21 7.02, MSB wrote:
>> On Wed, 12 May 2021 19:54:01 +0300, Tauno Voipio
>> <tauno.voipio@notused.fi.invalid> wrote:
>>
>>> For simple copy we have cp, and for brute-force copy there is dd.
>>
>>
>> Most of the time I *do* just "cheap out" with system("cp ....").
>> It's easy, it works - albeit a bit ugly and "un-C".
>>
>> I did find that "mv" doesn't always get it right ... if a filename
>> includes weirdo characters.
>
>mv is *not* a copy operation, it is a shell cover for the rename()
>system call.

But it does NOT always work the same. Names with any
kind of "escape" characters MAY not be handled properly.
Beware. I discovered this doing a backup app that handled
half a million files (mostly Winders files). Every time there
would be a handful of mistakes. Traced it to system("mv ...")

Re: Why No "fcopy()" in 'C' ?

<ktsr9g1fh9u6m1r1krmu5is99nkdb7csej@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5016&group=comp.os.linux.misc#5016

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 13 May 2021 22:59:12 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Thu, 13 May 2021 23:59:11 -0400
Message-ID: <ktsr9g1fh9u6m1r1krmu5is99nkdb7csej@4ax.com>
References: <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me> <3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com> <s7jhaa$5jm$1@dont-email.me> <slrns9rnfv.99t.spamtrap42@one.localnet>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 41
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-ZYHn4nHPgJdum4I2IDLAJB7ZZzgEsUfu+LAobGXErlWyldAkP8l+RmFm3e6pI5Y4l1pbz/CeaoaWSL5!lFbtaKMNUyOAzhiJ6Kg+2gIrr10u7weGJBttDRvHIeSq5xfBLkH9r3s24o6qzxNlkSGW482Du4Oc!hDA0ENMNYrJ0PY0=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3094
 by: MSB - Fri, 14 May 2021 03:59 UTC

On 14 May 2021 02:18:40 GMT, Robert Riches <spamtrap42@jacob21819.net>
wrote:

>On 2021-05-13, Tauno Voipio <tauno.voipio@notused.fi.invalid> wrote:
>> On 13.5.21 7.02, MSB wrote:
>>> On Wed, 12 May 2021 19:54:01 +0300, Tauno Voipio
>>> <tauno.voipio@notused.fi.invalid> wrote:
>>>
>>>> For simple copy we have cp, and for brute-force copy there is dd.
>>>
>>>
>>> Most of the time I *do* just "cheap out" with system("cp ....").
>>> It's easy, it works - albeit a bit ugly and "un-C".
>>>
>>> I did find that "mv" doesn't always get it right ... if a filename
>>> includes weirdo characters.
>>
>> mv is *not* a copy operation, it is a shell cover for the rename()
>> system call.
>
>At least in old-days Unix, if the source and destination are on
>different mountpoints, "mv" will copy the file to the destination
>directory/file and then delete the source. Does the rename()
>system call do that? The man page does not say it does.

It does for sure if the file being renamed is on the SAME
mountpoint. I'll have to check if it behaves the same if
we're talking two mountpoints. Interesting question.
I usually try to rename (or gzip for that matter) on ONE
mountpoint for speed and simplicity. If there's a problem
I've unconsciously gone around it for decades.

And there's one of the BIG problems of software verification,
the condition a given programmer/user has NEVER managed
to evoke because it's just not in their thought paradigm. I *do*
always try to throw some BS at critical functions, just to make
sure, but I guarentee there are combinations of conditions
I miss.

Re: Why No "fcopy()" in 'C' ?

<s7ktfd$aip$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5017&group=comp.os.linux.misc#5017

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Fri, 14 May 2021 04:14:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <s7ktfd$aip$1@dont-email.me>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78Sd$lurd@giganews.com> <s7esscTUur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me> <3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com> <s7jhaa$5jm$1@dont-email.me> <6gsr9glh98d4vf0o8qc9jueb6r9h4bkrjl@4ax.com>
Injection-Date: Fri, 14 May 2021 04:14:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="23e44688b1e81faa99fdc112d23832cd";
logging-data="10841"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dw4q8SSQAXbmtsHSkqg7Q"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:MVmnkASWd3USL9f2G7siq2IFDS4=
 by: Rich - Fri, 14 May 2021 04:14 UTC

MSB <Bit15_.us> wrote:
> On Thu, 13 May 2021 18:40:57 +0300, Tauno Voipio
> <tauno.voipio@notused.fi.invalid> wrote:
>
>>On 13.5.21 7.02, MSB wrote:
>>> On Wed, 12 May 2021 19:54:01 +0300, Tauno Voipio
>>> <tauno.voipio@notused.fi.invalid> wrote:
>>>
>>>> For simple copy we have cp, and for brute-force copy there is dd.
>>>
>>>
>>> Most of the time I *do* just "cheap out" with system("cp ....").
>>> It's easy, it works - albeit a bit ugly and "un-C".
>>>
>>> I did find that "mv" doesn't always get it right ... if a filename
>>> includes weirdo characters.
>>
>>mv is *not* a copy operation, it is a shell cover for the rename()
>>system call.
>
> But it does NOT always work the same. Names with any
> kind of "escape" characters MAY not be handled properly.

That is not mv's fault. That is the fault of the programmer who did
not properly escape shell special characters when using system() to
call 'mv'. The system() library call uses /bin/sh, so all the
characters that are special to /bin/sh have to first be escaped so
/bin/sh will not modify them.

Re: Why No "fcopy()" in 'C' ?

<qmtr9gl6h4ohoet12q795v95iir3c2br3g@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5018&group=comp.os.linux.misc#5018

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!goblin3!goblin.stu.neva.ru!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 13 May 2021 23:18:35 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Fri, 14 May 2021 00:18:35 -0400
Message-ID: <qmtr9gl6h4ohoet12q795v95iir3c2br3g@4ax.com>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s7eldp$dcr$1@dont-email.me> <s7en7k$dcr$3@dont-email.me> <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78SvNnZ2d@giganews.com> <s7essd$lur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <s7gknf$ggn$2@dont-email.me> <9l5p9g5nrc9ki39gtr4bo09d2a08tp4gs3@4ax.com> <s7j69l$1gd$2@dont-email.me>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 65
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-S0M6BImbt33QpXAOXWBYVaSlG8azWGpfcL7SKBJoqZD5f4Ynu3IKR6moHWQBdCumMRdiOkC7jHZ2DrJ!SxEod1n7/KEDt12/I+CimC2RLh6v9kMUd7YdEVYoaeJMnP6ZDD+FZI1RcL/HqmvBwK/pwEaAINWg!55qt/e7XT8hhhjk=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 4204
 by: MSB - Fri, 14 May 2021 04:18 UTC

On Thu, 13 May 2021 12:32:53 -0000 (UTC), Rich <rich@example.invalid>
wrote:

>MSB <Bit15_.us> wrote:
>> On Wed, 12 May 2021 13:20:47 -0000 (UTC), Rich <rich@example.invalid>
>> wrote:
>>
>>>MSB <Bit15_.us> wrote:
>>>> Geez ... my little inquiry seems to have gotten out of hand. I
>>>> assumed there'd be somebody a bit before my time who could clearly
>>>> explain why no standard fcopy() was in 'C'. Instead .............
>>>> :-)
>>>
>>>Yes, your trolling has been /loads of fun/...
>>>
>>>If you genuinely wanted an answer, and were really looking for folks
>>>who would likely know, you'd have posted to 'comp.lang.c'. Posting
>>>here, in the wrong group for that question, looks very trollish.
>>
>> Sorry, but I almost exclusively use Linux and it's
>> written amost entirely in 'C' .... so this ISN'T a
>> stupid place to ask the question.
>
>Other than C's libc, and the group of functions provided therein, were
>more or less standardized long before Linux existed. Linux may be
>mostly written in C, but that does not mean the authors of Linux also
>wrote the C compiler or the C library functions. There may be some
>crossover between the two, but gcc (the C compiler from GNU) and
>gnulibc (the C libraries, also from GNU) both existed before Linux.

UNIX came first, then 'C' made it better. Linus, fortunately,
didn't re-invent the 'C' wheel. Hey, just for fun, he MIGHT
have decided to write it all in BASICA or Lisp or something :-)

Hmm ... been looking at "alternatives" lately. Today I looked
at "Gambas". It's CLOSE to Visual BASIC. The environment
reminds me of Delphi/Lazarus but the code is a bit more
simple. Had a few weird issues, I'll see what the problems
are tomorrow or so. DOES produce a compiled product
however, which is better than Python (and Cython/Nutika
won't always save you there).

Long LONG ago I wrote a data-entry app for a Psion
Organizer. BASIC. It was essentially a long GOTO
ladder which let you go down or back at a keystroke.
Dunno if Gambas still does GOTO. It CAN be useful
and a big time/space saver if employed properly.

But that's another thread.

>> My next question is why you think I'm "trolling". It
>> was a perfectly legit historical question. I thought
>> there'd be ONE clear answer ... but no ......
>
>Your initial post did not look like a troll. But your subsequent goal
>post shifting, revisionist history, feigning confusion, and
>argumentative posts look very trollish.

Usenet threads "evolve" ... that's how it works. Start with
one subject and then it branches out. EVENTUALLY you
get a bunch of new threads that specialize on those
branches. Then THEY evolve ....

"Stream of consciousness" ?

Re: Why No "fcopy()" in 'C' ?

<q1vr9gpqt5bgprotdb46enc4kk9l3ss4aa@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5019&group=comp.os.linux.misc#5019

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 13 May 2021 23:43:06 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Fri, 14 May 2021 00:43:06 -0400
Message-ID: <q1vr9gpqt5bgprotdb46enc4kk9l3ss4aa@4ax.com>
References: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com> <s79kuo$19bd$1@gioia.aioe.org> <ageh9g1dnfltim7qnad5io4vmnhq7rjjab@4ax.com> <slrns9jtvg.j96.spamtrap42@one.localnet> <tsuj9gh0qsqfge4vg0v742vjrc833i8bu1@4ax.com> <s7drtn$l8j$2@dont-email.me> <87sg2tz1h6.fsf@LkoBDZeT.terraraq.uk> <s7ee8i$4t1$1@dont-email.me> <87k0o4z7vj.fsf@LkoBDZeT.terraraq.uk>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Lines: 58
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-BGKWIGPGIx0Wnm+8Jc/ZeamtzRWZ22j+NOvdffmNbg+RN2PXsalaK9KgBU9TcaYFIdAXTQml2hDdnF2!JC98Iis23fppZK3OqRZ64YcCAoHMBaBSrJx1lxkaNok+jps/Jx8oUFj0zIq+Xjy3XwfbqhqILxJV!p8TJgXbK9bOV0XU=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3818
 by: MSB - Fri, 14 May 2021 04:43 UTC

On Wed, 12 May 2021 09:14:24 +0100, Richard Kettlewell
<invalid@invalid.invalid> wrote:

>Rich <rich@example.invalid> writes:
>> Richard Kettlewell <invalid@invalid.invalid> wrote:
>>> Rich <rich@example.invalid> writes:
>>>> MSB <Bit15_.us> wrote:
>>>>> A "standard" function, like "printf" or "fopen()" is generally a
>>>>> GOOD thing, gets everyone on the same track instead of continually
>>>>> re-inventing the wheel (with the inevitible little variations).
>>>>
>>>> And, in C the language, there is also no printf() and no fopen().
>>>> Both of those are supplied by the libraries that accompany most
>>>> implementations of C the language.
>>>
>>> The OP is obviously talking about hosted implementations, not
>>> free-standing ones.
>>
>> While the OP has 'drifted' in his subsequent posts into additionally
>> talking about hosted implementations, it is not at all obvious that was
>> their initial question's framework.
>>
>> Their original was here:
>> Message-ID: <mg0c9ghgravcdi2cibr1l53fo1uqdm09lb@4ax.com>
>>
>> And there is certainly nothing in that initial post that "obviously"
>> indicates they are talking about hosted implementations.
>
>Now you’re just being silly. Hosted implementations have IO and
>free-standing implementations don’t (indeed they barely have a libc at
>all), so yes, it is obvious that he was talking about hosted
>implementations.

Nope. Was talking about GCC actually (or Clang, almost the
same thing these days).

NO fcopy() in GCC.

Yes, it's easy to write - but after DECADES you'd think there
would be a "standard" function with a few useful options so
everybody would be on the same page, so to speak. Mostly,
such "standardization" is a GOOD thing.

Python has open statements with "r" OR "rb" ... yes, Python
has issues with binary. 'C' *can* handle things just a tad
differently depending on whether you use open/read/write
or fopen/fread/fwrite ... mostly a matter of how fwrite()
can try to "fix" line-endings, assuming you're doing text
files and want newlines at the end and/or "escape"
sequences interpreted. A fcopy() with "r" or "rb", "w" or
"wb" options, doesn't seem ridiculous as a "standard".

I've heard various reasons here why fcopy() was never
included in a standard libary. Some sound legit, others
not so much. There are just SO many quasi-useless
things in todays libraries ... I see a "hole" that's been
there pretty much from the beginning.

Re: Why No "fcopy()" in 'C' ?

<0b0s9gpcog1sdc3fcjllq42573s7k7ovg8@4ax.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=5020&group=comp.os.linux.misc#5020

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 13 May 2021 23:57:23 -0500
From: Bit15_...@nowhere (MSB)
Newsgroups: comp.os.linux.misc
Subject: Re: Why No "fcopy()" in 'C' ?
Date: Fri, 14 May 2021 00:57:23 -0400
Message-ID: <0b0s9gpcog1sdc3fcjllq42573s7k7ovg8@4ax.com>
References: <s7eo6l$dcr$5@dont-email.me> <z46dncKcx8LKbQf9nZ2dnUU78Sd$lurd@giganews.com> <s7esscTUur$2@dont-email.me> <yYedncTUQJMEkgb9nZ2dnUU7-a_NnZ2d@giganews.com> <slrns9mg94.rtj.spamtrap42@one.localnet> <rclm9g5p3fccssosr9228c9q84o2nbsduq@4ax.com> <ig2bnkFu2j3U4@mid.individual.net> <s7h17a$gqv$1@dont-email.me> <3b7p9gtsqsb6h0ijmhjhdugunnsf37836g@4ax.com> <s7jhaa$5jm$1@dont-email.me> <6gsr9glh98d4vf0o8qc9jueb6r9h4bkrjl@4ax.com> <s7ktfd$aip$1@dont-email.me>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 47
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.166.178
X-Trace: sv3-EjVMZbGpyAYRrG9odqV5y+qcWqScLtE5qqywqL9ODcChGKvryjhxOZb/Aibc66mGpJVMcO9khQD7SMO!MTdXOqc6OaSW1DCMuBoUZ7tKDXKKFep/pg93hzFHtH9eImGlyhh1zCkufdBLxp9HAqNy17EtK0EI!h7GPyAoJSJ3wgDQ=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3254
 by: MSB - Fri, 14 May 2021 04:57 UTC

On Fri, 14 May 2021 04:14:37 -0000 (UTC), Rich <rich@example.invalid>
wrote:

>MSB <Bit15_.us> wrote:
>> On Thu, 13 May 2021 18:40:57 +0300, Tauno Voipio
>> <tauno.voipio@notused.fi.invalid> wrote:
>>
>>>On 13.5.21 7.02, MSB wrote:
>>>> On Wed, 12 May 2021 19:54:01 +0300, Tauno Voipio
>>>> <tauno.voipio@notused.fi.invalid> wrote:
>>>>
>>>>> For simple copy we have cp, and for brute-force copy there is dd.
>>>>
>>>>
>>>> Most of the time I *do* just "cheap out" with system("cp ....").
>>>> It's easy, it works - albeit a bit ugly and "un-C".
>>>>
>>>> I did find that "mv" doesn't always get it right ... if a filename
>>>> includes weirdo characters.
>>>
>>>mv is *not* a copy operation, it is a shell cover for the rename()
>>>system call.
>>
>> But it does NOT always work the same. Names with any
>> kind of "escape" characters MAY not be handled properly.
>
>That is not mv's fault. That is the fault of the programmer who did
>not properly escape shell special characters when using system() to
>call 'mv'. The system() library call uses /bin/sh, so all the
>characters that are special to /bin/sh have to first be escaped so
>/bin/sh will not modify them.

Sorry, but I collect filenames and then DO stuff
with them - and do NOT want to have to out-think
"mv" for every possible instance, making my code
five times larger and more complex.

So, now, it's rename() instead of system("mv ...)
forever and always.

I ran into this problem in a backup app that was handling
over half a million (mostly Winders) files. There would
always be a handful of problem cases - which I traced
to system("mv ..."). So, 200 lines of code looking for
everything/anything that might possibly be seen by the
system as an "escape" sequence, today - or rename() ?

Pages:1234
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor