Subversion Repositories SvarDOS

Rev

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

Rev 242 Rev 244
Line 27... Line 27...
27
 
27
 
28
#include <stdio.h>    /* printf() */
28
#include <stdio.h>    /* printf() */
29
#include <stdlib.h>   /* malloc() and friends */
29
#include <stdlib.h>   /* malloc() and friends */
30
#include <string.h>   /* strcasecmp() */
30
#include <string.h>   /* strcasecmp() */
31
 
31
 
-
 
32
#include "kitten/kitten.h"
32
#include "kprintf.h"
33
#include "kprintf.h"
33
#include "libunzip.h"
34
#include "libunzip.h"
34
#include "pkginst.h"
35
#include "pkginst.h"
35
#include "pkgrem.h"
36
#include "pkgrem.h"
36
#include "showinst.h"
37
#include "showinst.h"
Line 109... Line 110...
109
  }
110
  }
110
}
111
}
111
 
112
 
112
 
113
 
113
int main(int argc, char **argv) {
114
int main(int argc, char **argv) {
114
  int res, flags;
115
  int res = 1, flags;
115
  enum ACTIONTYPES action;
116
  enum ACTIONTYPES action;
116
  const char *dosdir;
117
  const char *dosdir;
117
  struct customdirs *dirlist;
118
  struct customdirs *dirlist;
118
 
119
 
-
 
120
  kittenopen("pkginst"); /* NLS init */
-
 
121
 
119
  action = parsearg(argc, argv);
122
  action = parsearg(argc, argv);
120
  if (action == ACTION_HELP) return(showhelp());
123
  if (action == ACTION_HELP) {
-
 
124
    showhelp();
-
 
125
    goto GAMEOVER;
-
 
126
  }
121
 
127
 
122
  /* read the DOSDIR environment variable */
128
  /* read the DOSDIR environment variable */
123
  dosdir = getenv("DOSDIR");
129
  dosdir = getenv("DOSDIR");
124
  if (dosdir == NULL) {
130
  if (dosdir == NULL) {
125
    kitten_puts(2, 2, "%DOSDIR% not set! You should make it point to the FreeDOS main directory.");
131
    kitten_puts(2, 2, "%DOSDIR% not set! You should make it point to the FreeDOS main directory.");
126
    kitten_puts(2, 3, "Example: SET DOSDIR=C:\\FDOS");
132
    kitten_puts(2, 3, "Example: SET DOSDIR=C:\\FDOS");
127
    return(-1);
133
    goto GAMEOVER;
128
  }
134
  }
129
 
135
 
130
  /* load configuration */
136
  /* load configuration */
131
  flags = 0;
137
  flags = 0;
132
  dirlist = NULL;
138
  dirlist = NULL;
133
  if (loadconf(dosdir, &dirlist, &flags) != 0) return(5);
139
  if (loadconf(dosdir, &dirlist, &flags) != 0) goto GAMEOVER;
134
 
140
 
135
  switch (action) {
141
  switch (action) {
136
    case ACTION_INSTALL:
142
    case ACTION_INSTALL:
137
      res = pkginst(argv[2], flags, dosdir, dirlist);
143
      res = pkginst(argv[2], flags, dosdir, dirlist);
138
      break;
144
      break;
Line 145... Line 151...
145
    default:
151
    default:
146
      res = showhelp();
152
      res = showhelp();
147
      break;
153
      break;
148
  }
154
  }
149
 
155
 
-
 
156
  GAMEOVER:
-
 
157
  kittenclose(); /* NLS de-init */
150
  if (res != 0) return(1);
158
  if (res != 0) return(1);
151
  return(0);
159
  return(0);
152
}
160
}