diff options
author | hubertf <hubertf@NetBSD.org> | 1999-07-28 01:45:41 +0000 |
---|---|---|
committer | hubertf <hubertf@NetBSD.org> | 1999-07-28 01:45:41 +0000 |
commit | 932e74d4028472671e706b8d64965ef4a4293d0f (patch) | |
tree | 7155c281e751417d576084fd2feebae3a4e5159e /battlestar/battlestar.c | |
parent | d0abda98e89948088de49cb3c2f192c15aa4518d (diff) | |
download | bsdgames-darwin-932e74d4028472671e706b8d64965ef4a4293d0f.tar.gz bsdgames-darwin-932e74d4028472671e706b8d64965ef4a4293d0f.tar.zst bsdgames-darwin-932e74d4028472671e706b8d64965ef4a4293d0f.zip |
This patch improves the handling of save files in battlestar(6), by
allowing the user to choose the name of the save file and specify it
on the command line when restoring. It also eliminates a buffer
overrun in determining the path to the save file, and any particular
arbitrary limit on the name length. In the name of a tidier home
directory, the default name is changed from "Bstar" to ".Bstar".
Patch supplied in PR 8085 by Joseph Myers <jsm28@cam.ac.uk>
Minor modification (s/startup/filename/ in initialize()) by me.
Diffstat (limited to 'battlestar/battlestar.c')
-rw-r--r-- | battlestar/battlestar.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/battlestar/battlestar.c b/battlestar/battlestar.c index 9eb63707..8d57921f 100644 --- a/battlestar/battlestar.c +++ b/battlestar/battlestar.c @@ -1,4 +1,4 @@ -/* $NetBSD: battlestar.c,v 1.7 1999/07/21 03:56:53 hubertf Exp $ */ +/* $NetBSD: battlestar.c,v 1.8 1999/07/28 01:45:42 hubertf Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: battlestar.c,v 1.7 1999/07/21 03:56:53 hubertf Exp $"); +__RCSID("$NetBSD: battlestar.c,v 1.8 1999/07/28 01:45:42 hubertf Exp $"); #endif #endif /* not lint */ @@ -69,7 +69,10 @@ main(argc, argv) /* Open the score file then revoke setgid privileges */ open_score_file(); setregid(getgid(), getgid()); - initialize(argc < 2 || strcmp(argv[1], "-r")); + + initialize((argc < 2) ? NULL : (strcmp(argv[1], "-r") ? argv[1] + : (argv[2] ? argv[2] + : DEFAULT_SAVE_FILE))); start: news(); beenthere[position]++; |