China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 21:05
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Drawing on and Reflecting on GHOST User Parameters... View 2,282 Replies 13
Original Poster Posted 2006-08-19 21:43 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
In the process of writing a hard disk reader-writer, I referred to the parameters for representing hard disks and partitions in GHOST, which are very concise, such as: 1:2...
However, at the same time, I feel that other parameters in GHOST, such as SRC, DST, CLONE, PDUMP, PRESTORE, SPLIT, etc., are a bit deviating from this spirit..

I saw some programming books (about user interface) introducing that when designing a program, users should not be involved in the internal things of the program, such as read mode (READ), write mode (WRITE), what type, source data (SRC), target data (TARGET), dump (DUMP), restore (RESTORE), etc., because these are the business of programmers. Programmers often involuntarily bring out these things when writing programs, which is not fully considering users. One should use one's brain to design something that is free of program traces and easy to use (user friendly)...
Of course, there should also be a simple convention (for example, 1, 2 represent hard disks, 1:2 represents a partition of a hard disk....)

Just now, I was thinking about what parameter mode to adopt for the mini hard disk reader-writer I just wrote?
To achieve both conciseness and rich functions (of course, just for the functions contained in my program..)

The initial design of the following parameter mode is for reference..

Except for TO, there is no programmer's term seen...


1
Program 1 TO 2
Naturally, it is to copy hard disk 1 to hard disk 2. There is no need for source hard disk and target hard disk. Naturally, the left is the source and the right is the target, which conforms to the thinking habit of most people. Even without TO, it is also possible... Of course, with TO, the thinking is clearer

4 (multiple hard disks)
Program 1, 2 TO 3

5 (adding partition function)
Program 1:2 TO 2:3
Copy partition 2 of hard disk 1 to partition 3 of hard disk 2

6 (support drive letters)
Program E: TO 2:3

7
Program C: TO G:


Support image files

8
Program 1 TO (1)
Load hard disk 1 into image file 1

9
Program 1 TO (1=C)
Load hard disk 1 into image file 1, compress, default level

10
Program 1 TO (1=C9)
Load hard disk 1 into image file 1, compress, level 9

11
Program 1 TO (1=C9=K)
Load hard disk 1 into image file 1, compress, level 9, encrypt

12
Program 1 TO (1=C9=K=V)
Load hard disk 1 into image file 1, compress, level 9, encrypt, default volume (1000MB)

12
Program 1 TO (1=C9=K=V1500)
Load hard disk 1 into image file 1, compress, level 9, encrypt, volume (1500MB)

12
Program 1 TO (1=C9=K=V1500=E)
Load hard disk 1 into image file 1, compress, level 9, encrypt, volume (1500MB), each volume should be encrypted (with the same password as the first file)

12
Program 1 TO (1=C9=K=V1500=E?)
Load hard disk 1 into image file 1, compress, level 9, encrypt, volume (1500MB), each volume should be encrypted (each file should prompt the user to enter a different password)

13 (restore according to image file)
Program (1) TO 1
Restore image file 1 to hard disk 1, automatically check whether it is compressed, but do not automatically check whether there are volumes

14 (restore according to image file)
Program (1=V) TO 1
Restore image file 1 to hard disk 1, automatically check whether it is compressed,
Automatically check volumes. If not, prompt the user to enter the volume name (if the user renamed it later)

If you need to enrich functions:
Comprehensive:

Program 1:2, 2:3, 3:4 TO 3:2, (G:\BACK.Z=C9=K=V1500=E?)


If you need to specify the sector position and specify the number of sectors to operate:
(- means the starting sector position to operate
+ means the total number of sectors to operate)

1
Program 1-100+1000 TO 2
Copy 1000 sectors from sector 100 of hard disk 1 to sector 0 of the hard disk

2
Program 1-100+1000 TO 2-200

3
Program 1:2-100+1000 TO 2:3-300

4
Program 1:2+1000, E:-300 TO G:-200, 2:4-500

5
Program 1:2+1000, E:-300 TO G:-200, (H:\BACK.Z=C9=K=V500=E?)+1000, 2:4-500
Load 1000 sectors of partition 2 of hard disk 1 and 300th sector of E: drive into sector 200 of G: drive (all remaining sectors) and file H:\BACK.Z (1000 sectors, referring to uncompressed) and 500th sector of partition 4 of hard disk 2....

My mini hard disk reader-writer will try to adopt this parameter mode....

