|
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 c
Length: 1905 (0x771) Types: TextFile Names: »cvmotd.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Crystal/cvmotd.c«
/* cvmotd.c *************************************************************************/ #include <stdio.h> #include <time.h> #include <filehdr.h> #include <ldfcn.h> #include "cvmisc.h" #define MLEN 500 extern long time(); extern char *crypt(); extern char *malloc(); extern void free(); extern char *word1; static char msg[MLEN] = "\nUNIX PC Crystal version 1.7\n"; static char salt[2] = '\0\0'; /* To get this in the .data section */ static char password[14] = '\0'; static char nums[65] = /* remember the terminating null */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; void motd() { (void) fputs(msg, stdout); } static void newmotd() { register char *m, *line; #define lim 70 printf("\nLimit lines to %d bytes. End with a null line.\n",lim); m = msg; line = malloc(lim+2); do { fgets(line,lim+2,stdin); if (strlen(line) == lim+1 && *(line+lim) != '\n') { while (getchar() != '\n') ; puts("\nLine too long, retype:"); } else { if (*line == '\n') break; strcpy(m,line); m += strlen(line); *m = '\0'; if (m - msg + 71 > MLEN) { puts("\nNot enough room for another line. Ending here.\n"); *line = '\n'; } } } while (*line != '\n'); free(line); } static int wizard() { auto long now; auto struct tm *local; if (!yes(227,0,228)) return FALSE; if (password[0] != '\0') { puts("\nProve it! Say the magic word!\n"); getin(); if (strcmp(crypt(word1,salt),password)) { puts("\nFoo, you are nothing but a charlatan!\n"); return FALSE; } } return TRUE; } void maint(argv) char *argv; { auto long now; if (!wizard()) return; blklin = FALSE; puts("\nNew magic word (null to leave it unchanged):"); getin(); now = time((long *)0); *salt = nums[(now/64)%64]; *(salt+1) = nums[now%64]; strcpy(password,crypt(word1,salt)); if (yes(229,0,0)) newmotd(); puts("Okay. Now being saved.\n"); return; }