Subversion Repositories SvarDOS

Rev

Rev 295 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 295 Rev 613
1
/*
1
/*
2
 * This file is part of pkg (SvarDOS)
2
 * This file is part of pkg (SvarDOS)
3
 * Copyright (C) 2012-2021 Mateusz Viste
3
 * Copyright (C) 2012-2022 Mateusz Viste
4
 */
4
 */
5
 
5
 
6
#include <ctype.h>     /* toupper() */
6
#include <ctype.h>     /* toupper() */
7
#include <stdio.h>
7
#include <stdio.h>
8
#include <stdlib.h>    /* system() */
8
#include <stdlib.h>    /* system() */
9
#include <string.h>    /* strcpy() */
9
#include <string.h>    /* strcpy() */
10
#include <unistd.h>    /* read() */
10
#include <unistd.h>    /* read() */
11
#include <sys/types.h> /* struct utimbuf */
11
#include <sys/types.h> /* struct utimbuf */
12
 
12
 
13
#include "helpers.h"   /* slash2backslash(), strtolower() */
13
#include "helpers.h"   /* slash2backslash(), strtolower() */
14
#include "fileexst.h"
14
#include "fileexst.h"
15
#include "kprintf.h"
15
#include "kprintf.h"
16
#include "libunzip.h"  /* zip_listfiles()... */
16
#include "libunzip.h"  /* zip_listfiles()... */
17
#include "showinst.h"  /* pkg_loadflist() */
17
#include "showinst.h"  /* pkg_loadflist() */
-
 
18
#include "svarlang.lib\svarlang.h"
18
 
19
 
19
#include "pkginst.h"   /* include self for control */
20
#include "pkginst.h"   /* include self for control */
20
 
21
 
21
 
22
 
22
/* validate a filename (8+3, no weird characters, etc). returns 0 on success,
23
/* validate a filename (8+3, no weird characters, etc). returns 0 on success,
23
 * nonzero otherwise. */
24
 * nonzero otherwise. */
24
static int validfilename(const char *fname) {
25
static int validfilename(const char *fname) {
25
  int i, i2;
26
  int i, i2;
26
  char *validchars = "!#$%&'()-@^_`{}~";
27
  char *validchars = "!#$%&'()-@^_`{}~";
27
  int elemlen = 0;
28
  int elemlen = 0;
28
  int elemmaxlen = 8; /* switches from 8 to 3 depending wheter I am analyzing
29
  int elemmaxlen = 8; /* switches from 8 to 3 depending wheter I am analyzing
29
                         a filename or an extension */
30
                         a filename or an extension */
30
  /* look for invalid chars in the entire string, and check the length of the
31
  /* look for invalid chars in the entire string, and check the length of the
31
   * element at the same time */
32
   * element at the same time */
32
  for (i = 0; fname[i] != 0; i++) {
33
  for (i = 0; fname[i] != 0; i++) {
33
    /* director separators are threated specially */
34
    /* director separators are threated specially */
34
    if (fname[i] == '\\') {
35
    if (fname[i] == '\\') {
35
      elemlen = 0;
36
      elemlen = 0;
36
      elemmaxlen = 8;
37
      elemmaxlen = 8;
37
      continue;
38
      continue;
38
    }
39
    }
39
    /* '.' switches the check into extension mode */
40
    /* '.' switches the check into extension mode */
40
    if (fname[i] == '.') {
41
    if (fname[i] == '.') {
41
      if (elemlen == 0) return(-1); /* a file must have a base name */
42
      if (elemlen == 0) return(-1); /* a file must have a base name */
42
      if (elemmaxlen == 3) return(-2); /* a file cannot have two extensions */
43
      if (elemmaxlen == 3) return(-2); /* a file cannot have two extensions */
43
      elemlen = 0;
44
      elemlen = 0;
44
      elemmaxlen = 3;
45
      elemmaxlen = 3;
45
      continue;
46
      continue;
46
    }
47
    }
47
    /* check that the element is not too long */
48
    /* check that the element is not too long */
48
    if (++elemlen > elemmaxlen) return(-3);
49
    if (++elemlen > elemmaxlen) return(-3);
49
    /* look for valid characters */
50
    /* look for valid characters */
50
    if ((fname[i] >= 'a') && (fname[i] <= 'z')) continue;
51
    if ((fname[i] >= 'a') && (fname[i] <= 'z')) continue;
51
    if ((fname[i] >= 'A') && (fname[i] <= 'Z')) continue;
52
    if ((fname[i] >= 'A') && (fname[i] <= 'Z')) continue;
52
    if ((fname[i] >= '0') && (fname[i] <= '9')) continue;
53
    if ((fname[i] >= '0') && (fname[i] <= '9')) continue;
53
    if ((fname[i] & 128) != 0) continue; /* high bytes are okay (NLS) */
54
    if ((fname[i] & 128) != 0) continue; /* high bytes are okay (NLS) */
54
    /* look for other valid characters */
55
    /* look for other valid characters */
55
    for (i2 = 0; validchars[i2] != 0; i2++) {
56
    for (i2 = 0; validchars[i2] != 0; i2++) {
56
      if (fname[i] == validchars[i2]) break;
57
      if (fname[i] == validchars[i2]) break;
57
    }
58
    }
58
    if (validchars[i2] != 0) continue;
59
    if (validchars[i2] != 0) continue;
59
    /* if we are here, then the character is invalid */
60
    /* if we are here, then the character is invalid */
60
    return(-4);
61
    return(-4);
61
  }
62
  }
62
  /* all checks passed */
63
  /* all checks passed */
63
  return(0);
64
  return(0);
64
}
65
}
65
 
