$ cal 5875707
cal: year 5875707 not in range 1..5875706
What is the significance of the year 5875706? Why stop there? This seems like some kind of RMS Michael Shuttleworth ploy to fuck us over in the calendar department.
int isleap(int yrm1) {
int dd;
yrm1++;
return (yrm1&3)?(dd=yrm1%100)?1:(dd&3)?0:1:0;
}
main(int argc, char **argv) {
if(argc==4) {
unsigned int yrm1 = atoi(argv[1])-1;
unsigned int mnth = atoi(argv[2])-1;
unsigned int date = atoi(argv[3])-1;
unsigned int adn = 365*yrm1;
unsigned int ax = yrm1/100;
unsigned int dx = yrm1%100;
adn -= ax;
ax /=4;
adn += ax;
adn += yrm1/4;
adn += yeldtab[mnth];
if(mnth>2)
adn += isleap(yrm1);
adn += date;
printf("ADN for %u-%u-%u (%s) is %u\n",yrm1+1,mnth+1,date+1,daynames[(adn+1)%7],adn+1);
}
}
Name:
Anonymous2008-12-18 1:32
>>22
Your variable names suck. ax? dx? These are good register names, but when we program in higher level languages you can use words that mean something. Try it sometime.
Name:
Anonymous2008-12-18 2:04
>>21
Yes, but which cal are you using? As I said, mine is "util-linux-ng". Obviously, yours is not. Where did it come from? Could you please provide a link to the source or something?
Name:
Anonymous2008-12-18 3:14
>>23
It's half-edited decompiler output. Here's a fixed version (with a bug corrected):
main(int argc, char **argv) {
if(argc==4) {
unsigned int yrm1 = atoi(argv[1])-1;
unsigned int mnth = atoi(argv[2])-1;
unsigned int date = atoi(argv[3])-1;
unsigned int adn = 365*yrm1 - yrm1/100 + yrm1/400 + yrm1/4 + yeldtab[mnth];
if(mnth>2)
adn += isleap(yrm1);
adn += date;
printf("ADN for %u-%u-%u (%s) is %u\n",yrm1+1,mnth+1,date+1,daynames[(adn)%7],adn,adn);
}
}
Name:
Anonymous2008-12-18 5:58
http://opengroup.org/susv3xcu/cal.html The cal utility shall write a calendar to standard output using the Julian calendar for dates from January 1, 1 through September 2, 1752 and the Gregorian calendar for dates from September 14, 1752 through December 31, 9999 as though the Gregorian calendar had been adopted on September 14, 1752.
9999 is the STANDARD!!!
/* Copyright (c) 2008 Anonymous
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that you grant this
* same permission to anyone you distribute it to without any additional
* restrictions.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
>>26 The following environment variables shall affect the execution of cal:
Your implementation of cal is broken, anon.
Name:
Anonymous2008-12-18 6:42
>>27
1. add this at the top of the file: #include <libintl.h>
2. add this at the beginning of main: textdomain("cal");
setlocale(LC_ALL,"");
2. replace "learn to use cal, you idiot: http://opengroup.org/susv3xcu/cal.html" with gettext("learn to use cal, you idiot: http://opengroup.org/susv3xcu/cal.html")
problem solved.
I just want to point out that the one you wrote broken, and the fixed one won't work for anonix (or the fix will do nothing).
according to them it's not broken: - No internationalization. A large amount of GNU bloat is caused by this, and
with English continuing to dominate, the ANONIX initial planning group decided
against explicitly adding code for this, instead opting to let those few who
need it translate themselves.
I don't want to fix it, I have my own working from gnu.
your gnu one can't do cal 1 340282366920938463463374607431768211456, while this one can (and supports localization): /* Copyright (c) 2008 Anonymous
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that you grant this
* same permission to anyone you distribute it to without any additional
* restrictions.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
and here's a localization file for it: # icelandic localization for cal
# Copyright (C) 2008 anonymous
# This file is distributed under the same license as the cal package.
#
msgid ""
msgstr ""
"Project-Id-Version: cal 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-12-18 12:28-0000\n"
"PO-Revision-Date: 2008-12-18 10:29-0500\n"
"Last-Translator: anonymous\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language-Team: Icelandic\n"
# icelandic localization for cal
# Copyright (C) 2008 anonymous
# This file is distributed under the same license as the cal package.
#
msgid ""
msgstr ""
"Project-Id-Version: cal 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-12-18 12:28-0000\n"
"PO-Revision-Date: 2008-12-18 10:29-0500\n"
"Last-Translator: anonymous\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language-Team: Icelandic\n"
>>46
So compiling any already existent trivial UNIX program under the ANONIX SOFTWARE PLATFORM will make it consume huge amounts of memory or crash altogether?
Jeez, I wonder why the project hasn't taken off yet.
Name:
Anonymous2008-12-18 20:41
>>49
A trivial UNIX program that makes use of LINE_MAX to create a statically-sized input buffa is deemed unworthy of running on An Onyx. All programs are to employ dynamically expanding strings when processing freeform text, including that from an untrusted source.
Name:
!w4lolitaKs2008-12-18 21:13
>>50
If we had all the utilities artificially limited to lines of fixed length, they would become almost trivial to write and offer no advantages over existing implementations.
I have several hundred million bytes of memory in my machine and I should be able to use it all when I need to, but only as much as necessary; sure, pushing LINE_MAX up to several million may be less restrictive, but then with fixed-length buffers that memory is wasted when processing smaller files.
In other words, Anonix principles exploit the full capabilities of the hardware in an as-needed fashion.