paul@667 | 1 | /* |
paul@667 | 2 | * Run a program using the supplied arguments. |
paul@667 | 3 | * |
paul@667 | 4 | * Copyright (C) 2024 Paul Boddie <paul@boddie.org.uk> |
paul@667 | 5 | * |
paul@667 | 6 | * This program is free software; you can redistribute it and/or |
paul@667 | 7 | * modify it under the terms of the GNU General Public License as |
paul@667 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@667 | 9 | * the License, or (at your option) any later version. |
paul@667 | 10 | * |
paul@667 | 11 | * This program is distributed in the hope that it will be useful, |
paul@667 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@667 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@667 | 14 | * GNU General Public License for more details. |
paul@667 | 15 | * |
paul@667 | 16 | * You should have received a copy of the GNU General Public License |
paul@667 | 17 | * along with this program; if not, write to the Free Software |
paul@667 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@667 | 19 | * Boston, MA 02110-1301, USA |
paul@667 | 20 | */ |
paul@667 | 21 | |
paul@667 | 22 | #include <stdio.h> |
paul@667 | 23 | #include <errno.h> |
paul@667 | 24 | |
paul@667 | 25 | /* NOTE: To be provided via a header. */ |
paul@667 | 26 | |
paul@667 | 27 | extern int systemv(int, const char *[]); |
paul@667 | 28 | |
paul@667 | 29 | |
paul@667 | 30 | |
paul@667 | 31 | /* List objects in the filesystem image. */ |
paul@667 | 32 | |
paul@667 | 33 | int main(int argc, char *argv[]) |
paul@667 | 34 | { |
paul@667 | 35 | int result; |
paul@667 | 36 | |
paul@680 | 37 | if (argc < 2) |
paul@680 | 38 | { |
paul@680 | 39 | printf("Usage: test_systemv <program> <argument>...\n"); |
paul@680 | 40 | return 1; |
paul@680 | 41 | } |
paul@680 | 42 | |
paul@667 | 43 | printf("Running: %s\n", argv[1]); |
paul@667 | 44 | |
paul@667 | 45 | result = systemv(argc - 1, (const char **) argv + 1); |
paul@667 | 46 | |
paul@667 | 47 | if (result == -1) |
paul@667 | 48 | printf("Error: %d\n", errno); |
paul@667 | 49 | else |
paul@667 | 50 | printf("Result: %d\n", result); |
paul@667 | 51 | |
paul@667 | 52 | return 0; |
paul@667 | 53 | } |
paul@667 | 54 | |
paul@667 | 55 | /* vim: tabstop=4 expandtab shiftwidth=4 |
paul@667 | 56 | */ |