代码:
将manjaro的自动桌面bing中的桌面自动备份脚本:cp ~/.cache/plasma_engine_potd/bing ~/bing_`date +%Y%m%d`.jpg
cp ~/.cache/plasma_engine_potd/apod ~/apod_`date +%Y%m%d`.jpg
1 //This is c program code! 2 /* *=+=+=+=+* *** *=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= 3 * 文档信息: *** :~/WORKM/stutyCode/linuxPrograming/manageDisk/v2/appUi.c 4 * 版权声明: *** :(魎魍魅魑)MIT 5 * 联络信箱: *** :guochaoxxl@163.com 6 * 创建时间: *** :2020年12月14日的上午10:39 7 * 文档用途: *** :数据结构与算法分析-c语言描述 8 * 作者信息: *** :guochaoxxl(http://cnblogs.com/guochaoxxl) 9 * 修订时间: *** :2020年第50周 12月14日 星期一 上午10:39 (第349天) 10 * 文件描述: *** :自行添加 11 * *+=+=+=+=* *** *+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+*/ 12 #define _XOPEN_SOURCE 13 14 #include "cdData.h" 15 16 #define TMP_STRING_LEN 125 /* this number must be larger than the biggest single string in any database structure */ 17 18 19 20 /* local prototypes */ 21 // int command_mode(int argc, char *argv[]); 22 // void announce(void); 23 // menu_options show_menu(const CdcEntry *current_cdc); 24 // int get_confirm(const char *question); 25 // int enter_new_cat_entry(CdcEntry *entry_to_update); 26 // void enter_new_track_entries(const CdcEntry *entry_to_add_to); 27 // void del_cat_entry(const CdcEntry *entry_to_delete); 28 // void del_track_entries(const CdcEntry *entry_to_delete); 29 // CdcEntry find_cat(void); 30 // void list_tracks(const CdcEntry *entry_to_use); 31 // void count_all_entries(void); 32 // void display_cdc(const CdcEntry *cdc_to_show); 33 // void display_cdt(const CdtEntry *cdt_to_show); 34 // void strip_return(char *string_to_strip); 35 36 void announce(void) { 37 printf(" Welcome to the demonstration CD catalog database program "); 38 } /* announce */ 39 40 menu_options show_menu(const CdcEntry *cdc_selected) { 41 char tmp_str[TMP_STRING_LEN + 1]; 42 menu_options option_chosen = mo_invalid; 43 44 while (option_chosen == mo_invalid) { 45 if (cdc_selected->catalog[0]) { 46 printf(" Current entry: "); 47 printf("%s, %s, %s, %s ", cdc_selected->catalog, 48 cdc_selected->title, 49 cdc_selected->type, 50 cdc_selected->artist); 51 52 printf(" "); 53 printf("1 - add new CD "); 54 printf("2 - search for a CD "); 55 printf("3 - count the CDs and tracks in the database "); 56 printf("4 - re-enter tracks for current CD "); 57 printf("5 - delete this CD, and all it's tracks "); 58 printf("6 - list tracks for this CD "); 59 printf("q - quit "); 60 printf(" Option: "); 61 fgets(tmp_str, TMP_STRING_LEN, stdin); 62 switch(tmp_str[0]) { 63 case '1': option_chosen = mo_add_cat; break; 64 case '2': option_chosen = mo_find_cat; break; 65 case '3': option_chosen = mo_count_entries; break; 66 case '4': option_chosen = mo_add_tracks; break; 67 case '5': option_chosen = mo_del_cat; break; 68 case '6': option_chosen = mo_list_cat_tracks; break; 69 case 'q': option_chosen = mo_exit; break; 70 } 71 } 72 else { 73 printf(" "); 74 printf("1 - add new CD "); 75 printf("2 - search for a CD "); 76 printf("3 - count the CDs and tracks in the database "); 77 printf("q - quit "); 78 printf(" Option: "); 79 fgets(tmp_str, TMP_STRING_LEN, stdin); 80 switch(tmp_str[0]) { 81 case '1': option_chosen = mo_add_cat; break; 82 case '2': option_chosen = mo_find_cat; break; 83 case '3': option_chosen = mo_count_entries; break; 84 case 'q': option_chosen = mo_exit; break; 85 } 86 } 87 } /* while */ 88 return(option_chosen); 89 } /* show_menu */ 90 91 int get_confirm(const char *question) { 92 char tmp_str[TMP_STRING_LEN + 1]; 93 94 printf("%s", question); 95 fgets(tmp_str, TMP_STRING_LEN, stdin); 96 if (tmp_str[0] == 'Y' || tmp_str[0] == 'y') { 97 return(1); 98 } 99 return(0); 100 } /* get_confirm */ 101 102 103 int enter_new_cat_entry(CdcEntry *entry_to_update) { 104 CdcEntry new_entry; 105 char tmp_str[TMP_STRING_LEN + 1]; 106 107 memset(&new_entry, '