summaryrefslogtreecommitdiff
path: root/uirc.c
blob: bedf76dedd7822e6ada87c106e6c1edbd12b137b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stb/stb_image.h>

const char *VERSION = "0.1.0";

int handleArg(arg) char *arg; {
  int value, size; 
  char flag, *longFlag, first, firstTwo[3];
  const char *help;

  help =  "usage: uirc [-hl] [-r] IMAGE1 [IMAGE2] [...]\n\n"

          "options:\n"
          "\t-h\t> Display this message\n"
          "\t-l\t> Display the license disclaimer for uirc (BSD 2-Clause)\n\n"

          "\t-r\t> Display the resolution of the image (in addition to the ratio)\n\n"

          "help:\n"
          "If you get stuck using uirc, you can read the manpage for uirc:\n\n"

          "\t'man uirc'\n\n";

  flag = '-';
  longFlag = "--";
  first = arg[0];

  firstTwo[0] = arg[0];
  firstTwo[1] = arg[1];
  firstTwo[2] = '\0';
  size = sizeof arg;

  //if (strcmp(longFlag, firstTwo) == 0) {
    //printf("it has two dashes\n");
  //  switch (arg) {
  //    case "--okay":
  //      printf("success");
  //      break;
  //    default:
  //      printf("failure");
  //      break;
  //  }
  //  return 0;
  //} else if (flag == first) {
  //  printf("it has a dash\n");
  //  return 0;
  //}

  if (flag == first) {
    for (int i = 1; i < size; i++) {
      switch (arg[i]) {
        case 'h':
          printf("an unneccessary image ratio calculator (uirc) v%s\n\n", VERSION);
          printf("Copyright 2022 Bryson Steck\nLicensed under the BSD 2-Clause. You can read the license by running 'uirc -l'\n\n");  
          printf("%s\n", help);
          break;
        case 'l':
          printf("%s\n", license);
          break;
        case '\0':
          break;
        //default:
        //  printf("uirc: invalid argument \"%s\"\n", arg);
        //  return 1;
      }
    }
  }

  return 0;
  
}

int readFile() {
  
}

int main(argc, argv) int argc; char *argv[]; {
  //int i;
  char *i;

  if (argc <= 1) {
    printf("uirc: at least one argument is required\n");
    return 1;
  }

  char *a = argv[1];
  return handleArg(a);

}