unixwz0r

dwmstatus.c

Oct 3rd, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.59 KB | None | 0 0
  1. /*
  2.  *
  3.  * bbinst.c BSDBOX installer Program
  4.  * cc bbinst.c -o bbinst  
  5.  * ./bbinst
  6.  * The BSDBox Project By: Gary Perreault, and Vincent (anybody is welcome to contrib).
  7.  * 2016
  8.  *
  9.  *
  10.  * Copyright (c) 2016, The BSDBOX Project Team.
  11.  * All rights reserved.
  12.  *
  13.  * Redistribution and use in source and binary forms, with or without
  14.  * modification, are permitted provided that the following conditions are met:
  15.  *
  16.  * 1. Redistributions of source code must retain the above copyright notice, this
  17.  * list of conditions and the following disclaimer.
  18.  * 2. Redistributions in binary form must reproduce the above copyright notice,
  19.  * this list of conditions and the following disclaimer in the documentation
  20.  * and/or other materials provided with the distribution.
  21.  *
  22.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  23.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  24.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25.  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  26.  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28.  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  29.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31.  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32.  *
  33.  * The views and conclusions contained in the software and documentation are those
  34.  * of the authors and should not be interpreted as representing official policies,
  35.  * either expressed or implied, of the FreeBSD Project.
  36.  */
  37. #include <ncurses.h>
  38. #include <stdio.h>
  39. #include <stdlib.h>
  40. #include <sys/utsname.h>
  41. #include <unistd.h>
  42. #include <string.h>
  43. #include <errno.h>
  44. #include <sys/wait.h>
  45. #include <sys/sysctl.h>
  46. #define RED     "\x1b[31m" // Colours for the logo to make it pretty!
  47. #define GREEN   "\x1b[32m"
  48. #define BLUE    "\x1b[34m"
  49. #define RESET   "\x1b[0m"
  50.  
  51. /* BSDBOX logo created by me, I use block characters */
  52. void print_logo(){
  53.  
  54. printf(RED"╔═══════════════════════════════════════════════════════════════════╗\n");
  55. printf(RED"║ ▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄    ▄▄▄▄ "RED"║\n");
  56. printf(RED"║ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄   ▄▄    ▄▄  "RED" ║\n");
  57. printf(RED"║  ▄▄   ▄▄▄ ▄▄        ▄▄▄    ▄▄▄▄  ▄▄   ▄▄▄ ▄▄▄    ▄▄▄     ▄  ▄    "RED" ║\n");
  58. printf(RED"║  ▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄ ▄▄▄    ▄▄▄▄  ▄▄▄▄▄▄▄  ▄▄▄    ▄▄▄      ▄▄     "RED" ║\n");
  59. printf(RED"║  ▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄ ▄▄▄    ▄▄▄▄  ▄▄▄▄▄▄▄  ▄▄▄    ▄▄▄      ▄▄     "RED" ║\n");
  60. printf(RED"║  ▄▄   ▄▄▄        ▄▄ ▄▄▄    ▄▄▄▄  ▄▄   ▄▄▄ ▄▄▄    ▄▄▄     ▄  ▄    "RED" ║\n");
  61. printf(RED"║ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄   ▄▄    ▄▄  "RED" ║\n");
  62. printf(RED"║ ▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄    ▄▄▄▄"RED" ║\n");
  63. printf(RED"║"GREEN"                                                      Install v2.1"RED" ║\n");
  64. printf(RED"╚═══════════════════════════════════════════════════════════════════╝"RESET"\n");
  65. }
  66.  
  67. void status_bsdboxdwm1(){
  68. printf("\n\n");
  69. printf(BLUE"This part will copy 4 shell scripts for BSDBOXdwm Status");
  70. printf(RED" PLEASE HIT "GREEN"ENTER"RED" TO PROCEED."GREEN"\n");
  71. getchar();
  72. printf("\n\n");
  73.     char buf[256];
  74.     char *argv[] = {
  75.                      "cp", "-v", "timedwm", "/usr/local/bin",
  76.                      0,
  77.                    };
  78. pid_t pid = fork();
  79. if(pid == 0) {
  80.                    execv("/bin/cp", argv);
  81. }                  
  82.  else {
  83.      waitpid(pid, NULL, 0);
  84.  }                 
  85. }
  86.  
  87. void status_bsdboxdwm2(){
  88.     char buf[256];
  89.     char *argv[] = {
  90.                      "cp", "-v", "uptimedwm", "/usr/local/bin",
  91.                      0,
  92.                    };
  93. pid_t pid = fork();
  94. if(pid == 0) {
  95.                    execv("/bin/cp", argv);
  96. }                  
  97.  else {
  98.      waitpid(pid, NULL, 0);
  99.  }                 
  100. }
  101.  
  102. void status_bsdboxdwm3(){
  103.     char buf[256];
  104.     char *argv[] = {
  105.                      "cp", "-v", "xmms2np", "/usr/local/bin",
  106.                      0,
  107.                    };
  108. pid_t pid = fork();
  109. if(pid == 0) {
  110.                    execv("/bin/cp", argv);
  111. }                  
  112.  else {
  113.      waitpid(pid, NULL, 0);
  114.  }                 
  115. }
  116.  
  117. void status_bsdboxdwm4(){
  118.     char buf[256];
  119.     char *argv[] = {
  120.                      "cp", "-v", "memuse", "/usr/local/bin",
  121.                      0,
  122.                    };
  123. pid_t pid = fork();
  124. if(pid == 0) {
  125.                    execv("/bin/cp", argv);
  126. }                  
  127.  else {
  128.      waitpid(pid, NULL, 0);
  129.  }                 
  130. }
  131.  
  132. int main( int argc, char **argv ){
  133.    
  134. print_logo();
  135. status_bsdboxdwm1();
  136. status_bsdboxdwm2();
  137. status_bsdboxdwm3();
  138. status_bsdboxdwm4();
  139. return 0;
  140. }
Add Comment
Please, Sign In to add comment