Mercurial > hg > early-roguelike
annotate rogue4/findpw.c @ 177:7bdac632ab9d
srogue: fix an uninitialized variable.
In wanderer(), if rp == hr, the loop could test ch before its value has
been set.  Initializing ch to '-' now causes the loop to repeat until
a location is found.
| author | John "Elwin" Edwards | 
|---|---|
| date | Tue, 04 Aug 2015 11:39:49 -0400 | 
| parents | 9535a08ddc39 | 
| children | 
| rev | line source | 
|---|---|
| 
12
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
1 /* | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
2 * print out an encrypted password on the standard output | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
3 * | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
4 * @(#)findpw.c 1.1 (Berkeley) 12/20/81 | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
5 * | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
6 * Rogue: Exploring the Dungeons of Doom | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
7 * Copyright (C) 1980, 1981, 1982 Michael Toy, Ken Arnold and Glenn Wichman | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
8 * All rights reserved. | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
9 * | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
10 * See the file LICENSE.TXT for full copyright and licensing information. | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
11 */ | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
12 | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
13 #include <stdio.h> | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
14 | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
15 main() | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
16 { | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
17 char buf[80]; | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
18 | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
19 fprintf(stderr, "Password: "); | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
20 fgets(buf, 80, stdin); | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
21 buf[strlen(buf) - 1] = '\0'; | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
22 printf("%s\n", xcrypt(buf, "mT")); | 
| 
 
9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
 
edwarj4 
parents:  
diff
changeset
 | 
23 } | 
