home *** CD-ROM | disk | FTP | other *** search
- /* set -- set/display file attributes from file */
- /* copyright 1984 Michael M Rubenstein */
-
- #include <sysio.h>
- #include <buff.h>
-
- #define MAXLINE 32
-
- int modbit;
-
- extern FCB dfcb_;
- extern char dbuff_[];
-
- extern unsigned c_user;
-
- main()
- {
- struct FILE f;
- static char s[MAXLINE + 1];
- static int i;
- static int c;
-
- if (dfcb_.name1.fname[0] == ' ' || dfcb_.name1.fname[0] == '?')
- error("syntax: pset <setfile>\n");
-
- strncpy(&f, &dfcb_, sizeof(FCB));
-
- if (open(&f) == 0xff)
- error("pset: cannot open input file");
- f.f_buff = dbuff_;
- f.f_bufl = f.f_bufc = 128;
-
- while ((c = getc(&f)) != EOF && c != CPMEOF)
- {
- if (c <= ' ')
- {
- if (i)
- {
- s[i] = '\0';
- setdone(s);
- i = 0;
- }
- }
- else
- if (i < MAXLINE)
- s[i++] = c;
- }
-
- if (i)
- {
- s[i] = '\0';
- setdone(s);
- }
-
- close(&f);
- }
-
- /* mark a file as done */
- setdone(s)
- char *s;
- {
- static unsigned user;
-
- user = getusr();
- setfcb(s, &dfcb_);
- setusr(c_user);
- if (open(&dfcb_) != 0xff)
- {
- close(&dfcb_);
- dfcb_.name1.fname[modbit] |= 0x80;
- filatt(&dfcb_);
- }
- setusr(user);
- }
- s[MAXLINE + 1];
- static int i;
- static int c;
-
- if (dfcb_.name