@@ -31,8 +31,6 @@ main(int argc, char *argv[])
int i;
of_set_callback((void *) &_callback_entry);
- if (strcmp(argv[0], "ping") == 0)
- return ping(argc, argv);
#ifdef SNK_BIOSEMU_APPS
// BIOS Emulator applications
if (strcmp(argv[0], "biosemu") == 0)
@@ -17,3 +17,20 @@ PRIM(NET_X2d_LOAD)
}
TOS.n = netboot(i, argvs);
MIRP
+
+PRIM(NET_X2d_PING)
+ int slen = TOS.n; POP;
+ char *arg = TOS.a;
+ char *argvs[8];
+ int i, p;
+ argvs[0] = arg;
+ i = 1;
+ for (p = 0; p < slen; p++) {
+ if (arg[p] == ' ') {
+ arg[p] = 0;
+ argvs[i] = &arg[p + 1];
+ i++;
+ }
+ }
+ TOS.n = ping(i, argvs);
+MIRP
@@ -1,2 +1,3 @@
cod(NET-LOAD)
+cod(NET-PING)
@@ -70,5 +70,8 @@ INSTANCE VARIABLE ciregs-buffer
;
: ping ( -- )
- s" ping " my-args $cat (client-exec)
+ s" ping " my-args $cat
+ \ Zero-terminate string:
+ s" " $cat 2dup + 1 - 0 swap c!
+ net-ping
;
Now that we link libnet to Paflof, we can call the ping function there directly instead of using the one from net-snk. We add a similar Forth-to-C wrapper like it has already been done for netboot() - simplification and clean-up will be done in a later patch once we do not link against net-snk anymore. Signed-off-by: Thomas Huth <thuth@redhat.com> --- clients/net-snk/app/main.c | 2 -- lib/libnet/libnet.code | 17 +++++++++++++++++ lib/libnet/libnet.in | 1 + slof/fs/packages/obp-tftp.fs | 5 ++++- 4 files changed, 22 insertions(+), 3 deletions(-)