OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [libgfortran/] [intrinsics/] [system.c] - Diff between revs 733 and 783

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 733 Rev 783
/* Implementation of the SYSTEM intrinsic.
/* Implementation of the SYSTEM intrinsic.
   Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc.
   Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc.
   Contributed by Tobias Schlüter.
   Contributed by Tobias Schlüter.
 
 
This file is part of the GNU Fortran runtime library (libgfortran).
This file is part of the GNU Fortran runtime library (libgfortran).
 
 
Libgfortran is free software; you can redistribute it and/or modify it under
Libgfortran is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
Software Foundation; either version 3, or (at your option) any later
version.
version.
 
 
Libgfortran is distributed in the hope that it will be useful, but WITHOUT
Libgfortran is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.
for more details.
 
 
Under Section 7 of GPL version 3, you are granted additional
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
3.1, as published by the Free Software Foundation.
 
 
You should have received a copy of the GNU General Public License and
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
<http://www.gnu.org/licenses/>.  */
<http://www.gnu.org/licenses/>.  */
 
 
#include "libgfortran.h"
#include "libgfortran.h"
#include <string.h>
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
 
 
extern void system_sub (const char *fcmd, GFC_INTEGER_4 * status,
extern void system_sub (const char *fcmd, GFC_INTEGER_4 * status,
                        gfc_charlen_type cmd_len);
                        gfc_charlen_type cmd_len);
iexport_proto(system_sub);
iexport_proto(system_sub);
 
 
void
void
system_sub (const char *fcmd, GFC_INTEGER_4 *status, gfc_charlen_type cmd_len)
system_sub (const char *fcmd, GFC_INTEGER_4 *status, gfc_charlen_type cmd_len)
{
{
  char cmd[cmd_len + 1];
  char cmd[cmd_len + 1];
  int stat;
  int stat;
 
 
  /* Flush all I/O units before executing the command.  */
  /* Flush all I/O units before executing the command.  */
  flush_all_units();
  flush_all_units();
 
 
  memcpy (cmd, fcmd, cmd_len);
  memcpy (cmd, fcmd, cmd_len);
  cmd[cmd_len] = '\0';
  cmd[cmd_len] = '\0';
 
 
  stat = system (cmd);
  stat = system (cmd);
  if (status)
  if (status)
    *status = stat;
    *status = stat;
}
}
iexport(system_sub);
iexport(system_sub);
 
 
extern GFC_INTEGER_4 PREFIX(system) (const char *, gfc_charlen_type);
extern GFC_INTEGER_4 PREFIX(system) (const char *, gfc_charlen_type);
export_proto_np(PREFIX(system));
export_proto_np(PREFIX(system));
 
 
GFC_INTEGER_4
GFC_INTEGER_4
PREFIX(system) (const char *fcmd, gfc_charlen_type cmd_len)
PREFIX(system) (const char *fcmd, gfc_charlen_type cmd_len)
{
{
  GFC_INTEGER_4 stat;
  GFC_INTEGER_4 stat;
  system_sub (fcmd, &stat, cmd_len);
  system_sub (fcmd, &stat, cmd_len);
  return stat;
  return stat;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.