Subversion Repositories SvarDOS

Rev

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

Rev 225 Rev 226
Line 57... Line 57...
57
  return(1);
57
  return(1);
58
}
58
}
59
 
59
 
60
 
60
 
61
static enum ACTIONTYPES parsearg(int argc, char **argv) {
61
static enum ACTIONTYPES parsearg(int argc, char **argv) {
62
  int extpos, i;
-
 
63
  enum ACTIONTYPES res = ACTION_HELP;
-
 
64
  /* I expect exactly 2 arguments (ie argc == 3) */
62
  /* I expect exactly 2 arguments (ie argc == 3) */
65
  if (argc != 3) return(ACTION_HELP);
63
  if (argc != 3) return(ACTION_HELP);
-
 
64
 
66
  /* look for valid actions */
65
  /* look for valid actions */
67
  if (strcasecmp(argv[1], "install") == 0) {
66
  if (strcasecmp(argv[1], "install") == 0) {
68
    res = ACTION_INSTALL;
67
    return(ACTION_INSTALL);
69
  } else if (strcasecmp(argv[1], "remove") == 0) {
68
  } else if (strcasecmp(argv[1], "remove") == 0) {
70
    res = ACTION_REMOVE;
69
    return(ACTION_REMOVE);
71
  }
-
 
72
  /* the argument should never be empty */
-
 
73
  if (argv[2][0] == 0) return(ACTION_INSTALL);
-
 
74
  /* for 'install', validate that the extension is '.zip' */
-
 
75
  if (res == ACTION_INSTALL) {
-
 
76
    /* find where the file's extension starts */
-
 
77
    extpos = 0;
70
  } else {
78
    for (i = 0; argv[2][i] != 0; i++) {
-
 
79
      if (argv[2][i] == '.') extpos = i + 1;
-
 
80
    }
-
 
81
    if (extpos == 0) return(ACTION_HELP);
71
    return(ACTION_HELP);
82
  }
72
  }
83
  /* return the result */
-
 
84
  return(res);
-
 
85
}
73
}
86
 
74
 
87
 
75
 
88
static int pkginst(char *file, int flags, char *dosdir, char *tempdir, struct customdirs *dirlist) {
76
static int pkginst(char *file, int flags, char *dosdir, char *tempdir, struct customdirs *dirlist) {
89
  char pkgname[32];
77
  char pkgname[32];