コード例 #1
0
ファイル: Admin.c プロジェクト: shenyamu/OrderDish
void Staff_manage()
{
	char dirname[] = "./Date/Staff.txt";
	FILE *fp;
	pList head;
	int n,count;
	fp = File_open(dirname);
	head = File_read(fp,sizeof(struct staff_t));
	count = List_count(head);
	while(1)
	{	 
		system("cls");
		printf("\n\n\n\t\t\t员工管理界面\n\n");
		printf("\t\t\t1、增加员工\n\n"); 
		printf("\t\t\t2、删除员工\n\n");
		printf("\t\t\t3、修改员工\n\n"); 
		printf("\t\t\t4、查询员工\n\n"); 
		printf("\t\t\t5、返回\n\n"); 
		printf("\t\t\t请输入要操作的功能:");
		n = glb_putString(NULL,'1','5',1,2);
		switch(n)
		{
		case 1:	
			List_print(head,staff_print);
			File_add(fp,head,sizeof(struct staff_t),staff_add);
			List_print(head,staff_print);		
			break;
		case 2:
			List_print(head,staff_print);
			File_remove(fp,head,sizeof(struct staff_t),staff_remove);
			head = File_read(fp,sizeof(struct staff_t));
			List_print(head,staff_print);			
			break;
		case 3:
			List_print(head,staff_print);
			File_updata(fp,head,sizeof(struct staff_t),staff_updata);
			head = File_read(fp,sizeof(struct staff_t));
			List_print(head,staff_print);		
			break;
		case 4:  
			staff_search(head);			
			break;
		case 5:
			break;
		}
		if (n == 5)
		{
			break;
		}
		else
		{
            printf("\n按<Esc>键返回...");
			while(getch() != 27)
			{}
		}
		
		
	}
	List_free(head);
}
コード例 #2
0
ファイル: Admin.c プロジェクト: shenyamu/OrderDish
void Menu_manage()
{
	char dirname[] = "./Date/Menu.txt";
	FILE *fp;
	pList head;
	int n;
	fp = File_open(dirname);
	head = File_read(fp,sizeof(struct Menu_t));
	while(1)
	{	 
		system("cls");
		printf("\n\n\n\t\t\t菜谱管理界面\n\n");
		printf("\t\t\t1、增加菜谱\n\n"); 
		printf("\t\t\t2、删除菜谱\n\n");
		printf("\t\t\t3、修改菜谱\n\n"); 
		printf("\t\t\t4、查询菜谱\n\n"); 
		printf("\t\t\t5、返回\n\n"); 
		printf("\t\t\t请输入您要操作的功能:");
	    n = glb_putString(NULL,'1','5',1,2);
		switch(n)
		{
		case 1:	
			List_print(head,Menu_print);
			File_add(fp,head,sizeof(struct Menu_t),Menu_add);
			head = File_read(fp,sizeof(struct Menu_t));
			List_print(head,Menu_print);
			break;
		case 2:
			List_print(head,Menu_print);
			File_del(fp,dirname,head,sizeof(struct Menu_t),Menu_del);
			List_print(head,Menu_print);
			break;
		case 3:
			List_print(head,Menu_print);
			File_updata(fp,head,sizeof(struct Menu_t),Menu_updata);
		    head = File_read(fp,sizeof(struct Menu_t));
			List_print(head,Menu_print);
			break;
		case 4: 
	
		    Menu_search(head);
			break;
		case 5:
			break;
		}
		if (n == 5)
		{
			break;
		}
		else
		{
            printf("\n按<Esc>键返回...");
			while(getch() != 27)
			{}
		}
		
	}
	  List_free(head);
}
コード例 #3
0
ファイル: Admin.c プロジェクト: shenyamu/OrderDish
void Table_manage()
{
	char dirname[] = "./Date/Table.txt";
	FILE *fp;
	pList head;
	int n;
	fp = File_open(dirname);
	head = File_read(fp,sizeof(struct Table_t));
	while(1)
	{	 
		system("cls");
		printf("\n\n\n\t\t\t台桌管理界面\n\n");
		printf("\t\t\t1、增加台桌\n\n"); 
		printf("\t\t\t2、删除台桌\n\n");
		printf("\t\t\t3、修改台桌\n\n"); 
		printf("\t\t\t4、查询台桌\n\n"); 
		printf("\t\t\t5、返回\n\n"); 
		printf("\t\t\t请输入您要操作的功能:");
	    n = glb_putString(NULL,'1','5',1,2);
		switch(n)
		{
		case 1:	
			List_print(head,Table_print);
			File_add(fp,head,sizeof(struct Table_t),Table_add);
			head = File_read(fp,sizeof(struct Table_t));
			List_print(head,Table_print);			
			break;
		case 2:
			List_print(head,Table_print);
			File_remove(fp,head,sizeof(struct Table_t),Table_remove);
			head = File_read(fp,sizeof(struct Table_t));
			List_print(head,Table_print);
			break;
		case 3:
			List_print(head,Table_print);
			File_updata(fp,head,sizeof(struct Table_t),Table_updata);
		    head = File_read(fp,sizeof(struct Table_t));
			List_print(head,Table_print);
			break;
		case 4: 
		    Table_search(head,3,4);
			break;
		case 5:
			break;
		}
		if (n == 5)
		{
			break;
		}
		else
		{
            printf("\n按<Esc>键返回...");
			while(getch() != 27)
			{}
		}
		
	}
	  List_free(head);
}
コード例 #4
0
ファイル: Waiter.c プロジェクト: shenyamu/OrderDish
/************************************************************************
int Ui_waiter()
服务员界面
************************************************************************/
int Ui_waiter()
{  
	pList pTable;
	int n;
    FILE *fp;
	void (*pst[5])(pList pTable) = {Open_desk,Order_dishes,Settle_Accounts,turnover_search,Order_search};
	fp = File_open("./Date/Table.txt");
    pTable= File_read(fp,sizeof(struct Table_t));
	while(1)
	{	
		system("cls");
		printf("\n\n\n\t\t\t服务员功能选择界面\n\n");
		printf("\t\t\t1、开桌\n\n");
		printf("\t\t\t2、点菜\n\n");
		printf("\t\t\t3、结账\n\n");
		printf("\t\t\t4、营业额查询\n\n");
		printf("\t\t\t5、已买/未买单查询\n\n");
		printf("\t\t\t6、注销\n\n");
		printf("\t\t\t7、退出\n\n");
		printf("\t\t\t请输入您所要选择的功能:");
		n = glb_putString(NULL,'1','7',1,2);
		if (n > 0 && n <6)
		{
			pst[n-1](pTable);
		}
		else if(n == 6)
			return 0;
		else if (n == 7)
			return 1;		    				
	}	
	   
	  
}
コード例 #5
0
ファイル: hash.c プロジェクト: QubeX2/mangolib
Hash_T Hash_load(const char *file) {
    int fd, read, done = 0, i;
    int d[2];
    Hash_T h = NULL;

    if((fd=File_openRead(file)) != -1) {
        h = Hash_new();
        while(!done) {
            for(i=0; i<2; i++) {
                read = File_read(fd, &d[i], sizeof(int));
                if(read == -1)
                    goto err;
                else if(read == 0)
                    done = 1;
                else
                    Hash_add(h, d[0], d[1]);
            }
        }
    }
    return h;

err:
    Hash_free(&h);
    return Hash_new();
}
コード例 #6
0
ファイル: Waiter.c プロジェクト: shenyamu/OrderDish
/************************************************************************
void turnover_search(pList  pTable)
营业额查询
************************************************************************/
void turnover_search(pList  pTable)
{
  FILE *fp;
  pList pOrder,pt;
  struct Order_t *data;
  long *stardate,*enddate;
  long ordernum;// 订单号
  int a,b,c;// 用来打印年月日
  long money = 0;// 总营业额
  stardate = (long *)malloc(sizeof(long));// 开始日期
  enddate = (long *)malloc(sizeof(long));// 结束日期
  fp = File_open("./Date/Order/Order.txt");
  pOrder = File_read(fp,sizeof(struct Order_t));// 读出已买订单链表

  system("cls");
  printf("\n\t\t\t(1):当天查询\n");
  printf("\n\t\t\t(2):历史查询\n");
  printf("\n\t\t\t请输入要选择的功能:");
  if (glb_putString(NULL,'1','2',1,2) == 1)
  {
	  system("cls");
	  *stardate = Ordernum_get(NULL,NULL);// 获取当前系统日期
	  *enddate = *stardate;
  }
  else
  {
      Orderdate_input(stardate,enddate);// 输入开始和结束日期
	  printf("\n");
  }
 
  printf("\t\t%-16s%-18s%-11s\n","订单号","时间","金额");
  pt = pOrder->pNext;
  while (pt)
  {
	  data = (struct Order_t *)(pt->pData);
	  sscanf(data->ordernum,"%8ld",&ordernum);// 字符串转化成长整型
	  if ((strcmp(data->acname,acName) == 0)&&((ordernum <= *enddate) && (ordernum >= *stardate)))//
	  {
		  money = money + (data->money);// 营业额累加
         sscanf(data->ordernum,"%4d%2d%2d",&a,&b,&c);//分别取出年月日
		 printf("\t\t%-16s%d%s%2d%s%2d%-6s%s%d\n",data->ordernum,a,"年",b,"月",c,"日","¥",data->money);		 
	  }
	  pt = pt->pNext;
  } 
      printf("\n\t\t营业额总额:¥%ld\n",money);
      List_free(pOrder);
	  printf("\n\t\t按任意键返回...");
	  getch();
}
コード例 #7
0
ファイル: IoTService.cpp プロジェクト: TSIoT/IoTRepublic
//Config file
void loadConfigFile()
{
	printf("Start load config file\n");
	TSFile fileHandle;
	const int bufferSize = 1000;
	char buffer[bufferSize];
	memset(buffer,'\0', bufferSize);


	File_open(&fileHandle,"C:\\Users\\loki.chuang\\Desktop\\MobileDesc.txt", O_RDONLY);
	File_read(&fileHandle, buffer, bufferSize);
	File_close(&fileHandle);

	printAllChar(buffer, bufferSize);
}
コード例 #8
0
int
main(void) {
    init();
    void * input = new(File, "./utf8-example");
    void * content = File_read(input);
    uint8_t * string = Object_inspect(content);
    printf("[%s]\n", string);
    uint8_t buffer[30];
    buffer[0] = '\0';
    size_t len = strlen(string);
    size_t n;
    for(int i = 0; i < len; i += n) {
        n = utf8_char_len(string + i);
        strncpy(buffer, string + i, n);
        buffer[n] = '\0';
        printf("[%s]\n", buffer);
    }
    return 0;
}
コード例 #9
0
ファイル: File.c プロジェクト: danielbradley/Build
int File_copyTo( const IFile* self, const IPath* targetPath, int force )
{
	bool status = 0;

	char* target = NULL;
	IFile* target_file = NULL;
	IDirectory* target_dir = new_Directory_path( targetPath );
	if ( Directory_exists( target_dir ) )
	{
		target = CharString_cat3( Path_getCommon( targetPath ), "/", Path_getBasename( self->path ) );
	} else {
		target = CharString_copy( Path_getCommon( targetPath ) );
	}

	target_file = new_File( target );
	if ( !File_exists( target_file ) || force )
	{
		if ( File_open( target_file, "w" ) )
		{
			byte buffer[256];
			int read;
		
			while ( (read = File_read( self, buffer, 256 )) )
			{
				File_write( target_file, buffer, read );
				status = 1;
			}
			if ( !status )
			{
				fprintf( stdout, "File.c::copyTo: could not copy data\n" );
			}
		}
		File_close( target_file );
	}		
	free_Directory( target_dir );
	free_File( target_file );
	free_CharString( target );	

	return status;
}
コード例 #10
0
ファイル: Waiter.c プロジェクト: shenyamu/OrderDish
/************************************************************************
void Order_search(pList  pTable)
已买/未买单查询
************************************************************************/
void Order_search(pList  pTable)
{
	int n;
	FILE *fp;
	pList pOrder;
	fp = File_open("./Date/Cache/Order.txt");
    pOrder = File_read(fp,sizeof(struct Order_t));// 读出未买单链表
    while (1)
    {
    system("cls");
	printf("\n\n\n\t\t\t已买/未买单查询界面\n\n");
	printf("\t\t\t1、未买单查询\n\n");
	printf("\t\t\t2、已买单查询\n\n");
	printf("\t\t\t3、退出\n\n");
	printf("\t\t\t请输入您所要选择的功能:");
	n = glb_putString(NULL,'1','3',1,2);
	switch(n)
	{
	case 1:
		Order_search_unbuy(pOrder);// 未买单查询函数 
		getch();
		break;
	case 2:
		Order_search_buy();// 已买单查询函数
		getch();
		break;
	case 3:
		
		break;
	}
	 if (n == 3)
	 {
		break;
	 }
   
	}
     List_free(pOrder);// 释放链表
}
コード例 #11
0
ファイル: example.c プロジェクト: xsoameix/libooc
int main(void) {
    // static string
    Value a;
    Value_type(&a, StaticString);
    Value_set_str(&a, "a");
    Value_get_str(&a);

    // string
    void * b = new(String, "b");

    // hash
    void * hash = new(Hash);
    Hash_set(hash, &a, b);
    void * c = Hash_get(hash, &a);
    puts(Object_inspect(c));
    delete(hash);

    // array
    void * ary = new(Array);
    Array_push(ary, &a);
    Array_unshift(ary, b);
    void * d = Array_shift(ary);
    puts(Object_inspect(d));
    delete(ary);

    delete(b);

    // file
    void * file = new(File, "libooc/example");
    void * content = File_read(file);
    puts(Object_inspect(content));
    delete(file);

    void write_file(void * file) {
        File_puts(file, "hello");
        File_printf(file, " w%drld", 0);
    }
コード例 #12
0
Errors Command_compare(StringList                      *archiveFileNameList,
                       EntryList                       *includeEntryList,
                       PatternList                     *excludePatternList,
                       JobOptions                      *jobOptions,
                       ArchiveGetCryptPasswordFunction archiveGetCryptPasswordFunction,
                       void                            *archiveGetCryptPasswordUserData
                      )
{
  byte              *archiveBuffer,*buffer;
  FragmentList      fragmentList;
  String            archiveFileName;
  Errors            failError;
  Errors            error;
  ArchiveInfo       archiveInfo;
  ArchiveFileInfo   archiveFileInfo;
  ArchiveEntryTypes archiveEntryType;
  FragmentNode      *fragmentNode;

  assert(archiveFileNameList != NULL);
  assert(includeEntryList != NULL);
  assert(excludePatternList != NULL);
  assert(jobOptions != NULL);

  /* allocate resources */
  archiveBuffer = (byte*)malloc(BUFFER_SIZE);
  if (archiveBuffer == NULL)
  {
    HALT_INSUFFICIENT_MEMORY();
  }
  buffer = malloc(BUFFER_SIZE);
  if (buffer == NULL)
  {
    free(archiveBuffer);
    HALT_INSUFFICIENT_MEMORY();
  }
  FragmentList_init(&fragmentList);
  archiveFileName = String_new();

  failError = ERROR_NONE;
  while (   !StringList_empty(archiveFileNameList)
         && (failError == ERROR_NONE)
        )
  {
    StringList_getFirst(archiveFileNameList,archiveFileName);
    printInfo(1,"Comparing archive '%s':\n",String_cString(archiveFileName));

    /* open archive */
    error = Archive_open(&archiveInfo,
                         archiveFileName,
                         jobOptions,
                         archiveGetCryptPasswordFunction,
                         archiveGetCryptPasswordUserData
                        );
    if (error != ERROR_NONE)
    {
      printError("Cannot open archive file '%s' (error: %s)!\n",
                 String_cString(archiveFileName),
                 Errors_getText(error)
                );
      if (failError == ERROR_NONE) failError = error;
      continue;
    }

    /* read files */
    while (   !Archive_eof(&archiveInfo)
           && (failError == ERROR_NONE)
          )
    {
      /* get next archive entry type */
      error = Archive_getNextArchiveEntryType(&archiveInfo,
                                              &archiveFileInfo,
                                              &archiveEntryType
                                             );
      if (error != ERROR_NONE)
      {
        printError("Cannot not read next entry in archive '%s' (error: %s)!\n",
                   String_cString(archiveFileName),
                   Errors_getText(error)
                  );
        if (failError == ERROR_NONE) failError = error;
        break;
      }

      switch (archiveEntryType)
      {
        case ARCHIVE_ENTRY_TYPE_FILE:
          {
            String       fileName;
            FileInfo     fileInfo;
            uint64       fragmentOffset,fragmentSize;
            FragmentNode *fragmentNode;
//            FileInfo   localFileInfo;
            FileHandle   fileHandle;
            bool         equalFlag;
            uint64       length;
            ulong        n;
            ulong        diffIndex;

            /* read file */
            fileName = String_new();
            error = Archive_readFileEntry(&archiveInfo,
                                          &archiveFileInfo,
                                          NULL,
                                          NULL,
                                          NULL,
                                          fileName,
                                          &fileInfo,
                                          &fragmentOffset,
                                          &fragmentSize
                                         );
            if (error != ERROR_NONE)
            {
              printError("Cannot not read 'file' content of archive '%s' (error: %s)!\n",
                         String_cString(archiveFileName),
                         Errors_getText(error)
                        );
              String_delete(fileName);
              if (failError == ERROR_NONE) failError = error;
              break;
            }

            if (   (List_empty(includeEntryList) || EntryList_match(includeEntryList,fileName,PATTERN_MATCH_MODE_EXACT))
                && !PatternList_match(excludePatternList,fileName,PATTERN_MATCH_MODE_EXACT)
               )
            {
              printInfo(2,"  Compare file '%s'...",String_cString(fileName));

              /* check file */
              if (!File_exists(fileName))
              {
                printInfo(2,"FAIL!\n");
                printError("File '%s' not found!\n",String_cString(fileName));
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_FILE_NOT_FOUND;
                }
                break;
              }
              if (File_getType(fileName) != FILE_TYPE_FILE)
              {
                printInfo(2,"FAIL!\n");
                printError("'%s' is not a file!\n",String_cString(fileName));
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_WRONG_FILE_TYPE;
                }
                break;
              }

              /* get file fragment list */
              fragmentNode = FragmentList_find(&fragmentList,fileName);
              if (fragmentNode == NULL)
              {
                fragmentNode = FragmentList_add(&fragmentList,fileName,fileInfo.size);
              }
//FragmentList_print(fragmentNode,String_cString(fileName));

              /* open file */
              error = File_open(&fileHandle,fileName,FILE_OPENMODE_READ);
              if (error != ERROR_NONE)
              {
                printInfo(2,"FAIL!\n");
                printError("Cannot open file '%s' (error: %s)\n",
                           String_cString(fileName),
                           Errors_getText(error)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = error;
                }
                continue;
              }

              /* check file size */
              if (fileInfo.size != File_getSize(&fileHandle))
              {
                printInfo(2,"FAIL!\n");
                printError("'%s' differ in size: expected %lld bytes, found %lld bytes\n",
                           String_cString(fileName),
                           fileInfo.size,
                           File_getSize(&fileHandle)
                          );
                File_close(&fileHandle);
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_FILES_DIFFER;
                }
                continue;
              }

              /* check file content */
              error = File_seek(&fileHandle,fragmentOffset);
              if (error != ERROR_NONE)
              {
                printInfo(2,"FAIL!\n");
                printError("Cannot read file '%s' (error: %s)\n",
                           String_cString(fileName),
                           Errors_getText(error)
                          );
                File_close(&fileHandle);
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = error;
                }
                continue;
              }
              length    = 0;
              equalFlag = TRUE;
              diffIndex = 0;
              while ((length < fragmentSize) && equalFlag)
              {
                n = MIN(fragmentSize-length,BUFFER_SIZE);

                /* read archive, file */
                error = Archive_readData(&archiveFileInfo,archiveBuffer,n);
                if (error != ERROR_NONE)
                {
                  printInfo(2,"FAIL!\n");
                  printError("Cannot not read content of archive '%s' (error: %s)!\n",
                             String_cString(archiveFileName),
                             Errors_getText(error)
                            );
                  if (failError == ERROR_NONE) failError = error;
                  break;
                }
                error = File_read(&fileHandle,buffer,n,NULL);
                if (error != ERROR_NONE)
                {
                  printInfo(2,"FAIL!\n");
                  printError("Cannot read file '%s' (error: %s)\n",
                             String_cString(fileName),
                             Errors_getText(error)
                            );
                  if (jobOptions->stopOnErrorFlag)
                  {
                    failError = error;
                  }
                  break;
                }

                /* compare */
                diffIndex = compare(archiveBuffer,buffer,n);
                equalFlag = (diffIndex >= n);
                if (!equalFlag)
                {
                  printInfo(2,"FAIL!\n");
                  printError("'%s' differ at offset %llu\n",
                             String_cString(fileName),
                             fragmentOffset+length+(uint64)diffIndex
                            );
                  if (jobOptions->stopOnErrorFlag)
                  {
                    failError = ERROR_FILES_DIFFER;
                  }
                  break;
                }

                length += n;
              }
              File_close(&fileHandle);
              if (failError != ERROR_NONE)
              {
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                continue;
              }

#if 0
              /* get local file info */
              /* check file time, permissions, file owner/group */
#endif /* 0 */
              printInfo(2,"ok\n");

              /* add fragment to file fragment list */
              FragmentList_addEntry(fragmentNode,fragmentOffset,fragmentSize);

              /* discard fragment list if file is complete */
              if (FragmentList_checkEntryComplete(fragmentNode))
              {
                FragmentList_remove(&fragmentList,fragmentNode);
              }

              /* free resources */
            }
            else
            {
              /* skip */
              printInfo(3,"  Compare '%s'...skipped\n",String_cString(fileName));
            }

            /* close archive file, free resources */
            Archive_closeEntry(&archiveFileInfo);
            String_delete(fileName);
          }
          break;
        case ARCHIVE_ENTRY_TYPE_IMAGE:
          {
            String       imageName;
            DeviceInfo   deviceInfo;
            uint64       blockOffset,blockCount;
            FragmentNode *fragmentNode;
            DeviceHandle deviceHandle;
            bool         equalFlag;
            uint64       block;
            ulong        bufferBlockCount;
            ulong        diffIndex;

            /* read image */
            imageName = String_new();
            error = Archive_readImageEntry(&archiveInfo,
                                           &archiveFileInfo,
                                           NULL,
                                           NULL,
                                           NULL,
                                           imageName,
                                           &deviceInfo,
                                           &blockOffset,
                                           &blockCount
                                          );
            if (error != ERROR_NONE)
            {
              printError("Cannot not read 'image' content of archive '%s' (error: %s)!\n",
                         String_cString(archiveFileName),
                         Errors_getText(error)
                        );
              String_delete(imageName);
              if (failError == ERROR_NONE) failError = error;
              break;
            }

            if (   (List_empty(includeEntryList) || EntryList_match(includeEntryList,imageName,PATTERN_MATCH_MODE_EXACT))
                && !PatternList_match(excludePatternList,imageName,PATTERN_MATCH_MODE_EXACT)
               )
            {
              printInfo(2,"  Compare image '%s'...",String_cString(imageName));

              /* check if device exists */
              if (!File_exists(imageName))
              {
                printInfo(2,"FAIL!\n");
                printError("Device '%s' not found!\n",String_cString(imageName));
                Archive_closeEntry(&archiveFileInfo);
                String_delete(imageName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_FILE_NOT_FOUND;
                }
                break;
              }

              /* get image fragment list */
              fragmentNode = FragmentList_find(&fragmentList,imageName);
              if (fragmentNode == NULL)
              {
                fragmentNode = FragmentList_add(&fragmentList,imageName,deviceInfo.size);
              }

              /* open device */
              error = Device_open(&deviceHandle,imageName,DEVICE_OPENMODE_READ);
              if (error != ERROR_NONE)
              {
                printInfo(2,"FAIL!\n");
                printError("Cannot open file '%s' (error: %s)\n",
                           String_cString(imageName),
                           Errors_getText(error)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(imageName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = error;
                }
                continue;
              }

              /* check image size */
              if (deviceInfo.size != Device_getSize(&deviceHandle))
              {
                printInfo(2,"FAIL!\n");
                printError("'%s' differ in size: expected %lld bytes, found %lld bytes\n",
                           String_cString(imageName),
                           deviceInfo.size,
                           Device_getSize(&deviceHandle)
                          );
                Device_close(&deviceHandle);
                Archive_closeEntry(&archiveFileInfo);
                String_delete(imageName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_FILES_DIFFER;
                }
                continue;
              }

              /* check image content */
              error = Device_seek(&deviceHandle,blockOffset*(uint64)deviceInfo.blockSize);
              if (error != ERROR_NONE)
              {
                printInfo(2,"FAIL!\n");
                printError("Cannot read file '%s' (error: %s)\n",
                           String_cString(imageName),
                           Errors_getText(error)
                          );
                Device_close(&deviceHandle);
                Archive_closeEntry(&archiveFileInfo);
                String_delete(imageName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = error;
                }
                continue;
              }
              block     = 0LL;
              equalFlag = TRUE;
              diffIndex = 0;
              while ((block < blockCount) && equalFlag)
              {
                assert(deviceInfo.blockSize > 0);
                bufferBlockCount = MIN(blockCount-block,BUFFER_SIZE/deviceInfo.blockSize);

                /* read archive, file */
                error = Archive_readData(&archiveFileInfo,archiveBuffer,bufferBlockCount*deviceInfo.blockSize);
                if (error != ERROR_NONE)
                {
                  printInfo(2,"FAIL!\n");
                  printError("Cannot not read content of archive '%s' (error: %s)!\n",
                             String_cString(archiveFileName),
                             Errors_getText(error)
                            );
                  if (failError == ERROR_NONE) failError = error;
                  break;
                }
                error = Device_read(&deviceHandle,buffer,bufferBlockCount*deviceInfo.blockSize,NULL);
                if (error != ERROR_NONE)
                {
                  printInfo(2,"FAIL!\n");
                  printError("Cannot read file '%s' (error: %s)\n",
                             String_cString(imageName),
                             Errors_getText(error)
                            );
                  if (jobOptions->stopOnErrorFlag)
                  {
                    failError = error;
                  }
                  break;
                }

                /* compare */
                diffIndex = compare(archiveBuffer,buffer,bufferBlockCount*deviceInfo.blockSize);
                equalFlag = (diffIndex >= bufferBlockCount*deviceInfo.blockSize);
                if (!equalFlag)
                {
                  printInfo(2,"FAIL!\n");
                  printError("'%s' differ at offset %llu\n",
                             String_cString(imageName),
                             blockOffset*(uint64)deviceInfo.blockSize+block*(uint64)deviceInfo.blockSize+(uint64)diffIndex
                            );
                  if (jobOptions->stopOnErrorFlag)
                  {
                    failError = ERROR_FILES_DIFFER;
                  }
                  break;
                }

                block += (uint64)bufferBlockCount;
              }
              Device_close(&deviceHandle);
              if (failError != ERROR_NONE)
              {
                Archive_closeEntry(&archiveFileInfo);
                String_delete(imageName);
                continue;
              }

#if 0
              /* get local file info */
              /* check file time, permissions, file owner/group */
#endif /* 0 */
              printInfo(2,"ok\n");

              /* add fragment to file fragment list */
              FragmentList_addEntry(fragmentNode,blockOffset*(uint64)deviceInfo.blockSize,blockCount*(uint64)deviceInfo.blockSize);

              /* discard fragment list if file is complete */
              if (FragmentList_checkEntryComplete(fragmentNode))
              {
                FragmentList_remove(&fragmentList,fragmentNode);
              }

              /* free resources */
            }
            else
            {
              /* skip */
              printInfo(3,"  Compare '%s'...skipped\n",String_cString(imageName));
            }

            /* close archive file, free resources */
            Archive_closeEntry(&archiveFileInfo);
            String_delete(imageName);
          }
          break;
        case ARCHIVE_ENTRY_TYPE_DIRECTORY:
          {
            String   directoryName;
            FileInfo fileInfo;
//            String   localFileName;
//            FileInfo localFileInfo;

            /* read directory */
            directoryName = String_new();
            error = Archive_readDirectoryEntry(&archiveInfo,
                                               &archiveFileInfo,
                                               NULL,
                                               NULL,
                                               directoryName,
                                               &fileInfo
                                              );
            if (error != ERROR_NONE)
            {
              printError("Cannot not read 'directory' content of archive '%s' (error: %s)!\n",
                         String_cString(archiveFileName),
                         Errors_getText(error)
                        );
              String_delete(directoryName);
              if (failError == ERROR_NONE) failError = error;
              break;
            }

            if (   (List_empty(includeEntryList) || EntryList_match(includeEntryList,directoryName,PATTERN_MATCH_MODE_EXACT))
                && !PatternList_match(excludePatternList,directoryName,PATTERN_MATCH_MODE_EXACT)
               )
            {
              printInfo(2,"  Compare directory '%s'...",String_cString(directoryName));

              /* check directory */
              if (!File_exists(directoryName))
              {
                printInfo(2,"FAIL!\n");
                printError("Directory '%s' does not exists!\n",String_cString(directoryName));
                Archive_closeEntry(&archiveFileInfo);
                String_delete(directoryName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_FILE_NOT_FOUND;
                }
                break;
              }
              if (File_getType(directoryName) != FILE_TYPE_DIRECTORY)
              {
                printInfo(2,"FAIL!\n");
                printError("'%s' is not a directory!\n",
                           String_cString(directoryName)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(directoryName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_WRONG_FILE_TYPE;
                }
                break;
              }

#if 0
              /* get local file info */
              error = File_getFileInfo(directoryName,&localFileInfo);
              if (error != ERROR_NONE)
              {
                printError("Cannot not read local directory '%s' (error: %s)!\n",
                           String_cString(directoryName),
                           Errors_getText(error)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(directoryName);
                if (failError == ERROR_NONE) failError = error;
                break;
              }

              /* check file time, permissions, file owner/group */
#endif /* 0 */
              printInfo(2,"ok\n");

              /* free resources */
            }
            else
            {
              /* skip */
              printInfo(3,"  Compare '%s'...skipped\n",String_cString(directoryName));
            }

            /* close archive file */
            Archive_closeEntry(&archiveFileInfo);
            String_delete(directoryName);
          }
          break;
        case ARCHIVE_ENTRY_TYPE_LINK:
          {
            String   linkName;
            String   fileName;
            FileInfo fileInfo;
            String   localFileName;
//            FileInfo localFileInfo;

            /* read link */
            linkName = String_new();
            fileName = String_new();
            error = Archive_readLinkEntry(&archiveInfo,
                                          &archiveFileInfo,
                                          NULL,
                                          NULL,
                                          linkName,
                                          fileName,
                                          &fileInfo
                                         );
            if (error != ERROR_NONE)
            {
              printError("Cannot not read 'link' content of archive '%s' (error: %s)!\n",
                         String_cString(archiveFileName),
                         Errors_getText(error)
                        );
              String_delete(fileName);
              String_delete(linkName);
              if (failError == ERROR_NONE) failError = error;
              break;
            }

            if (   (List_empty(includeEntryList) || EntryList_match(includeEntryList,linkName,PATTERN_MATCH_MODE_EXACT))
                && !PatternList_match(excludePatternList,linkName,PATTERN_MATCH_MODE_EXACT)
               )
            {
              printInfo(2,"  Compare link '%s'...",String_cString(linkName));

              /* check link */
              if (!File_exists(linkName))
              {
                printInfo(2,"FAIL!\n");
                printError("Link '%s' -> '%s' does not exists!\n",
                           String_cString(linkName),
                           String_cString(fileName)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                String_delete(linkName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_FILE_NOT_FOUND;
                }
                break;
              }
              if (File_getType(linkName) != FILE_TYPE_LINK)
              {
                printInfo(2,"FAIL!\n");
                printError("'%s' is not a link!\n",
                           String_cString(linkName)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                String_delete(linkName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_WRONG_FILE_TYPE;
                }
                break;
              }

              /* check link content */
              localFileName = String_new();
              error = File_readLink(linkName,localFileName);
              if (error != ERROR_NONE)
              {
                printError("Cannot not read local file '%s' (error: %s)!\n",
                           String_cString(linkName),
                           Errors_getText(error)
                          );
                String_delete(localFileName);
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                String_delete(linkName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = error;
                }
                break;
              }
              if (!String_equals(fileName,localFileName))
              {
                printInfo(2,"FAIL!\n");
                printError("Link '%s' does not contain file '%s'!\n",
                           String_cString(linkName),
                           String_cString(fileName)
                          );
                String_delete(localFileName);
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                String_delete(linkName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_FILES_DIFFER;
                }
                break;
              }
              String_delete(localFileName);

#if 0
              /* get local file info */
              error = File_getFileInfo(linkName,&localFileInfo);
              if (error != ERROR_NONE)
              {
                printError("Cannot not read local file '%s' (error: %s)!\n",
                           String_cString(linkName),
                           Errors_getText(error)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                String_delete(linkName);
                if (failError == ERROR_NONE) failError = error;
                break;
              }

              /* check file time, permissions, file owner/group */
#endif /* 0 */
              printInfo(2,"ok\n");

              /* free resources */
            }
            else
            {
              /* skip */
              printInfo(3,"  Compare '%s'...skipped\n",String_cString(linkName));
            }

            /* close archive file */
            Archive_closeEntry(&archiveFileInfo);
            String_delete(fileName);
            String_delete(linkName);
          }
          break;
        case ARCHIVE_ENTRY_TYPE_SPECIAL:
          {
            String   fileName;
            FileInfo fileInfo;
            FileInfo localFileInfo;

            /* read special */
            fileName = String_new();
            error = Archive_readSpecialEntry(&archiveInfo,
                                             &archiveFileInfo,
                                             NULL,
                                             NULL,
                                             fileName,
                                             &fileInfo
                                            );
            if (error != ERROR_NONE)
            {
              printError("Cannot not read 'special' content of archive '%s' (error: %s)!\n",
                         String_cString(archiveFileName),
                         Errors_getText(error)
                        );
              String_delete(fileName);
              if (failError == ERROR_NONE) failError = error;
              break;
            }

            if (   (List_empty(includeEntryList) || EntryList_match(includeEntryList,fileName,PATTERN_MATCH_MODE_EXACT))
                && !PatternList_match(excludePatternList,fileName,PATTERN_MATCH_MODE_EXACT)
               )
            {
              printInfo(2,"  Compare special device '%s'...",String_cString(fileName));

              /* check special device */
              if (!File_exists(fileName))
              {
                printInfo(2,"FAIL!\n");
                printError("Special device '%s' does not exists!\n",
                           String_cString(fileName)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_FILE_NOT_FOUND;
                }
                break;
              }
              if (File_getType(fileName) != FILE_TYPE_SPECIAL)
              {
                printInfo(2,"FAIL!\n");
                printError("'%s' is not a special device!\n",
                           String_cString(fileName)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = ERROR_WRONG_FILE_TYPE;
                }
                break;
              }

              /* check special settings */
              error = File_getFileInfo(fileName,&localFileInfo);
              if (error != ERROR_NONE)
              {
                printError("Cannot not read local file '%s' (error: %s)!\n",
                           String_cString(fileName),
                           Errors_getText(error)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = error;
                }
                break;
              }
              if (fileInfo.specialType != localFileInfo.specialType)
              {
                printError("Different types of special device '%s'!\n",
                           String_cString(fileName)
                          );
                Archive_closeEntry(&archiveFileInfo);
                String_delete(fileName);
                if (jobOptions->stopOnErrorFlag)
                {
                  failError = error;
                }
                break;
              }
              if (   (fileInfo.specialType == FILE_SPECIAL_TYPE_CHARACTER_DEVICE)
                  || (fileInfo.specialType == FILE_SPECIAL_TYPE_BLOCK_DEVICE)
                 )
              {
                if (fileInfo.major != localFileInfo.major)
                {
                  printError("Different major numbers of special device '%s'!\n",
                             String_cString(fileName)
                            );
                  Archive_closeEntry(&archiveFileInfo);
                  String_delete(fileName);
                  if (jobOptions->stopOnErrorFlag)
                  {
                    failError = error;
                  }
                  break;
                }
                if (fileInfo.minor != localFileInfo.minor)
                {
                  printError("Different minor numbers of special device '%s'!\n",
                             String_cString(fileName)
                            );
                  Archive_closeEntry(&archiveFileInfo);
                  String_delete(fileName);
                  if (jobOptions->stopOnErrorFlag)
                  {
                    failError = error;
                  }
                  break;
                }
              }

#if 0

              /* check file time, permissions, file owner/group */
#endif /* 0 */

              printInfo(2,"ok\n");

              /* free resources */
            }
            else
            {
              /* skip */
              printInfo(3,"  Compare '%s'...skipped\n",String_cString(fileName));
            }

            /* close archive file */
            Archive_closeEntry(&archiveFileInfo);
            String_delete(fileName);
          }
          break;
        default:
          #ifndef NDEBUG
            HALT_INTERNAL_ERROR_UNHANDLED_SWITCH_CASE();
          #endif /* NDEBUG */
          break; /* not reached */
      }
    }

    /* close archive */
    Archive_close(&archiveInfo);
  }

  /* check fragment lists */
  for (fragmentNode = fragmentList.head; fragmentNode != NULL; fragmentNode = fragmentNode->next)
  {
    if (!FragmentList_checkEntryComplete(fragmentNode))
    {
      printInfo(0,"Warning: incomplete entry '%s'\n",String_cString(fragmentNode->name));
      if (failError == ERROR_NONE) failError = ERROR_FILE_INCOMPLETE;
    }
  }

  /* free resources */
  String_delete(archiveFileName);
  FragmentList_done(&fragmentList);
  free(buffer);
  free(archiveBuffer);

  return failError;
}
コード例 #13
0
ファイル: Waiter.c プロジェクト: shenyamu/OrderDish
/************************************************************************
void Settle_Accounts(pList pTable)
结账功能
************************************************************************/
void Settle_Accounts(pList pTable)
{
	FILE *fp;
	int money;
	pList pt,pTitle,pOrder,ps;
	struct Order_t * data;
	char txt[] = ".txt";
    char str[6] = {0};
	char str1[6] = {0};
    char tabpath[30] ="./Date/Cache/";// 未结详单路径
	fp = File_open("./Date/Cache/Order.txt");// 打开未买订单文件
	pOrder = File_read(fp,sizeof(struct Order_t));
	while(1)
	{	
	system("cls");
	pt = pOrder->pNext;
	if (pt == NULL)//判断当前是否有未买订单
	{
		printf("\n目前没有未买订单,按任意键返回...");
		return;
	}
	printf("\t\t%12s%12s%11s%11s\n","订单号","台桌号","金额","状态");
	while (pt)
	{
		data = (struct Order_t *)(pt->pData);
		printf("\t\t%12s%12s%11d%11s\n",data->ordernum,data->tablenum,data->money,"未支付");// 打印所有未结订单信息
		pt = pt->pNext;
	}  
	printf("\n请输入要结账的台桌号(3位):");
	glb_putString(str,'0','9',3,2);	
	ps = pOrder;
	pt = pOrder->pNext;
	while (pt)
	{
		data = (struct Order_t *)(pt->pData);
		if (strcmp(data->tablenum,str) == 0)// 找出要结账的订单结点
			break;
		ps = pt;
		pt = pt->pNext;
	}
	if (pt == NULL)// 未找到订单,作提示
	{
		printf("\n\n台桌号无订单或有误,按<Esc>键返回、其他键重新输入:");
		if (getch() == 27)
		return;	
		memset(str,0,sizeof(char));
	}
	else
	   break;
	}	
	strcat(tabpath,str);// 获取详单的路径
	strcat(tabpath,txt);
	fp = File_open(tabpath);// 打开将结账的详单文件
	pTitle = File_read(fp,sizeof(struct Title_t));// 读出未买详单链表
	Title_print(pTitle,data);// 打印未买详单信息
	printf("\n订单号为%s是否结账,(y)确定、(n)返回:",data->ordernum);
	if (glb_putString(NULL,0,0,1,1) == 'y')
	{
		printf("\n实收金额:");
		money = glb_putString(str1,'0','9',5,2);// 输入金额
		if (money < data->money)// 实收金额不可小于订单金额
		{
			printf("\n实收金额小于订单金额,无法结账,按任意键返回...");
			getch();
			return;
		}
		printf("\n回找金额:%d",money - (data->money));
		fp = File_open("./Date/Title/Title.txt");
		File_write(fp,pTitle,sizeof(struct Title_t),2);//写入已结详单链表
		
		fp = File_open("./Date/Order/Order.txt");
		fseek(fp,0,2);
		strcpy(data->acname,acName);//写入结账服务员登录名到订单结构体中
		fwrite(data,sizeof(struct Order_t),1,fp);//写入已结订单的结点到另一个文件
		fflush(fp);
		
		ps->pNext = pt->pNext;// 删除结点
		free(pt);//释放已结订单的结点
		fp = fopen("./Date/Cache/Order.txt","w+");
		File_write(fp,pOrder,sizeof(struct Order_t),0);//刷新未结订单的文件
		
		pt = pTable->pNext;
		while(pt)
		{
			if(strcmp(((struct Table_t *)(pt->pData))->acNo,str) == 0)// 找到已结账台桌结点
			{
				((struct Table_t *)(pt->pData))->state = 0;// 桌子状态改为空闲
				fp = File_open("./Date/Table.txt");
				File_write(fp,pTable,sizeof(struct Table_t),0);// 更新台桌信息文件
				break;
			}
			pt = pt->pNext;
		}
		printf("\n结账成功");			   
	}
	else
		printf("\n结账失败");
	printf(",按任意键返回...");
	getch();
	List_free(pTitle);
    List_free(pOrder);
}
コード例 #14
0
ファイル: Waiter.c プロジェクト: shenyamu/OrderDish
/************************************************************************
void Order_dishes(pList pTable)
点菜
************************************************************************/
void Order_dishes(pList pTable)
{
	FILE *fd;
	int n,count1;
	pList pMenu,pOrder,pTitle,pt;
    struct Order_t *pNew,*pdata;
	char txt[] = ".txt";
    char str[8] = {0};
    char tabpath[30] ="./Date/Cache/";// 详单的相对路径

	fd = File_open("./Date/Menu.txt");
	pMenu = File_read(fd,sizeof(struct Menu_t));	
	fd = File_open("./Date/Cache/Order.txt");
    pOrder = File_read(fd,sizeof(struct Order_t));

	while (1)
	{
		system("cls");
	n = Table_search(pTable,2,4);// 判断是否有可用桌子
	if (n == 0)
	{		
		printf(",暂无可用桌子,按任意键继续...");
		getch();
		return;
	}
	printf("请输入要点菜的台桌号:");
	glb_putString(str,'0','9',3,2);
    strcat(tabpath,str);
	strcat(tabpath,txt);// 获取详单的路径
    pt = pOrder->pNext;
	while(pt)
	{
         pdata = (struct Order_t *)(pt->pData);
		if (strcmp(pdata->tablenum,str) == 0)// 判断当前未买订单中是否存在此台桌的订单
		{
			pNew = pdata;
			fd = File_open(tabpath);
	        pTitle = File_read(fd,sizeof(struct Title_t));
			break;
		}
		pt = pt->pNext;
	}

    if (pt == NULL)// 未买订单不存在输入台桌的订单
    {	
        pt = pTable ->pNext;
		while(pt)
		{
			if (strcmp(((struct Table_t *)(pt->pData))->acNo,str) == 0)
			{
				if (((struct Table_t *)(pt->pData))->state == 2)
				{
					pNew = Order_init(str);// 初始化一个订单结点
					List_add(pOrder,pNew);
					File_write(fd,pOrder,sizeof(struct Order_t),0);// 写入未买订单文件
					fd = fopen(tabpath,"w+");// 已w+方式打开详单文件,便于开始点菜
		            pTitle = File_read(fd,sizeof(struct Title_t));
					break;
				}
				else if (((struct Table_t *)(pt->pData))->state == 0)
				{
					printf("\n此桌号为空闲需先开桌才能点菜,是否开桌,(y)开桌、(n)返回:");
					if (glb_putString(NULL,0,0,1,1) == 'y')
						Open_desk(pTable);// 跳转到开桌界面
					return;
				}		
		
			}
		               pt = pt->pNext;
		
		}
		if (pt == NULL)
		{
			memset(str,0,sizeof(char));
			strcpy(tabpath,"./Date/Cache/");
			printf("\n输入的桌号有误或者处于维修状态,请重新输入,按任意键继续...");
			getch();
		}
		else
			break;		
    }
	else
		break;
}
     Order_print(pMenu,pTitle,pNew);
	 count1 = List_count(pMenu);// 获取菜谱的个数
	 while (1)	
{
	JR_EmptyRaw(count1+3,count1+12);// 清空菜谱下面的几行信息
	JR_SetCursor(count1+3,0);
	printf("\t\t(1):点菜\n");
	printf("\t\t(2):退菜\n");
	printf("\t\t(3):返回\n");
	printf("\t\t请输入要操作的功能:");
    n = glb_putString(NULL,'1','3',1,2);
	switch(n)
	{ 
	 case 1:
		 {
			 Order_add(count1,pNew,pTitle,pOrder,pMenu,tabpath); // 加菜功能函数
		     break;
		 }	
	 case 2:
		 {
			 Order_del(count1,pNew,pTitle,pMenu,pOrder,tabpath);// 减菜功能函数
			 break;
		 }
	 case 3:
		     break;
		
	}	
	        
	 if (n == 3)
	 {
		 break;
	 }
	 	   		   
	}	 
	 List_free(pOrder);
	 List_free(pMenu);
	 List_free(pTitle);
}
コード例 #15
0
ファイル: Manage.c プロジェクト: shenyamu/OrderDish
void Profit_statist()
{
	pList pOrder,pStaff;
	pList p1,p2;
	struct Order_t *Odate;
	struct staff_t *Sdate;
	FILE *fp;
	long money,income;// 总金额
	long *stardate,*enddate;
    long ordernum;// 订单号
	money = income = 0;
	stardate = (long *)malloc(sizeof(long));// 开始日期
    enddate = (long *)malloc(sizeof(long));// 结束日期
	fp = File_open("./Date/Order/Order.txt");
    pOrder= File_read(fp,sizeof(struct Order_t));
	fp = File_open("./Date/Staff.txt");
    pStaff= File_read(fp,sizeof(struct staff_t));

	system("cls");
	printf("\n\t\t\t(1):当天查询\n");
	printf("\n\t\t\t(2):历史查询\n");
	printf("\n\t\t\t请输入要选择的功能:");
	if (glb_putString(NULL,'1','2',1,2) == 1)
	{
		system("cls");
		*stardate = Ordernum_get(NULL,NULL);// 获取当前系统日期
		*enddate = *stardate;
	}
	else
	{
		Orderdate_input(stardate,enddate);// 输入开始和结束日期
		printf("\n");
	}
    printf("\t\t\t%-15s%s\n","服务员","营收");
	p1 = pStaff->pNext;
	while (p1)
	{
		Sdate = (struct staff_t *)(p1->pData);
		p2 = pOrder->pNext;
		while(p2)
		{
			Odate = (struct Order_t *)(p2->pData);
			sscanf(Odate->ordernum,"%8ld",&ordernum);// 获取订单号上的日期
			if ((strcmp(Sdate->acName,Odate->acname) == 0)&&(ordernum <= *enddate) && (ordernum >= *stardate))
			{
				money = money + (Odate->money);
			}
			p2 = p2->pNext;
		}
		if ((Sdate->role == 0))// 判断是否为服务员
		{
			printf("\t\t\t%-15s%s%ld\n",Sdate->acName,"¥",money);
			income = income + money;// 累加每个服务员的营业额
			money = 0;
		}	
		p1 = p1->pNext;
	}

	    printf("\n\t\t\t总营业额:¥%ld\n",income);
		printf("\n\t\t\t请按任意键返回...");
		getch();
}