Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Torque is cheap.


devel / comp.lang.c / Re: getFirstDayOfMonth()

SubjectAuthor
* getFirstDayOfMonth()Mike Sanders
`* Re: getFirstDayOfMonth()Kenny McCormack
 +* Re: getFirstDayOfMonth()Janis Papanagnou
 |`* Re: getFirstDayOfMonth()Keith Thompson
 | +* Re: getFirstDayOfMonth()Janis Papanagnou
 | |`* Re: getFirstDayOfMonth()Janis Papanagnou
 | | `* Re: getFirstDayOfMonth()Keith Thompson
 | |  `- Re: getFirstDayOfMonth()Janis Papanagnou
 | `- Re: getFirstDayOfMonth()Mike Sanders
 +- Re: getFirstDayOfMonth()Scott Lurndal
 +- Re: getFirstDayOfMonth()Janis Papanagnou
 +- Re: getFirstDayOfMonth()Mike Sanders
 +* Re: getFirstDayOfMonth()Mike Sanders
 |`* Re: getFirstDayOfMonth()Scott Lurndal
 | +* Re: getFirstDayOfMonth()Mike Sanders
 | |`- Re: getFirstDayOfMonth()Tim Rentsch
 | `* Re: getFirstDayOfMonth()Mike Sanders
 |  `* Re: getFirstDayOfMonth()Scott Lurndal
 |   +- Re: getFirstDayOfMonth()Janis Papanagnou
 |   +* Re: getFirstDayOfMonth()Mike Sanders
 |   |+* Re: getFirstDayOfMonth()Janis Papanagnou
 |   ||`* Re: getFirstDayOfMonth()Mike Sanders
 |   || `- Re: getFirstDayOfMonth()Janis Papanagnou
 |   |+* Re: getFirstDayOfMonth()Keith Thompson
 |   ||+* Re: getFirstDayOfMonth()Janis Papanagnou
 |   |||+* Re: getFirstDayOfMonth()David Brown
 |   ||||+* Re: getFirstDayOfMonth()Kaz Kylheku
 |   |||||`- Re: getFirstDayOfMonth()David Brown
 |   ||||+* Re: getFirstDayOfMonth()Malcolm McLean
 |   |||||`- Re: getFirstDayOfMonth()Richard Harnden
 |   ||||`- Re: getFirstDayOfMonth()Janis Papanagnou
 |   |||`* Re: getFirstDayOfMonth()Mike Sanders
 |   ||| +* Re: getFirstDayOfMonth()Scott Lurndal
 |   ||| |`* Re: getFirstDayOfMonth()Mike Sanders
 |   ||| | `* Re: getFirstDayOfMonth()Scott Lurndal
 |   ||| |  +* Re: getFirstDayOfMonth()Kaz Kylheku
 |   ||| |  |`- Re: getFirstDayOfMonth()Scott Lurndal
 |   ||| |  `* Re: getFirstDayOfMonth()Janis Papanagnou
 |   ||| |   `- Re: getFirstDayOfMonth()Scott Lurndal
 |   ||| `* Re: getFirstDayOfMonth()Janis Papanagnou
 |   |||  +- Re: getFirstDayOfMonth()Mike Sanders
 |   |||  `* Re: getFirstDayOfMonth()Mark Bourne
 |   |||   `- Re: getFirstDayOfMonth()Scott Lurndal
 |   ||`* Re: getFirstDayOfMonth()Mike Sanders
 |   || +* Re: getFirstDayOfMonth()Scott Lurndal
 |   || |+- Re: getFirstDayOfMonth()Keith Thompson
 |   || |`* Re: getFirstDayOfMonth()Mike Sanders
 |   || | +- Re: getFirstDayOfMonth()Keith Thompson
 |   || | +* Re: getFirstDayOfMonth()Mike Sanders
 |   || | |`* [OT] Re: getFirstDayOfMonth()Janis Papanagnou
 |   || | | `- Re: [OT] Re: getFirstDayOfMonth()Mike Sanders
 |   || | `* Re: getFirstDayOfMonth()Scott Lurndal
 |   || |  `- Re: getFirstDayOfMonth()Keith Thompson
 |   || `* Re: getFirstDayOfMonth()Lew Pitcher
 |   ||  +* Re: getFirstDayOfMonth()Michael S
 |   ||  |+- Re: getFirstDayOfMonth()Michael S
 |   ||  |`- Re: getFirstDayOfMonth()Tim Rentsch
 |   ||  +- Re: getFirstDayOfMonth()Mike Sanders
 |   ||  `- Re: getFirstDayOfMonth()Janis Papanagnou
 |   |+* Re: getFirstDayOfMonth()James Kuyper
 |   ||`* Re: getFirstDayOfMonth()Mike Sanders
 |   || +- Re: getFirstDayOfMonth()James Kuyper
 |   || +* Re: getFirstDayOfMonth()Keith Thompson
 |   || |`* Re: getFirstDayOfMonth()Mike Sanders
 |   || | +* Re: getFirstDayOfMonth()Kaz Kylheku
 |   || | |+- Re: getFirstDayOfMonth()Mike Sanders
 |   || | |`- Re: getFirstDayOfMonth()Scott Lurndal
 |   || | `* Re: getFirstDayOfMonth()Keith Thompson
 |   || |  `- Re: getFirstDayOfMonth()Mike Sanders
 |   || `* Re: getFirstDayOfMonth()Michael S
 |   ||  `* Re: getFirstDayOfMonth()Mike Sanders
 |   ||   `- Re: getFirstDayOfMonth()Keith Thompson
 |   |`* Re: getFirstDayOfMonth()Scott Lurndal
 |   | `* Re: getFirstDayOfMonth()Michael S
 |   |  `- Re: getFirstDayOfMonth()Scott Lurndal
 |   `- Re: getFirstDayOfMonth()Mark Bourne
 +* Re: getFirstDayOfMonth()jak
 |+* Re: getFirstDayOfMonth()Tim Rentsch
 ||`- Re: getFirstDayOfMonth()jak
 |`* Re: getFirstDayOfMonth()Peter 'Shaggy' Haywood
 | `* Re: getFirstDayOfMonth()bart
 |  `* Re: getFirstDayOfMonth()jak
 |   `* Re: getFirstDayOfMonth()jak
 |    +* Re: getFirstDayOfMonth()Spiros Bousbouras
 |    |`* Re: getFirstDayOfMonth()Keith Thompson
 |    | `- Re: getFirstDayOfMonth()Keith Thompson
 |    `* Re: getFirstDayOfMonth()Keith Thompson
 |     `- Re: getFirstDayOfMonth()Tim Rentsch
 `* Re: getFirstDayOfMonth()Kaz Kylheku
  +- Re: getFirstDayOfMonth()Peter 'Shaggy' Haywood
  `- Re: getFirstDayOfMonth()Kenny McCormack

