1163 |
1165 |
1164 return 0; |
1166 return 0; |
1165 } |
1167 } |
1166 |
1168 |
1167 int cmd_edit(CmdArgs *a) { |
1169 int cmd_edit(CmdArgs *a) { |
|
1170 #ifdef _WIN32 |
|
1171 fprintf(stderr, "This feature is not supported on your platform.\n"); |
|
1172 return -1; |
|
1173 #else |
1168 if(a->argc != 1) { |
1174 if(a->argc != 1) { |
1169 fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few":"many"); |
1175 fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few":"many"); |
1170 fprintf(stderr, "Usage: dav %s\n", find_usage_str("edit")); |
1176 fprintf(stderr, "Usage: dav %s\n", find_usage_str("edit")); |
1171 return -1; |
1177 return -1; |
1172 } |
1178 } |
1261 char* editor = getenv("EDITOR"); |
1267 char* editor = getenv("EDITOR"); |
1262 if(!editor) editor = default_editor; |
1268 if(!editor) editor = default_editor; |
1263 char* viargs[3] = {editor, outfile, NULL}; |
1269 char* viargs[3] = {editor, outfile, NULL}; |
1264 |
1270 |
1265 int ret = 0; |
1271 int ret = 0; |
1266 // TODO: solution for windows |
|
1267 pid_t pid = fork(); |
1272 pid_t pid = fork(); |
1268 if(pid < 0) { |
1273 if(pid < 0) { |
1269 perror("Cannot create process for editor"); |
1274 perror("Cannot create process for editor"); |
1270 ret = 1; |
1275 ret = 1; |
1271 } else if(pid == 0) { |
1276 } else if(pid == 0) { |