1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
$NetBSD: patch-ab,v 1.1 1999/12/23 01:44:03 wiz Exp $
--- main.c.orig Fri Feb 28 16:50:07 1997
+++ main.c Wed Dec 22 02:32:19 1999
@@ -49,8 +49,8 @@ static void clean(void);
static void sig_handle(void);
/*** ふぁいるぐろーばる ***/
-static char command[32];
-static char display[32] = {'\0'};
+static char *command;
+static char *display = NULL;
static int scoreOK = True;
static int putscore = False;
static int colormap = True;
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
{
int i;
printf(" --- top 10 soldiers ---\n");
- printf("Name Stage Score\n",command);
+ printf("Name Stage Score\n");
for (i=1; i<=10; i++)
printf("%-20s %02d-%02d %08d\n",
player->Rec[i].name,
@@ -122,21 +122,19 @@ int main(int argc, char *argv[])
static void arginit(int argc, char *argv[])
{
- char *argv0;
int i;
- if ((argv0=strrchr(argv[0],'/')) != NULL)
- argv0++;
+ if ((command=strrchr(argv[0],'/')) != NULL)
+ command++;
else
- argv0 = argv[0];
- strcpy(command,argv0); /*** コマンド名取得とコピー ***/
+ command = argv[0];
for (i=1; i<argc; i++)
{
if ((strcmp(argv[i],"-display")==0) || (strcmp(argv[i],"-d")==0))
{
if (i < argc-1)
- strcpy(display,argv[i+1]);
+ display = argv[i+1];
}
else if ((strcmp(argv[i],"-wait")==0) || (strcmp(argv[i],"-w")==0))
{
@@ -207,7 +205,8 @@ static void init(void)
dpy = XOpenDisplay(display);
if (dpy == NULL)
{
- fprintf(stderr,"init: [%s] can't open display.\n",display);
+ fprintf(stderr,"init: [%s] can't open display.\n",
+ display?display:getenv("DISPLAY")?getenv("DISPLAY"):":0");
exit(1);
}
|