]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/alpha/vms-ld.c
Merge basic-improvements-branch to trunk
[thirdparty/gcc.git] / gcc / config / alpha / vms-ld.c
1 /* VMS linker wrapper.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4 Contributed by Douglas B. Rupp (rupp@gnat.com).
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 /* This program is a wrapper around the VMS linker.
24 It translates Unix style command line options into corresponding
25 VMS style qualifiers and then spawns the VMS linker. */
26
27 #include "config.h"
28 #include "system.h"
29 #include "coretypes.h"
30 #include "tm.h"
31
32 typedef struct dsc {unsigned short len, mbz; char *adr; } Descr;
33
34 #undef PATH_SEPARATOR
35 #undef PATH_SEPARATOR_STR
36 #define PATH_SEPARATOR ','
37 #define PATH_SEPARATOR_STR ","
38
39 /* Local variable declarations. */
40
41 /* File specification for vms-dwarf2.o. */
42 static char *vmsdwarf2spec = 0;
43
44 /* File specification for vms-dwarf2eh.o. */
45 static char *vmsdwarf2ehspec = 0;
46
47 /* verbose = 1 if -v passed. */
48 static int verbose = 0;
49
50 /* save_temps = 1 if -save-temps passed. */
51 static int save_temps = 0;
52
53 /* By default don't generate executable file if there are errors
54 in the link. Override with --noinhibit-exec. */
55 static int inhibit_exec = 1;
56
57 /* debug = 1 if -g passed. */
58 static int debug = 0;
59
60 /* By default prefer to link with shareable image libraries.
61 Override with -static. */
62 static int staticp = 0;
63
64 /* By default generate an executable, not a shareable image library.
65 Override with -shared. */
66 static int share = 0;
67
68 /* Remember if IDENTIFICATION given on command line. */
69 static int ident = 0;
70
71 /* Keep track of arg translations. */
72 static int link_arg_max = -1;
73 static const char **link_args = 0;
74 static int link_arg_index = -1;
75
76 /* Keep track of filenames */
77 static char optfilefullname [267];
78 static char *sharefilename = 0;
79 static char *exefilename = 0;
80
81 /* System search dir list. Leave blank since link handles this
82 internally. */
83 static char *system_search_dirs = "";
84
85 /* Search dir list passed on command line (with -L). */
86 static char *search_dirs;
87
88 /* Local function declarations. */
89
90 /* Add STR to the list of arguments to pass to the linker. Expand the list as
91 necessary to accommodate. */
92 static void addarg PARAMS ((const char *));
93
94 /* Check to see if NAME is a regular file, i.e. not a directory */
95 static int is_regular_file PARAMS ((char *));
96
97 /* Translate a Unix syntax file specification FILESPEC into VMS syntax.
98 If indicators of VMS syntax found, return input string. */
99 static char *to_host_file_spec PARAMS ((char *));
100
101 /* Locate the library named LIB_NAME in the set of paths PATH_VAL. */
102 static char *locate_lib PARAMS ((char *, char *));
103
104 /* Given a library name NAME, i.e. foo, Look for libfoo.lib and then
105 libfoo.a in the set of directories we are allowed to search in. */
106 static const char *expand_lib PARAMS ((char *));
107
108 /* Preprocess the number of args P_ARGC in ARGV.
109 Look for special flags, etc. that must be handled first. */
110 static void preprocess_args PARAMS ((int *, char **));
111
112 /* Preprocess the number of args P_ARGC in ARGV. Look for
113 special flags, etc. that must be handled for the VMS linker. */
114 static void process_args PARAMS ((int *, char **));
115
116 /* Action routine called by decc$to_vms. NAME is a file name or
117 directory name. TYPE is unused. */
118 static int translate_unix PARAMS ((char *, int));
119
120 int main PARAMS ((int, char **));
121 \f
122 static void
123 addarg (str)
124 const char *str;
125 {
126 int i;
127
128 if (++link_arg_index >= link_arg_max)
129 {
130 const char **new_link_args
131 = (const char **) xcalloc (link_arg_max + 1000, sizeof (char *));
132
133 for (i = 0; i <= link_arg_max; i++)
134 new_link_args [i] = link_args [i];
135
136 if (link_args)
137 free (link_args);
138
139 link_arg_max += 1000;
140 link_args = new_link_args;
141 }
142
143 link_args [link_arg_index] = str;
144 }
145
146 static char *
147 locate_lib (lib_name, path_val)
148 char *lib_name;
149 char *path_val;
150 {
151 int lib_len = strlen (lib_name);
152 char *eptr, *sptr;
153
154 for (sptr = path_val; *sptr; sptr = eptr)
155 {
156 char *buf, *ptr;
157
158 while (*sptr == PATH_SEPARATOR)
159 sptr ++;
160
161 eptr = strchr (sptr, PATH_SEPARATOR);
162 if (eptr == 0)
163 eptr = strchr (sptr, 0);
164
165 buf = alloca ((eptr-sptr) + lib_len + 4 + 2);
166 strncpy (buf, sptr, eptr-sptr);
167 buf [eptr-sptr] = 0;
168 strcat (buf, "/");
169 strcat (buf, lib_name);
170 ptr = strchr (buf, 0);
171
172 if (debug || staticp)
173 {
174 /* For debug or static links, look for shareable image libraries
175 last. */
176 strcpy (ptr, ".a");
177 if (is_regular_file (buf))
178 return xstrdup (to_host_file_spec (buf));
179
180 strcpy (ptr, ".olb");
181 if (is_regular_file (buf))
182 return xstrdup (to_host_file_spec (buf));
183
184 strcpy (ptr, ".exe");
185 if (is_regular_file (buf))
186 return xstrdup (to_host_file_spec (buf));
187 }
188 else
189 {
190 /* Otherwise look for shareable image libraries first. */
191 strcpy (ptr, ".exe");
192 if (is_regular_file (buf))
193 return xstrdup (to_host_file_spec (buf));
194
195 strcpy (ptr, ".a");
196 if (is_regular_file (buf))
197 return xstrdup (to_host_file_spec (buf));
198
199 strcpy (ptr, ".olb");
200 if (is_regular_file (buf))
201 return xstrdup (to_host_file_spec (buf));
202 }
203 }
204
205 return 0;
206 }
207
208 static const char *
209 expand_lib (name)
210 char *name;
211 {
212 char *lib, *lib_path;
213
214 if (strcmp (name, "c") == 0)
215 /* IEEE VAX C compatible library for non-prefixed (e.g. no DECC$)
216 C RTL functions. */
217 return "sys$library:vaxcrtltx.olb";
218
219 else if (strcmp (name, "m") == 0)
220 /* No separate library for math functions */
221 return "";
222
223 else
224 {
225 lib = xmalloc (strlen (name) + 14);
226
227 strcpy (lib, "lib");
228 strcat (lib, name);
229 lib_path = locate_lib (lib, search_dirs);
230
231 if (lib_path)
232 return lib_path;
233 }
234
235 fprintf (stderr,
236 "Couldn't locate library: lib%s.exe, lib%s.a or lib%s.olb\n",
237 name, name, name);
238
239 exit (1);
240 }
241
242 static int
243 is_regular_file (name)
244 char *name;
245 {
246 int ret;
247 struct stat statbuf;
248
249 ret = stat (name, &statbuf);
250 return !ret && S_ISREG (statbuf.st_mode);
251 }
252
253 static void
254 preprocess_args (p_argc, argv)
255 int *p_argc;
256 char **argv;
257 {
258 int i;
259
260 for (i = 1; i < *p_argc; i++)
261 if (strlen (argv[i]) >= 6 && strncmp (argv[i], "-shared", 7) == 0)
262 share = 1;
263
264 for (i = 1; i < *p_argc; i++)
265 if (strcmp (argv[i], "-o") == 0)
266 {
267 char *buff, *ptr;
268 int out_len;
269 int len;
270
271 i++;
272 ptr = to_host_file_spec (argv[i]);
273 exefilename = xstrdup (ptr);
274 out_len = strlen (ptr);
275 buff = xmalloc (out_len + 18);
276
277 if (share)
278 strcpy (buff, "/share=");
279 else
280 strcpy (buff, "/exe=");
281
282 strcat (buff, ptr);
283 addarg (buff);
284
285 if (share)
286 {
287 sharefilename = xmalloc (out_len+5);
288 if (ptr == strchr (argv[i], ']'))
289 strcpy (sharefilename, ++ptr);
290 else if (ptr == strchr (argv[i], ':'))
291 strcpy (sharefilename, ++ptr);
292 else if (ptr == strrchr (argv[i], '/'))
293 strcpy (sharefilename, ++ptr);
294 else
295 strcpy (sharefilename, argv[i]);
296
297 len = strlen (sharefilename);
298 if (strncasecmp (&sharefilename[len-4], ".exe", 4) == 0)
299 sharefilename[len-4] = 0;
300
301 for (ptr = sharefilename; *ptr; ptr++)
302 *ptr = TOUPPER (*ptr);
303 }
304 }
305 }
306
307 static void
308 process_args (p_argc, argv)
309 int *p_argc;
310 char **argv;
311 {
312 int i;
313
314 for (i = 1; i < *p_argc; i++)
315 {
316 if (strlen (argv[i]) < 2)
317 continue;
318
319 if (strncmp (argv[i], "-L", 2) == 0)
320 {
321 char *nbuff, *ptr;
322 int new_len, search_dirs_len;
323
324 ptr = &argv[i][2];
325 new_len = strlen (ptr);
326 search_dirs_len = strlen (search_dirs);
327
328 nbuff = xmalloc (new_len + 1);
329 strcpy (nbuff, ptr);
330
331 /* Remove trailing slashes. */
332 while (new_len > 1 && nbuff [new_len - 1] == '/')
333 {
334 nbuff [new_len - 1] = 0;
335 new_len--;
336 }
337
338 search_dirs = xrealloc (search_dirs, search_dirs_len + new_len + 2);
339 if (search_dirs_len > 0)
340 strcat (search_dirs, PATH_SEPARATOR_STR);
341
342 strcat (search_dirs, nbuff);
343 free (nbuff);
344 }
345
346 /* -v turns on verbose option here and is passed on to gcc. */
347 else if (strcmp (argv[i], "-v") == 0)
348 verbose = 1;
349 else if (strcmp (argv[i], "-g0") == 0)
350 addarg ("/notraceback");
351 else if (strncmp (argv[i], "-g", 2) == 0)
352 {
353 addarg ("/debug");
354 debug = 1;
355 }
356 else if (strcmp (argv[i], "-static") == 0)
357 staticp = 1;
358 else if (strcmp (argv[i], "-map") == 0)
359 {
360 char *buff, *ptr;
361
362 buff = xmalloc (strlen (exefilename) + 5);
363 strcpy (buff, exefilename);
364 ptr = strchr (buff, '.');
365 if (ptr)
366 *ptr = 0;
367
368 strcat (buff, ".map");
369 addarg ("/map=");
370 addarg (buff);
371 addarg ("/full");
372 }
373 else if (strcmp (argv[i], "-save-temps") == 0)
374 save_temps = 1;
375 else if (strcmp (argv[i], "--noinhibit-exec") == 0)
376 inhibit_exec = 0;
377 }
378 }
379
380 /* The main program. Spawn the VMS linker after fixing up the Unix-like flags
381 and args to be what the VMS linker wants. */
382
383 int
384 main (argc, argv)
385 int argc;
386 char **argv;
387 {
388 int i;
389 char cwdev [128], *devptr;
390 int devlen;
391 int optfd;
392 FILE *optfile;
393 char *cwd = getcwd (0, 1024);
394 char *optfilename;
395
396 devptr = strchr (cwd, ':');
397 devlen = (devptr - cwd) + 1;
398 strncpy (cwdev, cwd, devlen);
399 cwdev [devlen] = '\0';
400
401 search_dirs = xstrdup (system_search_dirs);
402
403 addarg ("link");
404
405 /* Pass to find args that have to be append first. */
406 preprocess_args (&argc , argv);
407
408 /* Pass to find the rest of the args. */
409 process_args (&argc , argv);
410
411 /* Create a temp file to hold args, otherwise we can easily exceed the VMS
412 command line length limits. */
413 optfilename = alloca (strlen ("LDXXXXXX") + 1);
414 strcpy (optfilename, "LDXXXXXX");
415 optfd = mkstemp (optfilename);
416 getcwd (optfilefullname, 256, 1); /* VMS style cwd. */
417 strcat (optfilefullname, optfilename);
418 strcat (optfilefullname, ".");
419 optfile = fdopen (optfd, "w");
420
421 /* Write out the IDENTIFICATION argument first so that it can be overridden
422 by an options file. */
423 for (i = 1; i < argc; i++)
424 {
425 int arg_len = strlen (argv[i]);
426
427 if (arg_len > 6 && strncasecmp (argv[i], "IDENT=", 6) == 0)
428 {
429 /* Comes from command line. If present will always appear before
430 IDENTIFICATION=... and will override. */
431
432 if (!ident)
433 ident = 1;
434 }
435 else if (arg_len > 15
436 && strncasecmp (argv[i], "IDENTIFICATION=", 15) == 0)
437 {
438 /* Comes from pragma Ident (). */
439
440 if (!ident)
441 {
442 fprintf (optfile, "case_sensitive=yes\n");
443 fprintf (optfile, "IDENTIFICATION=\"%15.15s\"\n", &argv[i][15]);
444 fprintf (optfile, "case_sensitive=NO\n");
445 ident = 1;
446 }
447 }
448 }
449
450 for (i = 1; i < argc; i++)
451 {
452 int arg_len = strlen (argv[i]);
453
454 if (strcmp (argv[i], "-o") == 0)
455 i++;
456 else if (arg_len > 2 && strncmp (argv[i], "-l", 2) == 0)
457 {
458 const char *libname = expand_lib (&argv[i][2]);
459 const char *ext;
460 int len;
461
462 if ((len = strlen (libname)) > 0)
463 {
464 char buff [256];
465
466 if (len > 4 && strcasecmp (&libname [len-4], ".exe") == 0)
467 ext = "/shareable";
468 else
469 ext = "/library";
470
471 if (libname[0] == '[')
472 sprintf (buff, "%s%s", cwdev, libname);
473 else
474 sprintf (buff, "%s", libname);
475
476 fprintf (optfile, "%s%s\n", buff, ext);
477 }
478 }
479
480 else if (strcmp (argv[i], "-v" ) == 0
481 || strncmp (argv[i], "-g", 2 ) == 0
482 || strcmp (argv[i], "-static" ) == 0
483 || strcmp (argv[i], "-map" ) == 0
484 || strcmp (argv[i], "-save-temps") == 0
485 || strcmp (argv[i], "--noinhibit-exec") == 0
486 || (arg_len > 2 && strncmp (argv[i], "-L", 2) == 0)
487 || (arg_len >= 6 && strncmp (argv[i], "-share", 6) == 0))
488 ;
489 else if (arg_len > 1 && argv[i][0] == '@')
490 {
491 FILE *atfile;
492 char *ptr, *ptr1;
493 struct stat statbuf;
494 char *buff;
495 int len;
496
497 if (stat (&argv[i][1], &statbuf))
498 {
499 fprintf (stderr, "Couldn't open linker response file: %s\n",
500 &argv[i][1]);
501 exit (1);
502 }
503
504 buff = xmalloc (statbuf.st_size + 1);
505 atfile = fopen (&argv[i][1], "r");
506 fgets (buff, statbuf.st_size + 1, atfile);
507 fclose (atfile);
508
509 len = strlen (buff);
510 if (buff [len - 1] == '\n')
511 {
512 buff [len - 1] = 0;
513 len--;
514 }
515
516 ptr = buff;
517
518 do
519 {
520 ptr1 = strchr (ptr, ' ');
521 if (ptr1)
522 *ptr1 = 0;
523 ptr = to_host_file_spec (ptr);
524 if (ptr[0] == '[')
525 fprintf (optfile, "%s%s\n", cwdev, ptr);
526 else
527 fprintf (optfile, "%s\n", ptr);
528 ptr = ptr1 + 1;
529 } while (ptr1);
530 }
531
532 /* Unix style file specs and VMS style switches look alike, so assume an
533 arg consisting of one and only one slash, and that being first, is
534 really a switch. */
535 else if ((argv[i][0] == '/') && (strchr (&argv[i][1], '/') == 0))
536 addarg (argv[i]);
537 else if (arg_len > 4
538 && strncasecmp (&argv[i][arg_len-4], ".OPT", 4) == 0)
539 {
540 FILE *optfile1;
541 char buff [256];
542
543 optfile1 = fopen (argv[i], "r");
544 while (fgets (buff, 256, optfile1))
545 fputs (buff, optfile);
546
547 fclose (optfile1);
548 }
549 else if (arg_len > 7 && strncasecmp (argv[i], "GSMATCH", 7) == 0)
550 fprintf (optfile, "%s\n", argv[i]);
551 else if (arg_len > 6 && strncasecmp (argv[i], "IDENT=", 6) == 0)
552 {
553 /* Comes from command line and will override pragma. */
554 fprintf (optfile, "case_sensitive=yes\n");
555 fprintf (optfile, "IDENT=\"%15.15s\"\n", &argv[i][6]);
556 fprintf (optfile, "case_sensitive=NO\n");
557 ident = 1;
558 }
559 else if (arg_len > 15
560 && strncasecmp (argv[i], "IDENTIFICATION=", 15) == 0)
561 ;
562 else
563 {
564 /* Assume filename arg. */
565 const char *addswitch = "";
566 char buff [256];
567 int buff_len;
568 int is_cld = 0;
569
570 argv[i] = to_host_file_spec (argv[i]);
571 arg_len = strlen (argv[i]);
572
573 if (arg_len > 4 && strcasecmp (&argv[i][arg_len-4], ".exe") == 0)
574 addswitch = "/shareable";
575
576 if (arg_len > 4 && strcasecmp (&argv[i][arg_len-4], ".cld") == 0)
577 {
578 addswitch = "/shareable";
579 is_cld = 1;
580 }
581
582 if (arg_len > 2 && strcasecmp (&argv[i][arg_len-2], ".a") == 0)
583 addswitch = "/lib";
584
585 if (arg_len > 4 && strcasecmp (&argv[i][arg_len-4], ".olb") == 0)
586 addswitch = "/lib";
587
588 if (argv[i][0] == '[')
589 sprintf (buff, "%s%s%s\n", cwdev, argv[i], addswitch);
590 else if (strchr (argv[i], ':'))
591 sprintf (buff, "%s%s\n", argv[i], addswitch);
592 else
593 sprintf (buff, "%s%s%s\n", cwd, argv[i], addswitch);
594
595 buff_len = strlen (buff);
596
597 if (buff_len >= 15
598 && strcasecmp (&buff[buff_len - 15], "vms-dwarf2eh.o\n") == 0)
599 vmsdwarf2ehspec = xstrdup (buff);
600 else if (buff_len >= 13
601 && strcasecmp (&buff[buff_len - 13],"vms-dwarf2.o\n") == 0)
602 vmsdwarf2spec = xstrdup (buff);
603 else if (is_cld)
604 {
605 addarg (buff);
606 addarg (",");
607 }
608 else
609 fprintf (optfile, buff);
610 }
611 }
612
613 #if 0
614 if (share)
615 fprintf (optfile, "symbol_vector=(main=procedure)\n");
616 #endif
617
618 if (vmsdwarf2ehspec)
619 {
620 fprintf (optfile, "case_sensitive=yes\n");
621 fprintf (optfile, "cluster=DWARF2eh,,,%s", vmsdwarf2ehspec);
622 fprintf (optfile, "collect=DWARF2eh,eh_frame\n");
623 fprintf (optfile, "case_sensitive=NO\n");
624 }
625
626 if (debug && vmsdwarf2spec)
627 {
628 fprintf (optfile, "case_sensitive=yes\n");
629 fprintf (optfile, "cluster=DWARF2debug,,,%s", vmsdwarf2spec);
630 fprintf (optfile, "collect=DWARF2debug,debug_abbrev,debug_aranges,-\n");
631 fprintf (optfile, " debug_frame,debug_info,debug_line,debug_loc,-\n");
632 fprintf (optfile, " debug_macinfo,debug_pubnames,debug_str,-\n");
633 fprintf (optfile, " debug_zzzzzz\n");
634 fprintf (optfile, "case_sensitive=NO\n");
635 }
636
637 if (debug && share)
638 {
639 fprintf (optfile, "case_sensitive=yes\n");
640 fprintf (optfile, "symbol_vector=(-\n");
641 fprintf (optfile,
642 "%s$DWARF2.DEBUG_ABBREV/$dwarf2.debug_abbrev=DATA,-\n",
643 sharefilename);
644 fprintf (optfile,
645 "%s$DWARF2.DEBUG_ARANGES/$dwarf2.debug_aranges=DATA,-\n",
646 sharefilename);
647 fprintf (optfile, "%s$DWARF2.DEBUG_FRAME/$dwarf2.debug_frame=DATA,-\n",
648 sharefilename);
649 fprintf (optfile, "%s$DWARF2.DEBUG_INFO/$dwarf2.debug_info=DATA,-\n",
650 sharefilename);
651 fprintf (optfile, "%s$DWARF2.DEBUG_LINE/$dwarf2.debug_line=DATA,-\n",
652 sharefilename);
653 fprintf (optfile, "%s$DWARF2.DEBUG_LOC/$dwarf2.debug_loc=DATA,-\n",
654 sharefilename);
655 fprintf (optfile,
656 "%s$DWARF2.DEBUG_MACINFO/$dwarf2.debug_macinfo=DATA,-\n",
657 sharefilename);
658 fprintf (optfile,
659 "%s$DWARF2.DEBUG_PUBNAMES/$dwarf2.debug_pubnames=DATA,-\n",
660 sharefilename);
661 fprintf (optfile, "%s$DWARF2.DEBUG_STR/$dwarf2.debug_str=DATA,-\n",
662 sharefilename);
663 fprintf (optfile, "%s$DWARF2.DEBUG_ZZZZZZ/$dwarf2.debug_zzzzzz=DATA)\n",
664 sharefilename);
665 fprintf (optfile, "case_sensitive=NO\n");
666 }
667
668 fclose (optfile);
669 addarg (optfilefullname);
670 addarg ("/opt");
671
672 addarg (NULL);
673
674 if (verbose)
675 {
676 int i;
677
678 for (i = 0; i < link_arg_index; i++)
679 printf ("%s ", link_args [i]);
680 putchar ('\n');
681 }
682
683 {
684 int i;
685 int len = 0;
686
687 for (i = 0; link_args[i]; i++)
688 len = len + strlen (link_args[i]) + 1;
689
690 {
691 char *allargs = (char *) alloca (len + 1);
692 Descr cmd;
693 int status;
694 int status1 = 1;
695
696 for (i = 0; i < len + 1; i++)
697 allargs [i] = 0;
698
699 for (i = 0; link_args [i]; i++)
700 {
701 strcat (allargs, link_args [i]);
702 strcat (allargs, " ");
703 }
704
705 cmd.adr = allargs;
706 cmd.len = len;
707 cmd.mbz = 0;
708
709 i = LIB$SPAWN (&cmd, 0, 0, 0, 0, 0, &status);
710 if ((i & 1) != 1)
711 {
712 LIB$SIGNAL (i);
713 exit (1);
714 }
715
716 if (debug && !share)
717 {
718 strcpy (allargs, "@gnu:[bin]set_exe ");
719 strcat (allargs, exefilename);
720 strcat (allargs, " /nodebug /silent");
721 len = strlen (allargs);
722 cmd.adr = allargs;
723 cmd.len = len;
724 cmd.mbz = 0;
725
726 if (verbose)
727 printf (allargs);
728
729 i = LIB$SPAWN (&cmd, 0, 0, 0, 0, 0, &status1);
730
731 if ((i & 1) != 1)
732 {
733 LIB$SIGNAL (i);
734 exit (1);
735 }
736 }
737
738 if (!save_temps)
739 remove (optfilefullname);
740
741 if ((status & 1) == 1 && (status1 & 1) == 1)
742 exit (0);
743
744 if (exefilename && inhibit_exec == 1)
745 remove (exefilename);
746
747 exit (1);
748 }
749 }
750 }
751
752 static char new_host_filespec [255];
753 static char filename_buff [256];
754
755 static int
756 translate_unix (name, type)
757 char *name;
758 int type ATTRIBUTE_UNUSED;
759 {
760 strcpy (filename_buff, name);
761 return 0;
762 }
763
764 static char *
765 to_host_file_spec (filespec)
766 char *filespec;
767 {
768 strcpy (new_host_filespec, "");
769 if (strchr (filespec, ']') || strchr (filespec, ':'))
770 strcpy (new_host_filespec, filespec);
771 else
772 {
773 decc$to_vms (filespec, translate_unix, 1, 1);
774 strcpy (new_host_filespec, filename_buff);
775 }
776
777 return new_host_filespec;
778 }