Subversion Repositories SvarDOS

Rev

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

Rev 236 Rev 237
Line 39... Line 39...
39
  ACTION_HELP
39
  ACTION_HELP
40
};
40
};
41
 
41
 
42
 
42
 
43
static int showhelp(void) {
43
static int showhelp(void) {
44
  printf("FDINST v" PVER " Copyright (C) " PDATE " Mateusz Viste\n"
44
  printf("PKGINST ver " PVER " Copyright (C) " PDATE " Mateusz Viste\n"
45
         "\n"
45
         "\n"
46
         "FDINST is a lightweigth package installer for FreeDOS. It is an alternative\n"
46
         "PKGINST is the package installer for SvarDOS.\n"
47
         "to FDNPKG, when only basic, local install/remove actions are necessary. FDINST\n"
-
 
48
         "is a 16-bit, 8086-compatible application running in real mode.\n"
-
 
49
         "\n"
47
         "\n"
50
         "Usage: FDINST install package.zip\n"
48
         "Usage: PKGINST install package.zip\n"
51
         "       FDINST remove package\n"
49
         "       PKGINST remove package\n"
52
         "\n"
50
         "\n"
53
         "FDINST is published under the MIT license, and shares most of its source code\n"
51
         "PKGINST is published under the MIT license. It uses a PKGINST.CFG configuration\n"
54
         "with FDNPKG to guarantee consistent behaviour of both tools. It also uses\n"
52
         "file located in the directory pointed by %%PKGCFG%%\n"
55
         "FDNPKG's configuration file.\n"
-
 
56
         );
53
         );
57
  return(1);
54
  return(1);
58
}
55
}
59
 
56
 
60
 
57
 
Line 71... Line 68...
71
    return(ACTION_HELP);
68
    return(ACTION_HELP);
72
  }
69
  }
73
}
70
}
74
 
71
 
75
 
72
 
76
static int pkginst(const char *file, int flags, const char *dosdir, struct customdirs *dirlist) {
73
static int pkginst(const char *file, int flags, const char *dosdir, const struct customdirs *dirlist) {
77
  char pkgname[32];
74
  char pkgname[32];
78
  int t, lastpathdelim = -1, u = 0;
75
  int t, lastpathdelim = -1, u = 0;
79
  struct ziplist *zipfileidx;
76
  struct ziplist *zipfileidx;
80
  FILE *zipfilefd;
77
  FILE *zipfilefd;
81
  for (t = 0; file[t] != 0; t++) {
78
  for (t = 0; file[t] != 0; t++) {
Line 106... Line 103...
106
 
103
 
107
 
104
 
108
int main(int argc, char **argv) {
105
int main(int argc, char **argv) {
109
  int res, flags;
106
  int res, flags;
110
  enum ACTIONTYPES action;
107
  enum ACTIONTYPES action;
111
  char *dosdir, *cfgfile;
108
  char *dosdir;
112
  struct customdirs *dirlist;
109
  struct customdirs *dirlist;
113
 
110
 
114
  action = parsearg(argc, argv);
111
  action = parsearg(argc, argv);
115
  if (action == ACTION_HELP) return(showhelp());
112
  if (action == ACTION_HELP) return(showhelp());
116
 
113
 
117
  /* allocate some bits for cfg file's location */
-
 
118
  cfgfile = malloc(256);
-
 
119
  if (cfgfile == NULL) {
-
 
120
    puts("ERROR: Out of memory");
-
 
121
    return(1);
-
 
122
  }
-
 
123
 
-
 
124
  /* read all necessary environment variables */
114
  /* read all necessary environment variables */
125
  if (readenv(&dosdir, cfgfile, 256) != 0) {
115
  if (readenv(&dosdir) != 0) return(1);
126
    free(cfgfile);
-
 
127
    return(1);
-
 
128
  }
-
 
129
 
116
 
130
  /* load configuration */
117
  /* load configuration */
131
  flags = 0;
118
  flags = 0;
132
  dirlist = NULL;
119
  dirlist = NULL;
133
  if (loadconf(cfgfile, &dirlist, &flags) < 0) return(5);
120
  if (loadconf(dosdir, &dirlist, &flags) != 0) return(5);
134
 
-
 
135
  /* free the cfgfile buffer, I won't need the config file's location any more */
-
 
136
  free(cfgfile);
-
 
137
  cfgfile = NULL;
-
 
138
 
121
 
139
  switch (action) {
122
  switch (action) {
140
    case ACTION_INSTALL:
123
    case ACTION_INSTALL:
141
      res = pkginst(argv[2], flags, dosdir, dirlist);
124
      res = pkginst(argv[2], flags, dosdir, dirlist);
142
      break;
125
      break;