mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
* libguile/deprecated.h: * libguile/deprecated.c (scm_find_executable): Deprecate. Use strdup instead of weird scm_cat_path function. * libguile/script.h: * libguile/script.c: Remove old decls.
92 lines
1.9 KiB
C
92 lines
1.9 KiB
C
/* Copyright 2003-2004,2006,2008-2018
|
||
Free Software Foundation, Inc.
|
||
|
||
This file is part of Guile.
|
||
|
||
Guile is free software: you can redistribute it and/or modify it
|
||
under the terms of the GNU Lesser General Public License as published
|
||
by the Free Software Foundation, either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
Guile is distributed in the hope that it will be useful, but WITHOUT
|
||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||
License for more details.
|
||
|
||
You should have received a copy of the GNU Lesser General Public
|
||
License along with Guile. If not, see
|
||
<https://www.gnu.org/licenses/>. */
|
||
|
||
#ifdef HAVE_CONFIG_H
|
||
# include <config.h>
|
||
#endif
|
||
|
||
#include <stdio.h>
|
||
#include <string.h>
|
||
#include <unistd.h>
|
||
|
||
#define SCM_BUILDING_DEPRECATED_CODE
|
||
|
||
#include "deprecation.h"
|
||
#include "gc.h"
|
||
|
||
#include "deprecated.h"
|
||
|
||
#if (SCM_ENABLE_DEPRECATED == 1)
|
||
|
||
|
||
|
||
#ifndef MAXPATHLEN
|
||
#define MAXPATHLEN 80
|
||
#endif /* ndef MAXPATHLEN */
|
||
#ifndef X_OK
|
||
#define X_OK 1
|
||
#endif /* ndef X_OK */
|
||
|
||
char *
|
||
scm_find_executable (const char *name)
|
||
{
|
||
char tbuf[MAXPATHLEN];
|
||
int i = 0, c;
|
||
FILE *f;
|
||
|
||
scm_c_issue_deprecation_warning ("scm_find_executable is deprecated.");
|
||
|
||
/* fprintf(stderr, "s_f_e checking access %s ->%d\n", name, access(name, X_OK)); fflush(stderr); */
|
||
if (access (name, X_OK))
|
||
return 0L;
|
||
f = fopen (name, "r");
|
||
if (!f)
|
||
return 0L;
|
||
if ((fgetc (f) == '#') && (fgetc (f) == '!'))
|
||
{
|
||
while (1)
|
||
switch (c = fgetc (f))
|
||
{
|
||
case /*WHITE_SPACES */ ' ':
|
||
case '\t':
|
||
case '\r':
|
||
case '\f':
|
||
case EOF:
|
||
tbuf[i] = 0;
|
||
fclose (f);
|
||
return strdup (tbuf);
|
||
default:
|
||
tbuf[i++] = c;
|
||
break;
|
||
}
|
||
}
|
||
fclose (f);
|
||
return strdup (name);
|
||
}
|
||
|
||
|
||
|
||
|
||
void
|
||
scm_i_init_deprecated ()
|
||
{
|
||
#include "deprecated.x"
|
||
}
|
||
|
||
#endif /* SCM_ENABLE_DEPRECATD == 1 */
|