66
 
66
 
67
 
67
/* returns 0 if pkgname is not installed, non-zero otherwise */
68
/* returns 0 if pkgname is not installed, non-zero otherwise */
68
int is_package_installed(const char *pkgname, const char *dosdir) {
69
int is_package_installed(const char *pkgname, const char *dosdir) {
69
  char fname[512];
70
  char fname[512];
70
  sprintf(fname, "%s\\packages\\%s.lst", dosdir, pkgname);
71
  sprintf(fname, "%s\\packages\\%s.lst", dosdir, pkgname);
71
  return(fileexists(fname)); /* file exists -> package is installed */
72
  return(fileexists(fname)); /* file exists -> package is installed */
72
}
73
}
73
 
74
 
74
 
75
 
75
/* checks that pkgname is NOT installed. return 0 on success, non-zero otherwise. */
76
/* checks that pkgname is NOT installed. return 0 on success, non-zero otherwise. */
76
static int validate_package_not_installed(const char *pkgname, const char *dosdir) {
77
static int validate_package_not_installed(const char *pkgname, const char *dosdir) {
77
  if (is_package_installed(pkgname, dosdir) != 0) {
78
  if (is_package_installed(pkgname, dosdir) != 0) {
78
    kitten_printf(3, 18, "Package %s is already installed! You might want to use the 'update' action.", pkgname);
79
    kitten_printf(3, 18, pkgname); /* "Package %s is already installed! You might want to use the 'update' action." */
79
    puts("");
80
    puts("");
80
    return(-1);
81
    return(-1);
81
  }
82
  }
82
  return(0);
83
  return(0);
83
}
84
}
84
 
85
 
85
 
86
 
86
/* find a filename in a flist linked list, and returns a pointer to it */
87
/* find a filename in a flist linked list, and returns a pointer to it */
87
static struct flist_t *findfileinlist(struct flist_t *flist, const char *fname) {
88
static struct flist_t *findfileinlist(struct flist_t *flist, const char *fname) {
88
  while (flist != NULL) {
89
  while (flist != NULL) {
89
    if (strcasecmp(flist->fname, fname) == 0) return(flist);
90
    if (strcasecmp(flist->fname, fname) == 0) return(flist);
90
    flist = flist->next;
91
    flist = flist->next;
91
  }
92
  }
92
  return(NULL);
93
  return(NULL);
93
}
94
}
94
 
95
 
95
 
96
 
96
/* prepare a package for installation. this is mandatory before actually installing it!
97
/* prepare a package for installation. this is mandatory before actually installing it!
97
 * returns a pointer to the zip file's index on success, NULL on failure. the **zipfd pointer is updated with a file descriptor to the open zip file to install. */
98
 * returns a pointer to the zip file's index on success, NULL on failure. the **zipfd pointer is updated with a file descriptor to the open zip file to install. */
