Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <dirent.h>
- #include <string.h>
- #include <unistd.h>
- #include <pwd.h>
- #include <fcntl.h> /* флажки чтения и записи */
- #include <sys/types.h> /* определения типов */
- #include <sys/stat.h> /* структура, возвращаемая stat */
- int main(int argc, char* argv[])
- {
- char fir_link, sec_link;
- int i = 1;
- int s_flag = 0;
- if (argc < 3){
- printf("ERROR!\n");
- return 0;
- }
- while(strcmp(argv[i], "-s") == 0){
- s_flag = 1;
- i++;
- }
- if(argv[i] == NULL){
- printf("ERROR!\n");
- return 0;
- }
- if(argv[i+1] == NULL){
- printf("ERROR!\n");
- return 0;
- }
- if(s_flag == 0){
- link(argv[i], argv[i + 1]);
- }
- else{
- symlink(argv[i], argv[i + 1]);
- }
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement