PracticeDev/study_clang/system-test/stop-docker.c

25 lines
425 B
C
Raw Normal View History

2022-12-20 17:31:11 +08:00
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc,char *argv[])
{
const char* id = NULL;
char cmd[100] = "docker stop ";
if(argc>1)
{
id = argv[1];
char addr[40];
sprintf(addr, id);
strcat(cmd, addr);
printf(cmd);
system(cmd);
return 1;
}
else
{
printf("Please enter the docker id!\n");
return -1;
}
}