~ubuntu-branches/ubuntu/quantal/unrar-nonfree/quantal

« back to all changes in this revision

Viewing changes to filcreat.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Meredith
  • Date: 2009-06-06 17:46:05 UTC
  • mto: (1.1.11 upstream) (5.1.5 sid)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090606174605-825ysfkrhw7wkc9e
ImportĀ upstreamĀ versionĀ 3.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "rar.hpp"
2
2
 
3
3
bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
4
 
                OVERWRITE_MODE Mode,bool *UserReject,Int64 FileSize,
 
4
                OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize,
5
5
                uint FileTime)
6
6
{
7
7
  if (UserReject!=NULL)
66
66
        NewName[Size]=0;
67
67
        OemToChar(NewName,NewName);
68
68
#else
69
 
        fgets(NewName,sizeof(NewName),stdin);
 
69
        if (fgets(NewName,sizeof(NewName),stdin)==NULL)
 
70
        {
 
71
          // Process fgets failure as if user answered 'No'.
 
72
          if (UserReject!=NULL)
 
73
            *UserReject=true;
 
74
          return(false);
 
75
        }
70
76
#endif
71
77
        RemoveLF(NewName);
72
78
        if (PointToName(NewName)==NewName)
111
117
    Ext=Name+strlen(Name);
112
118
  for (int FileVer=1;;FileVer++)
113
119
  {
114
 
    sprintf(NewName,"%.*s(%d)%s",Ext-Name,Name,FileVer,Ext);
 
120
    sprintf(NewName,"%.*s(%d)%s",int(Ext-Name),Name,FileVer,Ext);
115
121
    if (!FileExist(NewName))
116
122
    {
117
123
      strcpy(Name,NewName);