tinycobol/cobroutines/system.c

75 lines
1.9 KiB
C

/*
* Copyright (C) 2003 Hudson Reis, Husni Ali Husni.
*
* This library 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 2.1,
* or (at your option) any later version.
*
* This library 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 this library; see the file COPYING.LIB. If
* not, write to the Free Software Foundation, Inc., 59 Temple Place,
* Suite 330, Boston, MA 02111-1307 USA
*/
/* System routines */
#include <stdio.h>
#include <stdlib.h>
//#include <sys/utsname.h>
#include "globals.h"
/* Structs */
#pragma pack(1)
struct os_info {
char kernel_name[256];
char kernel_node[256];
char kernel_release[256];
char kernel_version[256];
char kernel_machine[256];
} *os_info;
#pragma pack()
/* Prototypes */
/* Functions */
cbl_t cbl_call_system(char *programa) {
if (cbl_align(programa) != 0) { return 1; }
if (system(programa) != 0) {
return 2;
} else {
return 0;
}
}
cbl_t cblsys(char *programa) {
if (cbl_align(programa) != 0) { return 1; }
if (system(programa) != 0) {
return 2;
} else {
return 0;
}
}
void cbl_get_os_info(struct os_info *os) {
os_info = os;
//uname(os_info);
// printf("All: %s\n", os_info);
// printf("Kernel name...: %s\n", ki->kernel_name);
// printf("Kernel node...: %s\n", ki->kernel_node);
// printf("Kernel release: %s\n", ki->kernel_release);
// printf("Kernel version: %s\n", ki->kernel_version);
// printf("Kernel machine: %s\n", ki->kernel_machine);
}