int complete, addcontent, isconfig, opt_l, recursive, verbose;
        int followsymlinks;
        int xargs, noclear;
+       int striparg;
        mode_t clmode;
 
        char *cltype, *clhash, *clmtime, *prefix, *strip, *cltarget;
                }
 
                if (opt->clmode) {
-                       file->mode = opt->clmode;
+                       file->mode = opt->clmode & 07777;
                } else {
-                       file->mode = st.st_mode;
+                       file->mode = st.st_mode & 07777;
                }
 
                if (opt->cluser) {
                        case 'N': opt.addcontent = 0; break;
                        case 'P': opt.prefix = optarg; break;
                        case 'S': opt.strip = optarg; break;
+                       case 's': opt.striparg = 1; break;
                        case 'T': opt.cltarget = optarg; break;
                        case 'c': opt.isconfig = 1; break;
                        case 'f': dbfile = optarg; break;
                        die("can't stat %s: %s", av[i], strerror(errno));
                }
                file.data = av[i];
+               if (opt.striparg) {
+                       opt.strip = av[i];
+               }
+
                if (add_file(&zpm, &file, &opt)) {
                        free_file(&file);
                } else {