|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T j
Length: 3555 (0xde3)
Types: TextFile
Names: »jump.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/X/Xwanderer/jump.c«
#include "wand_head.h"
void showpass(num)
int num;
{
long position;
char correct[20];
char buffer[100];
FILE *fp;
char ch;
#ifndef XWANDER
move(18,0);
#endif
position = PASSWD;
while(position > 200000)
position -= 200000;
if((fp = fopen("/usr/dict/words","r")) == NULL)
return;
fseek(fp,position,ftell(fp));
while(fgetc(fp) != '\n');
fscanf(fp,"%s\n",correct);
/* read a word into correct */
fclose(fp);
#ifndef XWANDER
(void) sprintf(buffer,"\007The password to jump from level %d ( using ~ ) is : %s \n",num,correct);
addstr(buffer);
addstr("PRESS ANY KEY TO REMOVE IT AND CONTINUE \n");
refresh();
#ifndef XWANDER
getchar();
#else
getchar(-1);
#endif
move(18,0);
addstr(" \n");
addstr(" ");
move(18,0);
refresh();
#else
message(0,"The password to jump from level %d ( using ~ ) is : %s\n",
num, correct);
message(1,"PRESS ANY KEY TO REMOVE IT AND CONTINUE");
#ifndef XWANDER
(void)getchar();
#else
(void)getchar(-1);
#endif
erase_message(0);
erase_message(1);
#endif
}
int jumpscreen(num)
int num;
{
char word[20],
buffer[100],
correct[20];
int index=0, input;
char ch;
long position;
FILE *fp;
#ifndef XWANDER
move(16,0);
sprintf(buffer,"Number of screen to jump to? (next is %d) :",num+1);
addstr("Please enter password of screen to jump to:");
refresh();
#else
message(1,"Please enter password of screen to jump to:");
#endif
#ifndef XWANDER
while(((word[index++] = getchar()) != '\n')&&(index < 19))
#else
while(((word[index++] = getchar(-1)) != '\n')&&(index < 19))
#endif
{
#ifndef XWANDER
addch(' ');
refresh();
#else
; /* NULL statement */
#endif
}
word[--index]='\0';
#ifndef XWANDER
move(16,0);
addstr("Validating... ");
refresh();
#else
erase_message(0);
message(0,"Validating...");
#endif
position = PASSWD;
while(position > 200000)
position -= 200000;
if((fp = fopen("/usr/dict/words","r")) == NULL)
return 0;
fseek(fp,position,ftell(fp));
while(fgetc(fp) != '\n');
fscanf(fp,"%s\n",correct);
/* read a word into correct */
fclose(fp);
if(strcmp(word,MASTERPASSWORD) == 0)
{
#ifndef XWANDER
move(16,0);
sprintf(buffer,"Certainly master, but the correct word is %s. \n",correct);
addstr(buffer);
addstr("Press letter corresponding to desired level. (Or space to continue)");
refresh();
#else
message(0,"Certainly master, but the correct word is %s.",correct);
message(1,"Press letter corresponding to desired level. (Or space to continue)");
#endif
#ifndef XWANDER
ch = getchar();
#else
ch = getchar(-1);
#endif
num++;
input = ch - 'a' +1;
if(!(ch<'a') && !(ch>'z'))
num = input;
#ifndef XWANDER
move(16,0);
addstr(" ");
move(16,0);
refresh();
#else
erase_message(0);
erase_message(1);
#endif
return num;
}
if(strcmp(correct,word) != 0)
{
#ifndef XWANDER
move(16,0);
addstr("\007INCORRECT! ");
refresh();
#else
erase_message(0);
message(0,"INCORRECT!");
dobeep();
#endif
return num;
}
#ifndef XWANDER
move(16,0);
addstr("Password Validated..... Jumping to next screen. ");
refresh();
#else
erase_message(0);
message(0,"Password Validated..... Jumping to next screen.");
#endif
/* if they match, return ++num */
return ++num;
}