Subversion Repositories SvarDOS

Rev

Rev 1090 | Rev 1716 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1090 Rev 1129
Line 47... Line 47...
47
#include "sayonara.h"
47
#include "sayonara.h"
48
 
48
 
49
#include "cmd.h"
49
#include "cmd.h"
50
 
50
 
51
 
51
 
-
 
52
/* struct used to pass all necessary information to the sub-commands */
52
struct cmd_funcparam {
53
struct cmd_funcparam {
53
  int argc;                 /* number of arguments */
54
  int argc;                 /* number of arguments */
54
  const char *argv[128];    /* pointers to each argument */
55
  const char *argv[128];    /* pointers to each argument */
55
  char argvbuf[256];        /* buffer that hold data pointed out by argv[] */
56
  char argvbuf[256];        /* buffer that hold data pointed out by argv[] */
56
  unsigned short env_seg;   /* segment of environment block */
57
  unsigned short env_seg;   /* segment of environment block */
Line 59... Line 60...
59
  const char *cmdline;      /* original cmdline (terminated by a NULL) */
60
  const char *cmdline;      /* original cmdline (terminated by a NULL) */
60
  unsigned short BUFFERSZ;  /* avail space in BUFFER */
61
  unsigned short BUFFERSZ;  /* avail space in BUFFER */
61
  char BUFFER[1];           /* a buffer for whatever is needed (must be last) */
62
  char BUFFER[1];           /* a buffer for whatever is needed (must be last) */
62
};
63
};
63
 
64
 
-
 
65
 
64
/* scans argv for the presence of a "/?" parameter. returns 1 if found, 0 otherwise */
66
/* scans argv for the presence of a "/?" parameter.
-
 
67
 * returns 1 if found, 0 otherwise
-
 
68
 * this is used by most sub-commands to detect /? invocations */
65
static int cmd_ishlp(const struct cmd_funcparam *p) {
69
static int cmd_ishlp(const struct cmd_funcparam *p) {
66
  int i;
70
  int i;
67
  for (i = 0; i < p->argc; i++) {
71
  for (i = 0; i < p->argc; i++) {
68
    if ((p->argv[i][0] == '/') && (p->argv[i][1] == '?')) return(1);
72
    if ((p->argv[i][0] == '/') && (p->argv[i][1] == '?')) return(1);
69
  }
73
  }