[BACK]Return to shell.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

File: [local] / OpenXM / src / kan96xx / Kan / shell.c (download)

Revision 1.1, Mon Nov 24 12:38:17 2003 UTC (20 years, 6 months ago) by takayama
Branch: MAIN

Added a new function KoxWhich();

Examples:
sm1>[(shell:which) (sm1)] extension ::
$/home/taka/OpenXM/bin/sm1$
sm1>[(shell:which) (hoge)] extension ::
Error: oxWhich_unix: could not find it in the path string.
%[null]
sm1>[(shell:which) (shell.c) (/home/taka/OpenXM/src/kan96xx/Kan)] extension ::
$/home/taka/OpenXM/src/kan96xx/Kan/shell.c$

/* $OpenXM: OpenXM/src/kan96xx/Kan/shell.c,v 1.1 2003/11/24 12:38:17 takayama Exp $ */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include "datatype.h"
#include "stackm.h"
#include "extern.h"
#include "extern2.h"
#include <signal.h>
#include "plugin.h"
#include "kclass.h"
#include <ctype.h>
#include "ox_pathfinder.h"


/* Functions for ox_shell */
struct object KoxWhich(struct object cmdo,struct object patho) {
  struct object rob;
  char *sss;
  rob = NullObject;
  if (cmdo.tag != Sdollar) errorKan1("%s\n","KoxWhich(str-obj,str-obj)");
  if (patho.tag == Sdollar) {
    sss=oxWhich(KopString(cmdo),KopString(patho));
    if (sss != NULL) rob=KpoString(sss);
    else{
      sss=getCommandPath(KopString(cmdo));
      if (sss != NULL) rob=KpoString(sss);
    }
  }else{
    sss=getCommandPath(KopString(cmdo));
    if (sss != NULL) rob=KpoString(sss);
  }
  return(rob);
}