Skip to content

Commit

Permalink
Seperated iOS and macOS (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
Torrekie committed May 17, 2021
1 parent 62b6eb2 commit 1c12283
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions src/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,17 +413,31 @@ void *os()
info.col6 = BRED " :_________: " BYELLOW;
info.col7 = BMAGENTA " :_________`-;" BYELLOW;
info.col8 = BBLUE " `.__.-.__.' " BYELLOW;
info.getPkgCount =
"ls /usr/local/Cellar/* | grep ':' | wc -l | xargs";
if ((strncmp(sysInfo.machine, "iPhone", 6) == 0) || (strncmp(sysInfo.machine, "iPad", 4) == 0) || (strncmp(sysInfo.machine, "iPod", 4) == 0)) {
info.getPkgCount =
"dpkg -l | tail -n+6 | wc -l";

char *iosVer = malloc(1024);
strcpy(iosVer, "iOS ");
char *productVer = pipeRead("sw_vers -productVersion");

char *macVer = malloc(64);
strcpy(macVer, "macOS ");
char *productVer = pipeRead("sw_vers -productVersion");
strcat(iosVer, productVer);
free(productVer);
osname = iosVer;
free(iosVer);
} else {
info.getPkgCount =
"ls /usr/local/Cellar/* | grep ':' | wc -l | xargs";

char *macVer = malloc(64);
strcpy(macVer, "macOS ");
char *productVer = pipeRead("sw_vers -productVersion");

strcat(macVer, productVer);
free(productVer);
osname = macVer;
free(macVer);
strcat(macVer, productVer);
free(productVer);
osname = macVer;
free(macVer);
}
} else if (strncmp(sysInfo.sysname, "FreeBSD", 7) == 0) {
info.col1 = BRED "";
info.col2 = BRED "/\\,-'''''-,/\\";
Expand Down

0 comments on commit 1c12283

Please sign in to comment.