modify the login prompt message

Login prompt message locates in /etc/motd, modify the file.

解释这段代码#include "config.h" #include "menu.h" #include "hint.h" #include "color.h" #include <stdio.h> #include <stdlib.h> const int optionNum[MENU_NUM] = {4, 7, 4, 6, 6, 4, 4, 4}; // visual prompts for different menus static const char* menuPrompts[MENU_NUM] = {"\ +==============+================+===============+========+\n\ | 1.User Login | 2.User Sign Up | 3.Admin Login | 4.Exit |\n\ +==============+================+===============+========+\n", \ "\ +=========+==========+==========+=========+==========+=======+========+\n\ | 1.Goods | 2.Search | 3.Orders | 4.Users | 5.Delete | 6.Ban | 7.Back |\n\ +=========+==========+==========+=========+==========+=======+========+\n", \ "\ +=========+==========+==============+========+\n\ | 1.Buyer | 2.Seller | 3.Infomation | 4.Back |\n\ +=========+==========+==============+========+\n", \ "\ +=========+=======+==========+=========+===============+========+\n\ | 1.Goods | 2.Buy | 3.Search | 4.Order | 5.Information | 6.Back |\n\ +=========+=======+==========+=========+===============+========+\n", \ "\ +========+=========+==========+=======+=========+========+\n\ | 1.Sell | 2.Goods | 3.Modify | 4.Ban | 5.Order | 6.Back |\n\ +========+=========+==========+=======+=========+========+\n", \ "\ +===============+==========+==========+========+\n\ | 1.Information | 2.Modify | 3.Top Up | 4.Back |\n\ +===============+==========+==========+========+\n", \ "\ +============+========+\n\ | 1.Password | 2.Back |\n\ +============+========+\n", \ "\ +========+=========+===============+========+\n\ | 1.Name | 2.Price | 3.Description | 4.Back |\n\ +========+=========+===============+========+\n"}; static const char* menuNames[MENU_NUM] = {"Main", "Admin", "User", "Buyer", "Seller", "Information", "Modify", "Good"}; /** * @brief print visual prompt message * * @param type menu type */ static void promptMessage(Menu type) { printf("\t\t\t%s%s Menu%s\n", REVERSE, menuNames[type], RESET); printf("%s\n请选择: ", menuPrompts[type]); } int menu(Menu type) { promptMessage(type); char buffer[MAX_LEN]; int res; scanf("%s", buffer); res = atoi(buffer); while (1) { if (res >= 1 && res <= optionNum[type]) break; illegalMessage(); printf("Please try again: "); scanf("%s", buffer); res = atoi(buffer); } return res; }
07-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值