MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

app/gson/src/main.cpp:99–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99int main(int argc, char* argv[])
100{
101 std::vector<std::string> files;
102 std::string path;
103 int ch;
104
105 while ((ch = getopt(argc, argv, "hf:d:")) > 0)
106 {
107 switch (ch)
108 {
109 case 'h':
110 usage(argv[0]);
111 return 0;
112 case 'f':
113 files.push_back(optarg);
114 break;
115 case 'd':
116 path = optarg;
117 break;
118 default:
119 break;
120 }
121 }
122
123 char buf[1024];
124 if (getcwd(buf, sizeof(buf)) == NULL)
125 {
126 printf("getcwd error %s\r\n", acl::last_serror());
127 return 1;
128 }
129
130 if (!path.empty())
131 {
132 if (chdir(path.c_str()) < 0)
133 {
134 printf("chdir to %s error %s\r\n", path.c_str(),
135 acl::last_serror());
136 return 1;
137 }
138
139 scan_path(files);
140 }
141
142 if (files.empty())
143 {
144 usage(argv[0]);
145 return 1;
146 }
147
148 create_files(files);
149
150 // return the saved working path
151 if (chdir(buf) < 0)
152 {
153 printf("chdir to %s error %s\r\n", buf, acl::last_serror());
154 return 1;
155 }
156 if(path.empty())

Callers

nothing calls this directly

Calls 10

scan_pathFunction · 0.85
create_filesFunction · 0.85
copy_filesFunction · 0.85
substrMethod · 0.80
usageFunction · 0.70
getoptFunction · 0.50
last_serrorFunction · 0.50
push_backMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…