Pages:1234
Re: getFirstDayOfMonth()

<us22ac$2hp4u$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34019&group=comp.lang.c#34019

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED.2001:a61:2633:2b01:88ab:a6ed:a355:85be!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Sun, 3 Mar 2024 15:43:22 +0100
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <us22ac$2hp4u$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 3 Mar 2024 14:43:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2001:a61:2633:2b01:88ab:a6ed:a355:85be";
logging-data="2679966"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
In-Reply-To: <87ttloqnnk.fsf@nosuchdomain.example.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Sun, 3 Mar 2024 14:43 UTC

On 02.03.2024 23:22, Keith Thompson wrote:
> porkchop@invalid.foo (Mike Sanders) writes:
>> Scott Lurndal <scott@slp53.sl.home> wrote:
>>> If I may suggest:
>>>
>>> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
>>>
>>> '-h' or '-?' have traditionally been used to display
>>> usage information for an utility.
>>
>> Yep, it will definitely be '-?' (still working to finalize things).
>
> I wouldn't use '-?'. The '?' character is a wildcard in most Unix
> shells. If you happen to have a file in the current directory that
> matches the pattern, it will expand to the name of that file. If you
> don't, the behavior depends on the shell and settings.
>
> [snip code sample]
>
> And most users of Unix-like systems won't expect '-?' to be an option;

I cannot speak for "most users of Unix-like systems" but my personal
experience differs.

> '-h' is much more common.

The "problem" is that you may want to have -h as an option character,
especially if your program supports a lot of options and you have no
creative naming way of choosing another character. (An example from
one of my recent implementations is using -h for 'height'.[*])

The advantage of -? is that is has as non-alpha option not a mnemonic
character. (We thus used it since the 1990's even in coding standards
as our preferred standard way to interrogate usage.)

Your point that -h may be a file is nonetheless valid, of course, as
would be a file named -?. Both are rather rare though and typically
the result of an error; especially commands started from the shell
will report errors and you have to use '--' to create files like -h.
The Shell also allows to disable file globbing if that happens to
appear to be an issue and if you don't want to just quote the -? in
such (rare) corner-cases with pathological filenames.

There's functional option names with application semantics (usually
expressed with mnemonic characters, or long names) and meta options
like issuing a usage synopsis. I'd certainly like to have mnemonics
preserved for the applications!

That's why using non-alpha key-symbols is also the standard for e.g.
Ksh; its option processing builtin 'getopts' _inherently_ supports
(for all shell scripts that use this function for option processing)
the meta options -? (for usage synopsis), --?? (for a verbose usage
message), and the prefix --?? generally for other meta-formats (like
--??html or also long form alternatives like --html to create usage
information in HTML).[**]

Janis

[*] In scripts you may of course also define long option names but
for interactive use it's certainly not a preferred workaround.

[**] That's also why I think that [without evidence] we cannot assume
"most users of Unix-like systems" to be a reliable qualification. It
seems to be a common standard.

Re: getFirstDayOfMonth()

<NC0FN.35691$zF_1.29507@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34021&group=comp.lang.c#34021

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: getFirstDayOfMonth()
Newsgroups: comp.lang.c
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me>
Lines: 81
Message-ID: <NC0FN.35691$zF_1.29507@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sun, 03 Mar 2024 15:24:29 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sun, 03 Mar 2024 15:24:29 GMT
X-Received-Bytes: 3255
 by: Scott Lurndal - Sun, 3 Mar 2024 15:24 UTC

porkchop@invalid.foo (Mike Sanders) writes:
>Scott Lurndal <scott@slp53.sl.home> wrote:
>
>> If I may suggest:
>>
>> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
>>
>> '-h' or '-?' have traditionally been used to display
>> usage information for an utility.
>
>Yep, it will definitely be '-?' (still working to finalize things).
>
>Many thanks for the link too btw.
>
>>>Error levels returned:
>>>
>>>3 Option syntax errors
>>>2 File open-read errors
>>>1 Dates match today or matching tags
>>>0 No dates match today or no tags match
>>
>> For commands defined by POSIX (and generally in
>> unix), an exit status of zero indicates success.
>
>Oh yeah. Have been wrestling with the potential
>consequences of this for a good while. I think I'm
>going leave it as is because, (only speaking for
>myself here) the POSIX 0 good, 1 bad is terrible.

The reason posix commands return zero for success
is because the posix (and all other shells)
check the exit status of a command and treat
non-zero values as failure.

$ grep 'sigdelset' asim.cpp
$ echo $?
1 $ grep 'sigaddset' asim.cpp
sigaddset(&signals, SIGHUP);
sigaddset(&signals, SIGABRT);
sigaddset(&signals, SIGPIPE);
sigaddset(&signals, SIGUSR1);
sigaddset(&signals, SIGUSR2);
sigaddset(&sa.sa_mask, SIGHUP);
sigaddset(&sa.sa_mask, SIGINT);
sigaddset(&sa.sa_mask, SIGQUIT);
sigaddset(&sa.sa_mask, SIGTERM);
sigaddset(&sa.sa_mask, SIGXCPU);
$ echo $?
0

if grep -q 'sigaddset' asim.cpp
then
echo "Found it!"
fi

>This is perhaps the only area I've ever seen where
>other OSs, like Windows, have a superior methodology
>on the issue. 0/1 provides next to no nuance. But
>I'm no expert, just my experience.

It's not 0/1, it is 0 for success and non-zero for
failure, where the failure is indicated by the
exit value (often restricted to 8-bits due to
the legacy wait(2) system call, however the
newer (for some value of new) system call waitid(2)
supports the full 32-bit exit status).

For example, the grep command returns
0 - success
1 - No lines were matched/selected
>1 - An error occurred.

Some utilities define additional exit status values.

VMS defined '1' (SS$_NORMAL) as the success return
value from system calls and commands, which is likely
the source of that feature in windows.

I've yet to find any feature of windows that is truely
superior (rather than just different).

Re: getFirstDayOfMonth()

<us2cvn$2k5bs$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34023&group=comp.lang.c#34023

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Sun, 3 Mar 2024 18:45:26 +0100
Organization: A noiseless patient Spider
Lines: 73
Message-ID: <us2cvn$2k5bs$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com>
<us22ac$2hp4u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 3 Mar 2024 17:45:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d857d54a78fadec21f1e634cdf023221";
logging-data="2758012"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pWoqMA6tz8XCqMvCrOWLvJQqNM8cMcFc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:6T42iTRWhRRgZVhTt9RwQzPZGzs=
In-Reply-To: <us22ac$2hp4u$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Sun, 3 Mar 2024 17:45 UTC

