projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
standardize sccs keyword lines
[unix-history]
/
usr
/
src
/
old
/
flcopy
/
flcopy.c
diff --git
a/usr/src/old/flcopy/flcopy.c
b/usr/src/old/flcopy/flcopy.c
index
789f18e
..
1b4c116
100644
(file)
--- a/
usr/src/old/flcopy/flcopy.c
+++ b/
usr/src/old/flcopy/flcopy.c
@@
-1,4
+1,8
@@
-static char *sccsid ="@(#)flcopy.c 4.4 (Berkeley) %G%";
+#ifndef lint
+static char *sccsid ="@(#)flcopy.c 4.6 (Berkeley) %G%";
+#endif
+
+#include <sys/file.h>
int floppydes;
char *flopname = "/dev/floppy";
int floppydes;
char *flopname = "/dev/floppy";
@@
-16,19
+20,31
@@
main(argc, argv)
register char *cp;
while ((cp = *++argv), --argc > 0) {
register char *cp;
while ((cp = *++argv), --argc > 0) {
- if (*cp++!='-')
- continue;
- while (*cp)
+ while (*cp) {
switch(*cp++) {
switch(*cp++) {
+ case '-':
+ continue;
+
case 'h':
hflag++;
printf("Halftime!\n");
case 'h':
hflag++;
printf("Halftime!\n");
- if ((file = open("floppy", 0)) < 0)
- printf("can't open \"floppy\"\n"),
- exit(1);
+ if ((file = open("floppy", 0)) < 0) {
+ printf("can't open \"floppy\"\n");
+ exit(1);
+ }
continue;
continue;
+ case 'f':
+ if (argc < 1) {
+ printf(
+ "flcopy: -f: missing file name\n");
+ exit(1);
+ }
+ flopname = *++argv;
+ argc--;
+ break;
+
case 't':
if (*cp >= '0' && *cp <= '9')
dsize = atoi(cp);
case 't':
if (*cp >= '0' && *cp <= '9')
dsize = atoi(cp);
@@
-47,11
+63,11
@@
main(argc, argv)
case 'r':
rflag++;
}
case 'r':
rflag++;
}
+ break;
+ }
}
if (!hflag) {
}
if (!hflag) {
- file = creat("floppy", 0666);
- close(file);
- file = open("floppy", 2);
+ file = open("floppy", O_RDWR|O_CREAT|O_TRUNC, 0666);
if (file < 0) {
printf("can't open \"floppy\"\n");
exit(1);
if (file < 0) {
printf("can't open \"floppy\"\n");
exit(1);
@@
-76,6
+92,7
@@
main(argc, argv)
lwrite(startad, n, buff);
startad += 512;
}
lwrite(startad, n, buff);
startad += 512;
}
+ exit(0);
}
rt_init()
}
rt_init()