Sunday, 8 October 2017

/usr/bin/cal with added hex output option. Generate Hex calendar ( unix src code )



Download
https://opensource.apple.com/source/misc_cmds/misc_cmds-9/cal/cal.c
apply this diff - compile and go. Use -x option to get hex output.


$ diff cal.c  cal_hex.c | sed 's/>/\>/;s/</\</'
36a37
>  * Hex version
138a140
> int xflag;
149,150c151,152
< yflag = year = 0;
< while ((ch = getopt(argc, argv, "jy")) != -1)
---
> yflag = year = xflag = 0;
> while ((ch = getopt(argc, argv, "jyx")) != -1)
157a160,162
> case 'x':
> xflag = 1;
> break;
210,211c215,219
< len = snprintf(lineout, sizeof(lineout), "%s %d",
<     month_names[month - 1], year);
---
> if (xflag) { 
> len = snprintf(lineout, sizeof(lineout), "%s 0x%x", month_names[month - 1], year);
> } else {
> len = snprintf(lineout, sizeof(lineout), "%s %d", month_names[month - 1], year);
> }
233c241,245
< (void)snprintf(lineout, sizeof(lineout), "%d", year);
---
> if (xflag) { 
> (void)snprintf(lineout, sizeof(lineout), "0x%x", year); 
> } else {
> (void)snprintf(lineout, sizeof(lineout), "%d", year);
> }
268c280,284
< (void)snprintf(lineout, sizeof(lineout), "%d", year);
---
> if (xflag) { 
> (void)snprintf(lineout, sizeof(lineout), "0x%x", year); 
> } else {
> (void)snprintf(lineout, sizeof(lineout), "%d", year);
> }
375a392,401
> static char *hday[] = {
>                 "",
>                 " 1", " 2", " 3", " 4", " 5", " 6", " 7",
>                 " 8", " 9", " A", " B", " C", " D", " E",
>                 " F" ,"10", "11", "12", "13", "14", "15", 
> "16", "17", "18", "19", "1A", "1B", "1C", 
> "1D", "1E", "1F",
>         };
395a422,425
> if ( xflag ) {
> *p++ = hday[day][0];
> *p++ = hday[day][1];
> } else {
397a428
> }
434c465
< (void)fprintf(stderr, "usage: cal [-jy] [[month] year]\n");
---

> (void)fprintf(stderr, "usage: cal [-jyx] [[month] year]\n");

I hate polystyrene and Bissell carpet cleaners lies right on the box.

I hate polystyrene and other single-use packaging materials. This single image explains the issue with non-recyclyeable non-biodegradable fragmenting plastic. This bird will be dead soon.



Often used in product shipping boxes as a bulking and holding material.  Alternatives exist and have been widely used by Mobile phone and other product shippers including Apple.        https://www.moldedfiber.com/eps-alternative.html

Bissell carpet cleaners are a great machine but the product packaging sucks. Particularly because they have "Sustainable packaging design" boldly printed on the box. The lie of that is just inside with three blocks of polystyrene. Shameful.  The tide is turning in the global awareness of ocean pollution by plastic debris calling out such hypocrisy can only serve to drive the message home.  

At time of writing the URL on the box www.bissell.com/SustainableDesign is redirected to a UK Bissell shop website. Message implementation fail.






Bissell was asked for a comment and this is included below. No mention of the broken URL or acknowledgement of the sustainable packaging message and polystyrene block mismatch.


PS: This article does not refer to Poly Styrene the late singer with X-Ray Specs. :-)


========== Reply  From Bissell ===============
Dear Mr Gannett,
Thank you for contacting Bissell UK.
I am sorry to read of your disappointment with our packaging.
Please be advised I have forwarded your comments and concerns to our head office and this will be taken into consideration for future purposes. At the moment there are no immediate plans to change our packaging or labeling so we are unable to provide you with any timescales of, if and when this will be changed.
I am sorry for the inconvenience caused.
Kind Regards
J******** C******




Customer Service Team