From 45fb924ecfb5212f04f548e73a100607eae17ef9 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 31 Oct 2024 06:14:58 -0700 Subject: [PATCH] Add missing 1994/shapiro/shapiro.alt.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With a tip from Leo the missing alt code has been added to the website. Ta, Leo (šŸ¦ā­ļøšŸŒŒ)! --- 1994/shapiro/.entry.json | 8 ++++++ 1994/shapiro/Makefile | 8 ++++-- 1994/shapiro/README.md | 25 ++++++++++++++--- 1994/shapiro/index.html | 15 +++++++--- 1994/shapiro/shapiro.alt.c | 57 ++++++++++++++++++++++++++++++++++++++ bugs.html | 7 +---- bugs.md | 8 ------ thanks-for-help.html | 3 ++ thanks-for-help.md | 4 +++ 9 files changed, 111 insertions(+), 24 deletions(-) create mode 100644 1994/shapiro/shapiro.alt.c diff --git a/1994/shapiro/.entry.json b/1994/shapiro/.entry.json index 8de4454f9..b5fad5101 100644 --- a/1994/shapiro/.entry.json +++ b/1994/shapiro/.entry.json @@ -45,6 +45,14 @@ "display_via_github" : false, "entry_text" : "author's hints" }, + { + "file_path" : "shapiro.alt.c", + "inventory_order" : 150, + "OK_to_edit" : true, + "display_as" : "c", + "display_via_github" : true, + "entry_text" : "author provided unobfuscated and formatted source code" + }, { "file_path" : "1994_shapiro.tar.bz2", "inventory_order" : 1415926535, diff --git a/1994/shapiro/Makefile b/1994/shapiro/Makefile index cc50c9060..f2deafd79 100644 --- a/1994/shapiro/Makefile +++ b/1994/shapiro/Makefile @@ -118,8 +118,8 @@ OBJ= ${PROG}.o DATA= shapiro.md TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# @@ -146,6 +146,10 @@ ${PROG}_t1: ${PROG}.c alt: data ${ALT_TARGET} @${TRUE} + +${PROG}.alt: ${PROG}.alt.c + ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} + # data files # data: ${DATA} diff --git a/1994/shapiro/README.md b/1994/shapiro/README.md index 45e3a4701..ff5e61429 100644 --- a/1994/shapiro/README.md +++ b/1994/shapiro/README.md @@ -4,13 +4,15 @@ make all ``` +There is an alternate version that is unobfuscated, provided by the author. See +[Alternate code](#alternate-code) below. + ### Bugs and (Mis)features: The current status of this entry is: > **STATUS: INABIAF - please DO NOT fix**
-> **STATUS: missing file - please provide it** For more detailed information see [1994/shapiro in bugs.html](../../bugs.html#1994_shapiro). @@ -41,6 +43,24 @@ Notice what you see in the output of `ps`! Observe too what happens after you bring it back to the foreground. +## Alternate code: + +This version, [shapiro.alt.c](%%REPO_URL%%/1994/shapiro/shapiro.alt.c), is an +unobfuscated version provided by the author. + + +## Alternate build: + +``` + make alt +``` + + +### Alternate use: + +Use `shapiro.alt` as you would `shapiro` above. + + ## Judges' remarks: This entry has many different levels of obfuscation, and yet the @@ -51,9 +71,6 @@ From time to time, run `ps(1)` and look at the new processes. If you want more information on the internals of this program, see [shapiro.html](shapiro.html). -The missing file `shapiro.alt.c` is an unobfuscated version of this program. See -[1994/shapiro in bugs.html](../../bugs.html#1994_shapiro). - ## Author's remarks: diff --git a/1994/shapiro/index.html b/1994/shapiro/index.html index a04b401d8..85c650d09 100644 --- a/1994/shapiro/index.html +++ b/1994/shapiro/index.html @@ -446,11 +446,12 @@ Location: US - United States of America

To build:

    make all
+

There is an alternate version that is unobfuscated, provided by the author. See +Alternate code below.

Bugs and (Mis)features:

The current status of this entry is:

-

STATUS: INABIAF - please DO NOT fix
-STATUS: missing file - please provide it

+

STATUS: INABIAF - please DO NOT fix

For more detailed information see 1994/shapiro in bugs.html.

To use:

@@ -467,14 +468,19 @@ Location: US - United States of America ./shapiro_t1

Notice what you see in the output of ps! Observe too what happens after you bring it back to the foreground.

+

Alternate code:

+

This version, shapiro.alt.c, is an +unobfuscated version provided by the author.

+

Alternate build:

+
    make alt
+

Alternate use:

+

Use shapiro.alt as you would shapiro above.

Judges’ remarks:

This entry has many different levels of obfuscation, and yet the source file is self documenting. :-)

From time to time, run ps(1) and look at the new processes.

If you want more information on the internals of this program, see shapiro.html.

-

The missing file shapiro.alt.c is an unobfuscated version of this program. See -1994/shapiro in bugs.html.

Author’s remarks:

The basic theme (pun) of this program is:

@@ -535,6 +541,7 @@ test it on.)

  • Makefile - entry Makefile
  • shapiro.orig.c - original source code
  • shapiro.html - author’s hints
  • +
  • shapiro.alt.c - author provided unobfuscated and formatted source code
  • Secondary files

      diff --git a/1994/shapiro/shapiro.alt.c b/1994/shapiro/shapiro.alt.c new file mode 100644 index 000000000..c01116c29 --- /dev/null +++ b/1994/shapiro/shapiro.alt.c @@ -0,0 +1,57 @@ +/* file: better_time.c */ +/* + * If you enjoyed the functionality of my 1994 IOCCC entry (you like having + * a clock on your screen at all times) but you do not want to use up 7 + * process slots to run the code, then this is the program for you. This + * program uses ANSI/VTxxx escape sequences and perodic time(3) calls to + * print a clock in the upper right corner of you screen. + * + * -Andrew Shapiro + * CSES/CIRES University of Colorado + * Campus Box 216 + * Boulder, CO 80309-0216, USA + * + * shapiro@alumni.cs.colorado.edu + * andrew@gooter.metronet.org + * + * To build: + * cc -o shapiro.alt shapiro.alt.c + * + * To run: + * shapiro.alt & + * + */ +#include +#include + +#define ESC '\033' +#define MOVETO "\033[%d;%d;H" +#define SAVE "\0337" +#define RESTORE "%c8",ESC +#define ROW 1 +#define COL 50 + +main() +{ + time_t i; + char * atime; + + while (1) { + time(&i); + atime = asctime(localtime(&i)); + atime[strlen(atime)-1] = '\0'; + printf(SAVE); + printf(MOVETO,ROW,COL); + printf(" +--------------------------+ "); + printf(MOVETO,ROW+1,COL); + printf(" + %s +",atime); + printf(MOVETO,ROW+2,COL); + printf(" +--------------------------+ "); + printf(MOVETO,ROW+3,COL); + printf(" "); + printf(RESTORE); + fflush(stdout); /**/ + sleep(1); + } +} + diff --git a/bugs.html b/bugs.html index 3a1aa3189..aeeabba58 100644 --- a/bugs.html +++ b/bugs.html @@ -1620,11 +1620,6 @@ and it functions correctly it will address the systems where EOF != -1!= EOF.

      Since it works there is no need to fix this except for a challenge to yourself.

      Jump to: top

      -

      STATUS: missing file - please provide it

      -

      The index.html file refers to an alternate version of the code that is not -obfuscated but it is missing from the entry directory and the archive. Do you -have this file?

      -

      Jump to: top

      1994/tvr

      @@ -1697,7 +1692,7 @@ not show any output, stuck in a loop.

      1995/vanschnitz

      Jump to: top

      -

      STATUS: missing file - please provide it

      +

      STATUS: missing file - please provide it

      Source code: 1995/vanschnitz/vanschnitz.c

      Information: 1995/vanschnitz/index.html

      The authors stated that they included a version that allows people with just K&R diff --git a/bugs.md b/bugs.md index 1abbc8540..4d2da277a 100644 --- a/bugs.md +++ b/bugs.md @@ -1702,14 +1702,6 @@ Since it works there is no need to fix this except for a challenge to yourself. Jump to: [top](#) -### STATUS: missing file - please provide it - -The index.html file refers to an alternate version of the code that is not -obfuscated but it is missing from the entry directory and the archive. Do you -have this file? - -Jump to: [top](#) -

      ## 1994/tvr
      diff --git a/thanks-for-help.html b/thanks-for-help.html index 65a773db6..05cd74816 100644 --- a/thanks-for-help.html +++ b/thanks-for-help.html @@ -2241,6 +2241,9 @@ assumed that getc() will return -1 on EOF or error, no where EOF != -1 it could result in an infinite loop.

      For an interesting problem that occurred here and what was done to solve it, check 1994/shapiro in bugs.html.

      +

      Cody also provided the missing +shapiro.alt.c file, found by Leo. +Thanks Leo!

      Jump to: top

      Winning entry: 1994/smr

      diff --git a/thanks-for-help.md b/thanks-for-help.md index f40da4a21..5d58312e5 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2658,6 +2658,10 @@ where `EOF != -1` it could result in an infinite loop. For an interesting problem that occurred here and what was done to solve it, check [1994/shapiro in bugs.html](bugs.html#1994_shapiro). +Cody also provided the missing +[shapiro.alt.c](%%REPO_URL%%/1994/shapiro/shapiro.alt.c) file, found by Leo. +Thanks Leo! + Jump to: [top](#)