On 03/03/2024 15:43, Janis Papanagnou wrote:
> On 02.03.2024 23:22, Keith Thompson wrote:
>> porkchop@invalid.foo (Mike Sanders) writes:
>>> Scott Lurndal <scott@slp53.sl.home> wrote:
>>>> If I may suggest:
>>>>
>>>> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
>>>>
>>>> '-h' or '-?' have traditionally been used to display
>>>> usage information for an utility.
>>>
>>> Yep, it will definitely be '-?' (still working to finalize things).
>>
>> I wouldn't use '-?'. The '?' character is a wildcard in most Unix
>> shells. If you happen to have a file in the current directory that
>> matches the pattern, it will expand to the name of that file. If you
>> don't, the behavior depends on the shell and settings.
>>
>> [snip code sample]
>>
>> And most users of Unix-like systems won't expect '-?' to be an option;
>
> I cannot speak for "most users of Unix-like systems" but my personal
> experience differs.
>

Try "cmd -h" and "cmd -?" for a selection of programs on your *nix
system. You'll find that "-h" will almost invariably give you a brief
help message. "-?" will also work for some programs, but not many - and
typically "-h" will work too for these programs.

"-?" is common in the DOS/Windows world, and for programs that come from
there, while "-h" is vastly more common in the *nix world. (And of
course, "--help" works too, as single-letter options usually also have a
full word version.)

>> '-h' is much more common.
>
> The "problem" is that you may want to have -h as an option character,
> especially if your program supports a lot of options and you have no
> creative naming way of choosing another character. (An example from
> one of my recent implementations is using -h for 'height'.[*])

Having "-h" as an option for something other than "--help" would be insane.

>
> The advantage of -? is that is has as non-alpha option not a mnemonic
> character. (We thus used it since the 1990's even in coding standards
> as our preferred standard way to interrogate usage.)
>
> Your point that -h may be a file is nonetheless valid, of course, as
> would be a file named -?.

File names that match "-?" would be any file name that starts with "-",
and is followed by a single character. So "-x" would match just as well
as "-?". I don't think it is likely to have such filenames, but it is
perhaps not /quite/ as unlikely as "-?".

> Both are rather rare though and typically
> the result of an error; especially commands started from the shell
> will report errors and you have to use '--' to create files like -h.

There are a variety of ways of doing it. The easiest way would be to
use "./-x" (or "./-h", or whatever).

> The Shell also allows to disable file globbing if that happens to
> appear to be an issue and if you don't want to just quote the -? in
> such (rare) corner-cases with pathological filenames.

That would be an extraordinary effort to work around poor choices of
options in a program.

Re: getFirstDayOfMonth()

<86h6hntdfo.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34024&group=comp.lang.c#34024

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Sun, 03 Mar 2024 09:47:39 -0800
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <86h6hntdfo.fsf@linuxsc.com>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <uru0k6$1hpdi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="8e6876f3e46194a45503e9d93596105d";
logging-data="2754882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18IQ406lLNlMDL9fwKqSK+JoaJPbz2TKKk="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:W/IA2ImItVTjDnQzmeSaPS3G29E=
sha1:/nW0JzxRRV9PiyNZ4OKXAQNRWlg=
 by: Tim Rentsch - Sun, 3 Mar 2024 17:47 UTC

jak <nospam@please.ty> writes:

