File sl_c.diff of Package sl
--- sl.c 1998-07-22 15:01:01.000000000 +0100
+++ sl.c 2009-01-31 00:35:27.000000000 +0000
@@ -36,6 +36,8 @@
int LOGO = 0;
int FLY = 0;
+
+
int my_mvaddstr(int y, int x, char *str)
{
for ( ; x < 0; ++x, ++str)
@@ -45,9 +47,11 @@
return OK;
}
+
+
void option(char *str)
{
- extern int ACCIDENT, FLY, LONG;
+ extern int ACCIDENT, FLY;
while (*str != '\0') {
switch (*str++) {
@@ -59,35 +63,64 @@
}
}
-void main(int argc, char *argv[])
+
+
+void add_man(int y, int x)
{
- int x, i;
+ static char *man[2][2] = {{"", "(O)"}, {"Help!", "\\O/"}};
+ int i;
- for (i = 1; i < argc; ++i) {
- if (*argv[i] == '-') {
- option(argv[i] + 1);
- }
+ for (i = 0; i < 2; ++i) {
+ my_mvaddstr(y + i, x, man[(LOGOLENGTH + x) / 12 % 2][i]);
}
- initscr();
- signal(SIGINT, SIG_IGN);
- noecho();
- leaveok(stdscr, TRUE);
- scrollok(stdscr, FALSE);
+}
- for (x = COLS - 1; ; --x) {
- if (LOGO == 0) {
- if (add_D51(x) == ERR) break;
- } else {
- if (add_sl(x) == ERR) break;
+
+void add_smoke(int y, int x)
+#define SMOKEPTNS 16
+{
+ static struct smokes {
+ int y, x;
+ int ptrn, kind;
+ } S[1000];
+ static int sum = 0;
+ static char *Smoke[2][SMOKEPTNS]
+ = {{"( )", "( )", "( )", "( )", "( )",
+ "( )" , "( )" , "( )" , "()" , "()" ,
+ "O" , "O" , "O" , "O" , "O" ,
+ " " },
+ {"(@@@)", "(@@@@)", "(@@@@)", "(@@@)", "(@@)",
+ "(@@)" , "(@)" , "(@)" , "@@" , "@@" ,
+ "@" , "@" , "@" , "@" , "@" ,
+ " " }};
+ static char *Eraser[SMOKEPTNS]
+ = {" ", " ", " ", " ", " ",
+ " " , " " , " " , " " , " " ,
+ " " , " " , " " , " " , " " ,
+ " " };
+ static int dy[SMOKEPTNS] = { 2, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0 };
+ static int dx[SMOKEPTNS] = {-2, -1, 0, 1, 1, 1, 1, 1, 2, 2,
+ 2, 2, 2, 3, 3, 3 };
+ int i;
+
+ if (x % 4 == 0) {
+ for (i = 0; i < sum; ++i) {
+ my_mvaddstr(S[i].y, S[i].x, Eraser[S[i].ptrn]);
+ S[i].y -= dy[S[i].ptrn];
+ S[i].x += dx[S[i].ptrn];
+ S[i].ptrn += (S[i].ptrn < SMOKEPTNS - 1) ? 1 : 0;
+ my_mvaddstr(S[i].y, S[i].x, Smoke[S[i].kind][S[i].ptrn]);
}
- refresh();
- usleep(20000);
+ my_mvaddstr(y, x, Smoke[sum % 2][0]);
+ S[sum].y = y; S[sum].x = x;
+ S[sum].ptrn = 0; S[sum].kind = sum % 2;
+ sum ++;
}
- mvcur(0, COLS - 1, LINES - 1, 0);
- endwin();
}
+
int add_sl(int x)
{
static char *sl[LOGOPATTERNS][LOGOHIGHT + 1]
@@ -129,7 +162,7 @@
}
-add_D51(int x)
+int add_D51(int x)
{
static char *d51[D51PATTERNS][D51HIGHT + 1]
= {{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
@@ -170,56 +203,33 @@
}
-int add_man(int y, int x)
+
+int main(int argc, char *argv[])
{
- static char *man[2][2] = {{"", "(O)"}, {"Help!", "\\O/"}};
- int i;
+ int x, i;
- for (i = 0; i < 2; ++i) {
- my_mvaddstr(y + i, x, man[(LOGOLENGTH + x) / 12 % 2][i]);
+ for (i = 1; i < argc; ++i) {
+ if (*argv[i] == '-') {
+ option(argv[i] + 1);
+ }
}
-}
-
-
-int add_smoke(int y, int x)
-#define SMOKEPTNS 16
-{
- static struct smokes {
- int y, x;
- int ptrn, kind;
- } S[1000];
- static int sum = 0;
- static char *Smoke[2][SMOKEPTNS]
- = {{"( )", "( )", "( )", "( )", "( )",
- "( )" , "( )" , "( )" , "()" , "()" ,
- "O" , "O" , "O" , "O" , "O" ,
- " " },
- {"(@@@)", "(@@@@)", "(@@@@)", "(@@@)", "(@@)",
- "(@@)" , "(@)" , "(@)" , "@@" , "@@" ,
- "@" , "@" , "@" , "@" , "@" ,
- " " }};
- static char *Eraser[SMOKEPTNS]
- = {" ", " ", " ", " ", " ",
- " " , " " , " " , " " , " " ,
- " " , " " , " " , " " , " " ,
- " " };
- static int dy[SMOKEPTNS] = { 2, 1, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0 };
- static int dx[SMOKEPTNS] = {-2, -1, 0, 1, 1, 1, 1, 1, 2, 2,
- 2, 2, 2, 3, 3, 3 };
- int i;
+ initscr();
+ signal(SIGINT, SIG_IGN);
+ noecho();
+ leaveok(stdscr, TRUE);
+ scrollok(stdscr, FALSE);
- if (x % 4 == 0) {
- for (i = 0; i < sum; ++i) {
- my_mvaddstr(S[i].y, S[i].x, Eraser[S[i].ptrn]);
- S[i].y -= dy[S[i].ptrn];
- S[i].x += dx[S[i].ptrn];
- S[i].ptrn += (S[i].ptrn < SMOKEPTNS - 1) ? 1 : 0;
- my_mvaddstr(S[i].y, S[i].x, Smoke[S[i].kind][S[i].ptrn]);
+ for (x = COLS - 1; ; --x) {
+ if (LOGO == 0) {
+ if (add_D51(x) == ERR) break;
+ } else {
+ if (add_sl(x) == ERR) break;
}
- my_mvaddstr(y, x, Smoke[sum % 2][0]);
- S[sum].y = y; S[sum].x = x;
- S[sum].ptrn = 0; S[sum].kind = sum % 2;
- sum ++;
+ refresh();
+ usleep(20000);
}
+ mvcur(0, COLS - 1, LINES - 1, 0);
+ endwin();
+ return 0;
}
+