- for (fdesc = 0; fdesc < NFILES; fdesc++)
- if (iob[fdesc].i_flgs == 0)
- goto gotfile;
- _stop("No more file slots");
-gotfile:
- (file = &iob[fdesc])->i_flgs |= F_ALLOC;
-
-#ifdef notyet
- for (cp = str; *cp && *cp != '/' && *cp != ':'; cp++)
- ;
- if (*cp != ':') {
- /* default bootstrap unit and device */
- file->i_ino.i_dev = bootdev;
- cp = str;
- } else {
-# define isdigit(n) ((n>='0') && (n<='9'))
- /*
- * syntax for possible device name:
- * <alpha-string><digit-string><letter>:
- */
- for (cp = str; *cp != ':' && !isdigit(*cp); cp++)
- ;
- for (dp = devsw; dp->dv_name; dp++) {
- if (!strncmp(str, dp->dv_name,cp-str))
- goto gotdev;
- }
- printf("unknown device\n");
- file->i_flgs = 0;
- errno = EDEV;
- return (-1);
- gotdev:
- i = 0;
- while (*cp >= '0' && *cp <= '9')
- i = i * 10 + *cp++ - '0';
- if (i < 0 || i > 255) {
- printf("minor device number out of range (0-255)\n");
- file->i_flgs = 0;
- errno = EUNIT;
- return (-1);
- }
- if (*cp >= 'a' && *cp <= 'h') {
- if (i > 31) {
- printf("unit number out of range (0-31)\n");
- file->i_flgs = 0;
- errno = EUNIT;
- return (-1);
- }
- i = make_minor(i, *cp++ - 'a');
+ for (fdesc = 0;; fdesc++) {
+ if (fdesc == NFILES)
+ _stop("No more file slots");
+ if (iob[fdesc].i_flgs == 0) {
+ file = &iob[fdesc];
+ file->i_flgs |= F_ALLOC;
+ file->i_adapt = file->i_ctlr = file->i_unit =
+ file->i_part = 0;
+ break;