> Kenny McCormack ha scritto:
>
>> In article <urrj5l$124o9$1@dont-email.me>,
>> Mike Sanders <porkchop@invalid.foo> wrote:
>>
>>> Just sharing what I've learned, hope some of you can adapt
>>> it for your own use.
>>>
>>> Calculates the name of the weekday (Sun, Mon, etc) for the
>>> 1st day of a given month & year...
>>>
>>> https://busybox.neocities.org/notes/get-first-day-of-month.txt
>>
>> Here's the guts of my version of the Zeller algorithm:
>>
>> int day(d,m,y)
>> int d, m, y;
>> {
>> if (m < 3) {
>> m += 12;
>> y--;
>> }
>> return (d + (13*m-27)/5 + y + y/4 - y/100 + y/400) % 7;
>
> I am referring in particular to this part of the equation:
> y + y/4 - y/100 + y/400
> Shouldn't it be calculated in a floating point and then truncated only
> the final result? Because, for example, if the year is 2024, the
> floating point calculation is 2514 (2514.82) while executed between
> integer is 2515.

The short answer is No. If you try some examples I expect
you will see that using integer division always gives
correct results. Leap days always happen in integer amounts,
so integer division is the right way to calculate them.

Note: I haven't tested this particular algorithm and so
cannot vouch for its correctness. But the part that
determines an extra number of days based on what year
it is matches other algorithms that I have tested.

Re: getFirstDayOfMonth()

<86cysbtd75.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34025&group=comp.lang.c#34025

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Sun, 03 Mar 2024 09:52:46 -0800
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <86cysbtd75.fsf@linuxsc.com>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtij7$1etmt$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="8e6876f3e46194a45503e9d93596105d";
logging-data="2754882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Cncxe0rmSMNYAwpqcqryJ9x2tgICnYzg="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:6tEpLCF5PQebOXRrScaMgRyyPxY=
sha1:wjaSWauXPSs8zmSnYmzonaOT8xk=
 by: Tim Rentsch - Sun, 3 Mar 2024 17:52 UTC

porkchop@invalid.foo (Mike Sanders) writes:

> Scott Lurndal <scott@slp53.sl.home> wrote:
>
>> That must not have been for 2024, or you have a bug.
>
> Well Scott, in the code of the link posted its displaying 2022:
>
> int year = 2022;
>
>> A calendar utility comes with most linux systems. It also supports
>> ISO 8601 which starts the week on Monday instead of Sunday.
>
> Yes sir, I know that. But I want to build my own instead so I can
> learn more about it. Even if that means reiventing the wheel, at
> least I'll learn it as I wish. Hoping not to sound contrite,
> cant we all just help each other learn? Darn man.

If you want to reinvent wheels, I suggest looking for some
rather more interesting wheels.

Re: getFirstDayOfMonth()

<20240303202004.00007517@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34028&group=comp.lang.c#34028

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Sun, 3 Mar 2024 20:20:04 +0200
Organization: A noiseless patient Spider
Lines: 95
Message-ID: <20240303202004.00007517@yahoo.com>
References: <urrj5l$124o9$1@dont-email.me>
<urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me>
<7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me>
<pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me>
<NC0FN.35691$zF_1.29507@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="f81cf74dab80d461d816c48d20d52fcc";
logging-data="2772266"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/B2ujakbKbU2xZPVvqJaR/EDyg/vCnKH0="
Cancel-Lock: sha1:3KI/CqERjpzH8FlE+NYtKzsimTU=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 3 Mar 2024 18:20 UTC

On Sun, 03 Mar 2024 15:24:29 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:

> porkchop@invalid.foo (Mike Sanders) writes:
> >Scott Lurndal <scott@slp53.sl.home> wrote:
> >
> >> If I may suggest:
> >>
> >> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
> >>
> >> '-h' or '-?' have traditionally been used to display
> >> usage information for an utility.
> >
> >Yep, it will definitely be '-?' (still working to finalize things).
> >
> >Many thanks for the link too btw.
> >
> >>>Error levels returned:
> >>>
> >>>3 Option syntax errors
> >>>2 File open-read errors
> >>>1 Dates match today or matching tags
> >>>0 No dates match today or no tags match
> >>
> >> For commands defined by POSIX (and generally in
> >> unix), an exit status of zero indicates success.
> >
> >Oh yeah. Have been wrestling with the potential
> >consequences of this for a good while. I think I'm
> >going leave it as is because, (only speaking for
> >myself here) the POSIX 0 good, 1 bad is terrible.
>
> The reason posix commands return zero for success
> is because the posix (and all other shells)
> check the exit status of a command and treat
> non-zero values as failure.
>
> $ grep 'sigdelset' asim.cpp
> $ echo $?
> 1
> $ grep 'sigaddset' asim.cpp
> sigaddset(&signals, SIGHUP);
> sigaddset(&signals, SIGABRT);
> sigaddset(&signals, SIGPIPE);
> sigaddset(&signals, SIGUSR1);
> sigaddset(&signals, SIGUSR2);
> sigaddset(&sa.sa_mask, SIGHUP);
> sigaddset(&sa.sa_mask, SIGINT);
> sigaddset(&sa.sa_mask, SIGQUIT);
> sigaddset(&sa.sa_mask, SIGTERM);
> sigaddset(&sa.sa_mask, SIGXCPU);
> $ echo $?
> 0
>
> if grep -q 'sigaddset' asim.cpp
> then
> echo "Found it!"
> fi
>
> >This is perhaps the only area I've ever seen where
> >other OSs, like Windows, have a superior methodology
> >on the issue. 0/1 provides next to no nuance. But
> >I'm no expert, just my experience.
>
> It's not 0/1, it is 0 for success and non-zero for
> failure, where the failure is indicated by the
> exit value (often restricted to 8-bits due to
> the legacy wait(2) system call, however the
> newer (for some value of new) system call waitid(2)
> supports the full 32-bit exit status).
>
> For example, the grep command returns
> 0 - success
> 1 - No lines were matched/selected
> >1 - An error occurred.
>
> Some utilities define additional exit status values.
>
> VMS defined '1' (SS$_NORMAL) as the success return
> value from system calls and commands, which is likely
> the source of that feature in windows.
>

Source of what feature in Windows?
Windows does not care too much about exit code, but to the level it
does care it follows the same conventions as Unix.

> I've yet to find any feature of windows that is truely
> superior (rather than just different).

How about F8 in cmd.exe shell?
Is not it non-trivially better than Crrl-r ?

Re: getFirstDayOfMonth()

<20240303102730.829@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34030&group=comp.lang.c#34030

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Sun, 3 Mar 2024 18:42:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <20240303102730.829@kylheku.com>
References: <urrj5l$124o9$1@dont-email.me>
<urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me>
<7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me>
<pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me>
<87ttloqnnk.fsf@nosuchdomain.example.com> <us22ac$2hp4u$1@dont-email.me>
<us2cvn$2k5bs$1@dont-email.me>
Injection-Date: Sun, 3 Mar 2024 18:42:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2a4cf53726382e543b2e0eba8b36e2b7";
logging-data="2784431"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/K24a2VyxOHFvfY54/s4cRiXOXeljxLA0="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:bwfsYL8kJLwIaODinrCBKTTFY+A=
 by: Kaz Kylheku - Sun, 3 Mar 2024 18:42 UTC

On 2024-03-03, David Brown <david.brown@hesbynett.no> wrote:
> On 03/03/2024 15:43, Janis Papanagnou wrote:
>> On 02.03.2024 23:22, Keith Thompson wrote:
>>> porkchop@invalid.foo (Mike Sanders) writes:
>>>> Scott Lurndal <scott@slp53.sl.home> wrote:
>>>>> If I may suggest:
>>>>>
>>>>> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
>>>>>
>>>>> '-h' or '-?' have traditionally been used to display
>>>>> usage information for an utility.
>>>>
>>>> Yep, it will definitely be '-?' (still working to finalize things).
>>>
>>> I wouldn't use '-?'. The '?' character is a wildcard in most Unix
>>> shells. If you happen to have a file in the current directory that
>>> matches the pattern, it will expand to the name of that file. If you
>>> don't, the behavior depends on the shell and settings.
>>>
>>> [snip code sample]
>>>
>>> And most users of Unix-like systems won't expect '-?' to be an option;
>>
>> I cannot speak for "most users of Unix-like systems" but my personal
>> experience differs.
>>
>
> Try "cmd -h" and "cmd -?" for a selection of programs on your *nix
> system. You'll find that "-h" will almost invariably give you a brief
> help message.

Mostly because it's an unrecognized option.

E.g. gnu grep:

$ grep -z
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
!2!
$ grep -h
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
!2!

-h isn't special in this data point.

There is no convention in POSIX or traditional Unix that -h means
help.

The lack of a -h convention is one of the reasons why GNU invented the
--help option. Plus the problem of the letters having inconsistent
meanings is also addressed with long option synonyms.

The GNU Coding Standards document contains a summary of the long
options used by GNU programs. The idea is that if you're introducing a
new option, it's a good idea to look here to see if other programs
already have something with similar semantics, and then use that
name.

https://www.gnu.org/prep/standards/html_node/Option-Table.html#Option-Table

> Having "-h" as an option for something other than "--help" would be insane.

du -h # human-readable sizes

df -h # human-readable sizes

ls -h # human-readhable sizes

free -h # human-readhable sizes

ps -h # suppress (h)eader.

grep -h # suppress prefixing of filenames when multiple files saerched.

rsync -h # human-readable sizes

Some of these are in POSIX.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: getFirstDayOfMonth()

<XJ3FN.115214$Vrtf.30287@fx39.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34031&group=comp.lang.c#34031

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx39.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: getFirstDayOfMonth()
Newsgroups: comp.lang.c
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <NC0FN.35691$zF_1.29507@fx18.iad> <20240303202004.00007517@yahoo.com>
Lines: 15
Message-ID: <XJ3FN.115214$Vrtf.30287@fx39.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sun, 03 Mar 2024 18:56:55 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sun, 03 Mar 2024 18:56:55 GMT
X-Received-Bytes: 1196
 by: Scott Lurndal - Sun, 3 Mar 2024 18:56 UTC

Michael S <already5chosen@yahoo.com> writes:
>On Sun, 03 Mar 2024 15:24:29 GMT
>scott@slp53.sl.home (Scott Lurndal) wrote:
>

>
>> I've yet to find any feature of windows that is truely
>> superior (rather than just different).
>
>How about F8 in cmd.exe shell?
>Is not it non-trivially better than Crrl-r ?

I have no idea what F8 does in cmd.exe.

Or crrl-r.

Re: getFirstDayOfMonth()

<us3810$2pqrm$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34053&group=comp.lang.c#34053

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 02:26:56 +0100
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <us3810$2pqrm$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<uru0k6$1hpdi$1@dont-email.me> <86h6hntdfo.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 4 Mar 2024 01:26:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3dd35eeaeeb2c81041951f7d31a5de99";
logging-data="2943862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+AYGGjMnRaQDipXvg2HJ1N"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:qmtm6i8llsbB37MQ0ct9SjNNWRw=
In-Reply-To: <86h6hntdfo.fsf@linuxsc.com>
 by: jak - Mon, 4 Mar 2024 01:26 UTC

Tim Rentsch ha scritto:
> jak <nospam@please.ty> writes:
>
>> Kenny McCormack ha scritto:
>>
>>> In article <urrj5l$124o9$1@dont-email.me>,
>>> Mike Sanders <porkchop@invalid.foo> wrote:
>>>
>>>> Just sharing what I've learned, hope some of you can adapt
>>>> it for your own use.
>>>>
>>>> Calculates the name of the weekday (Sun, Mon, etc) for the
>>>> 1st day of a given month & year...
>>>>
>>>> https://busybox.neocities.org/notes/get-first-day-of-month.txt
>>>
>>> Here's the guts of my version of the Zeller algorithm:
>>>
>>> int day(d,m,y)
>>> int d, m, y;
>>> {
>>> if (m < 3) {
>>> m += 12;
>>> y--;
>>> }
>>> return (d + (13*m-27)/5 + y + y/4 - y/100 + y/400) % 7;
>>
>> I am referring in particular to this part of the equation:
>> y + y/4 - y/100 + y/400
>> Shouldn't it be calculated in a floating point and then truncated only
>> the final result? Because, for example, if the year is 2024, the
>> floating point calculation is 2514 (2514.82) while executed between
>> integer is 2515.
>
> The short answer is No. If you try some examples I expect
> you will see that using integer division always gives
> correct results. Leap days always happen in integer amounts,
> so integer division is the right way to calculate them.
>
> Note: I haven't tested this particular algorithm and so
> cannot vouch for its correctness. But the part that
> determines an extra number of days based on what year
> it is matches other algorithms that I have tested.
>

Thank you

Re: getFirstDayOfMonth()

<us41v7$328mm$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34056&group=comp.lang.c#34056

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 09:49:43 +0100
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <us41v7$328mm$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com>
<us22ac$2hp4u$1@dont-email.me> <us2cvn$2k5bs$1@dont-email.me>
<20240303102730.829@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 4 Mar 2024 08:49:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="10397b01f6cccf2c5c374e194bc5ab00";
logging-data="3220182"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Z5/brWMhmgN4/ODyhdOVvkiS7OX8opoA="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:p8D86utx155EWpHmROZ3+Z1dG6Y=
Content-Language: en-GB
In-Reply-To: <20240303102730.829@kylheku.com>
 by: David Brown - Mon, 4 Mar 2024 08:49 UTC

On 03/03/2024 19:42, Kaz Kylheku wrote:
> On 2024-03-03, David Brown <david.brown@hesbynett.no> wrote:

> https://www.gnu.org/prep/standards/html_node/Option-Table.html#Option-Table
>
>> Having "-h" as an option for something other than "--help" would be insane.
>
> du -h # human-readable sizes
>
> df -h # human-readable sizes
>
> ls -h # human-readhable sizes
>
> free -h # human-readhable sizes
>
> ps -h # suppress (h)eader.
>
> grep -h # suppress prefixing of filenames when multiple files saerched.
>
> rsync -h # human-readable sizes
>
> Some of these are in POSIX.
>

You are, of course, entirely correct. Sorry for my complete lack of
thought there.

Re: getFirstDayOfMonth()

<us4bef$346tp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34057&group=comp.lang.c#34057

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 11:31:27 +0000
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <us4bef$346tp$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com>
<us22ac$2hp4u$1@dont-email.me> <us2cvn$2k5bs$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 4 Mar 2024 11:31:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3d4af15ea8e3a8055c2c9dc818e0bce1";
logging-data="3283897"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uhk2AEclTuT5WGNdJis3S0wNu2+onG7Y="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:AmivyeJPJDtXQ4ANkMM7RQ6meKo=
In-Reply-To: <us2cvn$2k5bs$1@dont-email.me>
Content-Language: en-GB
 by: Malcolm McLean - Mon, 4 Mar 2024 11:31 UTC

On 03/03/2024 17:45, David Brown wrote:
>
>
> Having "-h" as an option for something other than "--help" would be insane.
>

And Baby X resource compiler by yours truly. Write out a C source file,
but of course there's also an option for a header. And did I just go and
do that? And I can't remember, and I have to check, and, no, I knew
about that, and it is "-header" and that only. But it's just so easily
done.

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: getFirstDayOfMonth()

<us4lg7$36brd$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34062&group=comp.lang.c#34062

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: richard....@gmail.invalid (Richard Harnden)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 14:23:03 +0000
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <us4lg7$36brd$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com>
<us22ac$2hp4u$1@dont-email.me> <us2cvn$2k5bs$1@dont-email.me>
<us4bef$346tp$1@dont-email.me>
Reply-To: richard.harnden@invalid.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 4 Mar 2024 14:23:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="205634a87efa8abe31afb0b4f6d13218";
logging-data="3354477"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kSh58XaXpoJVI/AbduqJArkyuG2VdasA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:DlrNpuRA/QT7nSlfHKjJLHL5qPs=
In-Reply-To: <us4bef$346tp$1@dont-email.me>
Content-Language: en-GB
 by: Richard Harnden - Mon, 4 Mar 2024 14:23 UTC

On 04/03/2024 11:31, Malcolm McLean wrote:
> On 03/03/2024 17:45, David Brown wrote:
>>
>>
>> Having "-h" as an option for something other than "--help" would be
>> insane.
>>
>
> And Baby X resource compiler by yours truly. Write out a C source file,
> but of course there's also an option for a header. And did I just go and
> do that? And I can't remember, and I have to check, and, no, I knew
> about that, and it is "-header" and that only. But it's just so easily
> done.
>

Why do you specify -e twice? And why so many options to specify a
header file?

[Okay, I'm joking. And, yes, I know it's not funny]

Re: getFirstDayOfMonth()

<us4sot$382fh$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34066&group=comp.lang.c#34066

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 17:27:08 +0100
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <us4sot$382fh$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com>
<us22ac$2hp4u$1@dont-email.me> <us2cvn$2k5bs$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 4 Mar 2024 16:27:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="faecf4cca67f6a7c6a64654ed7f00bc3";
logging-data="3410417"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HB/Nr4NsvmJKYkejpEukV"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:xIw2K7D/NSS4lnqEz8TXtmFgLeI=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <us2cvn$2k5bs$1@dont-email.me>
 by: Janis Papanagnou - Mon, 4 Mar 2024 16:27 UTC

On 03.03.2024 18:45, David Brown wrote:
> On 03/03/2024 15:43, Janis Papanagnou wrote:
>>
>> The "problem" is that you may want to have -h as an option character,
>> especially if your program supports a lot of options and you have no
>> creative naming way of choosing another character. (An example from
>> one of my recent implementations is using -h for 'height'.[*])
>
> Having "-h" as an option for something other than "--help" would be insane.

A strong wording that is completely ignoring the existing tools
and the (very sensible, and certainly not "insane"!) rationale
that I - sadly, unsuccessfully, despite being so obvious - tried
to make clear.

Janis

Re: getFirstDayOfMonth()

<us507s$38rq1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34070&group=comp.lang.c#34070

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 17:26:21 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 83
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <us507s$38rq1$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com>
Injection-Date: Mon, 4 Mar 2024 17:26:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b53b78f7fd59df781de03802f6a93a73";
logging-data="3436353"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RLvgPWT0SCQddi6ihUI9H"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:Encyo2wihfqNWDGiN1LMfJ/zUa8=
 by: Mike Sanders - Mon, 4 Mar 2024 17:26 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:

> I wouldn't use '-?'. The '?' character is a wildcard in most Unix
> shells. If you happen to have a file in the current directory that
> matches the pattern, it will expand to the name of that file. If you
> don't, the behavior depends on the shell and settings.

Embarrassed to say I know that, but had forgotten it...

> And most users of Unix-like systems won't expect '-?' to be an option;
> '-h' is much more common.

Can of worms there too, '-h' (or whatever) is valid file name. Under win,
we also use '/h' which certainly wont work under unix.

>> Oh yeah. Have been wrestling with the potential
>> consequences of this for a good while. I think I'm
>> going leave it as is because, (only speaking for
>> myself here) the POSIX 0 good, 1 bad is terrible.
>> This is perhaps the only area I've ever seen where
>> other OSs, like Windows, have a superior methodology
>> on the issue. 0/1 provides next to no nuance. But
>> I'm no expert, just my experience.
>
> The C standard, not just POSIX, defines 0 as a successful status. If
> your program is intended to work on Unix-like systems (or on Windows if
> I'm not mistaken), using a status of 0 to indicate an error will cause
> problems. Conventions exist for a reason.

int ok = strcmp(foo, bar);

if (!ok) then success

ok == -1 less
ok == 0 same
ok == 1 greater

Hmm, so for someone from a differing OS, things need to be considered.
> Use 0 for success, 1 for unspecified errors, and other positive values
> for more specific errors.

This is not a problem under win, I've got lots of tools that use
varying %errorlevels% (unix analog '$?') all processed without
issue by %comspec% (analog '$SHELL'). No big deal.

But I'll take your word, here's where I'm at...

Usage: DATES [-OPTIONS] FILE1 [FILE2 ...]

-A=NUM Number of days in advance to look ahead (366 max)
-P=NUM Number of days in the past to look back (366 max)
-S=NUM Separate date fields using: 1 Slash, 2 Dash, 3 Dot
-X=NUM Export results as: 1 TXT, 2 CSV, 3 SQL, 4 HTML
-T=TAG Filter results for 'TAG' (16 characters max)
-I Use ISO8601 dates: yyyy/mm/dd (default is mm/dd/yyyy)
-W Include weekday abbreviations
-H Include holidays (see manual for list)
-F Include attribute flags (see manual for details)
-C Display calendar for current year
-D Debugging enabled
-M Display embedded user manual

Error levels returned:

0 Success
1 Error

'debugger' is a simple printf macro that among other things,
confirms my returns:

dates -a=30 -d -t="bank note" file

DEBUG: Exit 1

I'm getting there, in fact real close.

Thanks Keith.

--
:wq
Mike Sanders

Re: getFirstDayOfMonth()

<tCnFN.138324$t8cc.53416@fx06.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34071&group=comp.lang.c#34071

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx06.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: getFirstDayOfMonth()
Newsgroups: comp.lang.c
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com> <us507s$38rq1$1@dont-email.me>
Lines: 42
Message-ID: <tCnFN.138324$t8cc.53416@fx06.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 04 Mar 2024 17:34:17 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 04 Mar 2024 17:34:17 GMT
X-Received-Bytes: 2681
 by: Scott Lurndal - Mon, 4 Mar 2024 17:34 UTC

porkchop@invalid.foo (Mike Sanders) writes:
>Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>
>> I wouldn't use '-?'. The '?' character is a wildcard in most Unix
>> shells. If you happen to have a file in the current directory that
>> matches the pattern, it will expand to the name of that file. If you
>> don't, the behavior depends on the shell and settings.
>
>Embarrassed to say I know that, but had forgotten it...
>
>> And most users of Unix-like systems won't expect '-?' to be an option;
>> '-h' is much more common.
>
>Can of worms there too, '-h' (or whatever) is valid file name. Under win,
>we also use '/h' which certainly wont work under unix.

No, there is no chance of '-h' being interpreted as a filename.

The issue is that _iff_ there is a two character filename in
the current working directory where the first character of
the filename is the hypen character, the shell may substitute that
for '-?' when parsing the command line. E.g if you had a file
called '-F' in the current working directory, the shell may
change '-?' (if not quoted) into '-F'.

Pesonally, I find this highly unlikely in real world. However,
there are cases where this could be a security issue.

> The C standard, not just POSIX, defines 0 as a successful status.

POSIX defines 0 as a successful status "for shell commmands", in
the context of this discussion.

Unix defines 0 as a successful status for system calls handled
by the kernel. A non-zero status is accompanied by an updated
errno (thread-specific when threaded) value.

strcmp(3) is neither a command nor a kernel call, it's a
library function and the return value is well documented.

I refer you to Ralph Waldo Emerson's quote about consistency :-).

Re: getFirstDayOfMonth()

<us50mq$38rq1$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34072&group=comp.lang.c#34072

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 17:34:18 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <us50mq$38rq1$2@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com> <us22ac$2hp4u$1@dont-email.me>
Injection-Date: Mon, 4 Mar 2024 17:34:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b53b78f7fd59df781de03802f6a93a73";
logging-data="3436353"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qBFHkR8KiZ/Ku1s1GUERy"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:D7IuXwB3XYohhn3bO4Kvrx5Kx3o=
 by: Mike Sanders - Mon, 4 Mar 2024 17:34 UTC

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

> The "problem" is that you may want to have -h as an option character,
> especially if your program supports a lot of options and you have no
> creative naming way of choosing another character. (An example from
> one of my recent implementations is using -h for 'height'.[*])

This is my rationale as well: All of the switches have a more/or less
mnemonic feel -X (eXport), -H (Holiday), -C (Calendar), -M (Manual).

I thought it made good sense at least.

--
:wq
Mike Sanders

Re: getFirstDayOfMonth()

<VHnFN.393318$Ama9.190889@fx12.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34073&group=comp.lang.c#34073

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx12.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: getFirstDayOfMonth()
Newsgroups: comp.lang.c
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com> <us22ac$2hp4u$1@dont-email.me> <us50mq$38rq1$2@dont-email.me>
Lines: 21
Message-ID: <VHnFN.393318$Ama9.190889@fx12.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 04 Mar 2024 17:40:05 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 04 Mar 2024 17:40:05 GMT
X-Received-Bytes: 1816
 by: Scott Lurndal - Mon, 4 Mar 2024 17:40 UTC

porkchop@invalid.foo (Mike Sanders) writes:
>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>
>> The "problem" is that you may want to have -h as an option character,
>> especially if your program supports a lot of options and you have no
>> creative naming way of choosing another character. (An example from
>> one of my recent implementations is using -h for 'height'.[*])
>
>This is my rationale as well: All of the switches have a more/or less
>mnemonic feel -X (eXport), -H (Holiday), -C (Calendar), -M (Manual).
>
>I thought it made good sense at least.

As someone who started using unix in an environment where there
was only one case, I find I prefer lower-case option
flags, simply because they're easier to type.

(In the old days, to type upper-case characters on a teletype
required prefixing each upper-case character with a backslash
character - and the terminal driver would display uppercase
with the prefix).

Re: getFirstDayOfMonth()

<87plw9rhuz.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34074&group=comp.lang.c#34074

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 04 Mar 2024 10:07:16 -0800
Organization: None to speak of
Lines: 22
Message-ID: <87plw9rhuz.fsf@nosuchdomain.example.com>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me>
<87ttloqnnk.fsf@nosuchdomain.example.com>
<us507s$38rq1$1@dont-email.me> <tCnFN.138324$t8cc.53416@fx06.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="5c683459994fa3e34e479e42ca46e26d";
logging-data="3452796"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19LgvBsCYe4Jsdm46Hi8JZX"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:8/3zBodZ6uUN3koF04U6DHNA75k=
sha1:Plodqhf3U+Er8Wq+R/8y6pajpFw=
 by: Keith Thompson - Mon, 4 Mar 2024 18:07 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
> porkchop@invalid.foo (Mike Sanders) writes:
[...]
>> The C standard, not just POSIX, defines 0 as a successful status.
>
> POSIX defines 0 as a successful status "for shell commmands", in
> the context of this discussion.
>
> Unix defines 0 as a successful status for system calls handled
> by the kernel. A non-zero status is accompanied by an updated
> errno (thread-specific when threaded) value.

The C standard defines 0 as an argument to exit() or as a return value
from main() as a successful status. System calls are a separate issue
(but they happen to follow a similar convention for similar reasons.)

[...]

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: getFirstDayOfMonth()

<us52nb$3993i$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34075&group=comp.lang.c#34075

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 18:08:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 19
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <us52nb$3993i$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <us04rd$22som$1@dont-email.me>
Injection-Date: Mon, 4 Mar 2024 18:08:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b53b78f7fd59df781de03802f6a93a73";
logging-data="3449970"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/thmJiHDFkjvxGjioSk7ed"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:bxBOnbuYpFE22EZneFFAI1sqnko=
 by: Mike Sanders - Mon, 4 Mar 2024 18:08 UTC

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

> You haven't provided any evidence or facts of experience.

Janis, relax. I have nothing to prove to anyone. From
your remarks it certainly looks like you don't use
WinAPI much & from that I don't infer you're unintelligent,
its simply not an area you're familiar with.

Now apply that same thinking to other folks, in other
walks of life. You need to slow down with the often
wrong conclusions...

Now prove me wrong by not responding with more snark.

--
:wq
Mike Sanders

Re: getFirstDayOfMonth()

<us52t1$3993i$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34076&group=comp.lang.c#34076

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 18:11:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <us52t1$3993i$2@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com> <us22ac$2hp4u$1@dont-email.me> <us50mq$38rq1$2@dont-email.me> <VHnFN.393318$Ama9.190889@fx12.iad>
Injection-Date: Mon, 4 Mar 2024 18:11:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b53b78f7fd59df781de03802f6a93a73";
logging-data="3449970"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NsYv40XGr7FC+UaSmPhcP"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:tQd01niUSYQleLxlzW9yOSzG8R0=
 by: Mike Sanders - Mon, 4 Mar 2024 18:11 UTC

Scott Lurndal <scott@slp53.sl.home> wrote:

> As someone who started using unix in an environment where there
> was only one case, I find I prefer lower-case option
> flags, simply because they're easier to type.
>
> (In the old days, to type upper-case characters on a teletype
> required prefixing each upper-case character with a backslash
> character - and the terminal driver would display uppercase
> with the prefix).

Wow, chuckle, really made you work hard for the results!

--
:wq
Mike Sanders

Re: getFirstDayOfMonth()

<us53ei$3993i$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34077&group=comp.lang.c#34077

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 18:21:06 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <us53ei$3993i$3@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <us1ein$2dfo0$1@dont-email.me>
Injection-Date: Mon, 4 Mar 2024 18:21:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b53b78f7fd59df781de03802f6a93a73";
logging-data="3449970"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ox9DwwJnB45uSRADgWfbA"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:tkdhx3Z7LhkazcywVtYpo7liKYM=
 by: Mike Sanders - Mon, 4 Mar 2024 18:21 UTC

James Kuyper <jameskuyper@alumni.caltech.edu> wrote:

> The lack of nuance is apparently the result of your being unaware of the
> fact that 1 is not the only permitted error return.
>
> Keep in mind that the make utility and shells designed for Unix-like
> systems (as well as many other programs targeting such systems) expect 0
> for success, and may produce unexpected results if you violate that
> convention.

Not at all, what the shell accepts as success under unix, is not the
same under windows. The convention is OS specific, everyone here tends
to think only in terms of POSIX & $SHELL & yet, there are other worlds
out there...

:: comment

@echo off & cls

if %errorlevel% EQU 1000 (

echo successful as defined by my needs not yours

)

--
:wq
Mike Sanders

Re: getFirstDayOfMonth()

<2noFN.519729$xHn7.255625@fx14.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34078&group=comp.lang.c#34078

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: getFirstDayOfMonth()
Newsgroups: comp.lang.c
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com> <us22ac$2hp4u$1@dont-email.me> <us50mq$38rq1$2@dont-email.me> <VHnFN.393318$Ama9.190889@fx12.iad> <us52t1$3993i$2@dont-email.me>
Lines: 15
Message-ID: <2noFN.519729$xHn7.255625@fx14.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 04 Mar 2024 18:26:06 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 04 Mar 2024 18:26:06 GMT
X-Received-Bytes: 1627
 by: Scott Lurndal - Mon, 4 Mar 2024 18:26 UTC

porkchop@invalid.foo (Mike Sanders) writes:
>Scott Lurndal <scott@slp53.sl.home> wrote:
>
>> As someone who started using unix in an environment where there
>> was only one case, I find I prefer lower-case option
>> flags, simply because they're easier to type.
>>
>> (In the old days, to type upper-case characters on a teletype
>> required prefixing each upper-case character with a backslash
>> character - and the terminal driver would display uppercase
>> with the prefix).
>
>Wow, chuckle, really made you work hard for the results!

It does explain why CamelCase never gained traction in Unix.

Re: getFirstDayOfMonth()

<20240304103009.785@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34079&group=comp.lang.c#34079

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 18:30:44 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <20240304103009.785@kylheku.com>
References: <urrj5l$124o9$1@dont-email.me>
<urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me>
<7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me>
<pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me>
<87ttloqnnk.fsf@nosuchdomain.example.com> <us22ac$2hp4u$1@dont-email.me>
<us50mq$38rq1$2@dont-email.me> <VHnFN.393318$Ama9.190889@fx12.iad>
<us52t1$3993i$2@dont-email.me> <2noFN.519729$xHn7.255625@fx14.iad>
Injection-Date: Mon, 4 Mar 2024 18:30:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e3728d8dcd2e7deeba330e9e082a4102";
logging-data="3463400"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++46yubSaxgwFa3bCQIVXuaKIxpSEdDw8="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:06mT2gmw2j/NvV1jVxPmCrecbnI=
 by: Kaz Kylheku - Mon, 4 Mar 2024 18:30 UTC

On 2024-03-04, Scott Lurndal <scott@slp53.sl.home> wrote:
> porkchop@invalid.foo (Mike Sanders) writes:
>>Scott Lurndal <scott@slp53.sl.home> wrote:
>>
>>> As someone who started using unix in an environment where there
>>> was only one case, I find I prefer lower-case option
>>> flags, simply because they're easier to type.
>>>
>>> (In the old days, to type upper-case characters on a teletype
>>> required prefixing each upper-case character with a backslash
>>> character - and the terminal driver would display uppercase
>>> with the prefix).
>>
>>Wow, chuckle, really made you work hard for the results!
>
> It does explain why CamelCase never gained traction in Unix.

How did it come about in XWindow? Anyone know?

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: getFirstDayOfMonth()

<dUoFN.39119$zF_1.26659@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34081&group=comp.lang.c#34081

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: getFirstDayOfMonth()
Newsgroups: comp.lang.c
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com> <urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad> <urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad> <us00f7$21v55$1@dont-email.me> <87ttloqnnk.fsf@nosuchdomain.example.com> <us22ac$2hp4u$1@dont-email.me> <us50mq$38rq1$2@dont-email.me> <VHnFN.393318$Ama9.190889@fx12.iad> <us52t1$3993i$2@dont-email.me> <2noFN.519729$xHn7.255625@fx14.iad> <20240304103009.785@kylheku.com>
Lines: 23
Message-ID: <dUoFN.39119$zF_1.26659@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 04 Mar 2024 19:01:29 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 04 Mar 2024 19:01:29 GMT
X-Received-Bytes: 1976
 by: Scott Lurndal - Mon, 4 Mar 2024 19:01 UTC

Kaz Kylheku <433-929-6894@kylheku.com> writes:
>On 2024-03-04, Scott Lurndal <scott@slp53.sl.home> wrote:
>> porkchop@invalid.foo (Mike Sanders) writes:
>>>Scott Lurndal <scott@slp53.sl.home> wrote:
>>>
>>>> As someone who started using unix in an environment where there
>>>> was only one case, I find I prefer lower-case option
>>>> flags, simply because they're easier to type.
>>>>
>>>> (In the old days, to type upper-case characters on a teletype
>>>> required prefixing each upper-case character with a backslash
>>>> character - and the terminal driver would display uppercase
>>>> with the prefix).
>>>
>>>Wow, chuckle, really made you work hard for the results!
>>
>> It does explain why CamelCase never gained traction in Unix.
>
>How did it come about in XWindow? Anyone know?

X Windows came from MIT, not AT&T, and long after the
Teletype had reached obsolescence. They apparently didn't
mind the extra hassles typing identifiers with mixed case.

Re: getFirstDayOfMonth()

<us587t$3ahe4$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34082&group=comp.lang.c#34082

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: getFirstDayOfMonth()
Date: Mon, 4 Mar 2024 14:42:53 -0500
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <us587t$3ahe4$1@dont-email.me>
References: <urrj5l$124o9$1@dont-email.me> <urssrf$1vntr$1@news.xmission.com>
<urteto$1e55r$1@dont-email.me> <7VrEN.517245$xHn7.96511@fx14.iad>
<urtq7q$1ggh0$1@dont-email.me> <pZGEN.500996$7sbb.11881@fx16.iad>
<us00f7$21v55$1@dont-email.me> <us1ein$2dfo0$1@dont-email.me>
<us53ei$3993i$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 4 Mar 2024 19:42:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7d76384940bb3525ac5a9096e1f5b6af";
logging-data="3491268"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3itzIB1frtv8rYmONACgdhvZJsEWNHtk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:QgiUJ6BsxMhSOo9077d9RS/PNX4=
Content-Language: en-US
In-Reply-To: <us53ei$3993i$3@dont-email.me>
 by: James Kuyper - Mon, 4 Mar 2024 19:42 UTC

On 3/4/24 13:21, Mike Sanders wrote:
> James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
>
>> The lack of nuance is apparently the result of your being unaware of the
>> fact that 1 is not the only permitted error return.
>>
>> Keep in mind that the make utility and shells designed for Unix-like
>> systems (as well as many other programs targeting such systems) expect 0
>> for success, and may produce unexpected results if you violate that
>> convention.
>
> Not at all, what the shell accepts as success under unix, is not the
> same under windows.

I was talking about the problems you would have with ignoring that
convention on Unix-like systems, which I'm very familiar with, I had no
intention of giving advice relevant to other operating systems. The need
to do different things on different operating systems is part of the
reason why the EXIT_SUCCESS and EXIT_FAILURE macros exist, but that only
scratches the surface of what needs to be done for portability.
If your program needs to be portable to POSIX systems, it needs to have
a mode that returns 0 on success, regardless of what it does on any
other operating system.


devel / comp.lang.c / Re: getFirstDayOfMonth()

Pages:1234
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor