Talk:Yes (Unix)

Deletion of "Source Code"
I deleted the so-called "source code" because I believe it violates WP:NOR.

"Source code" means the human-readable instructions from which a computer program is derived.

The code as originally posted on 24 August 2016 is obviously not the set of instructions from which a specific implementation of the yes program is derived, because (1) The C code provided does not even cause the behavior of the program; (2) any specific implementation of the program would be written in only one language, not two; and (3) the code contains style errors that a programmer experienced enough to be entrusted with writing core operating system tools would be very unlikely to make.

The code was revised on 2 September 2016 so that it reproduces the correct behavior of the yes command as it is implemented on BSD-based systems (though not on GNU-based systems). However, the style and performance errors remain.

The code was again revised on 7 December 2016. This revision appears to have attempted to modify the behavior from the BSD behavior (printing the first provided argument indefinitely and ignoring the other arguments) to the GNU behavior (printing a string formed by all arguments indefinitely). However, the code from this revision introduces a different functional error (namely, that an extra space is added at the end of the reproduced string). The style and performance errors remain.

For reference, the style errors that I saw in all versions of the code are:
 * Using printf instead of puts seems out of place in a core operating system tool, because in a core operating system tool, the speed of the program's operation may be very important. Printf is slower than puts, because it needs to examine the printf format string and make appropriate replacements before outputting the string, whereas puts just outputs the string. (Note that the [actual OpenBSD source code for yes] uses puts rather than printf.)
 * Using 1 as the condition in a while loop seems inappropriate in C++, because C++ expects a boolean as the condition in a while loop. While the compiler may optimize this away and effectively replace the 1 with true, it is better style for the programmer to use the appropriate type in the first place.

The "routine calculations" section of WP:NOR (WP:CALC) does not apply here. The several revisions to the code, together with my distaste for the current version, demonstrate that the there is no consensus that the code is "obvious, correct, and a meaningful reflection of the sources" as the policy advises.

--68.115.32.106 (talk) 13:07, 8 December 2017 (UTC)

[Untitled]
Pretty much rewrote this entry.


 * Removed the example of using it in conjunction with 'rm' - 'rm -f', as noted, achieves the exact same thing as 'yes|rm', assuming that rm is aliased to 'rm -i'.
 * Changed occurances of 'Expletive' to 'STRING'
 * Added options, as found in the man page
 * Clarified how yes(1) works - basically, runs until killed or the pipe breaks. Previous entry suggested it kept going, or at least was ambiguous to that regard.  See rev history.
 * Removed See Also. "The environment file" is ambiguous, and as near as I can tell, yes doesn't really rely on locales a whole lot.
 * Removed some of the arbitrary line breaks for cleanup, and restructured internal headers.

—Preceding unsigned comment added by Ke6isf (talk • contribs) 21:08, 18 February 2006

This program can have other uses too, such as: yes > /dev/dsp yes yyy > /dev/dsp yes yyyyy > /dev/dsp --zzo38(✉) 03:04, 23 May 2010 (UTC)

History?
Can we possibly get some history on this and other core commands? It would be interesting to know if this (and other core commands) came about in UNIX, or if it was ported from Multics or earlier OSes. What the rational was for it, etc. I know yes is a trivial example, but it would still seem like appropriate content for the article. — Preceding unsigned comment added by Kyleaschmitt (talk • contribs) 17:54, 27 February 2012 (UTC)