98
struct ziplist *pkginstall_preparepackage(const char *pkgname, const char *zipfile, int flags, FILE **zipfd, const char *dosdir, const struct customdirs *dirlist) {
99
struct ziplist *pkginstall_preparepackage(const char *pkgname, const char *zipfile, int flags, FILE **zipfd, const char *dosdir, const struct customdirs *dirlist) {
99
  char fname[256];
100
  char fname[256];
100
  char appinfofile[256];
101
  char appinfofile[256];
101
  int appinfopresence;
102
  int appinfopresence;
102
  char *shortfile;
103
  char *shortfile;
103
  struct ziplist *ziplinkedlist = NULL, *curzipnode, *prevzipnode;
104
  struct ziplist *ziplinkedlist = NULL, *curzipnode, *prevzipnode;
104
  struct flist_t *flist = NULL;
105
  struct flist_t *flist = NULL;
105
 
106
 
106
  sprintf(appinfofile, "appinfo\\%s.lsm", pkgname); /* Prepare the appinfo/xxxx.lsm filename string for later use */
107
  sprintf(appinfofile, "appinfo\\%s.lsm", pkgname); /* Prepare the appinfo/xxxx.lsm filename string for later use */
107
 
108
 
108
  /* check if not already installed, if already here, print a message "you might want to use update instead"
109
  /* check if not already installed, if already here, print a message "you might want to use update instead"
109
   * of course this must not be done if we are in the process of upgrading said package */
110
   * of course this must not be done if we are in the process of upgrading said package */
110
  if (((flags & PKGINST_UPDATE) == 0) && (validate_package_not_installed(pkgname, dosdir) != 0)) {
111
  if (((flags & PKGINST_UPDATE) == 0) && (validate_package_not_installed(pkgname, dosdir) != 0)) {
111
    return(NULL);
112
    return(NULL);
112
  }
113
  }
113
 
114
 
114
  /* Now let's check the content of the zip file */
115
  /* Now let's check the content of the zip file */
115
 
116
 
116
  *zipfd = fopen(zipfile, "rb");
117
  *zipfd = fopen(zipfile, "rb");
117
  if (*zipfd == NULL) {
118
  if (*zipfd == NULL) {
118
    kitten_puts(3, 8, "ERROR: Invalid zip archive! Package not installed.");
119
    puts(svarlang_str(3, 8)); /* "ERROR: Invalid zip archive! Package not installed." */
119
    goto RAII;
120
    goto RAII;
120
  }
121
  }
121
  ziplinkedlist = zip_listfiles(*zipfd);
122
  ziplinkedlist = zip_listfiles(*zipfd);
122
  if (ziplinkedlist == NULL) {
123
  if (ziplinkedlist == NULL) {
123
    kitten_puts(3, 8, "ERROR: Invalid zip archive! Package not installed.");
124
    puts(svarlang_str(3, 8)); /* "ERROR: Invalid zip archive! Package not installed." */
124
    goto RAII;
125
    goto RAII;
125
  }
126
  }
126
  /* if updating, load the list of files belonging to the current package */
127
  /* if updating, load the list of files belonging to the current package */
127
  if ((flags & PKGINST_UPDATE) != 0) {
128
  if ((flags & PKGINST_UPDATE) != 0) {
128
    flist = pkg_loadflist(pkgname, dosdir);
129
    flist = pkg_loadflist(pkgname, dosdir);
129
  }
130
  }
130
  /* Verify that there's no collision with existing local files, look for the appinfo presence */
131
  /* Verify that there's no collision with existing local files, look for the appinfo presence */
131
  appinfopresence = 0;
132
  appinfopresence = 0;
132
  prevzipnode = NULL;
133
  prevzipnode = NULL;
133
  for (curzipnode = ziplinkedlist; curzipnode != NULL;) {
134
  for (curzipnode = ziplinkedlist; curzipnode != NULL;) {
134
    /* change all slashes to backslashes, and switch into all-lowercase */
135
    /* change all slashes to backslashes, and switch into all-lowercase */
135
    slash2backslash(curzipnode->filename);
136
    slash2backslash(curzipnode->filename);
136
    strtolower(curzipnode->filename);
137
    strtolower(curzipnode->filename);
137
    /* remove 'directory' ZIP entries to avoid false alerts about directory already existing */
138
    /* remove 'directory' ZIP entries to avoid false alerts about directory already existing */
138
    if ((curzipnode->flags & ZIP_FLAG_ISADIR) != 0) {
139
    if ((curzipnode->flags & ZIP_FLAG_ISADIR) != 0) {
139
      curzipnode->filename[0] = 0; /* mark it "empty", will be removed in a short moment */
140
      curzipnode->filename[0] = 0; /* mark it "empty", will be removed in a short moment */
140
    }
141
    }
141
    /* is it a "link file"? skip it - link files are no longer supported */
142
    /* is it a "link file"? skip it - link files are no longer supported */
142
    if (fdnpkg_strcasestr(curzipnode->filename, "links\\") == curzipnode->filename) {
143
    if (fdnpkg_strcasestr(curzipnode->filename, "links\\") == curzipnode->filename) {
143
      curzipnode->filename[0] = 0; /* in fact, I just mark the file as 'empty' on the filename - see later below */
144
      curzipnode->filename[0] = 0; /* in fact, I just mark the file as 'empty' on the filename - see later below */
144
    }
145
    }
145
 
146
 
146
    if (curzipnode->filename[0] == 0) { /* ignore empty filenames (maybe it was empty originally, or has been emptied because it's a dropped source or link) */
147
    if (curzipnode->filename[0] == 0) { /* ignore empty filenames (maybe it was empty originally, or has been emptied because it's a dropped source or link) */
147
      if (prevzipnode == NULL) {  /* take the item out of the list */
148
      if (prevzipnode == NULL) {  /* take the item out of the list */
148
        ziplinkedlist = curzipnode->nextfile;
149
        ziplinkedlist = curzipnode->nextfile;
149
        free(curzipnode); /* free the item */
150
        free(curzipnode); /* free the item */
150
        curzipnode = ziplinkedlist;
151
        curzipnode = ziplinkedlist;
151
      } else {
152
      } else {
152
        prevzipnode->nextfile = curzipnode->nextfile;
153
        prevzipnode->nextfile = curzipnode->nextfile;
153
        free(curzipnode); /* free the item */
154
        free(curzipnode); /* free the item */
154
        curzipnode = prevzipnode->nextfile;
155
        curzipnode = prevzipnode->nextfile;
155
      }
156
      }
156
      continue; /* go to the next item */
157
      continue; /* go to the next item */
157
    }
158
    }
158
    /* validate that the file has a valid filename (8+3, no shady chars...) */
159
    /* validate that the file has a valid filename (8+3, no shady chars...) */
159
    if (validfilename(curzipnode->filename) != 0) {
160
    if (validfilename(curzipnode->filename) != 0) {
160
      kitten_puts(3, 23, "ERROR: Package contains an invalid filename:");
161
      puts(svarlang_str(3, 23)); /* "ERROR: Package contains an invalid filename:" */
161
      printf(" %s\n", curzipnode->filename);
162
      printf(" %s\n", curzipnode->filename);
162
      goto RAII_ERR;
163
      goto RAII_ERR;
163
    }
164
    }
164
    /* look out for collisions with already existing files (unless we are
165
    /* look out for collisions with already existing files (unless we are
165
     * updating the package and the local file belongs to it */
166
     * updating the package and the local file belongs to it */
166
    shortfile = computelocalpath(curzipnode->filename, fname, dosdir, dirlist);
167
    shortfile = computelocalpath(curzipnode->filename, fname, dosdir, dirlist);
167
    strcat(fname, shortfile);
168
    strcat(fname, shortfile);
168
    if ((findfileinlist(flist, fname) == NULL) && (fileexists(fname) != 0)) {
169
    if ((findfileinlist(flist, fname) == NULL) && (fileexists(fname) != 0)) {
169
      kitten_puts(3, 9, "ERROR: Package contains a file that already exists locally:");
170
      puts(svarlang_str(3, 9)); /* "ERROR: Package contains a file that already exists locally:" */
170
      printf(" %s\n", fname);
171
      printf(" %s\n", fname);
171
      goto RAII_ERR;
172
      goto RAII_ERR;
172
    }
173
    }
173
    /* abort if any entry is encrypted */
174
    /* abort if any entry is encrypted */
174
    if ((curzipnode->flags & ZIP_FLAG_ENCRYPTED) != 0) {
175
    if ((curzipnode->flags & ZIP_FLAG_ENCRYPTED) != 0) {
175
      kitten_printf(3, 20, "ERROR: Package contains an encrypted file:");
176
      puts(svarlang_str(3, 20)); /* "ERROR: Package contains an encrypted file:" */
176
      puts("");
-
 
177
      printf(" %s\n", curzipnode->filename);
177
      printf(" %s\n", curzipnode->filename);
178
      goto RAII_ERR;
178
      goto RAII_ERR;
179
    }
179
    }
180
    /* abort if any file is compressed with an unsupported method */
180
    /* abort if any file is compressed with an unsupported method */
181
    if ((curzipnode->compmethod != ZIP_METH_STORE) && (curzipnode->compmethod != ZIP_METH_DEFLATE)) { /* unsupported compression method */
181
    if ((curzipnode->compmethod != ZIP_METH_STORE) && (curzipnode->compmethod != ZIP_METH_DEFLATE)) { /* unsupported compression method */
182
      kitten_printf(8, 2, "ERROR: Package contains a file compressed with an unsupported method (%d):", curzipnode->compmethod);
182
      kitten_printf(8, 2, curzipnode->compmethod); /* "ERROR: Package contains a file compressed with an unsupported method (%d):" */
183
      puts("");
183
      puts("");
184
      printf(" %s\n", curzipnode->filename);
184
      printf(" %s\n", curzipnode->filename);
185
      goto RAII_ERR;
185
      goto RAII_ERR;
186
    }
186
    }
187
    if (strcmp(curzipnode->filename, appinfofile) == 0) appinfopresence = 1;
187
    if (strcmp(curzipnode->filename, appinfofile) == 0) appinfopresence = 1;
188
    prevzipnode = curzipnode;
188
    prevzipnode = curzipnode;
189
    curzipnode = curzipnode->nextfile;
189
    curzipnode = curzipnode->nextfile;
190
  }
190
  }
191
  /* if appinfo file not found, this is not a real FreeDOS package */
191
  /* if appinfo file not found, this is not a real FreeDOS package */
192
  if (appinfopresence != 1) {
192
  if (appinfopresence != 1) {
193
    kitten_printf(3, 12, "ERROR: Package do not contain the %s file! Not a valid FreeDOS package.", appinfofile);
193
    kitten_printf(3, 12, appinfofile); /* "ERROR: Package do not contain the %s file! Not a valid SvarDOS package." */
194
    puts("");
194
    puts("");
195
    goto RAII_ERR;
195
    goto RAII_ERR;
196
  }
196
  }
197
 
197
 
198
  goto RAII;
198
  goto RAII;
199
 
199
 
200
  RAII_ERR:
200
  RAII_ERR:
201
  zip_freelist(&ziplinkedlist);
201
  zip_freelist(&ziplinkedlist);
202
  ziplinkedlist = NULL;
202
  ziplinkedlist = NULL;
203
  if ((zipfd != NULL) && (*zipfd != NULL)) {
203
  if ((zipfd != NULL) && (*zipfd != NULL)) {
204
    fclose(*zipfd);
204
    fclose(*zipfd);
205
    *zipfd = NULL;
205
    *zipfd = NULL;
206
  }
206
  }
207
 
207
 
208
  RAII:
208
  RAII:
209
  pkg_freeflist(flist);
209
  pkg_freeflist(flist);
210
  return(ziplinkedlist);
210
  return(ziplinkedlist);
211
}
211
}
212
 