[ Last edited by GOTOmsdos on 2006-8-19 at 21:46 ]
Floor 2 Posted 2006-08-19 22:39 ·  中国 山东 菏泽 电信
银牌会员
★★★
Credits 1,246
Posts 488
Joined 2003-11-11 00:00
22-year member
UID 12699
Gender Male
Status Offline
The idea is very good. The simpler it is, the more rigorous and thorough it needs to be.

Avoid contradictions and repetitions.

[ Last edited by wang6610 on 2006-8-19 at 22:41 ]
Floor 3 Posted 2006-08-19 22:48 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
1: Support drive letters! Drive letters under DOS? Or under Windows? Is there a consideration to give up backing up in the form of drive letters? After all, the birth of Vista will bring new formats. Having NTFS drive letter interleaving is already messy enough. It's better not to consider drive letter support when designing initially.

2: Will there be misoperations if the above parameters are all numbers? Is there a consideration to add core parameters to backup and restore operations? For example, use /B for backup, /R for restore, and /F for sector operations (letters can be optional). This can also avoid some misoperations. In addition, for 1 TO (1=C9=K=V1500=E), is there a consideration to use the - symbol instead of the = symbol which has been accustomed to.
Floor 4 Posted 2006-08-19 22:49 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
My original parameters are

Program

1
-r|w -d1 -d2
-r|w -d1 -s100 -d2
-r|w -d1 -s100 -n1000 -d2
-r|w -d1 -s100 -n1000 -d2 -s200

2
-r|w -d1 -p1 -d2 -p2
-r|w -d1 -p1 -s100 -d2 -p2
-r|w -d1 -p1 -s100 -n1000 -d2 -p2 -s300

3
-r|w -d1 -ffile
-r|w -d1 -p1 -ffile.z -c9 -k -v1000 -e?

....Now, I feel very annoyed.
Floor 5 Posted 2006-08-19 22:58 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Come up with another slightly far-fetched idea
Program 1:2,2:3,3:4 TO 3:2,(?:\BACK.Z=C9=K=V1500=E?)

?:\BACK.Z This? Similar to the find function
Floor 6 Posted 2006-08-19 23:16 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
TO fastslz
1
Since it's a DOS program, the drive letters are naturally DOS drive letters (FAT12, FAT16, FAT32). If you need to handle non-FAT partitions, the program has options to display various forms of partition table entries for users to view before operation.... It supports all partitions.

2
Regarding the issue of misoperation, there's no need to worry. Hard disk tools are very cautious. They won't make a final decision at once. The program will inform the user of some parameter information entered by the user, and wait for the user to confirm. If it's writing to the disk, there's an additional write confirmation.

I think the unique keyword TO in my concept is sufficient. It clearly indicates the relationship between the source and the target. All the parameters the program needs are completely in the left and right inputs.
The ones you mentioned, such as backup with /B, restore with /R, sector operation with /F, etc., although they have their uses, they go against the original intention of this thread (conciseness and efficiency). Moreover, technically, the relationship between "backup" and "restore" is already explained in TO. If it's left--disk and right--file, it's naturally called "backup"; conversely, it's naturally called "restore". Users should be very clear in their minds. If we have to mention these concepts, some users who don't understand computers may not be clear about these concepts instead.

In the GHOST user interface:

DISK TO DISK,
DISK TO IMAGE
IMAGE TO DISK

PARTITION TO PARTITION
PARTITION TO IMAGE
IMAGE TO PARTITION

