Subversion Repositories SvarDOS

Rev

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

Rev 219 Rev 225
Line 67... Line 67...
67
  return(dirlist);
67
  return(dirlist);
68
}
68
}
69
 
69
 
70
 
70
 
71
/* removes a package from the system. Returns 0 on success, non-zero otherwise */
71
/* removes a package from the system. Returns 0 on success, non-zero otherwise */
72
int pkgrem(char *pkgname, char *dosdir, char *mapdrv) {
72
int pkgrem(char *pkgname, char *dosdir) {
73
  char fpath[512];
73
  char fpath[512];
74
  char shellcmd[512];
74
  char shellcmd[512];
75
  char *lineptr;
75
  char *lineptr;
76
  FILE *flist;
76
  FILE *flist;
77
  int getdelimlen;
77
  int getdelimlen;
Line 81... Line 81...
81
  struct dirliststruct *dirlist = NULL; /* used to remember directories to remove */
81
  struct dirliststruct *dirlist = NULL; /* used to remember directories to remove */
82
  char pkglistfile[512];
82
  char pkglistfile[512];
83
 
83
 
84
  /* Check if the file %DOSDIR%\packages\pkgname.lst exists (if not, the package is not installed) */
84
  /* Check if the file %DOSDIR%\packages\pkgname.lst exists (if not, the package is not installed) */
85
  sprintf(fpath, "%s\\packages\\%s.lst", dosdir, pkgname);
85
  sprintf(fpath, "%s\\packages\\%s.lst", dosdir, pkgname);
86
  mapdrives(fpath, mapdrv);
-
 
87
  if (fileexists(fpath) == 0) { /* file does not exist */
86
  if (fileexists(fpath) == 0) { /* file does not exist */
88
    kitten_printf(4, 0, "Package %s is not installed, so not removed.", pkgname);
87
    kitten_printf(4, 0, "Package %s is not installed, so not removed.", pkgname);
89
    puts("");
88
    puts("");
90
    return(-1);
89
    return(-1);
91
  }
90
  }
Line 112... Line 111...
112
    slash2backslash(lineptr); /* change all / to \ */
111
    slash2backslash(lineptr); /* change all / to \ */
113
    if ((lineptr[0] == 0) || (lineptr[0] == '\r') || (lineptr[0] == '\n')) {
112
    if ((lineptr[0] == 0) || (lineptr[0] == '\r') || (lineptr[0] == '\n')) {
114
      free(lineptr); /* free the memory occupied by the line */
113
      free(lineptr); /* free the memory occupied by the line */
115
      continue; /* skip empty lines */
114
      continue; /* skip empty lines */
116
    }
115
    }
117
    /* remap drive */
-
 
118
    mapdrives(lineptr, mapdrv);
-
 
119
    /* remember the path part for removal later */
116
    /* remember the path part for removal later */
120
    lastdirsep = -1;
117
    lastdirsep = -1;
121
    for (x = 1; lineptr[x] != 0; x++) {
118
    for (x = 1; lineptr[x] != 0; x++) {
122
      if ((lineptr[x] == '\\') && (lineptr[x - 1] != ':')) lastdirsep = x;
119
      if ((lineptr[x] == '\\') && (lineptr[x - 1] != ':')) lastdirsep = x;
123
    }
120
    }