212
 
213
 
213
 
214
/* install a package that has been prepared already. returns 0 on success,
214
/* install a package that has been prepared already. returns 0 on success,
215
 * or a negative value on error, or a positive value on warning */
215
 * or a negative value on error, or a positive value on warning */
216
int pkginstall_installpackage(const char *pkgname, const char *dosdir, const struct customdirs *dirlist, struct ziplist *ziplinkedlist, FILE *zipfd) {
216
int pkginstall_installpackage(const char *pkgname, const char *dosdir, const struct customdirs *dirlist, struct ziplist *ziplinkedlist, FILE *zipfd) {
217
  char buff[256];
217
  char buff[256];
218
  char fulldestfilename[256];
218
  char fulldestfilename[256];
219
  char packageslst[32];
219
  char packageslst[32];
220
  char *shortfile;
220
  char *shortfile;
221
  long filesextractedsuccess = 0, filesextractedfailure = 0;
221
  long filesextractedsuccess = 0, filesextractedfailure = 0;
222
  struct ziplist *curzipnode;
222
  struct ziplist *curzipnode;
223
  FILE *lstfd;
223
  FILE *lstfd;
224
 
224
 
225
  sprintf(packageslst, "packages\\%s.lst", pkgname); /* Prepare the packages/xxxx.lst filename string for later use */
225
  sprintf(packageslst, "packages\\%s.lst", pkgname); /* Prepare the packages/xxxx.lst filename string for later use */
226
 
226
 
227
  /* create the %DOSDIR%/packages directory, just in case it doesn't exist yet */
227
  /* create the %DOSDIR%/packages directory, just in case it doesn't exist yet */
228
  sprintf(buff, "%s\\packages\\", dosdir);
228
  sprintf(buff, "%s\\packages\\", dosdir);
229
  mkpath(buff);
229
  mkpath(buff);
230
 
230
 
231
  /* open the lst file */
231
  /* open the lst file */
232
  sprintf(buff, "%s\\%s", dosdir, packageslst);
232
  sprintf(buff, "%s\\%s", dosdir, packageslst);
233
  lstfd = fopen(buff, "wb"); /* opening it in binary mode, because I like to have control over line terminators (CR/LF) */
233
  lstfd = fopen(buff, "wb"); /* opening it in binary mode, because I like to have control over line terminators (CR/LF) */
234
  if (lstfd == NULL) {
234
  if (lstfd == NULL) {
235
    kitten_printf(3, 10, "ERROR: Could not create %s!", buff);
235
    kitten_printf(3, 10, buff); /* "ERROR: Could not create %s!" */
236
    puts("");
236
    puts("");
237
    return(-2);
237
    return(-2);
238
  }
238
  }
239
 
239
 
240
  /* write list of files in zip into the lst, and create the directories structure */
240
  /* write list of files in zip into the lst, and create the directories structure */
241
  for (curzipnode = ziplinkedlist; curzipnode != NULL; curzipnode = curzipnode->nextfile) {
241
  for (curzipnode = ziplinkedlist; curzipnode != NULL; curzipnode = curzipnode->nextfile) {
242
    int unzip_result;
242
    int unzip_result;
243
    if ((curzipnode->flags & ZIP_FLAG_ISADIR) != 0) continue; /* skip directories */
243
    if ((curzipnode->flags & ZIP_FLAG_ISADIR) != 0) continue; /* skip directories */
244
    shortfile = computelocalpath(curzipnode->filename, buff, dosdir, dirlist); /* substitute paths to custom dirs */
244
    shortfile = computelocalpath(curzipnode->filename, buff, dosdir, dirlist); /* substitute paths to custom dirs */
245
    /* log the filename to packages\pkg.lst */
245
    /* log the filename to packages\pkg.lst */
246
    fprintf(lstfd, "%s%s\r\n", buff, shortfile);
246
    fprintf(lstfd, "%s%s\r\n", buff, shortfile);
247
    /* create the path, just in case it doesn't exist yet */
247
    /* create the path, just in case it doesn't exist yet */
248
    mkpath(buff);
248
    mkpath(buff);
249
    sprintf(fulldestfilename, "%s%s", buff, shortfile);
249
    sprintf(fulldestfilename, "%s%s", buff, shortfile);
250
    /* Now unzip the file */
250
    /* Now unzip the file */
251
    unzip_result = zip_unzip(zipfd, curzipnode, fulldestfilename);
251
    unzip_result = zip_unzip(zipfd, curzipnode, fulldestfilename);
252
    if (unzip_result != 0) {
252
    if (unzip_result != 0) {
253
      kitten_printf(8, 3, "ERROR: failed extracting '%s' to '%s'!", curzipnode->filename, fulldestfilename);
253
      kitten_printf(8, 3, curzipnode->filename, fulldestfilename); /* "ERROR: failed extracting '%s' to '%s'!" */
254
      printf(" [%d]\n", unzip_result);
254
      printf(" [%d]\n", unzip_result);
255
      filesextractedfailure += 1;
255
      filesextractedfailure += 1;
256
    } else {
256
    } else {
257
      printf(" %s -> %s\n", curzipnode->filename, buff);
257
      printf(" %s -> %s\n", curzipnode->filename, buff);
258
      filesextractedsuccess += 1;
258
      filesextractedsuccess += 1;
259
    }
259
    }
260
  }
260
  }
261
  fclose(lstfd);
261
  fclose(lstfd);
262
 
262
 
263
  kitten_printf(3, 19, "Package %s installed: %ld files extracted, %ld errors.", pkgname, filesextractedsuccess, filesextractedfailure);
263
  kitten_printf(3, 19, pkgname, filesextractedsuccess, filesextractedfailure); /* "Package %s installed: %ld files extracted, %ld errors." */
264
  puts("");
264
  puts("");
265
  return(filesextractedfailure);
265
  return(filesextractedfailure);
266
}
266
}
267
 
267