That's the same principle.
(It doesn't say, "backup here, restore here...")

This may also be a matter of thinking habits.

3
As for the = symbol, I originally also considered using the - sign, but what if the user needs to enter a file name containing a - sign?
I also considered using /, *, etc., and finally still think = is good. It doesn't need to press SHIFT at the same time, can be typed directly, and is also eye-catching....
Floor 7 Posted 2006-08-19 23:17 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
(?:\BACK.Z=C9=K=V1500=E?)
Okay!

But it needs to have a certain use!
What function do you want it to represent?

Hehe
The famous unique ternary operation expression in C language is like this:
XXX ? A : B
Meaning: Is XXX true? If it is true, then A, otherwise B

Wow! So concise! Both concise, clear and aesthetic..

[ Last edited by GOTOmsdos on 2006-8-19 at 23:40 ]
Floor 8 Posted 2006-08-19 23:20 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
Those old and excellent DOS LINUX programmers all have many parameter symbols that are both personalized and concise with rich functions!

[ Last edited by GOTOmsdos on 2006-8-19 at 23:34 ]
Floor 9 Posted 2006-08-20 00:24 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Well, let's put it this way, I hope it can automatically search, just like the command
FOR %%A IN (1:2 1:3 1:4 1:5 1:6 1:7 1:8 1:9 1:10 2:1 2:2 2:3 2:4 2:5 2:6 2:7 2:8 2:9 2:10 3:1 3:2 3:3 3:4 3:5 3:6 3:7 3:8 3:9 3:10 4:1 4:2 4:3 4:4 4:5 4:6 4:7 4:8 4:9 4:10) DO %%A:\BACK.Z TO 1:1
That is, execute 1:2 to 4:10 at the same time without jumping out due to an error because 1:2:\BACK.Z is not found and then continue to execute 1:3:\BACK.Z TO 1:1 until any possible number is executed. It's similar to the grub parameter find --set-root /menu.lstThe above (1:2 1:3 1:4 1:5 1:6 1:7 1:8 1:9 1:10 2:1 2:2 2:3 2:4 2:5 2:6 2:7 2:8 2:9 2:10 3:1 3:2 3:3 3:4 3:5 3:6 3:7 3:8 3:9 3:10 4:1 4:2 4:3 4:4 4:5 4:6 4:7 4:8 4:9 4:10) is equal to 4 hard drives and tentatively may have 10 partitions each

[ Last edited by fastslz on 2006-8-20 at 00:38 ]
Floor 10 Posted 2006-08-20 00:59 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
Oh, this means...
You mean when (?:\BACK.Z=C9=K=V1500=E?) is on the left?
That is the source file.

Because it's a DOS program, so looking for FAT - formatted partitions is still worth considering, and others naturally can't be done.

But the idea is quite interesting
Floor 11 Posted 2006-08-20 01:02 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
This is perfect, and there's no need to test the drive letter issue at all.

Regarding the parameter symbols, I think the occurrence of commas in filenames is less than that of hyphens, which is also within the scope of habits.

And the equal sign, I'm just talking casually here! In the Ghost parameters, I'm used to customizing the compression level variable.
set 压缩级别=-z2
But in your parameters, it becomes incorrect syntax.
set 压缩级别==c9
Although you can use set 压缩级别=c9, this is also one of the reasons I found that the equal sign is not suitable. Just for reference.
Floor 12 Posted 2006-08-20 01:26 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Actually, restoring the system is easier to go wrong than backing up the system. I think everyone often encounters the situation of failing to restore the system because they can't find a certain.gho during daily ghost operations. I was also inspired by grub's find. Try the grub command line: find --set-root /system.gho. Grub indeed did it, but unfortunately, it can't print the content to a file.
Floor 13 Posted 2006-08-20 01:49 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
1 - =

Of course, this symbol is irrelevant. If there is a better one, we can consider changing it.
But, there are only so many available symbols on the keyboard, and the others don't feel appropriate.
You suggested still using -, but I still think that filenames often use it.
In LINUX, it's all using -, and in WIN/DOS, it's also very common.
Generally, it's like XXX-A-1, YYY-2, etc., used for distinction.
Also, _ is also a legal filename, and some people like to use it very much, especially those with a programmer background.
Using it to separate makes the filename clearer than -.
As for the confusion between = and == you mentioned, this actually doesn't matter much because after all, the use of symbols in the program is not much.
Just a few times... It won't cause great confusion..(and it's all limited in parentheses)

2 Z C
This can be considered a common habit.
Floor 14 Posted 2006-09-01 14:00 ·  中国 香港
银牌会员
★★★
阿林
Credits 1,410
Posts 497
Joined 2004-06-28 00:00
22-year member
UID 27551
Gender Male
From 九龍,香港
Status Offline
Originally posted by GOTOmsdos at 2006-8-19 10:49 PM:
1
-r|w -d1 -d2
-r|w -d1 -s100 -d2
-r|w -d1 -s100 -n1000 -d2
-r|w -d1 -s100 -n1000 -d2 -s200

2
-r|w -d1 -p1 -d2 -p2
-r|w -d1 -p1 -s100 -d2 -p2
-r|w -d1 ...



Drawing on the approach of LAME...

--preset 1
--preset 2
我 的 網 站 - http://optimizr.dyndns.org
Forum Jump: